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:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
#################################### ########
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
#################################### ########
N=int(input())
A=set(range(1,N+1))
A=A-set(range(1,N+1)[2::3])
A=A-set(range(1,N+1)[4::5])
print(sum(A))

Submission status: Accepted

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

while N > 0:
  ai = N
  if (ai % 3 == 0) and (ai % 5 == 0):
    ai ='FizzBuzz'
  elif (ai % 3 == 0):
    ai = 'Fizz'
  elif (ai % 5 == 0):
    ai == 'Buzz'
  else:
    sum=sum+ai
  N=N-1

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(k)

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

for i in range(N+1):
  if i % 3 == 0 or i % 5 == 0:
    a.append(i)
  else:
    b.append(i)
    
print(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())
sum=0

for count in range(1,n+1):
    if(count%3==0)|(count%5==0):
        continue
    else:
        sum=sum+count
        
print(sum)

Submission status: Accepted

Solution code:
n=int(input())
a = n // 3
b = n // 5
c = n // 15

x = a * 3
y = b * 5
z = c * 15

s = (3 + x) * a // 2
t = (5 + y) * b // 2
u = (15 + z) * c // 2

souwa = (n + 1) * n // 2
print(souwa - s - t + u)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())

a = 0
for i in np.arange(1,n+1):
  if i%3 ==0 :
    a += 0
  elif i% 5 ==0:
    a  += 0
  else:
    a += i
    
print(a)

Submission status: Accepted

Solution code:
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,boundary=1,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

## return prime factors of N as dictionary {prime p:power of p}
## within 2 sec for N = 2*10**20+7
def primeFactor(N):
    i,n=2,N
    ret={}
    d,sq=2,99
    while i<=sq:
        k=0
        while n%i==0:
            n,k,ret[i]=n//i,k+1,k+1
        if k>0 or i==97:
            sq=int(n**(1/2)+0.5)
        if i<4:
            i=i*2-1
        else:
            i,d=i+d,d^6
    if n>1:
        ret[n]=1
    return ret


## return the list of prime numbers in [2,N], using eratosthenes sieve
## within 2sec for N = 1.2*10**7
def PrimeNumSet(N):
    Max = int(N**0.5)
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList:
        if seachList[0] <= Max:
            break
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

## retrun LCM of numbers in list b
## within 2sec for no of B = 10*5  and  Bi < 10**6
def LCM(b,mo=10**9+7):
    prs=PrimeNumSet(max(b))
    M=dict(zip(prs,[0]*len(prs)))
    for i in b:
        dc=primeFactor(i)
        for j,k in dc.items():
            M[j]=max(M[j],k)
    
    r=1
    for j,k in M.items():
        if k!=0:
            r*=pow(j,k,mo)
            r%=mo
    return r

show_flg=False
show_flg=True


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

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

Submission status: Accepted

Solution code:
import sys
import numpy as np


def solve(N: int):
    FB = list(range(N+1))
    FB = np.array(FB)

    FB = FB[(FB % 3 != 0) & (FB % 5 != 0) ]

    FB = FB.tolist()

    S = sum(FB)

    print(S)

    return


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:
# -*- coding: utf-8 -*-
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 (i % 3 != 0 and i % 5 != 0 ):
        sum +=  i
print(sum)

Submission status: Accepted

