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())
A=[]
for i in range(n):
    if (i+1)%3!=0 and (i+1)%5!=0:
        A.append(i+1)
print(sum(A))

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

count = 0

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

for i in range(3, N+1, 3):
    a[i] = 0

for i in range(5, N+1, 5):
    a[i] = 0

ans = sum(a)
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())

ret = list()
for ai in range(n):
    num = ai + 1
    if num % 15 == 0:
        pass
    elif num % 5 == 0:
        pass
    elif num % 3 == 0:
        pass
    else:
        ret.append(num)

print(sum(ret))

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

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

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

    print(ans)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """15"""
        output = """60"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """1000000"""
        output = """266666333332"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

s=0

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

print(s)

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(read())
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:


n = int(input())

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

print (c)

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
    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:
# ABC162 B

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

    res = []

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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:
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
from functools import reduce
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
def lcm_base(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
  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)
  
  
if __name__ == '__main__':
  main()

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
 
 
N = int(readline())
 
ans = sum([i for i in range(1, N+1) if i % 3 != 0 and i % 5 != 0])
 
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(n):
    if 0 != (i + 1) % 3 and 0 != (i + 1) % 5:
        ans += (i + 1)
print(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:
        continue
    else:
        cnt+=i
print(cnt)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    from sys import stdin
    input = stdin.readline

    n = int(input())
    count = 0
    for i in range(1, n+1):
        if i%3!=0 and i%5!=0:
            count += i
    print(int(count))
"""
    n = input()
    for i in n:
        if i == '7':
            print('Yes')
            break
    else:
        print('No')
"""

Submission status: Accepted

Solution code:
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count

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

def input_list_str():
  return list(map(str, input().split()))

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

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)
import math
import fractions
import collections
import itertools
from functools import reduce
main()

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
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):
    if i%3!=0 and i%5!=0:
        ans=ans+i
print(ans)

Submission status: Accepted

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


def fizzbuzz(n):
    if n % 15 == 0:
        return 'FizzBuzz'
    elif n % 3 == 0:
        return 'Fizz'
    elif n % 5 == 0:
        return 'Buzz'
    else:
        return n


for n in range(1, N + 1):
    if fizzbuzz(n) == n:
        ans += n
print(ans)

Submission status: Accepted

Solution code:
n =  int(input())

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

resolve()

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#def main(S, b):
if __name__ == '__main__':
    # n, w, k, V = map(int, input().split())

    n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字

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

print(ans)

Submission status: Accepted

Solution code:
from collections import *
from heapq import *
from itertools import *
from fractions import gcd

from decimal import *
import copy
from bisect import *
import time
import sys
import math
input=lambda :sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
N=int(input())
#A,B=map(int,input().split())
#A=list(map(int,input().split()))
c=0
for a in range(1,N+1):
    if not (a%3==0 or a%5==0):
        c+=a
print(c)

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

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

    print(ans_sum)

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy

# If you use recursive call, uncomment this code
#sys.setrecursionlimit(10**6)

def main():
    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 __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())
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:
# AtCoder
N = int(input())
sm = 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:
        sm += i
print(sm)

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    N = intinput()

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

Submission status: Accepted

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

def linput():
    return [int(x) for x in input().split()]

n = int(input())

a = 0

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    ans = 0
    for i in range(n + 1):
        if i % 5 == 0 or i % 3 == 0:
            pass
        else:
            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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2020/04/12
# AtCoder Beginner Contest 162 - B

# Input
n = int(input())

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

# Output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    total = 0
    for i in range(1,n+1):
        if i % 3 == 0 and i % 5 == 0:
            pass
            #print("FizzBuzz")
        elif i%3 == 0:
            pass
            #print("Fizz")
        elif i%5 == 0:
            pass
            #print()
        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 or i%15==0):
		pass
	else:
		ans+=i
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())

#N = int(input())
#N, M = map(int, input().split())
#A = list(map(lambda x: int(x)*(-1), input().split()))
#A = [int(input()) for i in range(N)]
#C = [list(map(int, input().split())) for i in range()]

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

ret = 0

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

print(ret)

Submission status: Accepted

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


def solve(N: int):
    a = 0
    for x in range(1,N+1):
        if (x % 3 != 0)&(x % 5 != 0):
            a += x
    print(a)
    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())
a = [i for i in range(n+1)]
for i in range(3, n+1, 3):
    a[i] = 0
for i in range(5, n+1, 5):
    a[i] = 0
print(sum(a))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,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())
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())
#h  = list(map(int, input().split()))
#h, w = list(map(int, input().split()))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
if __name__ == "__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(int(ans))

Submission status: Accepted

Solution code:


def resolve():
    N = int(input())
    count =0
    for i in range(1,N+1):

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

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

Submission status: Accepted

Solution code:
x = int(input())
ht=0
for a in range(x+1):
    if a%3==0 or a%5==0:
        ht+=a
print((x*(x+1))//2-ht)

Submission status: Accepted

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

Submission status: Accepted

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
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 or n%5==0):
        pass
    else:
        ans += n
print (ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(b)

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(1,n+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(1, N + 1):
  if not(i % 5 == 0 or i % 3 == 0):
    ans += i
print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

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())
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())
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())
print(sum(i for i in range(n+1) if i % 3 and i % 5))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    #N,K,C=map(int,input().split())
    #A=list(map(int,input().split()))
    S=input()
    S=int(S)
    ans=0
    for i in range(S+1):
        if i%3!=0 and i%5!=0:
            ans+=i
    print(ans)
    

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data = [False] * 1000001

for i in range(1, 1000001):
  if i % 3 == 0 or i % 5 == 0:
    continue
  data[i] = True

n = int(input())
result = 0

for i in range(1, n + 1):
  if data[i]:
    result += i

print(result)

Submission status: Accepted

Solution code:
import math
import copy
import sys
import fractions
# import numpy as np
# import statistics
import decimal
import heapq
import collections
import itertools
import bisect

# from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputIntList():
    outputDataList = []
    inputData = input().split()
    outputDataList = [int(n) for n in inputData]

    return outputDataList


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
import numpy as np
L = np.array([i for i in range(N+1)])
print(np.sum(L[(L % 3 != 0 )&(L % 5 != 0)]))