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

Solution (Python):
if __name__ == '__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)

Solution (Python):
N=int(input())
A=[];b=0
for i in range(1,N+1):
  if i%3!=0:
    if i%5!=0:
      b=b+i
print(b)

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

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

print(a)

Solution (Python):
from math import floor, ceil
def Sum1to(n):
    return int((n + 1) * n / 2)
N = int(input())
finN = floor(N/15)
base = finN * 60 + 120 * Sum1to(finN - 1)
addn = sum([i for i in range(15*finN+1,N+1) if i % 3 != 0 and i % 5 != 0])
print(base + addn)

Solution (Python):
N = int(input())
ans = []

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

print(sum(ans))

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

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

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 = input()
Sum = 0

for k in range(int(N)):
    i = k+1

    if i % 3 != 0:
        if i % 5 != 0:
            Sum = Sum + i

print(Sum)

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

s = int(N*(N+1)/2)

N3 = N // 3
N5 = N // 5
N15 = N // 15

s3 = int(N3*(N3+1)/2*3)
s5 = int(N5*(N5+1)/2*5)
s15 = int(N15*(N15+1)/2*15)

print(int(s-s3-s5+s15))

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

FizzBuzz = []

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:
    FizzBuzz.append(i)

print(sum(FizzBuzz))

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

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

import math

multiple_3 = n//3
multiple_5 = n//5
multiple_15 = n//15

