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

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

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

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

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

print(sum)

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

Solution (Python):



N=int(input())

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

print(ans)

Solution (Python):


n = int(input())

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

Solution (Python):
n = int(input())
m3 = n//3
m5 = n//5
m15 = n//15

ans = n*(n+1)//2+(15*(m15+1))*m15//2-3*(m3+1)*m3//2-5*(m5+1)*m5//2
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


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

Solution (Python):

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

print(sum)

Solution (Python):
import numpy as np
N = int(input())
b = [i+1 for i in range(N)]
a = np.array(b)

c = a - a//3 *3
d = a - a//5 *5

e = c*d
print(sum(a*(e!=0)))

Solution (Python):
fizzBuzz = []
inputNumber = int(input())
for i in range(inputNumber + 1):
    if i % 3 == 0 and i % 5 == 0:
        metCondition = 'FizzBuzz'
    elif i % 5 == 0:
        metCondition = 'Buzz'
    elif i % 3 == 0:
        metCondition = 'Fizz'
    else:
        metCondition = i
    fizzBuzz.append(metCondition)
metCondition_2 = [num for num in fizzBuzz if isinstance(num, (int, float))]
print(sum(metCondition_2))

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

sum = 0
for num in range(1, q+1):
    if num % 3 == 0:
        pass
    elif num % 5 == 0:
        pass
    else:
        sum += num

print(sum)

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

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

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

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

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

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

sum_num = 0
for n in range(1,num+1):
    if n % 3 == 0:
        continue
    if n % 5 == 0:
        continue
    sum_num = sum_num + n

print(sum_num)

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

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

Solution (Python):
given = int(input())
sums = 0
for i in range(1, given + 1):
    if i % 15 == 0:continue
    if i % 3 == 0:continue
    if i % 5 == 0:continue
    sums += i
print(sums)

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

Solution (Python):
f = []
input = int(input())
for i in range(input + 1):
    if i % 3 == 0 and i % 5 == 0:
        c = 'FizzBuzz'
    elif i % 5 == 0:
        c = 'Buzz'
    elif i % 3 == 0:
        c = 'Fizz'
    else:
        c = i
    f.append(c)
c1 = [num for num in f if isinstance(num, (int, float))]
print(sum(c1))

Solution (Python):
f = []
input = int(input())
for i in range(input + 1):
    if i % 3 == 0 and i % 5 == 0:
        c = 'FizzBuzz'
    elif i % 5 == 0:
        c = 'Buzz'
    elif i % 3 == 0:
        c = 'Fizz'
    else:
        c = i
    f.append(c)
c1 = [num for num in f if isinstance(num, (int, float))]
print(sum(c1))

Solution (Python):
N = int(input())
listo = [0]
for num in range(1,N+1):
    if (num%15 == 0):
        listo.append(0)
    elif (num%3 == 0):
        listo.append(0)
    elif (num%5 == 0):
        listo.append(0)
    else:
        listo.append(num)

print(sum(listo))

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

print(cnt)

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

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

Solution (Python):
n=int(input())
l=[]
o=list(i for i in range(1,n+1))
for j in o:
    if j%5 ==0 or j%3 ==0:
        l.append(j)
print(sum(o)-sum(l))

Solution (Python):

data = input()

total = 0

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

Solution (Python):
N = int(input())
result = N*(N+1)/2
result = result - 3*(int(N/3)*(int(N/3)+1)/2) - 5*(int(N/5)*(int(N/5)+1)/2) + 15*(int(N/15)*(int(N/15)+1)/2)
print(int(result))

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

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

Solution (Python):
N = int(input())
N1 = N + 1
N2 = N1 * N
S0 = N2 / 2


Na = N//3
N1a = Na + 1
N2a = N1a * Na
S0a = 3 * N2a / 2


Nb = N//5
N1b = Nb + 1
N2b = N1b * Nb
S0b = 5 * N2b / 2


Nc = N//15
N1c = Nc + 1
N2c = N1c * Nc
S0c = 15 * N2c / 2


S = S0 - S0a - S0b + S0c

print(int(S))

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

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

print(s)

