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: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def g(N):
    s=0
    for i in range(N):
        if i%5!=0 and i%3!=0:
            s+=i
    return s
N=int(input())
print(g(N))

Submission status: Wrong Answer

Solution code:
n = int(input())


fz = []
f = []
z = []

ans = 0
for i in range(n):

    if i % 15 == 0:
        fz.append(i)
    else:
        if i % 3 == 0:
            f.append(i)
        elif i % 5 == 0:
            z.append(i)
        else:
            ans += i


print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
c = 0
for n in range(N):
    if n%15==0:
        continue
    elif n %3==0:
        continue
    elif n%5==0:
        continue
    else:
        c += n
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print (ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

sum = 0

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

print(sum)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])

    ret = 0
    for i in range(n):
        if not(i % 3 == 0 or i % 5 == 0):
            ret += i

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys

# A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
# A,B = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
# A, B = [str(x) for x in stdin.readline().rstrip().split()]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, 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 fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

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

Submission status: Wrong Answer

Solution code:
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():

    N = int(input())

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

        total += i

    print(total)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

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

Submission status: Wrong Answer

Solution code:

N = int(input())

v = 0

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

print(v)

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import Counter
from pprint import pprint

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

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col):
    data.sort(key=lambda x:x[col],reverse=False)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#B

N = int(input())

a=0

for i in range(N):
  if i%15==0:
    pass
  elif i%3==0:
    pass
  elif i%5==0:
    pass
  else:
    a+=i
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())

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

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

n=int(input())

def fb(x):
    if x%15==0:
        return 0
    if x%5==0:
        return 0
    if x%3==0:
        return 0
    return x
ans=0
for i in range(n):
    ans+=fb(i)
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, gcd
from functools import lru_cache, reduce
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# ここから書き始める
n = input()
yes = False
for i in n:
    if i == "7":
        yes = True
        break
if yes:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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 fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

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

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#MLE注意！

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

n = int(input())
li = []
ans = 0
for i in range(n):
    if i%15 == 0:
        continue
    elif i%5 == 0:
        continue
    elif i%3 == 0:
        continue
    else:
        ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

Submission status: Wrong Answer

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

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

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

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

n = int(input())

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import *

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
(N,) = [int(x) for x in input().split()]

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

Submission status: Wrong Answer

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


N = int(input())
ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
ans = 'Yes' if '7' in s else 'No'
print(ans)

Submission status: Wrong Answer

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


main()

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

l=list(range(1,n+1))

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

    if i%3==0:
        l.remove(i)

    elif i%5==0:
        l.remove(i)
    else:
        pass
print(sum(l))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

D = 0
for I in range(a):
    if c[I]%15 == 0:
        c.remove(c[I])
        c.insert(I,'a')

    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        D = D + c[I]
print(D)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
b = 1
c = []
for i in range(a):
    c.append(b)
    b += 1

for I in range(a):
    if c[I]%15 == 0:
        c.remove(c[I])
        c.insert(I,'a')

    elif c[I]%5 == 0:
        c.remove(c[I])
        c.insert(I,'a')
    
    elif c[I]%3 == 0:
        c.remove(c[I])
        c.insert(I,'a')
        
    else:
        continue


D = 0
for q in range(a):
    if c[q] == 'a':
        continue
    elif c[q] != 'a':
        D = D + c[q]
print(D)

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
ans = 0
i = 1
while i <=a :
    if i%3 == 0:
        i += 1
        continue
    elif i%5 == 0:
        i += 1
        continue
    ans += a
    
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import time

n = input()

#空のリストを作成
fizzbuzz_list = 0

#3の倍数のリストを作成
multiples_of_3 = np.arange(3, 9*int(len(n))+1, 3)

def digitsum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

def place_of_one(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 1の位を返す
    return array[-1]

def dt_mu_15(n):
    if place_of_one(n) == 0 or place_of_one(n) == 5:
        if digitsum(n) in multiples_of_3:
            return n
    else: 
        pass

# start = time.time()

for i in range(int(n)):
    if dt_mu_15(i+1):
          pass
    elif digitsum(i+1) in multiples_of_3:
         pass
    elif place_of_one(i+1) == 0 or place_of_one(i+1) == 5 :
         pass
    else:
         fizzbuzz_list += (i+1)

# end = time.time()
# print(end-start)

print(fizzbuzz_list)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())

