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):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, gcd
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


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(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


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

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

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

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

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

Solution (Python):



import sys


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


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

    sum_fizz_buzz = 0

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

    print(sum_fizz_buzz)



if __name__ == "__main__":
    resolve()

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

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

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

print(sum(m))

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

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

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

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

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

Solution (Python):
n = int(input())
ans = []
num = 0

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

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


"""
NTC here
"""
import sys
inp = sys.stdin.readline
def input(): return inp().strip()
flush= sys.stdout.flush




def iin(): return int(input())


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





def main():
    n = iin()
    ans = (n*(n+1))//2
    for i in range(3, n+1, 3):ans-=i
    for i in range(5, n+1, 5):ans-=i
    for i in range(15, n+1, 15):ans+=i
    print(ans)

main()

Solution (Python):
n = int(input())
cnt = 0
sum = 0
while cnt < n:
    cnt += 1
    if (cnt%3 != 0) and (cnt%5 != 0):
        sum += cnt



print(sum)

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

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

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

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

print(cnt)

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


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

    print(sum_)

if __name__ == '__main__':
    main()

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

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

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

print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    if (i+1)%3 == 0 or (i+1)%5==0:
        pass
    else:
        ans += (i+1)
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())
i = 1
ans=0
while i <= n:
    if i % 15 == 0:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        ans+=i
    i += 1
print(ans)

Solution (Python):
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())

N = I()
kouho = []
for i in range(1,N+1):
    if i%3 and i%5:
        kouho.append(i)
print(sum(kouho))

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

Solution (Python):




import sys
input = sys.stdin.readline



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

    res = 0

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

    print(res)



main()

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

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

if __name__ == "__main__":
    main()

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

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

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

print(con)

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

s = n*(n+1)/2

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

print(int(s-(3*a*(a+1)/2)-(5*b*(b+1)/2)+(15*c*(c+1)/2)))

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

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

Solution (Python):
def resolve():
    '''
    code here
    '''

    N = int(input())

    FB = []
    for i in range(1,N+1):
        if i%3 == 0 or i%5==0:
            pass
        else:
            FB.append(i)
    
    res = sum(FB)
    print(res)
        

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

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

Solution (Python):
def s(num):
    return num*(num+1)//2

n=int(input())
print(s(n)-3*s(n//3)-5*s(n//5)+15*s(n//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 chk_fizzbuzz(i):
    if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
        return 0
    else:
        return i

N = int(input().rstrip())
ret = 0
for i in range(N+1):
    ret += chk_fizzbuzz(i)
print(ret)

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
def main():
    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)
if __name__ == "__main__":
    main()

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

s = 0

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

print(s)

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

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

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

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())
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(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%3==0):
        continue
    elif(i%5==0):
        continue
    elif(i%15==0):
        continue
    else:
        a.append(i)
print(sum(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())
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())

sum=0

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

print(sum)

Solution (Python):


n = int(input())

a = []
culm = 0
for i in range(1, n+1):
    if i%3 == 0:
        pass
    elif i%5==0:
        pass
    else:
        culm += i

print(culm)

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

box = []
for i in range(1, N+1):
    if i%3 ==0 or i%5==0:
        continue
    else:
        box.append(i)

print(sum(box))

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

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

Solution (Python):

n = int(input())
ans = sum(list(range(n+1))) - 3 * sum(list(range(n//3 + 1))) -5 * sum(list(range(n//5 + 1))) + 15 * sum(list(range(n//15 + 1)))
print(ans)

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

Solution (Python):
import sys

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

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

if __name__ ==  '__main__':
    main()

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

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


if __name__ == '__main__':
    main()

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

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

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

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

ans = 0

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

ans = 0

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

print(ans)

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

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

print(X)

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

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

print(summation)

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

print(sum(a))

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

ans=0
for i in range(N):
    i+=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 not (i % 3 == 0 or 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):
import sys

N = int(sys.stdin.readline().strip())

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

print(ans)

Solution (Python):
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)


inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))



def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  


def grid(n): return [s_list() for _ in range(n)]


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


if __name__ == '__main__':
    main()

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

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

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

print(cnt)

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

print(sum(ans))

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

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

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

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

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

total = N*(N+1)/2
N3 = N//3
N5 = N//5
N15 = N//15

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

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

res = (1 + n) * n/2

n3 = n // 3
fizzSum = 3 * (1 + n3) * n3 / 2

n5 = n // 5
buzzSum = 5 * (1 + n5) * n5 / 2

n15 = n // 15
fizzbuzzSum = 15 * (1 + n15) * n15 / 2

print(int(res- fizzSum - buzzSum + fizzbuzzSum))

Solution (Python):
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

N = int(input())

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

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

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

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

print(k)

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

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

print(summ)

Solution (Python):
from sys import stdin 
n = int(stdin.readline().rstrip())
answer = 0
for i in range(n):
    if (i+1) % 3 != 0 and (i+1) % 5 != 0:
        answer += (i+1)

print(answer)

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

print(a)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

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


def main():
    N = INT()

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

    print(cnt)


if __name__ == '__main__':
    main()

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

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

Solution (Python):




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


if __name__ == '__main__':
    main()

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

ans = 0

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

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

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

Solution (Python):
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()

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

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

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

resolve()

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

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):
def main():
    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)
    return 0


if __name__ == '__main__':
    main()

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

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
n = int(input())
li = []
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:
    li.append(i)

print(sum(li))

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

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

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
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

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

if __name__ == '__main__':
    main()

Solution (Python):
def b162(n):

    ans = 0

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

    return ans

def main():
    n = int(input())
    print(b162(n))

if __name__ == '__main__':
    main()

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

Solution (Python):
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

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) or (i % 5 == 0) :
    pass
  else:
    ans += i

print(ans)

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

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

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
N = int(input())
T = N//3
F = N//5
TF = N//15

ans = 0 
ans += N*(N+1)//2
ans -= T*(T+1)*3//2
ans -= F*(F+1)*5//2
ans += TF*(TF+1)*15//2
print(ans)

Solution (Python):
from sys import stdin

X = list(map(int, (stdin.readline().strip().split())))[0]
ans=0
for i in range(1,X+1):
    if i%3!=0 and i%5!=0:
        ans+=i
print(ans)

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

if __name__ == '__main__':
    resolve()

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

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

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

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

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

Solution (Python):
n = int(input())
goukei = n * (n + 1) // 2
bai3 = n // 3
bai5 = n // 5
bai15 = n // 15
gou3 = (3 + bai3 * 3) * bai3 // 2
gou5 = (5 + bai5 * 5) * bai5 // 2
gou15 = (15 + bai15 * 15) * bai15 // 2
ans = goukei - gou3 - gou5 + gou15
print(ans)

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

res = []

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

print(int(sum(res)))

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):
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
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
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):
def main():
    n = int(input())
    r = 0
    for i in range(1, n + 1):
        if i % 3 != 0 and i % 5 != 0:
            r += i

    print(r)

if __name__ == '__main__':
    main()