Solution code:
t = int(input())
f=t//5
tt=t//3
ff=t//15
f=(f*(f+1)//2 )*5
tt=(tt*(tt+1)//2 )*3
ff =(ff*(ff+1)//2 )*15
print(t*(t+1)//2 - f -tt +ff)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
n=int(input())
a=0
k=n//15
a+=60*k**2
while not 0==n%15:
  if not n%3==0 and not n%5==0:
    a+=n
  n-=1
print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/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())
m3 = n//3
m5 = n//5
m15 = n//15

ans = n*(n+1)//2+(15*(m15+1))*m15//2-3*(m3+1)*m3//2-5*(m5+1)*m5//2
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


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

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):
        sum += 0
    else:
        sum += i

print(sum)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
b = [i+1 for i in range(N)]
a = np.array(b)

c = a - a//3 *3
d = a - a//5 *5

e = c*d
print(sum(a*(e!=0)))

Submission status: Accepted

Solution code:
fizzBuzz = []
inputNumber = int(input())
for i in range(inputNumber + 1):
    if i % 3 == 0 and i % 5 == 0:
        metCondition = 'FizzBuzz'
    elif i % 5 == 0:
        metCondition = 'Buzz'
    elif i % 3 == 0:
        metCondition = 'Fizz'
    else:
        metCondition = i
    fizzBuzz.append(metCondition)
metCondition_2 = [num for num in fizzBuzz if isinstance(num, (int, float))]
print(sum(metCondition_2))

Submission status: Accepted

Solution code:
q = int(input())

sum = 0
for num in range(1, q+1):
    if num % 3 == 0:
        pass
    elif num % 5 == 0:
        pass
    else:
        sum += num

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

sum_num = 0
for n in range(1,num+1):
    if n % 3 == 0:
        continue
    if n % 5 == 0:
        continue
    sum_num = sum_num + n

print(sum_num)

Submission status: Accepted

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

Submission status: Accepted

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

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:
f = []
input = int(input())
for i in range(input + 1):
    if i % 3 == 0 and i % 5 == 0:
        c = 'FizzBuzz'
    elif i % 5 == 0:
        c = 'Buzz'
    elif i % 3 == 0:
        c = 'Fizz'
    else:
        c = i
    f.append(c)
c1 = [num for num in f if isinstance(num, (int, float))]
print(sum(c1))

Submission status: Accepted

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

print(sum(listo))

Submission status: Accepted

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

print(cnt)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
data = input()

total = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
N1 = N + 1
N2 = N1 * N
S0 = N2 / 2
# print(int(S0))

Na = N//3
N1a = Na + 1
N2a = N1a * Na
S0a = 3 * N2a / 2
# print(int(S0a))

Nb = N//5
N1b = Nb + 1
N2b = N1b * Nb
S0b = 5 * N2b / 2
# print(int(S0b))

Nc = N//15
N1c = Nc + 1
N2c = N1c * Nc
S0c = 15 * N2c / 2
# print(int(S0c))

S = S0 - S0a - S0b + S0c

print(int(S))

Submission status: Accepted

Solution code:
n = int(input())

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

print(s)

Submission status: Accepted

Solution code:
def sum1(N):
    S1 = int((((N // 3)) * (2 * 3 + (N //3 - 1) * 3) //2) )
    S2 = int((((N // 5)) * (2 * 5 + (N // 5 - 1) * 5) // 2) )
    S3 = int((((N // 15)) * (2 * 15+ (N // 15 - 1) * 15) // 2))
    a =  int(S1 + S2 - S3) 
    return a
N = int(input())
ans = (N*(N+1)/2)-sum1(N)
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=input()
y=int(x)
z=int(1)
number=int(0)
while z<=y:
    if z%3==0:
        pass
    elif z%5==0:
        pass
    elif z%15==0:
        pass
    else:
        number=number+z
    z=z+1
print(number)

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

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

print(an)

Submission status: Accepted

Solution code:
N = int(input())

result = (1 + N) * N / 2

n3 = (N // 3)
sum3 = (3 + 3 * n3) * n3 / 2

n5 = (N // 5)
sum5 = (5 + 5 * n5) * n5 / 2

n15 = (N // 15)
sum15 = (15 + 15 * n15) * n15 / 2

print(int(result - sum3 - sum5 + sum15))

Submission status: Accepted

Solution code:
i=int(input())
a=int(i/15)
sum=(a-1)*a*15*8/2+60*a
for j in range(i%15):
    if j%5!=0 and j%3!=0:
        sum+=(j+a*15)
if i%5!=0 and i%3!=0:
    sum+=i
print(int(sum))

Submission status: Accepted

Solution code:
def div(k):
    if (k % 3 != 0) and (k % 5) != 0:
        return True
    else:
        return False

def main():
    n = int(input())
    ary = [i for i in range(n+1)]
    ary = [i if div(i) else 0 for i in ary]
    print(sum(ary))

if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
a = input()
b = int(a)
sum = 0

for i in range(1, b+1):
    if i % 15 == 0:
        #print("Fizz Buzz!")
        sum += 0
    elif i % 3 == 0:
        #print("Fizz!")
        sum += 0
    elif i % 5 == 0:
        #print("Buzz!")
        sum += 0
    else:
        sum += i

print(sum)

Submission status: Accepted

Solution code:
n=int(input())
li=[]
for i in range(1,n+1):
    li.append(i)
sum=0
for j in li:
    if j%15==0:
        sum+=j
    elif j%3==0:
        sum+=j
    elif j%5==0:
        sum+=j
print(int(((n+1)*n/2) - sum))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
D = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60, 0]
E = [0, 1, 2, 2, 3, 3, 3,  4,  5,  5,  5,  6,  6,  7,  8, 0]

N = int(input())

s = N//15
t = (60*s)*(s)

m = s*15

t += D[N-m] + 15*E[N-m]*s

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

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

a = 0

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

print(a)

Submission status: Accepted

Solution code:
n=int(input())
num = [1,2,4,7,8,11,13,14]
total=0
total2=0
tmp=0
if n%15!=0:
  for i in range((15*(n//15))+1,n+1):
    if i%15 in(num):
      total+=i
for i in range(n//15):
  total2+=60+tmp
  tmp+=120
print(total+total2)

Submission status: Accepted

Solution code:

N = int(input())
if 1 <= N <= 10**6:
    Sum = 0
    for i in range(1, N+1):
        if i % 3 == 0 and i % 5 == 0:
            continue
        elif i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        Sum = Sum + i
    print(Sum)
else:
    pass

Submission status: Accepted

Solution code:
N=int(input())

ans = []
for i in range(1,N+1):
    if i % 3 == 0:
        continue 
    elif i % 5 == 0:
        continue
    ans.append(i)
print(sum(ans))

Submission status: Accepted

Solution code:
n = int(input())

summ = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(cnt)

Submission status: Accepted

Solution code:
x = input()
x = int(x)
list = []
sum = 0

for i in range(x):
	list.append(i+1)

for i in range(x):
    num = list[i]
    if num % 3 == 0 and num % 5 == 0:
        num
    elif num % 3 == 0:
        num
    elif num % 5 == 0:
        num
    else:
        sum = sum + list[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
    elif(i%5==0):
        continue
    else:
        count+=i

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

print(SUM)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)

n = int(input())
li = []
ans = 0
for i in range(n+1):
    if i%15 == 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())
s=0
i=1
while(i<=N):
    s=s+i
    i=i+1
a=N//3
b=N//5
c=N//15
p=0
x=1
while(x<=a):
    p=p+x
    x=x+1
p=p*3
q=0
y=1
while(y<=b):
    q=q+y
    y=y+1
q=q*5
r=0
z=1
while(z<=c):
    r=r+z
    z=z+1
r=r*15
print(s-p-q+r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(n):
    if (i+1) % 15 == 0:
        a.insert(i+1,"FizzBuzz") 
    elif (i+1) % 3 == 0:
        a.insert(i+1,"Fizz") 
    elif (i+1)% 5 == 0:
        a.insert(i+1,"Buzz") 
    else:
        a.append(i+1)
        
b = [num for num in a if isinstance(num, int)]
print(sum(b))

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

sumsum = 0
for i in range(N):
    
    val = i+1
    if val % 3 == 0 & val % 5 == 0:
        
        pass
        #print('FizzBuzz')
    
    elif val % 3 == 0:
        
        pass
        #print('Fizz')
    
    elif val % 5 == 0:
        
        pass
        #print('Buzz')
        
    else:
        
        sumsum += val
        
print(sumsum)

Submission status: Accepted

Solution code:
import math
#数値ひとつ
I = int(input())
#数値欲しいとき
#H, W = map(int, input().split())
#文字欲しいとき
#N = input()
#それをListにしたいとき
#listA = list(N)
a = 0
I = I + 1
for num in range(I):
    if num%3 == 0 and num%5 == 0:
        a = a
    elif num%3 == 0:
        a = a
    elif num%5 == 0:
        a = a
    else:
        a = a + num

print(a)

Submission status: Accepted

Solution code:
N = int(input())

i = 1
sum = i
while i < N :
   i = i + 1
   if i % 3 == 0 or i % 5 == 0 :
      continue
   sum = sum + i

print(sum)

Submission status: Accepted

Solution code:
print(sum(i*(i%3>0)*(i%5>0)for i in range(1,int(input())+1)))

Submission status: Accepted

Solution code:
N = int(input())

res = 0
for i in range(1, N+1):
  if i % 15 == 0 or i % 3 == 0 or i % 5 == 0:
    continue
  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 and i % 5 != 0:
        ans += i

print(ans)