A = list(range(N+1))
for n in range(N+1):
    if np.mod(n, 3) == 0 or np.mod(n, 5) == 0:
        A[n] = 0

print(sum(A))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = input()
x = []
for i in range(1, N+1):
    x.append(i)
    if i % 3 == 0 or i % 5 == 0:
        x.remove(i)
print sum(x)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
bro = [x for x in range(1, n+1)]
number = 3
while number <= n:
  try:
    bro.remove(number)
  except ValueError:
    pass
  number += 3
number = 5
while number <= n:
  try:
    bro.remove(number)
  except ValueError:
    pass
  number += 5
print(sum(bro))

Submission status: Time Limit Exceeded

Solution code:
N = input()
Q = 0
for i in range(int(N)+1):
  P = []
  for j in range(len(str(i))):
    k= str(i)
    P.append(int(k[j]))
  if(sum(P)%3 == 0 or P[-1]%5 == 0):
      Q += 0
  else:
      Q += i
print(Q)

Submission status: Time Limit Exceeded

Solution code:
N = input()
Q = 0
for i in range(int(N)+1):
  P = []
  for j in range(len(str(i))):
    k= str(i)
    P.append(int(k[j]))
  if(sum(P)%3 == 0 and P[-1]%5 == 0):
      Q += 0
  elif(sum(P)%3 == 0):
      Q += 0
  elif(P[-1] == 0 or P[-1] == 5):
      Q += 0
  else:
      Q += i
print(Q)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools
import math

k=200
klis = list(range(1,k+1))
lis = list(itertools.product(klis, klis, klis))
temp = []
for i in range(len(lis)):
    temp.append(math.gcd(math.gcd(lis[i][0],lis[i][1]),lis[i][2]))

print(sum(temp))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
o=list(i for i in range(1,n+1))
for j in o:
    if j%5==0:
        o.remove(j)
for p in o:
    if p%3==0:
        o.remove(p)
print(sum(o))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
o=list(i for i in range(1,n+1))
sum=0
for j in o:
    if j%5==0:
        o.remove(j)
for j in o:
    if j%3==0:
        o.remove(j)
for k in o:
    sum+=k
print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

list1 = []
for i in range(n):
  list1.append(i + 1)
   
for i in range(1, n + 1):
  if i % 15 == 0:
    list1.remove(i)
  elif i % 5 == 0:
    list1.remove(i)
  elif i % 3 == 0:
    list1.remove(i)

a = int(len(list1))
ans = 0
for i in range(a):
  ans = ans + list1[i]
  
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
o=list(i for i in range(1,n+1))
sum=0
l=[]
for j in o:
    if j % 5 == 0:
        o.remove(j)
for p in o :
    if p%3==0:
        o.remove(p)
for k in o:
    sum+=k
print(sum)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=input()
a=np.arange(np.float(N))+1
for i in range(len(a)):
    if a[i]%3==0 and a[i]%5==0:
        a[i]=0
    elif a[i]%3==0:
        a[i]=0
    elif a[i]%5==0:
        a[i]=0
print(int(sum(a)))

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 = answer + i

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def readinput():
    n=int(input())
    return n

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

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    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())
fb_list = []
for i in range(1, N + 1):
  if (i % 5 != 0) and (i % 3 != 0):
    fb_list.append(i)

ans = sum(fb_list)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ls = [i for i in range(1, N+1) if not (i%3==0 or i%5==0)]

print(sum(ls))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

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

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

print(result)

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 = []

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

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

Submission status: Accepted

Solution code:
n=int(input())
l3 = (n//3)*3
l5= (n//5)*5
l15=(n//15)*15
print(n*(n+1)//2 - (3+l3)*l3//6 - (5+l5)*l5//10 + (15+l15)*l15//30  )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
result = 0
for i in range(1, (N + 1)):
    if i % 15 == 0:
        'Fizz Buzz'
    elif i % 3 == 0:
        'Fizz'
    elif i % 5 == 0:
        'Buzz'
    else:
        result = result + i
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
print(sum(map(lambda x:x if (x % 3 != 0) and (x % 5 != 0) else 0,list(range(N + 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())
num=list(range(1,N+1))
num1=[i for i in num if (i%3!=0 and i%5!=0)]
print(sum(num1))