Solution (Python):
def sum1(N):
    S1 = int((((N // 3)) * (2 * 3 + (N //3 - 1) * 3) //2) )
    S2 = int((((N // 5)) * (2 * 5 + (N // 5 - 1) * 5) // 2) )
    S3 = int((((N // 15)) * (2 * 15+ (N // 15 - 1) * 15) // 2))
    a =  int(S1 + S2 - S3) 
    return a
N = int(input())
ans = (N*(N+1)/2)-sum1(N)
print(int(ans))

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

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

Solution (Python):
x=input()
y=int(x)
z=int(1)
number=int(0)
while z<=y:
    if z%3==0:
        pass
    elif z%5==0:
        pass
    elif z%15==0:
        pass
    else:
        number=number+z
    z=z+1
print(number)

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

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

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

print(an)

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

result = (1 + N) * N / 2

n3 = (N // 3)
sum3 = (3 + 3 * n3) * n3 / 2

n5 = (N // 5)
sum5 = (5 + 5 * n5) * n5 / 2

n15 = (N // 15)
sum15 = (15 + 15 * n15) * n15 / 2

print(int(result - sum3 - sum5 + sum15))

Solution (Python):
i=int(input())
a=int(i/15)
sum=(a-1)*a*15*8/2+60*a
for j in range(i%15):
    if j%5!=0 and j%3!=0:
        sum+=(j+a*15)
if i%5!=0 and i%3!=0:
    sum+=i
print(int(sum))

Solution (Python):
def div(k):
    if (k % 3 != 0) and (k % 5) != 0:
        return True
    else:
        return False

def main():
    n = int(input())
    ary = [i for i in range(n+1)]
    ary = [i if div(i) else 0 for i in ary]
    print(sum(ary))

if __name__ == '__main__':
    main()

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


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

Solution (Python):
a = input()
b = int(a)
sum = 0

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

print(sum)

Solution (Python):
n=int(input())
li=[]
for i in range(1,n+1):
    li.append(i)
sum=0
for j in li:
    if j%15==0:
        sum+=j
    elif j%3==0:
        sum+=j
    elif j%5==0:
        sum+=j
print(int(((n+1)*n/2) - sum))

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

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

Solution (Python):
D = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 33, 46, 60, 0]
E = [0, 1, 2, 2, 3, 3, 3,  4,  5,  5,  5,  6,  6,  7,  8, 0]

N = int(input())

s = N//15
t = (60*s)*(s)

m = s*15

t += D[N-m] + 15*E[N-m]*s

print(t)

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

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

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

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

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

a = 0

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

print(a)

Solution (Python):
n=int(input())
num = [1,2,4,7,8,11,13,14]
total=0
total2=0
tmp=0
if n%15!=0:
  for i in range((15*(n//15))+1,n+1):
    if i%15 in(num):
      total+=i
for i in range(n//15):
  total2+=60+tmp
  tmp+=120
print(total+total2)

Solution (Python):

N = int(input())
if 1 <= N <= 10**6:
    Sum = 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
        Sum = Sum + i
    print(Sum)
else:
    pass

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

ans = []
for i in range(1,N+1):
    if i % 3 == 0:
        continue 
    elif i % 5 == 0:
        continue
    ans.append(i)
print(sum(ans))

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

summ = 0

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

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

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

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

print(cnt)

Solution (Python):
x = input()
x = int(x)
list = []
sum = 0

for i in range(x):
	list.append(i+1)

for i in range(x):
    num = list[i]
    if num % 3 == 0 and num % 5 == 0:
        num
    elif num % 3 == 0:
        num
    elif num % 5 == 0:
        num
    else:
        sum = sum + list[i]

print(sum)

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

count=0


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

print(count)

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

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

print(SUM)

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

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

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

Solution (Python):
N=int(input())
s=0
i=1
while(i<=N):
    s=s+i
    i=i+1
a=N//3
b=N//5
c=N//15
p=0
x=1
while(x<=a):
    p=p+x
    x=x+1
p=p*3
q=0
y=1
while(y<=b):
    q=q+y
    y=y+1
q=q*5
r=0
z=1
while(z<=c):
    r=r+z
    z=z+1
r=r*15
print(s-p-q+r)

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

Solution (Python):
N=int(input())
a=list(range(N+1))
b=list()
i=0
for i in range(N+1):
    if a[i]%3==0:
      b.append(0)
    elif a[i]%5==0:
      b.append(0)
      
    else:
      b.append(a[i])
print(sum(b))

Solution (Python):
n = int(input())
a = []
for i in range(n):
    if (i+1) % 15 == 0:
        a.insert(i+1,"FizzBuzz") 
    elif (i+1) % 3 == 0:
        a.insert(i+1,"Fizz") 
    elif (i+1)% 5 == 0:
        a.insert(i+1,"Buzz") 
    else:
        a.append(i+1)
        
b = [num for num in a if isinstance(num, int)]
print(sum(b))

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

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

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

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

Solution (Python):
import math

I = int(input())






a = 0
I = I + 1
for num in range(I):
    if num%3 == 0 and num%5 == 0:
        a = a
    elif num%3 == 0:
        a = a
    elif num%5 == 0:
        a = a
    else:
        a = a + num

print(a)

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

i = 1
sum = i
while i < N :
   i = i + 1
   if i % 3 == 0 or i % 5 == 0 :
      continue
   sum = sum + i

print(sum)

Solution (Python):
print(sum(i*(i%3>0)*(i%5>0)for i in range(1,int(input())+1)))

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

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

print(res)

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

ans = 0

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

print(ans)

Solution (Python):
import math
import string
import collections
from collections import Counter
from collections import deque
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


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


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]


N = int(input())
a = []
ans = []
for i in range(1, N+1):
    a.append(i)

for i in range(len(a)):

    if a[i] % 3 != 0 and a[i] % 5 != 0 and a[i] % 15 != 0:
        ans.append(a[i])
    if a[i] % 15 == 0:
        ans.append('FizzBuzz')
    if a[i] % 3 == 0:
        ans.append('Fizz')

    if a[i] % 5 == 0:
        ans.append('Buzz')



sum = 0
for i in range(len(ans)):
    if ans[i] != 'FizzBuzz' and ans[i] != 'Fizz' and ans[i] != 'Buzz':
        sum += ans[i]
print(sum)

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

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

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

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

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

print(count)

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

Solution (Python):
import numpy as np
x = int(input())
a = np.arange(14)+1

a = np.where((a%3)*(a%5)<1, 0, a)

b = sum(a>0)
q = x//15
print(q*60+ b*15*q*(q-1)//2+  + sum(a[:x%15]) + 15*q*sum(a[:x%15] > 0))

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

Solution (Python):
fizzBuzz = []
inputNumber = int(input())
for i in range(inputNumber + 1):
    if i % 3 == 0 and i % 5 == 0:
        metCondition = 'FizzBuzz'
    elif i % 5 == 0:
        metCondition = 'Buzz'
    elif i % 3 == 0:
        metCondition = 'Fizz'
    else:
        metCondition = i
    fizzBuzz.append(metCondition)
metCondition_2 = [num for num in fizzBuzz if isinstance(num, (int, float))]
print(sum(metCondition_2))

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

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

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

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

print(ans)

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

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

    if flag == 0:
        s += i

print(s)

Solution (Python):
print(sum(filter(lambda x : not(x%3 == 0 or x%5 == 0),range(1,int(input())+1))))

Solution (Python):

def input1():
	return int(input())


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


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




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

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

count = 0

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


print(count)

Solution (Python):
N=int(input())
S=N//15
P=[1,2,4,7,8,11,13,14]
P2=[3,5,6,9,10,12]
Q=0
D=0
if S==0:
    for i in range(1,N+1):
        if i in P2:
            continue
        else:
            D=D+i
else:
    T=S-1
    D=(60+60+15*T*8)*S//2
    N1=N-15*S
    for i in range(1,N1+1):
        if i in P2:
            continue
        else:
            D=D+i+15*S

print(D)

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

Solution (Python):
num = int(input())
li = [i for i in range(1, num +1)]
oli = [i for i in li if i % 3 == 0 or i % 5 == 0]
print(sum(li) - sum(oli))

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

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

Solution (Python):
import sys







def main():

    N = int(input())

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

        total += i

    print(total)


if __name__ == '__main__':
    main()

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

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

print(cnt)

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

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

        ans+=0
    else:
        ans+=i
print(ans)

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

def sum30():
  return (1+2+4+7+8+11+13+14+16+17+19+22+23+26+28+29)

def sumx(x):
  ret = 0
  if(x ==0):
    return ret
  
  for j in range(1,x+1):
    if(j%3 != 0 and j%5 != 0):
      ret+=j
  return ret

def numx(x):
  ret = 0
  if(x ==0):
    return ret
  
  for j in range(1,x+1):
    if(j%3 != 0 and j%5 != 0):
      ret+=1
  return ret
sum=0

i=1


while(a > 0):
  if(a >= 30):
    temp=(i-1)*30*16+sum30()
    
    sum+=temp
  else:
    sum+=(i-1)*30*numx(a)+sumx(a)
  i+=1
  a-=30




    
print(sum)

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

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

cnt=n//15
r=n%15

ans=cnt*60
for i in range(cnt):
    ans+=15*8*i
tmp=0
for i in range(r+1):
    if i%3!=0 and i%5!=0:
        tmp+=i + cnt*15
print(tmp+ans)

Solution (Python):

n = int(input())

total = 0

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

    if i % 3 != 0 and i % 5 != 0 :
        total = total + i

print(total)

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

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

zenbu = n * (n + 1) / 2

A = (sum(i for i in range(1, n + 1) if i % 3 == 0))
B = (sum(i for i in range(1, n + 1) if i % 5 == 0))
C = (sum(i for i in range(1, n + 1) if i % 15 == 0))

D = zenbu - A - B + C

print(int(D))

Solution (Python):
N = int(input())
count_list = []
for i in range(N + 1):
    if i % 15 == 0:
        count_list.append('FizzBuzz')
    elif i % 3 == 0:
        count_list.append('Fizz')
    elif i % 5 == 0:
        count_list.append('Buzz')
    else:
        count_list.append(i)
int_list = []
for i in count_list:
    try:
        int_list.append(int(i))
    except:
        pass
print(sum(int_list))

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

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

Solution (Python):

import sys
from decimal import *
input = sys.stdin.readline


def main():
    n = int(input())
    result = Decimal(0)
    for i in range(1, n + 1):
        if not i % 3 == 0 and not i % 5 == 0:
            result += Decimal(i)

    print(result)


if __name__ == '__main__':
    main()

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

Solution (Python):
import math
num = int(input())
syou = math.floor(num/15)
amari = num % 15
sum = 0

list = [1,2,0,4,0,0,7,8,0,0,11,0,13,14,0]
if syou >=1:
    for x in range(syou):
        sum += 60 + 120 * x


    for i in range(amari):
        if list[i] == 0:
            None
        else:
            sum += list[i] + 15 * (syou)

    print(sum)

else:
    for d in range(num):
        sum += list[d]
    print(sum)

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

  counter = 0

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


if __name__ == "__main__":
  main()

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

Solution (Python):

N = int(input())


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

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

SUM = N*(N+1)/2


Fizz_count = N//3
Buzz_count = N//5
FizzBuzz_count = N//15


def GeometricProgression(a_1,r,n):
    return int(a_1*(r^n -1)/r-1)

def Touhi(a_1,d,n):
    return int(n*(2*a_1+(n-1)*d)/2)



SUM_Fizz = Touhi(3,3,Fizz_count)
SUM_Buzz = Touhi(5,5,Buzz_count)
SUM_FizzBuzz = Touhi(15,15,FizzBuzz_count)

"""
print(str(SUM_Fizz))
print(str(SUM_Buzz))
print(str(SUM_FizzBuzz))
"""

result = int(SUM - SUM_Fizz - SUM_Buzz + SUM_FizzBuzz)
print(result)

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

three = (3+(n//3)*3) * (n//3)/2
five = (5+(n//5)*5) * (n//5)/2
cup = (15+(n//15)*15) * (n//15)/2
total = (1+n) * n/2

ans = total - three - five + cup

print(int(ans))

Solution (Python):

N = int(input())

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

print(j)

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

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

Solution (Python):
n = int(input())
s = (n*(n+1))//2
o = n//5
p = n//3
q = n//15

s -= (5*o*(o+1))//2
s -= (3*p*(p+1))//2
s += (15*q*(q+1))//2

print(s)

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

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

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

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

Solution (Python):

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

Solution (Python):
ans=0
N=int(input())
if N<=0:
    exit()
elif N>=1000001:
    exit()
else:

    for n in range(1,N+1):
        if n%15==0:
            n=str("FizzBuzz")
        elif n%3==0:
            n=str("Fizz")
        elif n%5==0:
            n=str("Buzz")
        else:
            ans+=n

print(ans)

Solution (Python):
N = int(input())
ans = 0
n3 = int(N/3)
n5 = int(N/5)
n15= int(N/15)
sn = int((N)*(N+1)/2)
s3 = 3 * int(((n3)*(n3+1)/2))
s5 = 5 * int(((n5)*(n5+1)/2))
s15= 15* int(((n15)*(n15+1)/2))

ans = sn-s3-s5+s15
print(ans)

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

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

print(anw)

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

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

print(ans)

Solution (Python):
a=int(input())
fizzbuzz = 0
for i in range(1,a+1):
  if (i%3) == 0:
      fizzbuzz += i
  elif (i%5) == 0:
      fizzbuzz += i
all_ = (1+a)*a/2
print(int(all_-fizzbuzz))

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

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

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

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

print(total)

Solution (Python):
n = int(input())
a = []
b = []
c = []
d = []

for i in range(n+1):
  if i%1 == 0:
    a.append(i)
    
for j in range(n+1):
  if j%3 == 0:
    b.append(j)
    
for k in range(n+1):
  if k%5 == 0:
    c.append(k)

for l in range(n+1):
  if l%3 == 0 and l%5 == 0:
    d.append(l)

print(sum(a)-sum(b)-sum(c)+sum(d))

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

Solution (Python):
import sys
sys.setrecursionlimit(1000000)
n = int(input())
a = 0
for i in range(n+1):
    if (i % 3 !=0) and (i % 5 !=0):
        a += i
    else:
        continue
print(a)

Solution (Python):

s = int(input())
myList = list(range(1,s+1))
newList = []
otherList = []

for number in myList:
  if number % 15 == 0:
    otherList.append(number)
  elif number % 5 == 0:
    otherList.append(number)
  elif number % 3 == 0:
    otherList.append(number)
  else:
    newList.append(number)

print(sum(newList))

Solution (Python):
import numpy as np
import sys
import math



ans = 0
n = int(input())

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

    if x % 3 == 0:
        continue

    if x % 5 == 0:
        continue

    ans += x

print(ans)

Solution (Python):
N = int(input())
f = N//3
b = N//5
fb = N//15
S = int(N*(N+1)/2)
F = int((3+3*f)*f/2)
B = int((5+5*b)*b/2)
FB = int((15+15*fb)*fb/2)
s = S-F-B+FB
print(s)

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

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

Solution (Python):
n = int(input())
sum = 0
while n > 0:
	if n%3 == 0:
		sum = sum + 0
	elif n%5 == 0:
		sum = sum + 0
	else :
		sum = sum + n
	n = n - 1
print(sum)

Solution (Python):


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

print(ans)

Solution (Python):
i=int(input())
i1=i*(i+1)//2
i2=i//3
i3=i//5
i4=i2*(i2+1)//2
i5=i3*(i3+1)//2
i6=i//15
i7=i6*(i6+1)//2
print(i1-i4*3-i5*5+i7*15)

Solution (Python):

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

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

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

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

Solution (Python):
S=int(input())
sum = 0
for i in range(1,S+1):
  remainder3 = i % 3
  remainder5 = i % 5
  if remainder3 >0 and remainder5>0:
  	sum += i
print(sum)

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

Solution (Python):
n = int(input())
sum = n*(n+1)/2
for i in range(1,n+1):
    if i%3 == 0 or i%5 == 0:
        sum-=i
print(int(sum))

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

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

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

Solution (Python):
import math

x=int(input())
s=math.floor(x/3)
f=math.floor(x/5)
sf=math.floor(x/15)
sum=math.floor(x*(x+1)/2)

s_sum=math.floor(3*s*(s+1)/2)
f_sum=math.floor(5*f*(f+1)/2)
sf_sum=math.floor(15*sf*(sf+1)/2)

fl=sum-(s_sum+f_sum-sf_sum)
print(math.floor(fl))

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