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:
import sys
N = int(sys.stdin.readline())
ans = 0
for i in range(N + 1):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum)

Submission status: Accepted

Solution code:
n=int(input())

s = n*(n+1) / 2

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

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

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())
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:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
import numpy as np

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

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:

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

print(a)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

print(ans)

Submission status: Accepted

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

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

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

SUM = 0
for n in range(N):
    #print("{}".format(n))
    i = n+1
    if i%3 == 0 or i%5 == 0 or (i%3 == 0 and i%5 == 0):
        continue
    else:
        SUM += i
print("{}".format(SUM))

Submission status: Accepted

Solution code:
#B
n = int(input())

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

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

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

Submission status: Accepted

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

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

print(fizz_buzz_sum)

Submission status: Accepted

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

Submission status: Accepted

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

print(soma)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
List=[]
a=0
while a<N:
  a=a+1
  if (a%3)!=0 and (a%5)!=0:
    List.append(a)
print(sum(List))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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 or i%15==0):
    ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

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

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

print(sum(t))

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

solution(N,A)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

a=[]
s=[]

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

    if i % 15 == 0:

        a.append("FizzBuzz")

    elif i % 3 == 0:

        a.append("Fizz")

    elif i % 5 == 0:

        a.append("Buzz")

    else: s.append(i)

print(sum(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

##１からnの合計値
sum = 0
for i in range(1, n + 1):
	sum = sum + i

##まずは3の倍数を引く
i3 = n // 3
for i in range(1, i3 + 1):
	sum = sum - 3 * i

##次に5の倍数を引く。15の倍数は引かなくていい
i5 = n // 5
for i in range(1, i5 + 1):
	if (i % 3 != 0):
		sum = sum - 5 * i

print(sum)

Submission status: Accepted

Solution code:
n=int(input())
a=list(range(1,n+1))
#print(a)

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

Submission status: Accepted

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

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

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

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

print(str(sum(A)))

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

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

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 = 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())
sum = 0

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

print(sum)

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 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
input = sys.stdin.readline
N = int(input())
assert 1 <= N <= 10**6
total = 0
for i in range(1, N+1):
    if i % 3 and i % 5:
        total += i
print(total)

Submission status: Accepted

Solution code:
N = int(input())

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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)

Submission status: Accepted

Solution code:
N=int(input())

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

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):
        a=1
    elif(i%3==0):
        a=1
    elif(i%5==0):
        a=1
    else:
        count=count+i
        
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
f = 3
b = 5
fb = f * b

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

print(sum)

Submission status: Accepted

Solution code:
# In peace, in love, in war, everything is the same

import math

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

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

Submission status: Accepted

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

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

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


#############
# Constants #
#############

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

#############
# Functions #
#############

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

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

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

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

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

######Factorization######
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

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

#############
# Main Code #
#############

N = inputI()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
kei = 0

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

print(kei)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

    return y

n = int(input())
ans = 0

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

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

print(ans)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum(target_list))

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:
    pass
  elif i%3==0:
    pass
  elif 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())
fizzbuzz = [i for i in range(1, N+1) if (i % 3 == 0) or (i % 5 == 0)]

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

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 or (i+1)%3 ==0 or (1+i)%5 ==0 :
        continue
    else:
        S = S+1+i

print(S)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

print(sum(B))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
Fizz = int(N // 3)
Buzz = int(N // 5)
FBzz = int(N // 15)

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

Submission status: Accepted

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

print(N)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ans = 0

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

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

Submission status: Accepted

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

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

print(res)

Submission status: Accepted

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

print(b)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
print(sum(n for n in range(1, int(input()) + 1) if all([n % 3, n % 5])))

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

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:
import sys
N = int(input())
r3 = N//3
r5 = N//5
r15 = N//15
def sum(N):
    return int(1/2*N*(N+1))
S = sum(N) - 3*sum(r3) - 5*sum(r5) +15*sum(r15)
print(S)

Submission status: Accepted

Solution code:
n = int(input())

sum = 0

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

print(sum)

Submission status: Accepted

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

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

print(FizzBuzz)

Submission status: Accepted

Solution code:
N = int(input())

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

print(S)

Submission status: Accepted

Solution code:
n = range(int(input())+1)
N =list(n)
A =[]
B = []
for i in N[1:] :
  if i%3==0 and i%5==0 :
    A.append('fizzbuzz')
  elif i%3==0 :
    A.append('fizz')
  elif i%5==0 :
    A.append('buzz')
  else:
    B.append(i)
c=0
for j in B:
  c+=j
print(c)

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:
        continue
    elif i%3 == 0:
        continue
    elif i%5 == 0:
        continue
    else:
        ans += i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
numbers = []
for i in range(1, N + 1):
    if i % 15 == 0:
        continue
    elif i % 5 == 0:
        continue
    elif i % 3 == 0:
        continue
    else:
        numbers.append(i)

print(sum(numbers))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:
# input
I = int(input())
n = []
append = n.append

for i in range(1, I + 1):
    # check
    if i % 3 == 0 and i % 5 == 0:
        # "FizzBuzz"
        pass
    elif i % 3 == 0:
        # Fizz
        pass
    elif i % 5 == 0:
        # Buzz
        pass
    else:
        append(i)

print(sum(n))

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:
def f(n,k):
  n = n//k
  return n*(n+1)//2*k

n = int(input())

ans = f(n,1) - f(n,3) - f(n,5) + f(n,15)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
sum=0
i=1
while i <= N:
    if not((i%3==0 and i%5==0) or (i%3==0) or (i%5==0)):
        sum = sum + i
    i += 1
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC 162: B – FizzBuzz Sum
N = int(input())
print(sum([n for n in range(1, N + 1) if n % 3 != 0 and n % 5 != 0]))

Submission status: Accepted

Solution code:
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:
num = int(input())

div = num // 15

count = 60 *  div ** 2

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

Submission status: Accepted

Solution code:
import numpy as np
A = int(input())
L = np.arange(A)+1
S = 0 
for i in range(A):
    if L[i]%3 != 0 and L[i]%5 != 0 :
        S  += L[i]
print(S)

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

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)