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

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:
import sys
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce
 
# input = sys.stdin.readline
 
n = int(input())
 
sum = 0
for i in range(1, n+1):
    if ((i % 3) == 0 or (i % 5) == 0):
        continue
    else:
        sum += i
    
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = int(n*(n+1)/2)

n3 = n//3
l3 = n-n%3
s3 = int(n3*(3+l3)/2) if n>=6 else 3

n5 = n//5
l5 = n-n%5
s5 = int(n5*(5+l5)/2) if n>=10 else 5

n15 = n//15
l15 = n-n%15
s15 = int(n15*(15+l15)/2) if n>=30 else 15

if n<3:
  print(s)
elif n<5:
  print(s-s3)
elif n<15:
  print(s-s3-s5)
else:
  print(s-s3-s5+s15)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

x = 0

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

    if i % 5 == 0:
        continue

    x += i


print(x)

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

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 and i % 15 != 0:
		ans += i

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

N_fi = N//3
N_bu = N//5
N_fb = N//15

Sn = N*(1+N)/2
S_fi_n = N_fi/2*(2*3 + (N_fi - 1)*3)
S_bu_n = N_bu/2*(2*5 + (N_bu - 1)*5)
S_fb_n = N_fb/2*(2*15 + (N_fb - 1)*15)

