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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()

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

print(ans)

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 and i % 5:
        ans += i

print(ans)

Submission status: Accepted

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

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

a = 0

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

print(a)

Submission status: Accepted

Solution code:
n = int(input())
#a,b = map(int,input().split())
#L = list(map(int,input().split()))
num = 0

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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())
# s = input()
# n,m = map(int, input().split())
# x = list(map(int, input().split))

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

    print(ans)

main()

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def check(s):
    for i in range(len(s)):
        if s[i] != s[len(s)-1-i]:
            return False
    return True

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(1,N+1):
        if i%3!=0 and i%5!=0:
            ans+=i
            
    print(ans)

main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(sm)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import collections
input = sys.stdin.readline

N = int(input())

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

Submission status: Accepted

Solution code:
def main(n: int):
    ans = 0
    for i in range(1, n + 1):
        if i % 15 == 0:
            continue
        if i % 5 == 0:
            continue
        if i % 3 == 0:
            continue

        ans += i

    print(ans)


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

    main(n)

Submission status: Accepted

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


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


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
from collections import *
import sys
try: inp = raw_input
except: inp = input
def err(s):
    sys.stderr.write('{}\n'.format(s))

def ni():
    return int(inp())

def nl():
    return [int(_) for _ in inp().split()]

N = ni()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import sys
input = sys.stdin.readline

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

print(tot)

Submission status: Accepted

Solution code:
n = int(input())

res = 0

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

print(res)

Submission status: Accepted

Solution code:
import heapq
from collections import defaultdict, deque
from math import ceil, factorial
from fractions import gcd
import sys

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7

si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
lmii = lambda: list(map(int, input().split()))
smii = lambda: sorted(map(int, input().split()))


N = ii()

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(tota)

Submission status: Accepted

Solution code:
N = int(input())

S = 0

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

print(S)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

n = ni()

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

print(s(n) - s(n//3)*3 - s(n//5)*5 + s(n//15)*15)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

MOD = 10**9
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)
    return divisors

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import math
import fractions
import collections
import itertools
N=int(input())
cnt=0
for i in range(N):
    if ((i+1)%5!=0)and((i+1)%3!=0):
        cnt=cnt+i+1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
s=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())
ans = 0
for i in range(1, N+1):
    if i%15==0 or i%3==0 or i%5==0:
        continue
    else:
        ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

print(total)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

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

Submission status: Accepted

Solution code:
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:
def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if i % 5 == 0 or i % 3 == 0:
            continue
        ans += i
    return ans


if __name__ == '__main__':
    print(main())

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 = input()
ans = 0
for num in xrange(1, n+1):
  if num%3 == 0 or num%5 == 0:
    ans += 0
  else:
    ans += num
print ans

Submission status: Accepted

Solution code:
#[int(i) for i in input().split()]
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 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:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = I()
    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
print(reduce(lambda x, y:x+y, [0 if i % 3 == 0 or i % 5 == 0 else i  for i in range(1, int(input())+1)]))

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
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:
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
fizzbuzz_length = int(input())

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


print(num_sum)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

Solution code:
n=int(input())
i=1
k=0
while i<n+1:
    if i%3!=0 and i%5!=0:
        k+=i
    i+=1
print(k)

Submission status: Accepted

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

print(x)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read


#p,n,k,b,*a = [int(i) for i in read().split()]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import sys

n = int(input())

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

print(sum)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
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 x in range(1, n + 1):
    if x % 3 == 0 or x % 5 == 0:
        continue

    res += x

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

    total += v

print(total)

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools
import heapq
#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


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



if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ret = 0

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

print(ret)

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

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