def plus(n):
    return (n*(n+1)//2)


print(plus(n)-3*plus(multiple_3)-5*plus(multiple_5)+15*plus(multiple_15))

Solution (Python):
N = int(input())
a = list(range(1,N+1))
b = [i for i in range(1,N+1) if i % 3 == 0] 
c = [i for i in range(1,N+1) if i % 5 == 0] 
d = set(b+c)
A = sum(a)-sum(d)
print(A)

Solution (Python):
n = int(input())
s1 = set()
s2 = set()
a = 1
b = 1
while a <= n:
    if a % 3 == 0:
        s1.add(a)
    a += 1
while b <= n:
    if b % 5 == 0:
        s2.add(b)
    b += 1
s3 = set(range(1,n + 1))
s12 = s1 | s2
s4 = s3 - s12
c = 0
for x in s4:
    c += x
print(c)

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

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

print(cnt)

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

cnt = 0

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

ans = (n * (n + 1) // 2) - cnt

print(ans)

Solution (Python):
def sum_n(n,N):
  kosu = int(N/n)
  result = (2*n+n*(kosu-1))*kosu/2
  return result

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

  S = N*(N+1)/2

  sum_3  = sum_n(3,N)
  sum_5  = sum_n(5,N)
  sum_15 = sum_n(15,N)
  print(int(S-sum_3-sum_5+sum_15))

  return 0
 
if __name__ == "__main__":
  main()

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

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

total = 0
for num in range(0,n+1):

    if num % 15 == 0:
        continue
    if num % 3 == 0:
        continue
    if num % 5 == 0:
        continue

    total += num

print(total)

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

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

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

print(int(s))

Solution (Python):


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

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

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

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

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

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=n*(n+1)//2
k=n//3
l=n//5
m=n//15
k=k*(k+1)*3//2
l=l*(l+1)*5//2
m=m*(m+1)*15//2
ans=ans-k-l+m
print(ans)

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

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

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
def SuminCluster(num,C):
    if num>=15:
        return 60
    sum = 0
    for i in range(1,num+1):
        if i%3==0 or i%5==0:
            pass
        else:
            sum+=i
            sum+=C*15
    return sum

N = int(input())
C = N//15
A = N%15
FBSum = C*C*60+SuminCluster(A,C)


print(FBSum)

Solution (Python):
N = int(input())
output_list = [0]

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

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

def fizzbazzz(x):
    if x%3==0 or x%5 == 0:
        return 0
s = 0
for i in range(N):
    if fizzbazzz(i+1)!=0:
        s += i + 1
print(s)

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

p1 = N // 2
p2 = N % 2

if(p2==1):
    sum0 = (N + 1) * p1 + (p1 + 1)

else:
    sum0 = (N + 1) * p1

Fizz = N // 3
Buzz = N // 5
FizzBuzz = N // 15

sum1 = 0
sum2 = 0
sum3 = 0

if(Fizz != 0):
    for i in range(Fizz):
        sum1 += 3 * (i + 1)
    

if(Buzz != 0):
    for j in range(Buzz):
        sum2 += 5 * (j + 1)
    

if(FizzBuzz != 0):
    for k in range(FizzBuzz):
        sum3 += 15 * (k + 1)
    

ans = sum0 + sum3 - (sum1 + sum2)

print(ans)

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

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

print(ans)

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

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

print(sum(N))

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

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

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

print(res)

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

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

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

print(sum)

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

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

print(result)

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

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
x = int(n / 15)
for i in range(x):
    ans += 60 + i * 8 * 15

amari = n % 15

plus = int(n / 15) * 15

if amari == 1:
    ans += plus + 1
elif amari == 2 or amari == 3:
    ans += plus + plus + 3
elif amari == 4 or amari == 5 or amari == 6:
    ans += plus + plus + plus + 7
elif amari == 7:
    ans += plus + plus + plus + plus + 14
elif amari == 8 or amari == 9 or amari == 10:
    ans += plus + plus + plus + plus + plus + 22
elif amari == 11 or amari == 12:
    ans += plus + plus + plus + plus + plus + plus + 33
elif amari == 13:
    ans += plus + plus + plus + plus + plus + plus + plus + 46
elif amari == 14:
    ans += plus + plus + plus + plus + plus + plus + plus + plus + 60

print(ans)

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

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

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

sum = 0

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

Solution (Python):
N=int(input())
if 1<=N<=10**6:
    a=N*(N+1)/2
    b=N//15
    c_3=3*5*b*(5*b+1)/2
    c_5=5*3*b*(3*b+1)/2
    c_15=15*b*(b+1)/2
    a=a-c_3-c_5+c_15
    i=15*b+1
    if N%15==0:
        a=int(a)
        print(a)
    else:
        for i in range(15*b+1,N+1):
            if (i%5==0)or(i%3==0):
                a=a-i
                i+=1
        a=int(a)
        print(a)

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

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

print(summation)

Solution (Python):
def main():
    import math
    import sys

    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Solution (Python):
s=int(input())
k=0
for x in range(s+1):
    if x%3!=0 and x%5!=0:
        k+=x
print(k)

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

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

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

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

print(m)

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

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

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

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

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

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

print(b)

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

N_list = [1,3,3,7,7,7,14,22,22,22,33,33,46,60,60]
N_add15 = [1,2,2,3,3,3,4,5,5,5,6,6,7,8,8]


num_15 = N // 15

n_list = N_list[N%15-1] + 15 * N_add15[N%15-1] * (num_15)

if(N < 16):
    ans = N_list[N-1]
else:
    ans = num_15 * num_15 * 60 + n_list

print(ans)

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

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

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

print(ans)

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

i = 0
a = []

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

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

Solution (Python):
N = int(input())
a = N//3
b = N//5
c = N//15

ans = (N*(N+1)//2) - (3*a*(a+1)//2) -(5*b*(b+1)//2) + (15*c*(c+1)//2)
print(ans)

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

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

a = N//15
b = N%15
c = 0

for i in range(b+1):
  if i%3!=0 and i%5!=0:
    c=c+i+15*a

ans=(120*(a*(a-1)/2))+60*(a)+c

print(int(ans))

Solution (Python):
n=int(input())
x=n//3
y=n//5
z=n//15
ans = int(n*(n+1) - 3*x*(x+1) - 5*y*(y+1) + 15*z*(z+1))//2
print(ans)

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

allsum = int( (N + 1) * N / 2 )


f = int(N / 3)
b = int(N / 5)
fb = int(N / 15)






fsum = int((f+1)*f/2)*3
bsum = int((b+1)*b/2)*5
fbsum = int((fb+1)*fb/2)*15

print(allsum - fsum - bsum + fbsum)

Solution (Python):
n=int(input())
a=n//3
b=n//5
c=n//15
N=n*(1+n)//2
A=3*a*(1+a)//2
B=5*b*(1+b)//2
C=15*c*(1+c)//2
print(N-A-B+C)

Solution (Python):
import math
N=int(input())
ans=(N*(N+1))/2
ans=ans-3*math.floor(N/3)*(math.floor(N/3)+1)/2
ans=ans-5*math.floor(N/5)*(math.floor(N/5)+1)/2
ans=ans+15*math.floor(N/15)*(math.floor(N/15)+1)/2
print(int(ans))

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

sum = 0.5 * N * (N + 1)

num_3 = int(N / 3)
sum_3 = 3 * 0.5 * num_3 * (num_3 + 1)
num_5 = int(N / 5)
sum_5 = 5 * 0.5 * num_5 * (num_5 + 1)
num_15 = int(N / 15)
sum_15 = 15 * 0.5 * num_15 * (num_15 + 1)

print(int(sum - sum_3 - sum_5 + sum_15))

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

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

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

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

print(ans)

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

Solution (Python):
a = (int(input()) + 1)
ans = 0

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

Solution (Python):



A = int(input())

total = 0
for B in range(A):
    
    if (B + 1) % 3 == 0 and (B + 1) % 5 ==0:
        
        pass
    elif (B + 1) % 3 == 0:
        
        pass
    elif (B + 1) % 5 == 0:
        
        pass
    else:
        total += (B + 1)
print(total)

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

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

Solution (Python):
n = int(input())
ans = n*(n+1)//2
d = n//3
ans -= 3*(d+1)*d//2
e = n//5
ans -= 5*(e+1)*e//2
f = n//15
ans += 15*(f+1)*f//2
print(ans)

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

b = 0

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

print(b)

Solution (Python):
N = int(input())
kazuof3 = N // 3
kazuof5 = N // 5
kazuof15 = N//15

ans = N * (N + 1) // 2 - kazuof3 * (kazuof3 + 1) * 3 //2 - kazuof5 * (kazuof5 + 1) * 5 // 2 + kazuof15 * (kazuof15 + 1) * 15 // 2
print(ans)

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

a=n*(n+1)/2
fi=n//3
bu=n//5
fibu=n//15

a-=3*fi*(fi+1)/2
a-=5*bu*(bu+1)/2
a+=15*fibu*(fibu+1)/2

print(str(int(a)))

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

Solution (Python):
N = int(input())
L = []
for i in range(1,(10**6)+1):
    if (i % 3 == 0) | (i % 5 == 0):
        L.append(0)
    else:
        L.append(i)

l = L[:N]
ans = sum(l)
print(ans)

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

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

print (s)

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

Solution (Python):
import numpy as np
 
n = input()
N = int(n)
 
s = np.sum([i for i in range(N+1) if (i%3!=0)and(i%5!=0)])
print(s)

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

total = 0

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

Solution (Python):
N = int(input())
ans = []

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

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

Sum = 0

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

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

import math
 
a = N // 3
b = N // 5
c = N // 15
 
d = 3*a*(a+1)/2
e = 5*b*(b+1)/2
f = 15*c*(c+1)/2
 
g = N*(N+1)/2
 
print(math.floor(g-d-e+f))

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())
l = list(range(n+1))
l3=l[::3]
l5=l[::5]
l15=l[::15]




sum_all = sum(l) - sum(l3) - sum(l5) + sum(l15)
print(sum_all)

Solution (Python):
N=int(input())
array=[]
N+=1

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

value=sum(array)
print(value)

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

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

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

print(count)

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

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

print( total )

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

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

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

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

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

print(count)

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

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

ans = (1+n)*n/2 - (3+3*a)*a/2 - (5+5*b)*b/2 + (15+15*c)*c/2

print(int(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())
a=n//15
b=n%15
B=[0,1,2,0,4,0,0,7,8,0,0,11,0,13,14]
C=[0,1,2,2,3,3,3,4,5,5,5,6,6,7,8]
c=0
for i in range(b+1):
  c=c+B[i]
print(60*a+120*a*(a-1)//2+c+C[b]*15*a)

Solution (Python):

from sys import stdin
 

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

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

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

print(ans)

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

x = N // 3
y = N // 5
z = N // 15

p = N * (N + 1) / 2
q = 3 * x * (x + 1) / 2
r = 5 * y * (y + 1) / 2
s = 15 * z * (z + 1) / 2
Sum = p - q - r + s
print(int(Sum))

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


main()

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

print(ans)

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

i=1
S=1

while i<N:
  i+=1
  if i%3!=0 and i%5!=0:
    S+=i
  
print(S)

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

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

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

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

Solution (Python):

def main():
    N = int(input())
    l = []
    for i in range(1, N+1, 1):
        if i%15==0 or i%3==0 or i%5==0:
            continue
        else:
            l.append(i)
    print(sum(l))
main()

Solution (Python):

import sys

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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np
 
N = INT()
A = np.arange(N+1)
A = list(A)
 
for i in range(N+1):
  if A[i]%3 == 0 or A[i]%5 == 0:
    A[i]=0
    
print(sum(A))

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

Solution (Python):
n=int(input())
thr=n//3
fiv=n//5
fif=n//15
FB=((1+thr)*thr*3//2)+((1+fiv)*fiv*5//2)-((1+fif)*fif*15//2)
print((n+1)*n//2-FB)

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())
a = n // 3
a = 3*(a*(a+1))//2

b = n // 5
b = 5 *(b*(b+1))//2 

c = n // 15
c = 15*(c*(c+1))//2

print(n*(n+1)//2 - a  - b + c )

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

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

Solution (Python):
N = int(input())
a = [0]*(N+1)
for i in range(N+1):
    if i % 15 == 0 or i % 3 == 0 or i % 5 == 0:
        a[i] = 0
    else:
        a[i] = i

print(sum(a))

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

sum3 = 3*0.5*(n//3)*(n//3+1)
sum5 = 5*0.5*(n//5)*(n//5+1)
sum15 = 15*0.5*(n//15)*(n//15+1)
sums = 0.5*n*(n+1)
print(int(sums - sum3 - sum5 + sum15))

Solution (Python):
import sys


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

Solution (Python):
A = int(input())
B = 0

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

print(B)

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

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

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

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

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

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

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

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

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

print(ans)

Solution (Python):

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

print(result)

Solution (Python):
import sys


def in_ctrl():
    _input = [_.rstrip() for _ in sys.stdin.readlines()]
    
    N = int(_input[0])
    
    return N


def out_ctrl(s):
    print(s)


if __name__ == "__main__":
    N = in_ctrl()
    
    cnt = 0
    for n in range(N+1):
        if n%3>0 and n%5>0:
            cnt += n
    
    out_ctrl(cnt)

Solution (Python):

import sys


def solve(N: int):
    answer = 0
    for i in range(1,N+1):
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            answer += i
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

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())
sum_all = (1+N)*N/2
sum_fizz = ((N-N%3)+3)*(N-N%3)/3/2
sum_buzz = ((N-N%5)+5)*(N-N%5)/5/2
sum_fizzbuzz = ((N-N%15)+15)*(N-N%15)/15/2

sum = sum_all - sum_fizz - sum_buzz + sum_fizzbuzz
print(int(sum))

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

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

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

Solution (Python):
m = int(input())
     
def fizz_buzz(i):
  fizz = i % 3
  buzz = i % 5
      
  return (fizz > 0) & (buzz > 0)
     
res = 0
     
for i in range(m):
  use_i = i+1
  if fizz_buzz(use_i):
    res += use_i
        
print(res)

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

k = N // 15
ans = 0

ans += 60 * k + 15 * 8 * int(k*(k-1)/2)

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

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

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

Solution (Python):
import sys
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

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

print(nsum)

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

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

print(FB_sum)

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())
ful = [i for i in range(1,N+1)]
fi = N//5
fiz = [i*5 for i in range(1,fi+1)]
buz = N//3
buz = [i*3 for i in range(1,buz+1)]
fiz_buz = list(set(fiz) & set(buz))
fiz_and_buz = list((set(fiz) ^ set(buz))) 
ful_and_fi_bz = list(set(fiz_and_buz) ^ set(ful))
ful_and_fi_bz = list(set(ful_and_fi_bz) ^ set(fiz_buz))

print(sum(ful_and_fi_bz))

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

print(ans)