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.



Sample input:
15


Sample output:
60

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(int((N+1)*N/2 - ((f+1)*f/2*3 + (b+1)*b/2*5 - (fb+1)*fb/2*15)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    # 入力パターン．
    # 先に要素数Nが与えられて，その数読み込むパターン
    ### N
    ### a_1 a_2 a_3 ... a_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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys

num = int(sys.stdin.readline().strip())
s = (num+1) * num // 2
num3 = num // 3
num5 = num // 5
num15 = num // 15
result = s - 3 *( (num3+1) * num3 // 2 ) - 5 * ( (num5 + 1) * num5 // 2 ) + 15 * ((num15+1) * num15 // 2 )
print(result)

Submission status: Accepted

Solution code:
n = int(input())

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

print(s)

Submission status: Accepted

Solution code:
n = int(raw_input())
sum = 0;
for i in range(n+1):
  if i%3 == 0 or i%5 == 0:
    continue;
  else:
    sum += i;
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i = 1
sum = 0

while i <= n:
    if i%3 != 0 and i%5 != 0 :
        sum += i

    i += 1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


N = int(input())

x = 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:
        x += i

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    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__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
cnt = 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 :
        cnt += i
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def fizz_buzz(n):
    i = 1

    while i - 1 < n:
        if i % 3 == 0 or i % 5 == 0:
            yield 0
        else:
            yield i
        i += 1


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

    res = 0
    i = 0

    for num in fizz_buzz(n):
        res += num

    print(res)

Submission status: Accepted

Solution code:
N = int(input())


fbsum = 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:
        fbsum += i

print(fbsum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
aint = lambda: int(input())

n = aint()
a, b, c = int(n/3), int(n/5), int(n/15)
print(int(0.5*(n*(n+1)-3*a*(a+1)-5*b*(b+1)+15*c*(c+1))))

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

a = 0

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

Submission status: Accepted

Solution code:
def solution():
    n = int(input())
    nums = []
    for i in range(n):
        ii = i+1
        if (ii % 3 != 0) and (ii % 5 != 0):
            nums.append(ii)
    print(sum(nums))

solution()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
res = 0

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

print(res)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
usr = int(input())
sum = 0

for n in range(0,usr+1,1):
    if n % 3 == 0 or n % 5 == 0:
        continue
    sum += n

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
ans = 0
for i in range(1, n + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

sum=0

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

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

print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

print(sum(n for n in range(1, N+1) if n % 3 != 0 and n % 5 != 0))
"""
n3 = (N // 3)
n5 = (N // 5)
n15 = (N // 15)

total = N * (N+1) // 2
print(total, n3, n5, n15)
print(total - n3 - n5 + n15)
"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

result = int(n*(n+1)/2)

for i in range(1, n+1):
    if i%3 == 0:
        result -= i
    elif i%5 == 0:
        result -= i
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum(c))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = int(input())
total = 0
for i in range(N + 1):
    if(i % 15 == 0 ):
        continue
    elif(i % 3==0):
        continue
    elif(i % 5 == 0):
        continue
    else:
        total += i
print(total)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())

    ans = 0

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

    print(ans)


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=[a for a in range(N+1)]
B=[]
for a in range(1,N+1):
    if a%3==0 or a%5==0:
        continue
    else:
        B.append(a)
print(sum(B))

Submission status: Accepted

Solution code:
l=list(range(int(input())+1))

ans=0
for i in l:

    if i%5 and i%3:ans+=i 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

input_line = input()
N = int(input_line)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

print(sum(filter((lambda n: n % 3 != 0 and n % 5 != 0), [i for i in range(N+1)])))

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

n = int(input())

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

print(s)

Submission status: Accepted

Solution code:
n = int(input())

ans=0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

l = []

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

Submission status: Accepted

Solution code:
import numpy as np
import math
import statistics
import collections

def solve():
    n = int(input())
    ans = 0
    for i in range(1,n+1):
        bit = 0
        if i % 3 != 0:
            bit += 1
        if i % 5 != 0:
            bit += 1
        if bit == 2:
            ans += i
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq

#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N = int(input())
ans = 0

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


print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8

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

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    def su(x): return x * (x + 1) // 2
    ans = 0
    ans += su(n // 3) * 3
    ans += su(n // 5) * 5
    ans -= su(n // 15) * 15
    ans = su(n) - ans
    print(ans)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N, = (int(x) for x in input().split())

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

print(sol)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(total)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    
    counter = 0
    l = []
    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:
            # print(i)
            counter += i
            
    print(counter)            
        
    
main()

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools

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

count = 0
for el in range(num + 1):
    if el % 3 != 0 and el % 5 != 0:
        count += el
print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    n = int(input().strip())
    ans=0
    for i in range(1,n+1):
        if i%3==0:
            pass
        elif i%5==0:
            pass
        else:
            ans+=i
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline
N = int(input())

ans = 0

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


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline().rstrip())

S = 0
for num in range(1, N+1):
    f = num%5 == 0 or num%3==0 or num%15==0
    if not f:
        S+=num
        
print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
count = 0

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = [i+1 for i in range(N)]
for i in range(N):
    if (i+1) %3 == 0 or (i+1)%5 == 0:
        a[i] = 0
print(sum(a))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
sum = 0
for i in range(n+1):
    if (i%3!=0) & (i%5!=0):
        sum += i
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
f=N//3
b=N//5
fb=N//15
def s(x):
  return x*(x+1)//2
print(s(N)-3*s(f)-5*s(b)+15*s(fb))

Submission status: Accepted

Solution code:
n = int(input())
result = 0

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

print(result)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(c)

Submission status: Accepted

Solution code:
N = int(input())
S = (N * (N + 1)) // 2
t, f, ft = N // 3, N // 5, N // 15
S -= 3 * ((t * (t + 1)) // 2) + 5 * ((f * (f + 1)) // 2)
S += 15 * ((ft * (ft + 1)) // 2)
print(S)

Submission status: Accepted

Solution code:
n = int(input())

arr = range(1, n + 1)
arr = [x for x in arr if x % 3 != 0 and x % 5 != 0]
print(sum(arr))

Submission status: Accepted

Solution code:
N = int(input())
def is_not_fizzbuzz(n):
    if n % 5 == 0 or n % 3 == 0:
        return False
    else:
        return True
ans = sum([i for i in range(1, N + 1) if is_not_fizzbuzz(i)])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

sum_ = 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:
        sum_ += i

print(sum_)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def resolve():
    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
    return print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

print(sum(a))

Submission status: Accepted

Solution code:
n=int(input())
n0=n//3
n1=n//5
n2=n//15
ans=n*(n+1)//2-3*n0*(n0+1)//2-5*n1*(n1+1)//2+15*n2*(n2+1)//2
print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = []

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

Submission status: Accepted

Solution code:
N = int(input())

a=0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
(N,) = [int(x) for x in input().split()]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    ans= 0
    for i in range(1,N+1,1):
        if i % 3 == 0 or i % 5 == 0 :
            continue
        ans += i
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(s)