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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


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


def resolve():
    n = int(input())

    sum_fizz_buzz = 0

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

    print(sum_fizz_buzz)



if __name__ == "__main__":
    resolve()

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

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

Submission status: Accepted

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

print(sum(m))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = []
num = 0

for i in range(1, n+1):
    if i % 3 == 0 and i % 5 == 0:
        ans.append('FizzBuzz')
    elif i % 3 == 0:
        ans.append('Fizz')
    elif i % 5 == 0:
        ans.append('Buzz')
    else:
        num += i
print(num)

Submission status: Accepted

Solution code:


"""
NTC here
"""
import sys
inp = sys.stdin.readline
def input(): return inp().strip()
flush= sys.stdout.flush
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(2**26)

def iin(): return int(input())


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

# out = []
# range = xrange
# input = raw_input

def main():
    n = iin()
    ans = (n*(n+1))//2
    for i in range(3, n+1, 3):ans-=i
    for i in range(5, n+1, 5):ans-=i
    for i in range(15, n+1, 15):ans+=i
    print(ans)

main()
# threading.Thread(target=main).start()

Submission status: Accepted

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



print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

def 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_)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N = I()
kouho = []
for i in range(1,N+1):
    if i%3 and i%5:
        kouho.append(i)
print(sum(kouho))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(con)

Submission status: Accepted

Solution code:
n = int(input())

s = n*(n+1)/2

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''

    N = int(input())

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
def s(num):
    return num*(num+1)//2

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

Submission status: Accepted

Solution code:
def chk_fizzbuzz(i):
    if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
        return 0
    else:
        return i

N = int(input().rstrip())
ret = 0
for i in range(N+1):
    ret += chk_fizzbuzz(i)
print(ret)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    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)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

s = 0

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

print(s)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

sum=0

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

print(sum)

Submission status: Accepted

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

n = int(input())

a = []
culm = 0
for i in range(1, n+1):
    if i%3 == 0:
        pass
    elif i%5==0:
        pass
    else:
        culm += i

print(culm)

Submission status: Accepted

Solution code:
N = int(input())

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

print(sum(box))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:

n = int(input())
ans = sum(list(range(n+1))) - 3 * sum(list(range(n//3 + 1))) -5 * sum(list(range(n//5 + 1))) + 15 * sum(list(range(n//15 + 1)))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline().rstrip())

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

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

print(X)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(summation)

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(a))

Submission status: Accepted

Solution code:
N=int(input())

ans=0
for i in range(N):
    i+=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:
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

N = int(sys.stdin.readline().strip())

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

print(ans)

Submission status: Accepted

Solution code:
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

# input
N = int(input())

# initialization
ans = 0

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

# output
print(ans)

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:
A=int(input())
ans=[]
for i in range(1,A+1):
    if i%3==0 or i%5==0:
        continue
    ans.append(i)

print(sum(ans))

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(int(total - 3*N3*(N3+1)/2 - 5*N5*(N5+1)/2 + 15*N15*(N15+1)/2))

Submission status: Accepted

Solution code:
n = int(input())
# all sum
res = (1 + n) * n/2
# Fizz sum
n3 = n // 3
fizzSum = 3 * (1 + n3) * n3 / 2
# Buzz sum
n5 = n // 5
buzzSum = 5 * (1 + n5) * n5 / 2
# FizzBuzz sum
n15 = n // 15
fizzbuzzSum = 15 * (1 + n15) * n15 / 2

print(int(res- fizzSum - buzzSum + fizzbuzzSum))

Submission status: Accepted

Solution code:
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

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

print(k)

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

print(answer)

Submission status: Accepted

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

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:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()

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

    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import *
 
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())
ans = 0
for i in range(1,n+1):
    if (i%3 != 0) & (i%5 != 0):
        ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

    s = 0

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


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

Submission status: Accepted

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

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:
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N = intinp()

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

Submission status: Accepted

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

resolve()

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 n in range(1, N+1):
    if not n%3==0 and not n%5==0:
        ans += n
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:
def main():
    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)
    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = []
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:
    li.append(i)

print(sum(li))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def b162(n):

    ans = 0

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

    return ans

def main():
    n = int(input())
    print(b162(n))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

print(ans)

Submission status: Accepted

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

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T = N//3
F = N//5
TF = N//15

ans = 0 
ans += N*(N+1)//2
ans -= T*(T+1)*3//2
ans -= F*(F+1)*5//2
ans += TF*(TF+1)*15//2
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

X = list(map(int, (stdin.readline().strip().split())))[0]
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:
def resolve():
    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__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans =0
for i in range(1,N+1):
    if i %5 ==0 or i %3 ==0:
        continue
    else:
        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())
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())
goukei = n * (n + 1) // 2
bai3 = n // 3
bai5 = n // 5
bai15 = n // 15
gou3 = (3 + bai3 * 3) * bai3 // 2
gou5 = (5 + bai5 * 5) * bai5 // 2
gou15 = (15 + bai15 * 15) * bai15 // 2
ans = goukei - gou3 - gou5 + gou15
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

res = []

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

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

Submission status: Accepted

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

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

Submission status: Accepted

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

    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
#A=list(map(int, input().split()))

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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