akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long int ll;
typedef  long double ld;
#define F first
#define S second
#define pb push_back
#define forn(i, n) for(int i = 0; i < n; i++)
#define forl(i, n) for(long long i=0;i<n;++i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vpi vector<pi>
#define vpl vector<pl>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define vd vector<double>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define TT int T;cin>>T;for(int tt=1;tt<=T;tt++)
ll exp(ll n, ll m, ll md){
    ll a = 1;
    while (m > 0){
        if (m&1) a = (a * n%md) % md;
        m /= 2;
        n = (n*n) % md;
    }
    return a % md;
}

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast;
    string s,t;
    cin>>s>>t;
    int n=s.size(),count=0;
    forn(i, n)
    {
        if(s[i]!=t[i])
            count++;
    }
    cout<<count;
    return 0;
}   

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, X, tmp, minM = 1000;
  cin >> N >> X;
  vector<int> m(N);
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    m.at(i) = tmp;
    X -= tmp;
    minM = min(minM, tmp);
  }
  
  int sum = N + X / minM;
  cout << sum << endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define fs first
#define sc second
#define sz size
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 2; i <= (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using ll = long long;
const ll inf = 1e9+7; 

const double PI =  3.141592653589793;

int main(){
	IO;
	string s;
	ll ans=0;
	cin>>s;
	for(auto c :s){
		(c=='-')?ans--:ans++;
	}
	cout<<ans<<"\n";
	return 0;
}

// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

const long long N=200000;

int main(){
	
	long long a,b;
	
ios_base::sync_with_stdio(false);

cin>>a>>b;

if((a>=1)&&(a<=9)&&(b>=1)&&(b<=9))
	cout<<a*b<<endl;

else
	cout<<-1<<endl;

return 0;}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
pair<pair<int, int>, int>a[123456], b[123456];
int n, ans;
vector<pair<int, pair<int, int>>>v;
int pt[123456];
void f() {
	for (int i = 0; i < n; i++)pt[i] = i;
	return;
}
int root(int i) {
	if (pt[i] == i)return i;
	else return pt[i] = root(pt[i]);
}
void unite(int a, int b) {
	pt[root(b)] = root(a);
	root(b);
	return;
}
signed main() {
	cin >> n;
	for0(i, n) {
		int x, y; cin >> x >> y;
		a[i] = make_pair(make_pair(x, y), i);
		b[i] = make_pair(make_pair(y, x), i);
	}
	sort(a, a + n);
	sort(b, b + n);
	for1(i, n - 1) {
		v.push_back(make_pair(a[i].first.first - a[i - 1].first.first, make_pair(a[i].second, a[i - 1].second)));
		v.push_back(make_pair(b[i].first.first - b[i - 1].first.first, make_pair(b[i].second, b[i - 1].second)));
	}
	sort(v.begin(), v.end());
	f();
	for (pair<int, pair<int, int>> p : v) {
		if (root(p.second.first) != root(p.second.second)) {
			ans += p.first;
			unite(p.second.first, p.second.second);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 13424
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

int main(){

	int n;
	cin >> n;
	if(n<1000){
		cout << "ABC" << endl;
	} else {
		cout << "ABD" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,i,j,a[100010],s,x,lg,maxi;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(j=n;j>=1;j--)
    {
        lg=0;
        while(a[j]<=a[j-1] && j>0)
        {
            lg++;
            j--;
        }
        maxi=max(maxi,lg);
    }
    cout<<maxi;
    return 0;
}



Measured memory_bytes: 640
#include<cstdio>
#include<iostream>
#include<string>
#include<string.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<map>
#include<vector>
#include<list>
#include<stack>
#include<functional>
 
using namespace std;
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<n;i++)

 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
 
typedef pair<int ,int > P;
 
char maze[105][105];
 
int sx,sy;
int gx,gy;
int w,h;
 
char sc;        //スタート地点のカラー
 
//stdin
//stdout
 
void dfs(int x,int y)
{
    maze[y][x]='9';
 
    rep(i,4)
    {
/*        for(int j=-1;j<=1;j++)
        {*/
            int nx=x+dx[i];
            int ny=y+dy[i];
 
            if(0<=nx && nx<=w && 0<=ny && ny<=h &&maze[ny][nx]==sc)
            {
                dfs(nx,ny);
            }
 
/*        }*/
    }
    return ;
}
 
void solve()
{
 
    rep(i,101)
        rep(j,101)
        maze[i][j]='0';
 
    int n;
    char c;
    int d;
    int x,y;
 
    cin>>sx>>sy;
    cin>>gx>>gy;
 
    cin>>n;
 
    rep(i,n)
    {
        cin>>c>>d>>x>>y;
 
        if(d==1)
        {
            rep(j,2)
            {
                rep(k,4)
                {
                    maze[y+k][x+j]=c;
 
                }
            }
        }
        else if (d==0)
        {
            rep(j,4)
            {
                rep(k,2)
                {
                    maze[y+k][x+j]=c;
 
                }
            }
        }
 
    }
//6 6
//1 1
//3 6
//2
//1 0 1 1
//1 1 3 3
//  rep(i,w+1)
//  {
//      rep(j,h+1)
//      {
//          cout<<maze[i][j];
//
//      }
//      cout<<endl;
//  }
//
//  cout<<maze[gx][gy]<<endl;
 
    if(maze[sy][sx]=='0')
    {
        cout<<"NG"<<endl;
        return;
    }
    else
    {
        sc=maze[sy][sx];
        dfs(sx,sy);
    }
     
    //rep(i,w+1)
    //{
    //  rep(j,h+1)
    //  {
    //      cout<<maze[i][j];
 
    //  }
    //  cout<<endl;
    //}
 
    if(maze[gy][gx]=='9')
    {
        cout<<"OK"<<endl;
        return;
    }
    else
    {
        cout<<"NG"<<endl;
        return;
    }
 
 
 
}
 
int main()
{
 
    while(cin>>w>>h)
    {
        if(w==0 && h==0)
        {
            return 0;
        }
        else
        {
            solve();
        }
    }
 
 
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
double dp[305][305][305];
int main(){
	cout << fixed << setprecision(10);
	ll n; cin >> n;
	vector<ll> am(4);
	for(ll i = 0; i < n; i++){
		ll a; cin >> a;
		am[a]++;
	}
	for(ll c = 0; c <= n; c++) for(ll b = 0; b <= n; b++) for(ll a = 0; a <= n; a++){
		if(a == 0 && b == 0 && c == 0) continue;
		if(a + b + c > n) continue;
		dp[a][b][c] = n / double(a + b + c);

		if(a != 0) dp[a][b][c] += dp[a-1][b][c] * a/double(a + b + c);
		if(b != 0) dp[a][b][c] += dp[a+1][b-1][c] * b/double(a + b + c);
		if(c != 0) dp[a][b][c] += dp[a][b+1][c-1] * c/double(a + b + c);
	}
	cout << dp[am[1]][am[2]][am[3]] << endl;
}

Measured memory_bytes: 219392
import collections

n = int(input())
votes = [input() for _ in range(n)]

v_coll = collections.Counter(votes).most_common()

most = v_coll[0][1]
mosts = []

for v, i in v_coll:
    if i == most:
        mosts.append(v)
    else:
        break

mosts.sort()

[print(m) for m in mosts]



Measured memory_bytes: 49432
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int a;
  cin >> a;
  cout << a + a*a + a*a*a << '\n';
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n, m;
priority_queue<ll> pq;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < n; ++i) {
    ll a;
    scanf("%lld", &a);
    pq.push(a);
  }

  for (int i = 0; i < m; ++i) {
    ll cur = pq.top();
    pq.pop();

    pq.push(cur / 2);
  }

  ll ans = 0;

  while (!pq.empty()) {
    ll cur = pq.top();
    pq.pop();
    ans += cur;
  }

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

  return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;


//ここから

using P=pair<int,int>;
void solve(){
  int n,m;
  cin>>n>>m;
  vector<vector<P>>v(n);
  rep(i,m){
    int p,y;
    cin>>p>>y;
    p--;
    v[p].eb(y,i);
  }
  vector<P>ans(m);
  rep(i,n){
    if(v[i].size()>1)sort(v[i].begin(),v[i].end());
    rep(j,v[i].size()){
      ans[v[i][j].second]=P{i+1,j+1};
    }
  }
  rep(i,m){
    string s=to_string(ans[i].first),t=to_string(ans[i].second);
    while(s.size()<6)s="0"+s;
    while(t.size()<6)t="0"+t;
    cout<<s<<t<<endl;
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

ll dp[55][3000][55];
int main(){
  int N,A;
  cin >> N >> A;
  vector<int> x(N);
  for(int i=0;i<N;++i) cin >> x[i];
  memset(dp,0,sizeof(dp));
  dp[0][0][0] = 1;
  for(int i=0;i<N;++i){
    for(int s = 0;s<=N*A;++s){
      for(int k=0;k<=N;++k){
        if(dp[i][s][k] == 0) continue;
        dp[i+1][s][k] += dp[i][s][k];//選ばない
        dp[i+1][s+x[i]][k+1] += dp[i][s][k];//選ぶ
      }
    }
  }
  ll res = 0;
  for(int k=1;k<=N;++k) res+=dp[N][A*k][k];
  cout << res << endl;
}

Measured memory_bytes: 74524
// Task : Moving segments icpc 2019
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////
ll power(ll x, ll y, ll p)  
{  
    ll res = 1;     
    x = x % p;
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
          y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}  

void solve() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cout<<"ACL";
	}
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
#endif


	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;

using I = long long;
using U = unsigned long long;

using F = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;
template <typename T> using Uq = unique_ptr<T>;

using StrView = string_view;

auto solve(I const N, Vec<I> const A) -> void {
  I x = 1;
  bool minus = false;
  for (auto a : A) {
    if (a == 0) {
      puts("0");
      return;
    }
    if (minus) {
      continue;
    }

    if (1000000000000000000LL / x / a < 1) {
      minus = true;
      continue;
    }

    I bx = x;
    x *= a;
    if (1000000000000000000LL < x) {
      minus = true;
      continue;
    }
    if (x / a != bx) {
      minus = true;
      continue;
    }
  }
  if (minus) {
    puts("-1");
    return;
  }
  cout << x << "\n";
}

auto main() -> int {
  I N;
  scanf("%lld", &N);
  Vec<I> A(N);
  for (I i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  solve(N, move(A));
  return 0;
}


Measured memory_bytes: 4072
#include <bits/stdc++.h>

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    set<char>s;
    for (int i = 0; i < n; ++i) {
        char c;cin >>c;
        s.insert(c);
    }
    if(s.size()==3)puts("Three");
    else puts("Four");
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;

using namespace std;

void INeedIt() {
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	INeedIt();
	int n;
	cin>>n;
	cout<<n*n*n;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int nums[n+10];

    int fMax=1, sMax=0;
    for (int i=0; i<n ; ++i )
    {
        cin>>nums[i];
        if(nums[i]>fMax)
        {
            sMax=fMax;
            fMax=nums[i];
        }else if(nums[i]>sMax){
            sMax=nums[i];
        }


    }
    for (int i=0;i<n ;++i )
        {
            if(nums[i]==fMax)
                cout<<sMax<<endl;
            else
                cout<<fMax<<endl;
        }
    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
    int a;
    cin >> a;
    double ans;

	if (a == 1)  {
		ans = 1.0;
	} else if(a % 2 == 0) {
        ans = 0.5;
    } else {
        ans = double(a/2+1) / double(a);
    }
	printf("%.7f\n", ans);

}


Measured memory_bytes: 256
#include<cstdio>
int n,f[100005][3];
int max(int a,int b){return a>b?a:b;}
int main()
{
	scanf("%d",&n);
	for(int i=1,a,b,c;i<=n;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		f[i][0]=max(f[i-1][1],f[i-1][2])+a;
		f[i][1]=max(f[i-1][0],f[i-1][2])+b;
		f[i][2]=max(f[i-1][0],f[i-1][1])+c;
	}printf("%d\n",max(max(f[n][0],f[n][1]),f[n][2]));
}

Measured memory_bytes: 1280
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

void comb(int N, int X){
	int com = 0;
	
	for(int i=1; i<=N-2; i++){
		for(int j=i+1; j<=N-1; j++){
			for(int k=j+1; k<=N; k++){
				if(i+j+k == X) com += 1;
			}
		}
	}
	
	cout << com << endl;
}

int main(){
	int n, x;
	
	while(true){
		cin >> n >> x;
		if(n==0 && x==0) break;
		
		comb(n, x);
	}
}

Measured memory_bytes: 3072
N = int(input())
A = list(int(i) for i in input().split())
B = list(int(i) for i in input().split())
result = 0

if N == 1:
    result = A[0] + B[0]
else:
    for i in range(N-1):
        result = max(result, sum(A[:i+1]) + sum(B[i:]))

print(result)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main()
{
    int A,B;
    cin >> A >> B;

    std::cout << A * B << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>


using namespace std;

const int N = 110;

int val[N];

int main() {
	int n;
	scanf("%d", &n);

	for (int i = 0; i < n; ++i) {
		scanf("%d", &val[i]);
	}
	int last = -1;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		if(last == val[i]) {
			last = -1;
			ans++;
		}
		else {
			last = val[i];
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
//#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long

auto main() -> signed {
    vector<int> v(3);
    for(int i=0; i<3; ++i) cin >> v[i];
    sort(v.begin(), v.end());
    cout << v[0] + v[1] << endl;
    return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	p := getNextInt(scanner)
	dp := make([][2]int64, n+1)
	dp[0][0] = 1
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		dp[i+1][0] = dp[i][0]
		dp[i+1][1] = dp[i][1]
		if a%2 == 0 {
			dp[i+1][0] += dp[i][0]
			dp[i+1][1] += dp[i][1]
			continue
		}
		dp[i+1][0] += dp[i][1]
		dp[i+1][1] += dp[i][0]
	}

	fmt.Println(dp[n][p])
	writer.Flush()
}


Measured memory_bytes: 640
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  string s;cin>>s;
  int n=s.size();
  int c0=0, c1=0;
  rep(i,n){
    if(i%2==0){
      if(s.at(i)!='0'){c0++;}
      else{c1++;}
    }
    else{
      if(s.at(i)!='0'){c1++;}
      else{c0++;}
    }
  }
  cout<<min(c0,c1);
       
}
      

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    string s;

    cin >> s;

    int m = (s[5] - '0') * 10 + s[6] - '0', d = (s[8] - '0') * 10 + s[9] - '0';

    if (m < 4)
    {
        cout << "Heisei" << endl;
        return 0;
    }
    else if (m == 4 && d <= 30)
    {
        cout << "Heisei" << endl;
        return 0;
    }
    cout << "TBD" << endl;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var h,n,a int
	fmt.Scan(&h,&n)
	
	damage := 0;
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		damage += a
	}
	
	ans := ""
	if damage < h {
		ans = "No"
	} else {
		ans = "Yes"
	}
	fmt.Println(ans)
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;

signed main () {
    int n, h;
    cin >> n >> h;
    vector < int > a(n), b(n);
    for (int i = 0; i < n; ++i) 
        cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int ans = 0;
    while (h && !b.empty() && b.back() >= a.back()) {
        h = max(h - b.back(), 0);
        b.pop_back();
        ++ans;
    }
    ans += (h + a.back() - 1) / a.back();
    cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    vector<ll> s(n+1), t(n+1);
    rep(i, n) {
        s[i+1] = s[i] + a[i];
        t[i+1] = t[i] + a[n-i-1];
    }
    ll ans = INF;
    Rep(i, 1, n) chmin(ans, abs(s[i] - t[n-i]));
    cout << ans << endl;
}

Measured memory_bytes: 7996
#include<queue>
#include<cstdio>
#include<cstring>
#include<iostream>
#define re register
using namespace std;
priority_queue<int,vector<int>,less<int> > q;
int n,ans,tot;
inline int read()
{
    int x=0;
    char c=getchar();
    while(c<'0'||c>'9') c=getchar();
    while(c>='0'&&c<='9')
    {
        x=x*10+c-48;
        c=getchar();
    }
    return x;
}
int main()
{
    n=read();
    if(n%2==1) q.push(0);
    int xx;
    for(re int i=1;i<=n;i++)
    {
        xx=read();
        q.push(xx);
    }
    while(q.size())
    {
        ans+=q.top();
        q.pop();
        tot+=q.top();
        q.pop();
    }
    cout<<ans-tot<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main() {
    int m, f, r;
    string grade;

    while (true) {
        cin >> m >> f >> r;
        if (m == -1 && f == - 1 && r == -1) break;
        
        grade = "F";
        if (m == -1 || f == -1) grade = "F";
        else if (m + f >= 80) grade = "A";
        else if (m + f >= 65) grade = "B";
        else if (m + f >= 50) grade = "C";
        else if (m + f >= 30) grade = "D";
        
        if (grade == "D" && r >= 50) grade = "C";
        
        cout << grade << endl;
    }    
    
    return 0;
}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
string s;
bool is_pal(string str){
	string _str=str;
	reverse(_str.begin(),_str.end());
	return _str==str;
}
int main(void){
	cin>>s;
	int n=s.size();
	if(is_pal(s.substr(0,(n-1)/2))&&is_pal(s.substr((n+3)/2-1,n))&&is_pal(s))cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
use proconio::{input,fastout};

fn f(x: usize, y: usize, z: usize) -> usize {
    x*x + y*y + z*z + x*y + y*z + z*x
}

#[fastout]
fn main() {
    input! {
        n: usize
    }
    let mut v = vec![0; n];
    for i in 1..=100 {
        if i*i > n { break; }
        for j in 1..=100 {
            if j*j > n { break; }
            for k in 1..=100 {
                if k*k > n { break; }
                let m = f(i,j,k);
                if m <= n { v[m-1] += 1; }
                else { break; }
            }
        }
    }
    for &x in &v { println!("{}", x) }
}


Measured memory_bytes: 2168
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;

int main(){
	int n;
    cin >> n;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i*j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

    int n; cin >> n;

    int temp;
    map<int, int> mp;
    for(int i=0; i<n; i++){
        cin >> temp;
        mp[temp]++;
    }

    int cnt = 0;
    for(auto x : mp){
        if(x.second % 2 == 1){
            cnt++;
        }
    }

    cout << cnt;

    return 0;
}

Measured memory_bytes: 4992
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include<bits/stdc++.h>
using namespace std;

int n;
int month[]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
bool run(int n) {
	if(n%4)
		return 0;
	if(n%400==0)
		return 1;
	if(n%100==0)
		return 0;
	return 1;
}
int main() {
	IOS
	map<string,string>m;
	m["ABC"]="ARC";
	m["ARC"]="ABC";
	string s;
	cin>>s;
	cout<<m[s]<<endl;

}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int h, w, ans;
string s[2200];
int a[2200][2200];

void dfs() {
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      int cnt = 0, k = j;
      while (k < w and s[i][k] == '.') {
        cnt++;
        k++;
      }
      for (int l = j; l < k; l++) {
        a[i][l] = cnt;
      }
      j = k;
    }
  }
  for (int i = 0; i < w; i++) {
    for (int j = 0; j < h; j++) {
      int cnt = 0, k = j;
      while (k < h and s[k][i] == '.') {
        cnt++;
        k++;
      }
      for (int l = j; l < k; l++) {
        a[l][i] += cnt;
      }
      j = k;
    }
  }
}

int main() {
  cin >> h >> w;
  
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }
  
  dfs();
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      ans = max(ans, a[i][j]-1);
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 22784
#include<bits/stdc++.h>
#include<string.h>
#include <math.h>
#include<iostream>
using namespace std;
typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         ld;

#define sf                  scanf
#define pf                  printf
#define srev                reverse(s.begin(),s.end())
#define sortstr             sort(s.begin(), s.end());
#define gtl(x)              getline(cin, (x))
#define gcd(a, b)           __gcd(a, b)
#define lcm(a, b)           ((a)*((b)/gcd(a,b)))
#define PI                  acos(-1)
#define Precision(a) cout << fixed << setprecision(a)
#define FasterIO     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}
//scanf("%[^\n]", str);
//sort(s,s+n,greater<int>());

int main()
{
    int n, m, a, sum=0, x;
    cin >> n >> m;
    for(int i=0; i<m; i++)
    {
        cin >> a;
        sum += a;
    }
    if(sum>n)
        cout << -1 << endl;
    else
    {
        x = n-sum;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <algorithm>
#include <climits>

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
inline int gcd(int a,int b){return b?gcd(b,a%b):a;}
inline int lcm(int a,int b){return a*b/gcd(a,b);}
typedef long long ll;
typedef std::vector<int> VI;
typedef std::pair<int, int> PII;

using namespace std;


int main()
{
  int N;
  cin >> N;
  int ans = 0;
  VI A(N);
  VI C(N-1);
  REP(i, N)
    cin >> A[i];
  REP(i, N) {
    int b;
    cin >> b;
    ans += b;
  }
  REP(i, N-1) {
    cin >> C[i];
  }
  REP(i, N-1) {
    if (A[i+1] == A[i]+1) ans += C[A[i]-1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int main(void) {
	string o,e;
	cin >> o >> e;
	int i;
	for(i = 0; i < e.length(); i++){
		cout << o[i] << e[i];
	}
	if(o.length() != e.length()) cout << o[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int main(){
	int N;
	cin >> N;
	int p[20];
	for(int i=0; i<N; i++) cin >> p[i];
	int ans = 0;
	for(int i=1; i<N-1; i++){
		if(p[i-1] < p[i] && p[i] < p[i+1]) ans++;
		if(p[i-1] > p[i] && p[i] > p[i+1]) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <tuple>

using namespace std;

using PII = pair<int, int>;
using VB = vector<bool>;
using VVB = vector<VB>;

int main() {

	map<int, PII> nums;
	int a;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> a;
			nums[a] = make_pair(i, j);
		}
	}

	VVB bingo(3, VB(3, false));
	int n, b;
	cin >> n;

	int r, c;
	for (int i = 0; i < n; i++) {
		cin >> b;
		if (nums.count(b) > 0) {
			tie(r, c) = nums[b];
			bingo[r][c] = true;
		}
	}

	bool ok = false;
	for (int i = 0; i < 3; i++) {
		if ((bingo[i][0] && bingo[i][1] && bingo[i][2]) ||
			(bingo[0][i] && bingo[1][i] && bingo[2][i])
		) {
			ok = true;
			break;
		}
	}

	if ((bingo[0][0] && bingo[1][1] && bingo[2][2]) ||
		(bingo[2][0] && bingo[1][1] && bingo[0][2])
	) {
		ok = true;
	}

	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if ((a <= c && c <= b) || (b <= c && c <= a))
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>

int w[105],v[105];
long long dp[105][105000];
using namespace std;
int main(){
	int N,W;
	scanf("%d%d",&N,&W);
	for(int i=0;i<N;i++)
		scanf("%d%d",&w[i],&v[i]);
	for(int i=N-1;i>=0;i--){
		for(int j=0;j<=W;j++){
			if(j<w[i]){
				dp[i][j]=dp[i+1][j];
			}
			else dp[i][j]=max(dp[i+1][j],dp[i+1][j-w[i]]+v[i]);
		}
	}
	printf("%lld\n",dp[0][W]);
	return 0;
}

Measured memory_bytes: 84224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using P = pair<int, int>;

int main() {
    double d, t, s;

    cin >> d >> t >> s;
    if((d/s) <= t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


	return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>
#include <stdlib.h>


int main(void){
	int N,i,ans=0;
	scanf("%d",&N);
	int p[100001],notok[100010]={0};
	for(i=1;i<=N;i++)scanf("%d",&p[i]);
	for(i=1;i<N;i++){
		if(p[i]==i)notok[i]=1;
		if(notok[i]==1){
			notok[i]=0;
			int tmp=p[i];
			p[i] = p[i+1];
			p[i+1] = tmp;
			ans++;
		}
	}
	if(p[N]==N)ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>

using namespace std;

int main() {

	int K, N;
	cin >> K >> N;

	vector<int> A(N + 1);
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	A[N] = K + A[0];

	int a = 0, b = A[1] - A[0], c = 1;
	for (int i = 0; i < N; ++i)
	{
		if (A[i + 1] - A[i] >= b) {
			a = i;
			b = A[i + 1] - A[i];
			c = i + 1;
		}
	}

	bool Right = false;

	/*
	if (a == 0) {
		if (A[N] - A[N - 1] > A[c + 1] - A[a + 1]) {
			Right = true;
		}
		else Right = false;
	}
	else if (c == 0) {
		if (A[c - 1] - A[a - 1] > A[1] - A[0]) {
			Right = true;
		}
		else Right = false;
	}
	else {
		if (A[c - 1] - A[a - 1] > A[c + 1] - A[a + 1]) {
			Right = true;
		}
		else Right = false;
	}
	*/
	cout << K - b << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/
struct Timer {
    int64_t start;
    const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high;
        __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};

Timer timer;

bool multicase = false;

ll n, m, k, num, a, b, c, d, e, h, q, ans, sum;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

ll x[500005], y[500005], z[500005];


void solve() {
    cin >> n;
    ll m = (n + 999) / 1000;
    ll ans = m * 1000 - n;
    p(ans);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



Measured memory_bytes: 3652
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF = 1e18;
vector<vector<int>> calcNext(const string &S)
{
    int n = (int)S.size();
    vector<vector<int>> res(n + 1, vector<int>(10, n));
    for (int i = n - 1; i >= 0; --i)
    {
        for (int j = 0; j < 10; ++j)
            res[i][j] = res[i + 1][j];
        res[i][S[i] - '0'] = i;
    }
    return res;
}
void add(long long &a, long long b)
{
    a += b;
    if (a >= MOD)
        a -= MOD;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    vector<vector<int>> next=calcNext(s);
    VV dp(n + 1,V(4,0));
    dp[0][0] = 1;
    
    rep(i,n){
        rep(j,10){
            rep(k,4){
                if(next[i][j]>=n)
                    continue;
                add(dp[next[i][j]+1][k + 1], dp[i][k]);
              //  cout<<i<<" "<<j<<" "<<next[i][j]<<" "<<k<<" "<<dp[next[i][j]][k + 1]<<endl;
            }
        }
    }
    ll res=0;
    rep(i,n+1){
        add(res, dp[i][3]);
    }
   
    cout << res << endl;
}


Measured memory_bytes: 4480
//
//  main.cpp
//  programs
//
//  Created by Arunesh Sarker on 18/11/19.
//  Copyright © 2019 Arunesh Sarker. All rights reserved.
//

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int p1;int p2;
    cin>>p1>>p2;
    ll total=0;
    if(p1==3)
        total+=100000;
    if(p1==2)
        total+=200000;
    if(p1==1)
        total+=300000;
    if(p2==3)
            total+=100000;
        if(p2==2)
            total+=200000;
        if(p2==1)
            total+=300000;
    if(total==600000)
        total+=400000;
    cout<<total<<"\n";
    
    
        
        
        
        
        
        
        
    }
    




Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A;
  int B;
  cin >> A;
  cin >> B;
  for(int i = 0; i < 10000; i++){
    if((int)(i*0.08) == A && (int)(i*0.1) == B){
      cout << i << endl;
      break;
    }else if(i == 9999){
      cout << -1 << endl;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
struct pos{
	int x,y,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	ll n,k;
	ll a[200002],ma=0;
	ll t=0;
	cin>>k>>n;
	cin>>a[0];
	rep(i,n-1){
		cin>>a[i+1];
		t+=a[i+1]-a[i];
		ma=max(ma,a[i+1]-a[i]);
	}
	t+=k-a[n-1]+a[0];
	cout<<t-max(ma,k-a[n-1]+a[0])<<endl;

	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* myfgets(char *buf,int n,FILE *fp){ //accepts LF/CRLF
	char *ret=fgets(buf,n,fp);
	if(!ret)return NULL;
	if(strlen(buf)&&buf[strlen(buf)-1]=='\n')buf[strlen(buf)-1]=0;
	if(strlen(buf)&&buf[strlen(buf)-1]=='\r')buf[strlen(buf)-1]=0;
	return ret;
}

char Q[29999],*q[9],L[29999];
int n;
dfs(old_indent,depth){
	int indent=0;
	if(!myfgets(L,sizeof(L),stdin)){puts("no such property");exit(0);}
	for(;L[indent]==' ';indent++);
	if(old_indent>=indent){puts("no such property");exit(0);}
	char *name=strtok(L+indent,":"),*value=name+strlen(name)+1;
	if(!strcmp(name,q[depth])){
		if(depth==n-1){
			if(*value)
				printf("string \"%s\"\n",value+1),exit(0);
			else
				puts("object"),exit(0);
		}
		dfs(indent,depth+1);
	}
	dfs(old_indent,depth);
}

main(depth){
	myfgets(Q,sizeof(Q),stdin);
	q[0]=strtok(Q+1,".");
	for(n=1;;n++)if(!(q[n]=strtok(NULL,".")))break;
	dfs(-1,0);
}

Measured memory_bytes: 584
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N ; i++) {
        std::cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    cout << d[N/2]-d[N/2-1];    
}

Measured memory_bytes: 640
from sys import stdin

def f(num):
  d = []
  if num != 1:
    for i in range(1,num):
      if num % i == 0:
    	  d.append(i)
      d.append(num)
  else:
      d = [1]
  return d

A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
a = f(A)
b = f(B)
d = set(a)&set(b)
d = sorted(list(d),reverse=True)
print(d[C-1])


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
map<int, int> mp;
int n,m;
int res=0;
vector<int> v;
int main()
{
	cin >>n>>m;
	for (int i=0;i<n;i++)
	{
		int x;
		cin >>x;
		mp[x-1]++;
	}
	if (mp.size()<=m)
	{
		cout <<"0";
		return 0;
	}
	for (map<int, int>::iterator it=mp.begin();it!=mp.end();it++)
	    v.push_back(it->second);
	sort(v.begin(),v.end());
	for (int i=0;i<v.size()-m;i++) res+=v[i];
	cout <<res;
	return 0;
}


Measured memory_bytes: 10748
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define M(a) ((int)pow(10.0,(a)))
int A,B,K,Bo[16],c,r;
void dfs(int p,int k)
{
	int m=M(p),a=A%M(p+1)/m,b=B%M(p+1)/m;
	if(M(p)-A>0)
	{
		r=c>r?c:r;
		return;
	}
	if(a-Bo[p]>=b)
	{
		c+=(a-Bo[p]-b)*m;
		Bo[p+1]=0;
		dfs(p+1,k);
		c-=(a-Bo[p]-b)*m;
	}
	else
	{
		c+=(a-Bo[p]+10-b)*m;
		if(k<K)
		{
			Bo[p+1]=0;
			dfs(p+1,k+1);
		}
		Bo[p+1]=1;
		dfs(p+1,k);
		c-=(a-Bo[p]+10-b)*m;
	}
}

int main()
{
	scanf("%d%d%d",&A,&B,&K);
	dfs(0,0);
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int MOD = 1e9 + 7 , MID = 2000;
int f[5050][5050];
int n;
int x[202020] , y[202020];
int fac[8080] , inv[8080];
void init(){
	fac[0] = fac[1] = 1;
	for(int i = 2 ; i <= 8000 ; ++ i)
		fac[i] = 1ll * fac[i - 1] * i % MOD;
	inv[0] = inv[1] = 1;
	for(int i = 2 ; i <= 8000 ; ++ i)
		inv[i] = MOD - 1ll * (MOD / i) * inv[MOD % i] % MOD;
	for(int i = 2 ; i <= 8000 ; ++ i)
		inv[i] = 1ll * inv[i - 1] * inv[i] % MOD;
}
int C(int x , int y){
	return 1ll * fac[x] * inv[y] % MOD * inv[x - y] % MOD;
}
int main(){
	init();
	cin >> n;
	for(int i = 1 ; i <= n ; ++ i)
		cin >> x[i] >> y[i];
	for(int i = 1 ; i <= n ; ++ i)
		f[-x[i] + MID][-y[i] + MID] ++;
	for(int i = 1 ; i <= 4000 ; ++ i)
		(f[i][0] += f[i - 1][0]) %= MOD;
	for(int i = 1 ; i <= 4000 ; ++ i)
		(f[0][i] += f[0][i - 1]) %= MOD;
	for(int i = 1 ; i <= 4000 ; ++ i)
		for(int j = 1 ; j <= 4000 ; ++ j){
			(f[i][j] += f[i - 1][j]) %= MOD;
			(f[i][j] += f[i][j - 1]) %= MOD;
		}
	int ans = 0;
	for(int i = 1 ; i <= n ; ++ i){
		(ans += f[x[i] + MID][y[i] + MID]) %= MOD;
		(ans += MOD - C(2 * x[i] + 2 * y[i] , 2 * x[i])) %= MOD;
	}
	cout << 1ll * ans * inv[2] % MOD << endl;
	return 0;
}

Measured memory_bytes: 82176