print(int(Sn - S_fi_n - S_bu_n + S_fb_n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3.8.2
#oj t -c "python3 ./main.py" -d ./tests/


N = int(input())
M = 1
answer = 0
while M <= N:
    if (M % 3 != 0) & (M % 5 != 0):
        answer += M
        M = M + 1
    else:
        M = M + 1
print(answer)

Submission status: Accepted

Solution code:
n = int(input())

l = []

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

print(sum(l))

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

Submission status: Accepted

Solution code:
n = int(input())
tmp = n // 15
tmp2 = n % 15
d = [(15*(tmp) + i) for i in [0,1,2,0,4,0,0,7,8,0,0,11,0,13,14]]
for i in [0,3,5,6,9,10,12]:
    d[i] = 0
print((tmp **2 * 60) + sum(d[:(tmp2+1)]))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
 
total = 0
three = 3 
five = 5
threefive = 15 
for i in range(1, n + 1):
    if i == threefive:
        three += 3 
        five += 5
        threefive += 15
        continue 
    if i == three:
        three += 3 
        continue 
    if i == five:
        five += 5
        continue 
    total += i 

# print(three)
# print(five)
# print(threefive)

print(total)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
[a,b] = [N // 15,N % 15]
S = 60*a*a
if b == 0:
  print(S)
else:
  for i in range(1,b+1):
    if i % 3 != 0 and i % 5 != 0:
      S += 15*a+i
  print(S)

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
  if i%15 == 0: continue
  ans += i

print(ans)

Submission status: Accepted

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

print(total)

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

Submission status: Accepted

Solution code:
N = int(input())

fiz = N // 3
buz = N // 5
fizbuz = N // 15


fiz_m = 0
buz_m = 0
fizbuz_offset = 0


for i in range(1,fiz+1):
    fiz_m += i*3

for j in range(1,buz+1):
    buz_m += j*5

for l in range(1,fizbuz+1):
    fizbuz_offset += l*15

total = 0
for num in range(1,N+1):
    total += num

result = total - fiz_m - buz_m + fizbuz_offset
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]

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

print(sums)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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 main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if (i%3==0) and (i%5==0):
            continue
        if (i%3==0):
            continue
        if (i%5==0):
            continue
        ans += i
    print(ans)
main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    n = int(input().strip())

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
# 整数の入力
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:
#!/usr/bin/python3
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 i in range(n+1):
  sum=sum+i

fizzbuzz=0
m=n//15
for i in range(m+1):
  fizzbuzz=fizzbuzz+15*i

fizz=0
l=n//3
for i in range(l+1):
  fizz=fizz+3*i

buzz=0
o=n//5
for i in range(o+1):
  buzz=buzz+5*i

print(sum-fizz-buzz+fizzbuzz)

Submission status: Accepted

Solution code:
N=int(input())
X= N*(2+(N -1)) / 2
k1=N//3
k2=N//5
k3=N//15
a=k1*(3+(k1)*3)/2
b=k2*(5+(k2)*5)/2
c=k3*(15+(k3)*15)/2
print(int(X-a-b+c))

Submission status: Accepted

Solution code:
n = int(input())
a = list(range(1,n+1))
ans = sum(a) - sum(list(range(0, n+1, 3))) - sum(list(range(0, n+1, 5))) + sum(list(range(0, n+1, 15)))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def run():
    n = int(input())
    num = 0
    for i in range(n + 1):
        if i % 3 == 0 or i % 5 == 0:
            continue
        num += i
    print(num)


if __name__ == '__main__':
    run()

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

Submission status: Accepted

Solution code:
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

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

print(sum)

Submission status: Accepted

Solution code:

N = int(input())

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

    elif i % 5 == 0:
        continue
    else:
        sums += i

print(sums)

Submission status: Accepted

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

print(sum(C))

Submission status: Accepted

Solution code:
N = int(input())

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

t = N // 3
s = N // 5
u = N // 15

ans = ans - 3*t*(t+1)//2 - 5*s*(s+1)//2 + 15*u*(u+1)//2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

    print(sum)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
mis=0
for j in range(1,n+1):
    cnt+=j
for i in range(n+1):
    if i%3==0 or i%5==0:
        mis+=i

print(cnt-mis)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

if __name__ == "__main__":
	N = int(input())

	sum = 0

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

	print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
lst = list(range(n))
sum = 0

for i in lst:
    calc = lst[i]+1

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#i　こうひ　j 

def sums(t,i):
    return int(0.5 * (n // i) * (i * 2 + i * ((n // i) -1)))

print(sums(n,1) - sums(n,3) -sums(n,5) + sums(n,15))

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:
def sum(x):
    a=int(x//3)
    b=int(x//5)
    c=int(x//15)
    sall=int((1+x)*(x/2))
    #print(sall)
    s3=int((3*(a-1)+6)*(a/2))
    #print(s3)
    s5=int((5*(b-1)+10)*(b/2))
    #print(s5)
    s15=int((15*(c-1)+30)*(c/2))
    #print(s15)
    ans=int(s15-s3-s5+sall)
    print(ans)
n=int(input())
sum(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
sum = a*(a+1)/2
b = a//3
c = a//5
d = a//15

sum3 = 3*b*(b+1)/2
sum5 = 5*c*(c+1)/2
sum15 = 15*d*(d+1)/2

sum = sum - sum3 - sum5 + sum15
print(int(sum))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

N = int(read())
x = np.arange(1, N + 1, dtype=np.int64)
x[x % 3 == 0] = 0
x[x % 5 == 0] = 0
print(x.sum())

Submission status: Accepted

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

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

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().split()[0])
all_sum = int(N * (N+1) / 2)

for i in range(3, N+1, 3):
    all_sum -= i

for i in range(5, N+1, 5):
    all_sum -= i

for i in range(15, N+1, 15):
    all_sum += i

print(all_sum)

Submission status: Accepted

Solution code:
n = int(input())

s = 0
for i in range(1, n + 1):
    if not i % 3 == 0 and not 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())
wa = 0.5*n*(n+1)
Fizz_num = n//3
Fizz_sum = sum([3*i for i in range(1,Fizz_num+1)])
Buzz_num = n//5
Buzz_sum = sum([5*i for i in range(1,Buzz_num+1)])
FizzBuzz_num = n//15
FizzBuzz_sum = sum([15*i for i in range(1,FizzBuzz_num+1)])

ans = wa - (Fizz_sum+Buzz_sum) + FizzBuzz_sum

print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = (n*(n+1))/2
n3 = n // 3
n5 = n // 5
n15 = n // 15

for i in range(n3):
    ans -= 3 * (i+1)
for i in range(n5):
    ans -= 5 * (i+1)
for i in range(n15):
    ans += 15 * (i+1)
print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())
num = sum(list(range(n+1)))

a = int(n/3)
a = sum(list(range(a+1)))

b = int(n/5)
b = sum(list(range(b+1)))

c = int(n/15)
c = sum(list(range(c+1)))

print(num-(3*a)-(5*b)+(15*c))

Submission status: Accepted

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

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 and i%15!=0:
        s+=i
print(s)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = n//3
b = n//5
c = n//15
def s(x):
  return x*(x+1)//2
print(s(n) - 3*s(a) - 5*s(b) + 15*s(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 += i+1
print(s)

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

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

print(str(sum(fizzbuzzlist)))

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
total = n * (n + 1) // 2
fizz = n // 3 * (n // 3 + 1) // 2 * 3
buzz = n // 5 * (n // 5 + 1) // 2 * 5
fizzbuzz = n // 15 * (n // 15 + 1) // 2 * 15
print(total - fizz - buzz + fizzbuzz)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

count=0
for i in range(N+1):
    if i %15==0:
        i="FizzBuzz"
    elif i%3==0:
        i="Fizz"
    elif i%5==0:
        i="Buzz"
    else:
        count+=i
print(count)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(N+1):
    if i % 15 == 0:
        i = 'FizzBuzz'
    elif i % 3 == 0:
        i = 'Fizz'
    elif i % 5 == 0:
        i = 'Buzz'
    else:
        count += i
print(count)

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])

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

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

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:
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())
sequence = list(range(1, N + 1))
for i in range(len(sequence)):
    num = sequence[i]
    if num % 3 == 0 and num % 5 == 0:
        sequence[i] = "FizzBuzz"
    elif num % 3 == 0:
        sequence[i] = "Fizz"
    elif num % 5 == 0:
        sequence[i] = "Buzz"
total = 0
for i in sequence:
    if isinstance(i, int):
        total += i
print(total)

Submission status: Accepted

Solution code:
def sum_cnt(max_num):
    cnt = 0
    for i in range(max_num):
        cnt += (i+1)
    return cnt
def sum_cal(n, num):
    q = n//num
    return num*sum_cnt(q)

n = int(input())
sum_all = n*(n+1)//2
sum_5 = sum_cal(n, 5)
sum_3 = sum_cal(n, 3)
sum_15 = sum_cal(n, 15)
print(sum_all - (sum_5+sum_3) + sum_15)

Submission status: Accepted

Solution code:
N = int(input())
all_sum = int(N / 2 * (N + 1))
i = 1
while i <= N:
	if i % 3 == 0 and i % 5 == 0:
		all_sum -= i
	elif i % 3 == 0:
		all_sum -= i
	elif i % 5 == 0:
		all_sum -= i
	i += 1
print(all_sum)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(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())
count = 0
for n in range(N+1):
  if (n%5)*(n%3) != 0:
    count += n
print(count)

Submission status: Accepted

Solution code:
N = int(input())
sum1 = 0
a = list(range(1,N + 1,1))

for i in a:
    if i%3 != 0 and i%5 != 0:
        sum1 = sum1 + i

print(sum1)

Submission status: Accepted

Solution code:
input_line = int(input())
fizzbuzz_list = []

for i in range(input_line + 1):
    if i % 15 == 0 or i % 5 == 0 or i % 3 == 0:
        pass
    else:
        fizzbuzz_list.append(i)
print(sum(fizzbuzz_list))

Submission status: Accepted

Solution code:
N = int(input())

is_Fizz = lambda number: number % 3 == 0
is_Buzz = lambda number: number % 5 == 0

answer = 0
for i in range(N + 1):
    if is_Fizz(i) or is_Buzz(i): continue
    
    answer += i

print(answer)

Submission status: Accepted

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

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

def fz(n):
    if n % 3 == 0:
        return 0
    elif n % 5 == 0:
        return 0
    else:
        return n

def fzsum(n):
    return sum([fz(i + 1) for i in range(n)])

print(fzsum(N))

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
t=0
u=0
v=0
for i in range(1,n+1):
  s = s+i
  if i%3==0:
    t = t+i
  elif i%5==0:
    u = u +i
  elif v %15==0:
    v = v+i
print(s-t-u+v-1)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = IN()
	#s = input()
	r=0
	for i in range(1,n+1):
		if i % 3 == 0 or i % 5 == 0:
			continue
		r+=i
	print(r)
	
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

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

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

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): 
        continue
    if i%3==0:
        continue
    elif i%5==0:
        continue
    else :
        sum+=i
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
number = int(input())
outputlist = list()
count = 0
if number >= 1 and number <= 1000000:
    number = number + 1
    for i in range (1, number):
        if i % 3 == 0 and i % 5 == 0:
            outputlist.append("FizzBuzz")
        elif i % 3 == 0:
            outputlist.append("Fizz")
        elif i % 5 == 0:
            outputlist.append("Buzz")
        else:
            outputlist.append(str(i))
    for i in outputlist:
        if i.isdigit() == True:
            count = count + int(i)
        else:
            count = count
    print(count)
else:
    print()

Submission status: Accepted

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

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

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

g = sum(a)
print(g)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

l = [0]*(a+1)
for i in range(a+1):
    if i%3 == 0:
        l[i] = 0
    elif i%5 == 0:
        l[i] = 0
    else:
        l[i] = i

print(sum(l))

Submission status: Accepted

Solution code:
n=int(input())
i=1
total=0
while i <=n:
    if i%15==0:
        #print("FB")
        total+=0
    elif i%5==0:
        #print("B")
        total+=0
    elif i%3==0:
        #print("F")
        total+=0
    else:
        #print(i)
        total+=i
    i+=1
print(total)

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=[]
for i in range(1,N+1):
    S.append(i)
for j in range(0,len(S)):
    if S[j]%3==0 or S[j]%5==0 or S[j]%15==0:
        S[j]=0
print(sum(S))

Submission status: Accepted

Solution code:
n=int(input())
sum=n*(n+1)/2
k3=n//3
k5=n//5
k15=n//15
sum-=3*k3*(k3+1)/2
sum-=5*k5*(k5+1)/2
sum+=15*k15*(k15+1)/2
print(int(sum))

Submission status: Accepted

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


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