stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define debug(x) cout << #x" = " << x;



#define st first

#define nd second



using namespace std;

using namespace placeholders;



typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;



const int MAXN = 2E3 + 10;

const int MOD = 1E9 + 7;



ll inv[MAXN], fac[MAXN], facinv[MAXN];



ll modExp(ll e, ll n, ll m = MOD){

	ll ret = 1;

	for (; n; n >>= 1, e = e * e % m)

		if (n & 1)

			ret = ret * e % m;

	return ret;

}



void getInv(int n = MAXN - 1, int m = MOD){

	inv[0] = 0, inv[1] = 1;

	fac[0] = fac[1] = 1;

	facinv[0] = facinv[1] = 1;

	for (int i = 2; i <= n; ++i){

		inv[i] = inv[m % i] * (m - m / i) % m;

		fac[i] = fac[i - 1] * i % m;

		facinv[i] = facinv[i - 1] * inv[i] % m;

	}

}



ll C(int n, int m){

	return m < 0 || n < m ? 0 : fac[n] * facinv[m] % MOD * facinv[n - m] % MOD;

}



inline void update(int &x, int y){

	if ((x += y) >= MOD)

		x -= MOD;

}



int f[MAXN][MAXN];



int main(){

	getInv();



	int n, k;

	scanf("%d%d", &n, &k);

	f[0][0] = 1;

	for (int i = 1; i <= k - 1; ++i){

		int s = f[i - 1][i - 1];

		for (int j = i; j < n; ++j){

			update(f[i][j], s);

			update(f[i][j], f[i - 1][j]);

			update(s, f[i - 1][j]);

//			printf("%d %d %d\n", i, j, f[i][j]);

		}

	}

	int ans = 0;

	for (int i = 0; i < n; ++i)

		update(ans, f[k - 1][i]);

	printf("%d\n", (int)(ans * modExp(2, max(0, n - k - 1)) % MOD));

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>



typedef long long ll;



const int MAXN = 2E3 + 10;

const int MOD = 1E9 + 7;



ll modExp(ll e, ll n, ll m = MOD){

	ll ret = 1;

	for (; n; n >>= 1, e = e * e % m)

		if (n & 1)

			ret = ret * e % m;

	return ret;

}



inline void update(int &x, int y){

	if ((x += y) >= MOD)

		x -= MOD;

}



int f[MAXN][MAXN];



int main(){

	int n, k;

	scanf("%d%d", &n, &k);

	f[0][0] = 1;

	for (int i = 1; i < k; ++i){

		int s = f[i - 1][i - 1];

		for (int j = i; j < n; ++j){

			update(f[i][j], s);

			update(f[i][j], f[i - 1][j]);

			update(s, f[i - 1][j]);

		}

	}

	int ans = 0;

	for (int i = 0; i < n; ++i)

		update(ans, f[k - 1][i]);

	printf("%d\n", (int)(ans * modExp(2, n == k ? 0 : n - k - 1) % MOD));

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<iomanip>

#include<stack>

#include<queue>

#include<list>

#include<vector>

#include<set> 

#include<map>

#include<string>

#include<algorithm>

#include<cmath>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<ctime>

#define ll long long

#define db double

#define inf 2001

#define INF (int)2e9 

#define mod (ll)(1e9+7)

#define pi acos(-1)

#define mxbit 30

#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}

using namespace std;

//#define int long long



int Qpow2(int k){

	if (k==-1){

		return 1;

	}

	ll x=2,ans=1LL;

	while (k){

		if (k&1){

			ans=(ans*x)%mod;

		}

		x=(x*x)%mod;

		k/=2;

	}

	return (int)ans;

}



int dp[inf][inf];



main(){

	int n,k;

	rd(n) rd(k)

	dp[0][n+1]=1;

	for (int i=1;i<=k;i++){

		int sum=dp[i-1][n+1];

		for (int j=n;j>=1;j--){

			sum=(sum+dp[i-1][j])%mod;

			if (j<=n-i+1){

				dp[i][j]=sum;

			}

		}

	}

	ll ans=(dp[k][1]-dp[k-1][1]+mod)%mod*Qpow2(n-k-1)%mod;

	printf("%lld\n",ans);

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

  for(int i=1;i<=k;i++)

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

const long long P=1000000007ll;

long long n,k,f[10001];

inline long long qpow(long long a,int x){

    if(x<0)return 1;

    long long s=1ll;

    while(x){if(x&1)(s*=a)%=P;(a*=a)%=P;x>>=1;}

    return s;

}

int main(){

    scanf("%lld%lld",&n,&k);

    f[0]=1ll;

    for(int i=1;i<n;++i){for(int j=i;j;--j)f[j]=(f[j+1]+f[j-1])%P;f[0]=f[1];}

    printf("%lld",f[n-k]*qpow(2ll,n-k-1)%P);

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

  for(int i=1;i<=k;i++)

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

using namespace std;

const long long P=1000000007;

long long n,k,f[10001];

long long qpow(long long a,int x)

{

    if(x<0)return 1;

    long long s=1;

    while(x)

	{

		if(x&1) s=(s*a)%P;

		a=(a*a)%P;

		x>>=1;

	}

    return s;

}

int main()

{

    scanf("%lld%lld",&n,&k);

    f[0]=1;

    for(int i=1;i<n;++i)

	{

		for(int j=i;j;--j)

			f[j]=(f[j+1]+f[j-1])%P;

		f[0]=f[1];

	}

    printf("%lld",f[n-k]*qpow(2,n-k-1)%P);

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

  for(int i=1;i<=k;i++)

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// luogu-judger-enable-o2

#include<iostream>

#include<cstring>

#include<cstdio>

#define ll long long

using namespace std;

const int maxn=2005;

const int mod=1e9+7;

int n,k;

ll dp[maxn][maxn],f[maxn];

ll kuai(ll a,int k)

{

	ll ans=1;

	while(k)

	{

		if(k&1)(ans*=a)%=mod;

		(a*=a)%=mod;k>>=1;

	}

	return ans%mod;

} 

int main()

{

//	freopen("forget.in","r",stdin);

//	freopen("forget.out","w",stdout);

	cin>>n>>k;

	dp[0][n+1]=1;ll ans=0;

	for(int i=1;i<=k;i++)

	{

		f[n+1]=dp[i-1][n+1];

		for(int j=n;j>=1;j--)f[j]=(f[j+1]+dp[i-1][j])%mod;

		for(int j=1;j<=n-i+1;j++)

			dp[i][j]=f[j];

	}

	dp[k][1]=(dp[k][1]-dp[k-1][1]+mod)%mod;

	if(n==k)ans=dp[k][1];

	else ans=dp[k][1]*kuai(2,n-k-1)%mod;

	cout<<ans<<endl;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

const int mod=1e9+7;

int n,k;

long long f[2005][2005],s[2005],ans;

long long ksm(long long a,long long b)

{

  long long ans=1;

  while(b)

  {

  	if(b&1)  ans=ans*a%mod;

  	a=a*a%mod;b>>=1;

  }

  return ans;

}

int main()

{

  //FILE *fi,*fo;

  //fi=fopen("forget.in","r");

  //fo=fopen("forget.out","w"); 

  scanf("%d%d",&n,&k);f[0][n+1]=1;

  for(int i=1;i<=k;i++)

  {

	s[n+1]=f[i-1][n+1];  

	for(int j=n;j>=1;j--)  s[j]=(f[i-1][j]+s[j+1])%mod;

	for(int j=1;j<=n-i+1;j++)  f[i][j]=s[j];

  }

  if(n>k)  ans=(((f[k][1]-f[k-1][1]+mod)%mod)*ksm(2,n-k-1))%mod;

  else  ans=(f[k][1]-f[k-1][1]+mod)%mod;

  printf("%lld",ans);

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main()

{

    char c;

    int ans = 700;

    for(int i = 0; i < 3; i++){

        scanf("%c", &c);

        ans += (c == 'o' ? 100 : 0);

    }

    printf("%d", ans);

    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

int main()

{

    char c;

    int ans = 700;

    for(int i = 0; i < 3; i++){

        scanf("%c", &c);

        ans += (c == 'o' ? 100 : 0);

    }

    printf("%d\n", ans);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

   long long int  n,i,s=0;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        if(i % 3!=0 && i % 5!=0)

        {

            s=s+i;

        }

    }cout<<s;

}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#pragma GCC optimize("Ofast")

//#pragma GCC optimize ("unroll-loops")

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")



#include <bits/stdc++.h>



#define fastio                              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);

#define read                                freopen("input.txt", "r", stdin);

#define write                               freopen("output.txt", "w", stdout);

#define nl                                  '\n'

#define mem(ara,n)                          memset(ara,n,sizeof ara)

#define debug(x)                            cerr << #x << " = " << x << nl



#define ll                                  long long

#define ull                                 unsigned long long

#define vi                                  vector<int>

#define pb                                  push_back

#define vpii                                vector<pair<int, int>>

#define vpll                                vector<pair<ll, ll>>

#define mp                                  make_pair

#define ff                                  first

#define ss                                  second

#define all(v)                              v.begin(), v.end()

#define rsort(v)                            sort(v.rbegin(), v.rend())



using namespace std;



const double pi = 2*acos(0.0);



int main(){

    //fastio; 

    //read;

    ull n, count = 0, sum = 0, i = 1;

    cin >> n;

    for(ull i = 1; i <= n; i++){

        if(i%3 and i%5) sum += i;

    }

    cout << sum << nl;

}

// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    long long n,i,sum = 0;

    cin >> n;



    for (i = 1; i <= n; i++){

        if (i % 3 == 0 || i % 5 == 0){

            continue;

        }

        sum += i;

    }

    cout << sum;

}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main()

{

    long long n,sum=0;

    cin >> n;

    for(int i=1;i<=n;i++){

        if((i%3)&&(i%5)&&(i%15)) sum+=i;

    }

    cout << sum << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

	long long n,sum=0;

	cin>>n;

	long long a[n+1];

	for(int i=1;i<=n;i++)

	{

		if(i%3==0||i%5==0)

		    a[i]=0;

		else

		    a[i]=i;

		sum+=a[i];

	}

	cout<<sum<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

#include<stack>

#include<vector>

#include<cstring>

#include<algorithm>

#include<set>

#include<queue>

#include <vector>

#include <list>

#include <map>

#include <set>

#include <deque>

#include <stack>

#include <bitset>

#include <algorithm>

#include <functional>

#include <numeric>

#include <utility>

#include <complex>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cstring>

#include <ctime>

#include <cassert>

using namespace std;

typedef long long ll;

const ll inf =1e17;

#define scn(a) scanf("%d",&a)

#define scd(a) scanf("%lf",&a)

#define scl(a) scanf("%lld",&a)

#define ptf(a) printf("%d\n",&a)

#define mes(a,b) memset(a,b,sizeof(a))

#define fon(s,n) for(int i=s;i<=n;i++)

#define range(i,a,b) for(int i=a;i<=b;++i)

#define rerange(i,a,b) for(int i=a;i>=b;--i)

//#define N 100010

const int S=20;

int gcd(int a,int b) { return b>0 ? gcd(b,a%b):a;}

ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll q_pow(ll a,ll b,ll mod)

{

	ll ans=1,res=a;

	while(b){

		if(b&1) ans=ans*res%mod;

		res=res*res%mod;

		b>>=1;

	}

	return ans%mod;

}





int main(){

	int n;

	ll sum = 0;

	cin >> n;

	for(int i=1;i<=n;i++){

		if(i%3==0||i%5==0)continue;

		sum += i;

	}	

	printf("%lld\n",sum);

    return 0;

}




// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define ll long long

#define pi acos(-1.0)

#define Go "\n"

#define bye return 0

#define Afor(i,b) for(int i=0;i<b;i++)

#include<bits/stdc++.h>

using namespace std;

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    ll N,i,s=0;

    cin>>N;

    for(i=1;i<=N;i++)

    {

        if(i%3!=0&&i%5!=0)

        {

            s=s+i;

        }

    }

    cout<<s<<Go;

    bye;



}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int t;

    scanf("%d",&t);

    long long sum=0;

    for(int i=1;i<=t;i++)

    {

        if(i%3==0||i%5==0)

            continue;

        else sum+=i;

    }

    cout<<sum<<endl;

}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio> 

#include<iostream>

using namespace std;

typedef long long ll;

ll sum (ll n) {

    return n*(n+1)/2;

}



int main() {

     ll n, res;

    scanf("%lld", &n);

    res=sum(n)-3*sum(n/3)-5*sum(n/5)+15*sum(n/15);

    printf("%lld\n", res);

    return 0;

}


// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


                                 /*Bismillahir Rahmanir Rahim*/





#include<bits/stdc++.h>

#include<cstring>

#include<vector>

#include<map>

#include<set>

#define ll long long int

#define dd double

using namespace std;



int main()

{

  

	ll a,i,sum=0;

	

	cin >> a;

  for(i=1;i<=a;i++)

  {

    if(i%3==0 || i%5==0)

    continue;

    sum+=i;

  }

  cout<<sum<<endl;







  

}

//Apna Time Aayega :)

// Optimized solution to the same problem (faster):
///f. fizzbuzz sequence

#include <stdio.h>

#include <math.h>



int main()

{

    long long int n;

    scanf("%lld",&n);

    long long int d3,d5,d15;

    d3=n/3; d5=n/5; d15=n/15;



    long long sum = (n*(n+1)-3*d3*(d3+1)-5*d5*(d5+1)+15*d15*(d15+1))/2;

    printf("%lld",sum);

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int n,i;

    cin>>n;

    long long sum=0;

    for(i=1;i<=n;i++)

    {

        if(i%3==0||i%5==0||i%15==0)

        {

            continue;

        }

        else

        {

            sum=sum+i;

        }

    }

    cout<<sum<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

int main()

{

	double n,sum=0,flag=0;

	scanf("%lf",&n);

	for(int i=1;i<=n;i++)

	{

		if(i%3==0||i%5==0||i%15==0)

		  flag=1;

		else

		  sum+=i;

	}

	printf("%.0lf\n",sum);

	return 0;	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <stdio.h>

#include <string.h>

#include <string>

#include <queue>

#include <math.h>

#define ll long long

using namespace std;

//int main()

//{

//    int a[1005];

//    int n;

//    scanf("%d",&n);

//    for(int i=0;i<n;i++)

//        scanf("%d",&a[i]);

//    sort(a,a+n);

//    int l=0,r=n-1;

//    int flag=0;

//    while(l<r)

//    {

//        //printf("***");

//        int mx=0,mn=0;

//        int m=a[l]+a[r];

//        for(int i=0;i<n;i++)

//        {

//            if(i==r||i==l)

//                continue;

//           // printf("***");

//            if(a[i]+m==0)

//            {

//                flag=1;

//                printf("%d %d %d\n",a[l],a[i],a[r]);

//            }

//            mx=abs(a[i]+m);

//            if(a[i]+m>0)

//                mn=1;

//            else if(a[i]+m<0)

//                mn=-1;

//        }

//        if(mn==-1)

//            l++;

//        if(mn==1)

//            r--;

//    }

//    if(flag==0)

//    {

//        printf("No Solution\n");

//    }

//    return 0;

//}





int main()

{

   int n;

   ll sum=0,sum1=0;

   scanf("%d",&n);

   for(int i=1;i<=n;i++)

   {

       sum+=i;

       if(i%3==0||i%5==0)

        sum1+=i;



   }

   printf("%lld\n",sum-sum1);

   return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;

int main()

{

	double n,sum=0,flag=0;

	scanf("%lf",&n);

	for(int i=1;i<=n;i++)

	{

		if(i%3==0||i%5==0||i%15==0)

		  flag=1;

		else

		  sum+=i;

	}

	printf("%.0lf\n",sum);

	return 0;	

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <unordered_map> 

#define io ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);

#define int long long

#define sp " "

#define fi freopen("bruh.txt","r",stdin);

#define fo freopen("input.txt", "w", stdout);

#define pb push_back

#define ff first

#define ss second

#define all(x) x.begin(),c.end();

#define allr(x) x.rbegin(), x.rend()

#define pii pair< int , int >

#define rep(i,a,n) for(int i=a;i<n;i++)

#define rev(i,n,a)for(int i=n;i>=a;i--)

#define mem(ara,a) memset(ara,a,sizeof (ara))

long long inf=2e18;

long long minf=-inf;

using namespace std;



signed main(){

int n , m=0;

cin>>n;

for(int i=1;i<=n;i++){

    if(i%3==0 or i%5==0)continue;

    m+=i;

}

cout<<m<<endl;

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;



int main()

{

    long long int i,n,sum=0;

    cin>>n;

    for(i=1;i<=n;i++)

    {

        if(i%3!=0 && i%5!=0)

            sum=sum+i;

    }

    cout<<sum;

}






// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

main()

{

    long long int x,c=0,i;

    cin>>i;

    for(x=1;x<=i;x++){

        if(x%5==0 || x%3==0) continue;



        else c+=x;

    }

    cout<<c;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main()

{

    int n,i;

    long long int sum=0;

    cin >> n;

    for(i=1; i<=n; i++)

    {

        if(i%3!=0 && i%5!=0)

        {

            sum+=i;

        }



    }

    cout << sum;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

    long long int n, s = 0;

    scanf("%lld", &n);

    for (int i = 1; i <= n; i++) {

        if ((i % 3) == 0 || (i % 5) == 0) {

            s = s;

        } else {

            s += i;

        }

    }

    printf("%lld", s);

}

// Fastest known solution for this problem: