Language: C++

								/// Start with the name of almighty Allah
 
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<set>
//#include <boost/algorithm/string.hpp>
using namespace std;
#define f first
#define s second
#define int long long
#define st string
#define start int32_t main()
#define bari_ja return 0
#define forn(i, n) for (int i = 0; i < n; i++)
#define INF 1e12+5
#define pb push_back
#define vec std::vector<int>
#define in insert
#define set std::set<int>
#define mod 1000000007
#define m 1000000007
const double pi =  3.141592653589793;
int test, x, y, d;
vector<int>v;
vector<int>sum;
//int sum[100001];
//long long arr[10000000]={0}, d[10000000];
//const INT N = (int) 1e5 + 5;
/// using transform() function and ::toupper in STL 
///transform(su.begin(), su.end(), su.begin(), ::toupper); 
///getline(cin, str); 
int factorial(int n);
int gcd(int a, int b);
bool isPrime(int n);
void sieve(int n);
int eulertotient(int n);
int binarysearch(int a, int n);
int crr[1000001];
auto Sign = [&](int x){
		if(x>0)return 1;
		else return -1;
};
 
int primeFactor(int n){
	set S;
	if(n%2==0){
		S.in(2);
		while(n%2==0)n/=2;
	}
 
	for(int i=3; i<=sqrt(n); i+=2){
		if(n%i==0){
			S.in(i); n/=i;
		}
	}
	if(n>2)S.in(n);
 
	for(auto i:S)cout<<i<<"  ";
	cout<<endl;
 
	return S.size();
}
 
int makelps(st str, int l, int *lps){
	lps[0]=0;
	int len=0, i=1;;
	while(i<l){
		if(str[i]==str[len]){
			len++;
			lps[i] = len; i++;
		}else{
			if(len==0){lps[i]=0; i++;}
			else{
				len = lps[len-1];
			}
		}
	}
	//for(int i=0; i<l; i++)cout<<lps[i]<<"  ";
	int res = lps[l-1];
	return (res>l/2)? l/2:res;
 
}

bool kmp(st text, st pattern){
	//int cnt=0;
	int t= text.size();
	int p = pattern.size();
	int lps2[p];
	makelps(pattern, p, lps2);
	int i=0; //for text
	int j=0; //for pattern
	while(i<t){
		if(text[i]==pattern[j]){
			i++; j++;
		}
 
		if(j==p){
			//cout<<"found at "<<i-j<<endl;
			//cnt++;
			return true;
			j = lps2[j-1];
		}
		else if(i<t && text[i]!=pattern[j]){
			if(j!=0){
				j = lps2[j-1];
			}else{
				i = i+1;
			}
		}
	}
	return false;
}

 
int extendedEuclid(int A, int B) {
    if(B == 0) {
        d = A;
        x = 1;
        y = 0;
    }
    else {
        extendedEuclid(B, A%B);
        int temp = x;
        x = y;
        y = temp - (A/B)*y;
    }
	return y;
}
 
int modInverse(int A, int M)
{
    extendedEuclid(A,M);
    return (x%M+M)%M;    //x may be negative
}
 
void factor(int n, int sum,  int *arr){
	set S;
	for(int i=1; i*i<=sum; i++){
		if(sum%i==0){S.in(i); S.in(sum/i);}
	}
	for(int i:S){
		
		int sum2=0;
		bool flag = true;
		if(i>=x){
			for(int j=0; j<n; j++){
				sum2+=arr[j];
				if(sum2==i){
					sum2=0;
				}
				else if(sum2>i){
					flag = false;
					break;
				}
			}
 
			if(flag)cout<<i<<" ";
		}
 
		}
	cout<<endl;
}
int largest_prefix_suffix(const std::string &str) { 
	
int n = str.length(); 
	
if(n < 2) { 
	return 0; 
} 

int len = 0; 
int i = n/2; 
	
while(i < n) { 
	if(str[i] == str[len]) { 
	++len; 
	++i; 
	} else { 
	if(len == 0) { // no prefix 
		++i; 
	} else { // search for shorter prefixes 
		--len; 
	} 
	} 
} 
	
return len; 

} 
 
start{
    ios_base::sync_with_stdio(false);
	
	int n;	cin>>n;
	double a = n/1000.00;
	int b = ceil(a/1.00);
	int res = b*1000-n;
	cout<<res<<endl;
	
	
  bari_ja;
}
 
int factorial(int n){
 
if(n==0 || n==1)
    return 1;
 
int sum = 1;
 
for(int i=1; i<=n; i++){
        sum*=i;
		sum%=10000;
}
return sum;
 
}
 
int gcd(int a, int b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;
 
    if (a == b)
        return a;
    if (a > b)
        return gcd(a-b, b);
    return gcd(a, b-a);
}
bool isPrime(int n){
///this algo can deal with maximum 1e15 to 1e16
	if(n==1)
		return false;
	for(int i=2; i*i<=n; i++){
	
		if(n%i==0){
			return false;
		}
	}
	return true;
}
 
void sieve(int n){
//int d = r-l+1;
bool arr[n+1];
memset(arr, true, sizeof(arr));
arr[0] = arr[1]  = false;
for(int i=2; i*i<=n; i++){
 
	if(arr[i]){
		for(int j = i*i; j<=n; j+=i)arr[j] = false;
	}
}
 
for(int i=2; i<=n; i++){
	if(arr[i])v.pb(i);
}
 
return ;
}
 
int eulertotient(int n){
///return the co prime of a number N
	float result = n;
	for(int i=2; i*i<=n; i++){
		if(n%i==0){
			while(n%i==0)
				n/=i;
			result *= (1.0 - (1.0 / (float)i)); 
		}
	}
	if(n>1){result *= (1.0 - (1.0 / (float)n)); }
	return (int)result;
}
/*
int binarysearch(int a, int n){
	int low = 0, high = n-1;
	int mid;
	while(low<=high){
	
		 mid = (low+high)/2;
 
		if(arr[mid]>a && arr[mid-1]<=a)
			return mid-1;
		else if(arr[mid]>a && arr[mid-1]!=a) high = mid-1;
		else low = mid+1;
	}
 
	return mid;
}
*/

Compiler output:
a.cc:40:14: error: non-local lambda expression cannot have a capture-default
   40 | auto Sign = [&](int x){
      |              ^