Problem:
 Score : 200 points    Problem Statement Let us define the FizzBuzz sequence  a_1,a_2,... as follows:   If both 3 and 5 divides i , a_i=\mbox{FizzBuzz} .  If the above does not hold but 3 divides i , a_i=\mbox{Fizz} .  If none of the above holds but 5 divides i , a_i=\mbox{Buzz} .  If none of the above holds, a_i=i .   Find the sum of all numbers among the first N terms of the FizzBuzz sequence.      Constraints  1 \leq N \leq 10^6         Input Input is given from Standard Input in the following format:  N       Output Print the sum of all numbers among the first N terms of the FizzBuzz sequence.        Sample Input 1 15      Sample Output 1 60  The first 15 terms of the FizzBuzz sequence are:  1,2,\mbox{Fizz},4,\mbox{Buzz},\mbox{Fizz},7,8,\mbox{Fizz},\mbox{Buzz},11,\mbox{Fizz},13,14,\mbox{FizzBuzz}  Among them, numbers are 1,2,4,7,8,11,13,14 , and the sum of them is 60 .       Sample Input 2 1000000      Sample Output 2 266666333332  Watch out for overflow.

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

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

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

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

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

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

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

print(sum)

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

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

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

print(sum(l))

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

Solution (Python):
total = []

N = int(input())

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:
        total.append(i)

print(sum(total))

Solution (Python):
num_int = int(input())
sum_of_rest_num = 0
for i in range(1, num_int + 1):
    if not (i % 15 == 0 or i % 3 == 0 or i % 5 == 0):
        sum_of_rest_num += i

print(sum_of_rest_num)

Solution (Python):
total = []

N = int(input())

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:
        total.append(i)

print(sum(total))

Solution (Python):
n=int(input())
if n>10**6 or 1>n:
    pass
else:
    result=0
    for i in range(1,n+1,1):
        if i%3==0 and i%5==0:
            pass
        elif i%3==0:
            pass
        elif i%5==0:
            pass
        else:
            result+=i
        
    print(result)

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

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

print(str(sum))

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

Solution (Python):
N=input()
ans=0

for i in range(1,int(N)+1):

    if i%15==0:
        pass

    elif i%5==0:
        pass

    elif i%3==0:
        pass

    else:
        ans=ans+i

print(ans)

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

Solution (Python):

b=0
n=input()

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

    if i%3==0 and i%5==0:
      a="FizzBuzz"
    elif i%3==0:
        a="Fizz"
    elif i%5==0:
      a="Buzz"
    else:
      b=b+i

print(b)

Solution (Python):
'''
FizzBuzz列 a1,a2,... を次のように定めます。
    i が 3 でも　5 でも割り切れるなら、ai=FizzBuzz
    そうではなく i が 3 で割り切れるなら、ai=Fizz
    そうではなく i が 5 で割り切れるなら、ai=Buzz
    そうではないなら、ai=i

FizzBuzz列の N項目までに含まれる数の和を求めてください。
'''





n = int(input())



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

print(result)

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

print(j)

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

def isnot_fizzbuzz(number: int) -> bool:
    if (number) % 3 != 0 and (number) % 5 != 0:
        return True
    return False

def main():
    sum = 0
    for number in range(1, N + 1):
        if isnot_fizzbuzz(number) == True:
            sum += number
    print(sum)

if __name__ == "__main__":
    main()

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

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

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

a_ =sum(list(range(1,N,1)))
a_3=sum(list(range(3,N,3)))
a_5=sum(list(range(5,N,5)))
a_15=sum(list(range(15,N,15)))
ans=a_ + a_15 -(a_3+a_5)
print(ans)

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

Solution (Python):
def to_fizzbuzz(num: int) -> str:
    if num % 15 == 0:
        return 'FizzBuzz'
    if num % 3 == 0:
        return 'Fizz'
    if num % 5 == 0:
        return 'Buzz'
    return str(num)


N = int(input())
answer = 0
for i in range(1, N + 1):
    fb_str = to_fizzbuzz(i)
    if fb_str.isdecimal():
        answer += int(fb_str)
print(answer)

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

print(answer)

Solution (Python):
N = int(input())
res = (N * (N + 1)) / 2
three = ( (3 + 3 * (N // 3)) * (N // 3) )/ 2
five =  ( (5 + 5 * (N // 5)) * (N // 5) )/ 2
threefive =  ( (15 + 15 * (N // 15)) * (N // 15) )/ 2
print(int(res - three - five + threefive))

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    ans = n * (n + 1) // 2
    n_3 = n // 3
    n_5 = n // 5
    n_15 = n // 15
    ans -= n_3 * (n_3 + 1) * 3 // 2
    ans -= n_5 * (n_5 + 1) * 5 // 2
    ans += n_15 * (n_15 + 1) * 15 // 2
    print(ans)

main()

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

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

Solution (Python):
S = int(input())
sum_all = 0
sum_fizzbuzz = 0
for i in range(1,S+1):
    sum_all = sum_all + i
    if i % 3 == 0 or i % 5 == 0 or i % 15 ==0:
        sum_fizzbuzz = sum_fizzbuzz + i


print(sum_all - sum_fizzbuzz)

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

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

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

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


LN = list(range(N+1))


SUM = 0


for i in LN:
    if ((LN[i] % 3 != 0) and (LN[i] % 5 != 0)):
        SUM = SUM + LN[i]

print(SUM)

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

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

print(sum)

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

def S(x):
    return(x*(x+1)//2)

print(S(N) - 3*S(N//3) - 5*S(N//5) + 15*S(N//15))

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

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

print(s)

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

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

Solution (Python):

N = int(input())


calc = []
for cnt in range(1, N + 1):
    
    if cnt % 3 != 0 and cnt % 5 != 0:
        calc.append(cnt)


print(sum(calc))

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

Solution (Python):

N = int(input())

a = [i+1 for i in range(N)]

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

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

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

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

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

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

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

print(ans)

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

    ans = n * (n + 1) // 2 - 3 * (n // 3) * (n // 3 + 1) // 2 - 5 * \
        (n // 5) * (n // 5 + 1) // 2 + 15 * (n // 15) * (n // 15 + 1) // 2

    print(ans)


if __name__ == "__main__":
    main()

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

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

    print(ans)


if __name__ == "__main__":
    main()

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

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

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

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

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

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

print(sum)

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

if __name__ == "__main__":
    n = int(input())
    solve(n)

Solution (Python):
def solve(n):
    ans = 0
    for i in range(1, n+1):
        if (i % 3 == 0 and i % 5 == 0) or (i % 3 == 0) or (i % 5 == 0):
            continue
        else:
            ans += i
    print(ans)

if __name__ == "__main__":
    n = int(input())
    solve(n)

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

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



if '__main__' == __name__:
    resolve()

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

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

    return ans

print(main())

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

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

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

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

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

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

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

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

print(sum)

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

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

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

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

ans = 0

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

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

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    ans = 0
    for i in range(1,N+1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i
    
    print(ans)




if __name__ == "__main__":
    main()

Solution (Python):






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

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

print(ans)

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

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

print(ans)

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

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

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

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

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

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

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

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

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

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

suma=(0+a*3)*(a+1)//2
sumb=(0+b*5)*(b+1)//2
sumc=(0+c*15)*(c+1)//2

print((n+1)*n//2-suma-sumb+sumc)

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

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

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

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

Solution (Python):
import math
n = int(input())
x = n * (n + 1) / 2
f = math.floor(n / 3)
fizzsum = f * (f + 1) / 2 * 3
b = math.floor(n / 5)
buzzsum = b * (b + 1) / 2 * 5
fb = math.floor(n / 15)
fizzbuzzsum = fb * (fb + 1) / 2 * 15
print(int(x - fizzsum - buzzsum + fizzbuzzsum))

Solution (Python):
N = int(input())
ls = []

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

print(sum(ls))

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

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


if __name__ == '__main__':
    main()

Solution (Python):
N= int(input())
ls = []

for i in range(N+1):
  if i % 3 == 0 and i % 5 == 0:
    ls.append(0)
  elif i % 3 == 0:
    ls.append(0)
  elif i % 5 == 0:
    ls.append(0)
  else:
    ls.append(i)

print(sum(ls))

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

Solution (Python):


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

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

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

Solution (Python):
n = int(input())
sum_n = (1/2)*n*(n+1)
sum_3 = (1/2)*(n//3)*(n//3+1)*3
sum_5 = (1/2)*(n//5)*(n//5+1)*5
sum_15 = (1/2)*(n//15)*(n//15+1)*15
print(str(int(sum_n+sum_15-sum_3-sum_5)))

Solution (Python):
n = int(input())
sum_n = (1/2)*n*(n+1)
sum_3 = (1/2)*(n//3)*(n//3+1)*3
sum_5 = (1/2)*(n//5)*(n//5+1)*5
sum_15 = (1/2)*(n//15)*(n//15+1)*15
print(str(int(sum_n+sum_15-sum_3-sum_5)))

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

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

Solution (Python):
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


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

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

Solution (Python):
import math
def main():
    n = int(input())
    r = 0
    for x in range(1, n + 1):
        if x % 3 == 0 and x % 5 == 0:
            continue
        elif x % 3 == 0:
            continue
        elif x % 5 == 0:
            continue
        else:
            r += x
    
    print(r)

main()

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

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

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

if __name__ == "__main__":
    solve()

Solution (Python):

def main():
    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__':
    main()

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

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

print(sum(l))

Solution (Python):

N = int(input())
ans = ((1+N) * N)/2 - ((3 + 3*(N//3)) * (N//3))/2 - ((5 + 5*(N//5)) * (N//5))/2 + ((15 + 15*(N//15)) * (N//15))/2
print(int(ans))

Solution (Python):
n=int(input())
a=[0,1,3,3,7,7,7,14,22,22,22,33,33,46,60]
b=[0,1,2,2,3,3,3,4,5,5,5,6,6,7,8]
print(60*((n//15)**2)+b[n%15]*(15*(n//15))+a[n%15])

Solution (Python):
n=int(input())
a=[0,1,3,3,7,7,7,14,22,22,22,33,33,46,60]
b=[0,1,1,0,1,0,0,1,1,0,0,1,0,1,1]
print(60*(n//15)+120*(n//15)*(n//15-1)//2+sum(b[:n%15+1])*(15*(n//15))+a[n%15])

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

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

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

a = []

for i in range(1,n+1):
    if (i % 5 == 0) and (i % 3 == 0):
        continue
    elif i % 5==0:
        continue
    elif i % 3 ==0:
        continue
    else:
        a.append(i)
    
ans = sum(a)

print(ans)

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

Solution (Python):
N=int(input())
F=N//3
B=N//5
fb=N//15
S=(N*(N+1))//2
Fizz=(3*F*(F+1))//2
Buzz=(5*B*(B+1))//2
FizzBuzz=(15*fb*(fb+1))//2
print(S-Fizz-Buzz+FizzBuzz)

Solution (Python):

if __name__ == '__main__':
    N = int(input())
    ans = 0
    for i in range(1, N+1):
        if i%3 > 0 and i%5 > 0:
            ans += i
    print(ans)

Solution (Python):
N=int(input())
a=1
sum=0
while a in range(N+1):
  if a%3 !=0 and a%5 !=0:
    sum=sum+a
    a = a + 1
  else:a=a+1
print(sum)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

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

Solution (Python):


n = int(input())
ct = 0
for i in range(n + 1):
    if i % 3 != 0:
        if i % 5 != 0:
            ct += i
    else:
        continue

print(ct)

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

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

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

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

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

total1 =0
total2 = 0
for i in list1:
  total1 += i
for i in range(N+1):
  total2 += i
print(total2 -total1)

Solution (Python):
N = int(input())
N3 = N//3
N5 = N//5
N15 = N//15

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

print(int(ans))

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

print(ans)

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

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

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

print(ans)

Solution (Python):
N = int(input())
fizz = N // 3
buzz = N // 5
fzbz = N // 15
ans = (N+1)*N // 2
ans -= buzz * (5 * buzz + 5) // 2
ans -= fizz * (3 * fizz + 3) // 2
ans += fzbz * (15 * fzbz + 15) // 2
print(ans)

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

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

Solution (Python):
score = int(input())
souwa = int((score*(score+1))/2)
kou3 = score//3
souwa3 = int((kou3*(kou3+1)*3)/2)
kou5 = score//5
souwa5 = int((kou5*(kou5+1)*5)/2)
kou15 = score//15
souwa15 = int((kou15*(kou15+1)*15)/2)
answer = souwa-souwa3-souwa5+souwa15
print(answer)

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

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

print(ans)

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

Solution (Python):
ary = list(filter(lambda x: int(x) % 3 != 0 and int(x) % 5 != 0, list(range(int(input()) + 1))))
print(sum(ary))

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

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

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

Solution (Python):
n = int(input())
a = 0
for i in range(n+1):
    if i%3== 0: continue
    elif i%5 == 0:continue
    elif i%3 ==0 and i %5 ==0:continue
    else: a+=i

print(a)

Solution (Python):
n=int(input())
a=(n*(n+1))//2
z=n%3
x=n-z
x=x//3
s1=((x*(x+1))//2)*3
z=n%5
x=n-z
x=x//5
s2=((x*(x+1))//2)*5
z=n%15
x=n-z
x=x//15
s3=((x*(x+1))//2)*15
print (a-s1-s2+s3)

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

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

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

ans = 0

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

print(ans)

Solution (Python):
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
    if i >= n:
        print(ans)
        exit()

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

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

    s = 0
    for x in range(1, N + 1):
        if x % 3 == 0:
            continue
        if x % 5 == 0:
            continue
        s += x
    print(s)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = N*(N+1)//2
P = N//3
B = 3*P*(P+1)//2
Q = N//5
C = 5*Q*(Q+1)//2
R = N//15
D = 15*R*(R+1)//2

ans = A - B - C + D
print(ans)

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

ans = 0

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

print(ans)

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

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

print(ans)

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

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

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

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

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

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

print(nsum)

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

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

Solution (Python):
a=0

for i in range(int(input())+1):
	if i%15==0:
		continue
	elif i%3==0:
		continue
	elif i%5==0:
		continue
	else:
		a+=i
print(a)

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

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

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

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

Solution (Python):
n = int(input())
l = []

def func():
    pass

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

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

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

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

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

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

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

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

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

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

print(a)

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

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

print(cnt)

Solution (Python):
import sys
n = int(sys.stdin.read())
print(sum(i for i in range(1, n + 1) if i % 3 and i % 5))

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

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

print(ans)

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


c=0

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

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

count = 0
for i in range(n + 1):
    if i % 3 > 0 and i % 5 > 0:
        count += i
        
print(count)

Solution (Python):


def main():

    N = int(input())
    ans = 0

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

    print(ans)


if __name__ == "__main__":
    main()

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

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

print(ans)