akhauriyash/Code-Regression huggingface dataset:
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e5+20
#define INF 1e9+20
#define pb push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int,int> pii;
const int delta=(int)1e9+7;
int k,ans=1;
void dij(){
	set<pii>s;
	int dis[MAX_N]; fill(dis,dis+MAX_N,INF);
	dis[1]=0; for(int i=0;i<k;++i) s.insert(pii(dis[i],i));
	while(s.size()){
		pii x=*s.begin(); s.erase(x);
		int u=x.S,v=(10*u)%k;
		if(dis[u]+1<dis[(u+1)%k]){
			s.erase(pii(dis[(u+1)%k],(u+1)%k));
			dis[(u+1)%k]=dis[u]+1;
			s.insert(pii(dis[(u+1)%k],(u+1)%k));
		}
		if(dis[u]<dis[v]){
			s.erase(pii(dis[v],v));
			dis[v]=dis[u]; 
			s.insert(pii(dis[v],v));
		}
	}
	ans+=dis[0];
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin>>k;
	dij(); cout<<ans;
	return cout<<endl,0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, L;
  cin>>N>>L;
  vector<int> arr(N);
  for(int i=0;i<N;++i) arr[i] = L+i;
  int num = inf;
  for(int i=0;i<N;++i) {
    if(abs(num)>abs(arr[i])) num = arr[i];
  }
  int ans = 0;
  for(int i=0;i<N;++i) {
    if(arr[i]==num) continue;
    ans += arr[i];
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3596
#include <iostream>
#include <math.h>
#define PI 3.14159265
using namespace std;

int main() {
//    freopen("in.txt", "r", stdin);

    double a,b,c;
    double s,l,h;

    cin >> a >> b >> c;

    s = (1.0 / 2) * a * b * sin(PI/180*c);
    l = sqrt(pow(a,2) + pow(b,2) - 2.0 *a *b *cos(PI/180*c)) + a + b;
    h = b * sin(PI/180*c);
    printf("%.4lf\n%.4lf\n%.4lf", s,l,h);
}

Measured memory_bytes: 3328
#include "bits/stdc++.h"
 
using namespace std;
 
#define int long long
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FORR(i, a, b) for (int i = (a); i >= (b); i--)
 
#define pb push_back
#define VDEL(v, n) v.erase(v.begin() + (n))
#define ALL(v) v.begin(), v.end()
 
#define INT_INF 200000000
 
#define TINT(str) atoi(str.c_str())
#define TSTR(num) to_string(num)
 
typedef long long ll;
typedef pair<int, int> PINT;
typedef vector<int> VI;
typedef vector<vector<int>> VII;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
 
//the end of library zone
 
 
 
signed main(){
	int N;
 
	int L[20];
 
	cin >> N;
 
	int maxv = 0;
	int sum = 0;
 
	REP(i, N){
		cin >> L[i];
		maxv = max(maxv, L[i]);
		sum += L[i];
	}
 
	if(maxv >= (sum - maxv)){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}
 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int N=10005;
ll dp[N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h,n;
    cin>>h>>n;
    vector<ll>a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<N;i++){
        dp[i]=1e9;
    }
    dp[h]=0;
    ll res=inf;
    for(int j=h;j>=0;j--){
        for(int i=0;i<n;i++){
            dp[max(ll(0),j-a[i])]=min(dp[max(ll(0),j-a[i])],dp[j]+b[i]);

        }
    }
    cout<<dp[0]<<endl;
    return 0;
    }


Measured memory_bytes: 384
a = gets.split(' ').map(&:to_i)
# 5が2つ、7が1つのときはyes、そうでないときはno

b = 0
c = 0
a.each do |n|
	b += 1 if n == 5
  	c += 1 if n == 7
end

if(b == 2 && c == 1)
  print 'YES'
else
  print 'NO'
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;cin >>N;
    int A[N];
    for (int i=0;i<N;i++){
        int a; cin >>a;
        A[a-1]=i+1;
    }
    for (int i=0;i<N;i++){
        cout << A[i];
        if (i<N-1) cout <<" ";
    }
    cout <<"\n";
}



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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int v[105], w[105], dp[10010];
signed main(void)
{
  int n, W;
  cin >> n >> W;
  REP(i, n) cin >> v[i] >> w[i];

  REP(i, n) FOR(j, w[i], W+1) {
    dp[j] = max(dp[j], dp[j-w[i]] + v[i]);
  }
  cout << dp[W] << endl;
  return 0;
}

Measured memory_bytes: 3084
#include <iostream>
using namespace std;
typedef long long int llf;
int main() {
	// your code goes here
	llf M,rd,rr,cd,cr;
	cin >> M >> rd >> rr >> cd >> cr;
	llf xx=cd*100.0/rd;
	llf yy=cr*100.0/rr;
	if(xx*rd<100*cd)
	xx++;
	if(yy*rr<100*cr)
	yy++;
	if(M-xx-yy>=0)
	cout << M-xx-yy << endl;
	else
	cout <<-1<< endl;
	return 0;
}

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

int main() {
    const int dy[4] = {1, 0, -1, 0};
    const int dx[4] = {0, 1, 0, -1};

    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    rep(i, H) cin >> field[i];

    vector<vector<int>> dist(H, vector<int>(W, -1));
    queue<pair<int, int>> que;
    int ans = -1;

    rep(sy, H){
        rep(sx, W){
            if(field[sy][sx] == '#') continue;
            dist[sy][sx] = 0;
            que.push(make_pair(sy, sx));

            while(!que.empty()){
                pair<int, int> v  = que.front();
                que.pop();

                rep(i, 4){
                    pair<int, int> nv(v.first + dy[i], v.second + dx[i]);

                    if(nv.first < 0 || nv.first >= H || nv.second < 0 || nv.second >= W) continue;
                    if(dist[nv.first][nv.second] != -1) continue;
                    if(field[nv.first][nv.second] == '#') continue;
                    dist[nv.first][nv.second] = dist[v.first][v.second] + 1;
                    que.push(nv);
                }
            }
            int maxi = 0;
            rep(i, H) maxi = max(maxi, (int)*max_element(dist[i].begin(), dist[i].end()));
            ans = max(ans, maxi);
            dist.assign(H, vector<int>(W, -1));
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(L: int):
    print(L*L*L/27)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = int(next(tokens))  # type: int
    solve(L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

const int MAXN = 2e5 + 5;

int main(){
	ios_base::sync_with_stdio(NULL); cin.tie(); cout.tie();
	int n, A[MAXN] = {0}, B[MAXN] = {0};
	cin >> n;
	for(int i = 0; i < n - 1; i ++){
		int x; cin >> x;
		A[x] ++;
	}
	for(int i = 1; i <= n; i ++){
		cout << A[i] << endl; 
	}
}
/**

*/

Measured memory_bytes: 4432
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();

  		int[] p=new int[n];
		for(int c=0;c<n;c++){
    		p[c]=sc.nextInt();
    	}
  		int ans=0;
    	for(int d=0;d<n-2;d++){
        	if(p[d]<p[d+1]&&p[d+1]<p[d+2]){
            	ans++;
            }else if(p[d+2]<p[d+1]&&p[d+1]<p[d]){
            	ans++;
            }
        }

    	System.out.println(ans);
    }
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

typedef vector<int> vec;
typedef vector<vec> mat;

mat multi(const mat& A, const mat& B, const int& mod)
{
  mat C(A.size(), vec(B[0].size()));
  for(int i = 0; i < A.size(); i++) {
    for(int j = 0; j < B.size(); j++) {
      for(int k = 0; k < B[0].size(); k++) {
	(C[i][k] += A[i][j] * B[j][k]) %= mod;
      }
    }
  }
  return C;
}

mat power(mat A, int n, int mod)
{
  mat B(A.size(), vec(A.size()));
  for(int i = 0; i < A.size(); i++) B[i][i] = 1;
  while(n > 0) {
    if(n & 1) B = multi(B, A, mod);
    A = multi(A, A, mod);
    n >>= 1;
  }
  return B;
}

int dy[] = {-1, -1, 0, 0, 1, 1};
int dx[] = {-1, 0, -1, 1, 0, 1};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, M, L;
  for(int T = 1; cin >> N >> M >> L, N || M || L; T++) {
    int num = 0;
    vector<pint> pos;
    map<pint, int> id;
    int s = 0, t = N-1;
    rep(i, N+N-1) {
      if(i < N) t++;
      else s++;
      reps(j, s, t) {
	pos.push_back(make_pair(i, j));
	id[make_pair(i, j)] = num++;
      }
    }
    mat X(num, vec(1));
    rep(i, num) cin >> X[i][0];
    mat A(num, vec(num));
    rep(i, num) {
      int y, x;
      tie(y, x) = pos[i];
      rep(j, 6) {
	int ny = y + dy[j], nx = x + dx[j];
	if(id.count(make_pair(ny, nx))) {
	  A[i][id[make_pair(ny, nx)]] = 1;
	}
      }
      A[i][i] = 1;
    }
    mat Y = power(A, L, M);
    mat Z = multi(Y, X, M);
    int ans = 0;
    rep(i, Z.size()) ans += Z[i][0];
    cout << "Case " << T << ": " << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3252
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    ll n; cin >> n;
    vector<ll> a(n);
    deque<ll> deq;
    for (int i = 0; i < n;i++) {
        cin >> a[i];
        if(i %2 == 0)deq.push_back(a[i]);
        else deq.push_front(a[i]);
    }
    if (n % 2 != 0) {
        for (auto it = deq.rbegin(); it != deq.rend();it++) {
            cout << *it << " ";
        }
        cout << endl;
    }
    else {
        for (auto it = deq.begin();it != deq.end();it++) {
            cout << *it << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 5376
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;


const int N=100;
int mm[N];

int main(){	
	fastio;
	int n;cin>>n;
	int tot=0,mx=0;
	FER(i,0,n){
		int k;cin>>k;
		tot+=k;
		mx=max(mx,k);
	}
	cout<<tot-mx/2<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<b+c-d<<" "<<c+d-a<<" "<<b-d+a<<" "<<c-a+b<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define pb push_back
#define f first
#define s second
#define mp make_pair
#define SZ(x) ((int)(x.size()))
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define IN(x, y) ((y).find(x) != (y).end())
#define ALL(t) t.begin(),t.end()
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
#define DBG(c) cout << #c << " = " << c << endl;
#define Rtime1 ((double)clock()/(double)CLOCKS_PER_SEC)
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


typedef long long ll;
typedef long double lf;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
typedef vector < int > vi;
typedef vector<vi> vvi;
typedef complex<double> base;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const int N = 3e5 + 5;
const int lgN = 1e6+5;
const ll MOD = 1e9+7;
const ll MOD2 = 1299709;
const ll MOD3 = 1e9 + 9;
const lf pi = 3.141592653589793238462643383;
const ll IMAX = 4e18 + 5; 
const double PI = 3.141592653589793;


template<class T>
using max_pq = priority_queue<T>;
template<class T>
using min_pq = priority_queue<T,vector<T>,greater<T>>; 
template<class T>
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll x,y;
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}

//(a^x)%m   
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1;  while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; } 

int dp[N],h[N];

int main(){
    sync
    int n;
    cin>>n;
    FOI(i,1,n)
    cin>>h[i];
    h[0] = h[1];
    FOI(i,2,n)
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
    cout<<dp[n]<<endl;
}


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

#define pb push_back
#define F first
#define S second
#define fo(i,a,b)  for(int i = a; i < b; i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}
/*****************************************************/

int main()
{
    int n , m;
    cin >> n >> m;

    int acc = 0 , pen = 0 , allProb[n+1] = {0} , allpen[n+1] = {0};

    for(int i = 0; i < m; ++i){
        int problem;
        string ver;
        cin >> problem >> ver;
        if(ver == "AC" && allProb[problem] == 0){
            allProb[problem] = 1;
            pen += allpen[problem];
            acc++;
        }else if(ver == "WA" && allProb[problem] == 0){
            allpen[problem]++;
        }
    }

    cout << acc << " " << pen << "\n";

    return 0;
}


Measured memory_bytes: 1024
n = int(input())
a = [0]
a.extend([int(i) for i in input().split()])
a.append(0)

sum = 0
for i in range(n+1):
    sum += abs(a[i]-a[i+1])

for i in range(1,n+1):
    tmp_sum = sum - abs(a[i]-a[i-1])-abs(a[i]-a[i+1])
    tmp_sum += abs(a[i+1]-a[i-1])
    print(tmp_sum)

Measured memory_bytes: 14048
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B;cin>>A>>B;
  cout <<(A<=8&&B<=8? "Yay!":":(")<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var n = Console.ReadLine().ToInt();
		var s = Console.ReadLine();
		n = s.Length;
		bool all = true;
		long black = 0;
		for(int i = 0; i < n; i++)
		{
			if(s[i] == '.')
				black++;
			if(s[0] != s[i])
				all = false;
		}
		if(all)
		{
			Console.WriteLine(0);
			return;
		}
		long min = n*2;
		long rw = 0;
		for(int i = 0; i < n; i++)
		{
			min = Math.Min(min, black+rw);
			if(s[i] == '#')
				rw++;
			else
				black--;
		}
		min = Math.Min(min, black+rw);
		
		Console.WriteLine(min);
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 13112
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    while (true){
        cin>>H>>W;
        if(H==0 && W==0){
            break;
        }
         for(int j=0; j<W; j++){
            cout<<"#";
         }
         cout<<endl;
        
         for(int i=1; i<H-1; i++){
            cout<<"#";
            for(int j=1; j<W-1; j++){
            cout<<".";
            }
         cout<<"#"<<endl;
         }
         for(int j=0; j<W; j++){
         cout<<"#";
         }
         cout<<endl<<endl;
    }
}



Measured memory_bytes: 2996
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */

int main(void){
    ll x;
    cin >> x;
    double now = 100;
    ll ans = 0;
    while(now < x){
        now *= 1.01;
        now = ll(now);
        ans ++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3640
package main

import "fmt"
import "math"

func main(){
	var N, T, A int
	var ans int
	fmt.Scan(&N, &T, &A)

	H := make([]int, N)
	for i:=0;i<N;i++{
		fmt.Scan(&H[i])
	}

	tmp := 100000.

	for i:= 0 ; i < N ; i++{
		a := float64(T) - float64(H[i]) * 0.006
		b := math.Abs(float64(A)-a)
		if  b < tmp{
			ans = i+1
			tmp = b
		}
//		fmt.Println(a, b)
	}
	fmt.Println(ans)
}

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

int main() {
  ll Ans = 0;  // 回答：
  int N; cin >> N; // 文字列数：１～４０００
  string S; cin >> S; // 対象文字列
  ll R,G,B;  // 各色の個数：関連する計算項目が ll の場合、元の数も ll にしとかないとダメみたい。
  R=0;G=0;B=0;

  // 各色のカウント
  for(char c : S){
    R += c=='R';
    G += c=='G';
    B += c=='B';
  }
  // とりあえず、全色違う組数を出す
  Ans = R * G * B;

  // ２点間の距離が同じ組を判定し、合計数から引く
 int j,k;  //２文字目３文字目の位置
 rep(i,N){
   rep1(d,N){
     j = i + d; k = i + d + d;
     if ( k > N-1 ) { break; }
  // for (int d=1;d<N;++d){
  //   for (int i=0,j=d,k=2*d;k<N;++i,++j,++k){
        // 異なる色の場合、全数から引く
        if ( S.at(i) != S.at(j) && S.at(i) != S.at(k) && S.at(j) != S.at(k) ){
          Ans--;
        }
      }
  }

  cout << Ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, X, m[200];
    cin >> N >> X;
    int sum = 0, min;
    for (int i = 0; i < N; i++)
    {

        cin >> m[i];
        sum += m[i];
    }
    min=m[0];
    for (size_t i = 0; i < N; i++)
    {

        if (min > m[i])
        {
            min = m[i];
        }
    }
    int ans = N + (X - sum) / min;
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
D = list(map(int, input().split()))

mod = 998244353
c = Counter(D)
m = max(c.keys())

if D[0] == 0 and c[0] == 1:
    ans = 1
    for i in D[1:]:
        ans *= c[i-1]
        ans %= mod
    print(ans)
else:
    print(0)


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

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v)
{
  for (typename std::vector<T>::size_type i = 0; i < v.size(); ++i) {
    os << v[i];
    if (i + 1 < v.size()) { os << ' '; }
  }
  return os;
}

long long solve(unsigned N, const std::vector<long long> &a, int flag)
{
  long long c = 0;
  
  long long s = 0;
  for (unsigned n = 0; n < N; ++n) {
    long long b = s + a[n];
    if (n % 2 == flag) {
      // 正
      if (b <= 0) {
        c += std::abs((+1) - b);
        s = +1;
      } else {
        s = b;
      }
    } else {
      // 負
      if (b >= 0) {
        c += std::abs((-1) - b);
        s = -1;
      } else {
        s = b;
      }
    }
  }
  
  return c;
}

int main()
{
  unsigned N;
  std::cin >> N;
  
  std::vector<long long> a(N);
  for (unsigned n = 0; n < N; ++n) {
    std::cin >> a[n];
  }
  
  std::cout << std::min(solve(N, a, 0), solve(N, a, 1)) << std::endl;
  
  return 0;
}

Measured memory_bytes: 1024
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return r'\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
a=[None]*m
b=a[:]
ans=0
for i in range(m):
  a[i],b[i]=map(lambda x:x-1,map(int,input().split()))
for i in range(m):
  u=UnionFind(n)
  for j in range(m):
    if j!=i:
      u.union(a[j],b[j])
  if u.size(0)!=n:
    ans+=1
print(ans)

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int k;
  cin >> k;
  
  // 重み付き無向(有向)グラフの隣接リスト
  vector<vector<pair<int, ll>>> G(k); // G:頂点数kのグラフの隣接リスト
  
  // mod K
  for (int i = 0; i < k; i++) {
    G[i].emplace_back(make_pair((i + 1) % k, 1));
    G[i].emplace_back(make_pair((i * 10) % k, 0));
  }
  
  vector<ll> d(k, 1e9);
  d[1] = 1;
  deque<int> dq;
  dq.push_back(1);
  while (!dq.empty()) {
    int v = dq.front();
    dq.pop_front();
    for (int i = 0; i < G[v].size(); i++) {
      if (d[G[v][i].first] <= d[v] + G[v][i].second) continue;
      d[G[v][i].first] = d[v] + G[v][i].second;
      if (G[v][i].second == 0) dq.push_front(G[v][i].first);
      else dq.push_back(G[v][i].first);
    }
  }
  
  cout << d[0] << '\n';
}

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

template <typename InputIterator>
typename InputIterator::value_type
summation(InputIterator first, InputIterator last) {
  using T = typename InputIterator::value_type;
  T *p = new T();
  const auto sum = std::accumulate(first, last, *p);
  delete p;
  return sum;
}
template <typename T>
std::istream& operator>> (std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream& operator>> (std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<int> c(n, 0);

  for (int i = 0; i < m; i++) {
    int a, b;
    std::cin >> a >> b;
    a--;
    b--;
    c[a]++;
    c[b]++;
  }

  for (const auto i : c) {
    std::cout << i << std::endl;
  }
  return 0;
}

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

int main() {
    long int N;
    cin >> N;
    int cnt = 1;
    for (int i = 0; i < N; i++) {
        if (cnt*cnt > N) break;
        cnt++;
    }
    cout << (cnt-1)*(cnt-1) << "\n";
}

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

int main() {
    int n; cin >> n;
    int N[n], n_min = INT_MAX;
    for (int i = 0; i < n; i++) {
        cin >> N[i];
        if (N[i] < n_min) n_min = N[i];
    }
    for (int j = 1; j <= n_min; j++) {
        bool div_all = true;
        for (int i = 0; i < n; i++) if (N[i] % j != 0) div_all = false;
        if (div_all == true) cout << j << endl;
    }
}


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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    string S, T;
    cin >> S >> T;
    cout << T + S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    vector<bool> dp(K + 1);
    // dp[i]:=石がi個からスタートしたときどちらが勝つか 1:=First
    dp[0] = 0;
    for(int i = 0; i <= K; i++) {
        bool nim = 0;
        for(int j = 0; j < N; j++) {
            if(i - A[j] >= 0)
                nim |= !dp[i - A[j]];
        }
        dp[i] = nim;
    }
    if(dp[K]) {
        cout << "First" << endl;
    } else {
        cout << "Second" << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    string s; cin>>s;
    reverse(al(s));
    ll n=s.size(),cnt=1;
    vector<ll> m(n+1,0);
    map<ll,ll> r;
    r[0]=1;
    rep(i,n){
        m[i+1]=(m[i]+cnt*(s[i]-'0'))%2019;
        cnt=(cnt*10%2019);
        if(r.count(m[i+1])) r[m[i+1]]++;
        else r[m[i+1]]=1;
    }
    ll ans=0;
    for(auto q : r){
        ans+=q.second*(q.second-1)/2;
    }
    cout<<ans<<endl;
}

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

#define FOR(i,l,r) for(int i = (int) (l);i < (int) (r);i++)
#define ALL(x) x.begin(),x.end()
template<typename T> bool chmax(T& a,const T& b){ return a < b ? (a = b,true) : false; }
template<typename T> bool chmin(T& a,const T& b){ return b < a ? (a = b,true) : false; }
typedef long long ll;

ll N;
map<ll,ll> mp;

int main()
{
	FOR(i,0,1001) FOR(j,0,1001){
		mp [i + j]++;
	}

	while(~scanf("%lld",&N)){
		ll ans = 0;
		FOR(i,0,N + 1){
			ans += mp [i] * mp [N - i];
		}
		printf("%lld\n",ans);
	}

	return 0;
}

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

using namespace std;

#define INF 1e9
typedef vector<int> Vec;
typedef pair<int,int> pii;

struct Edge{
  int to,cost;
  Edge(int to,int cost) :
    to(to),cost(cost) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int N;
Graph G;

Vec dijkstra(int s){
  Vec dist(N,INF);
  dist[s] = 0;
  priority_queue<pii,vector<pii>,greater<pii> > Q;
  Q.push(pii(0,s));
  while(!Q.empty()){
    pii p = Q.top(); Q.pop();
    int v = p.second;
    if(dist[v] < p.first){
      continue;
    }
    for(int i = 0 ; i < (int)G[v].size() ; i++){
      Edge &e = G[v][i];
      if(dist[v] + e.cost < dist[e.to]){
        dist[e.to] = dist[v] + e.cost;
        Q.push(pii(dist[e.to],e.to));
      }
    }
  }
  return dist;
}

int getFarthestPoint(int v){
  Vec vec = dijkstra(v);
  int resv = -1, max = -1;
  for(int i = 0 ; i < N ; i++){
    if(max < vec[i]){
      max = vec[i];
      resv = i;
    }
  }
  return resv;
}

Vec getTreeHeight(){
  int v1 = getFarthestPoint(0);
  int v2 = getFarthestPoint(v1);
  Vec d1 = dijkstra(v1), d2 = dijkstra(v2);
  Vec res(N);
  for(int i = 0 ; i < N ; i++){
    res[i] = max(d1[i],d2[i]);
  }
  return res;
}

int main(){
  int a,b,c;
  cin >> N;
  G.resize(N);
  for(int i = 0 ; i < N-1 ; i++){
    cin >> a >> b >> c;
    G[a].push_back(Edge(b,c));
    G[b].push_back(Edge(a,c));
  }
  Vec height = getTreeHeight();
  for(int i = 0 ; i < N ; i++){
    cout << height[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 2004
import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())


def main():
    n = I()
    k = I()
    xs = LI()

    r = 0
    for x in xs:
        r += 2*min(k-x, x)

    return r


print(main())


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll long long
#define gcd(x,y) __gcd(x,y)
#define fi first
#define se second
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline ll abs(A &a) { return (a < 0 ? -a : a); }
using namespace std;
const ll inf=(1LL<<62);
const ll MOD=(1e9)+7;
const ll mod=998244353;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, x, t;
  cin >> n >> x >> t;
  int a = n / x;
  if (n % x != 0) {
    a++;
  }
  cout << a * t << "\n";
  return 0;
}
 

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
//constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N,D;
    cin>>N>>D;
    int X[N],Y[N];
    rep(i,N){
        cin>>X[i]>>Y[i];
    }

    two_sat ts(N);
    rep(i,N){
        for(int j=i+1;j<N;j++){
            if(abs(X[i]-X[j])<D){
                ts.add_clause(i,false,j,false);
            }
            if(abs(X[i]-Y[j])<D){
                ts.add_clause(i,false,j,true);
            }
            if(abs(Y[i]-X[j])<D){
                ts.add_clause(i,true,j,false);
            }
            if(abs(Y[i]-Y[j])<D){
                ts.add_clause(i,true,j,true);
            }
        }
    }
    if(!ts.satisfiable()){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    auto ans=ts.answer();
    rep(i,N){
        if(ans[i]){
            cout<<X[i]<<endl;
        }else{
            cout<<Y[i]<<endl;
        }
    }




}


Measured memory_bytes: 3780
i = list(map(int, input().split()))
H = i[0]
W = i[1]

if H == 1 or W == 1:
    print(1)
else:
    if H % 2 == 0 or W % 2 == 0:
        print(int(W * H / 2))
    else:
        print(int(W * H // 2) + 1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
#define F first
#define S second
int main()
{
    Hello
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int diffx = x2 - x1;
    int diffy = y2 - y1;
    cout << x2 - diffy << " ";
    cout << y2 + diffx << " ";
    cout << x1 - diffy << " ";
    cout << y1 + diffx;
    return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")

#include "bits/stdc++.h"
using namespace std;
typedef int64_t lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef pair<int,pll> pip;
typedef pair<pll,int> ppi;
typedef pair<lld,pll> plp;
typedef pair<pll,lld> ppl;
typedef pair<pll,pll> ppp;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<class T1,class T2>
ostream& operator<<(ostream& out, pair<T1,T2> p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) {
     return _out(s,c.begin(),c.end());
 }
#ifdef erd1
    #define pprint(x) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<endl
#else
    #define pprint(x)
#endif

// code starts here

vector<int> v;
vector<pii> st;
void push(int i){
    while(st.size() && st.back().ff > i)st.pop_back();
    if(st.empty() || st.back().ff != i)st.pb({i, 0});
    st.back().ss++;
}
signed main(){
    int n, ls = INT_MAX, x;
    bool f = true;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        if(ls >= x)v.pb(x);
        ls = x;
    }
    if(v.size() == 1)return cout << 1 << endl, 0;
    for(int i = 1; i < v.size(); i++)v[i-1] = v[i];
    v.pop_back();
    int l = 2, r = n;
    while(l != r){
        st.clear();
        int k = l+r>>1;
        for(auto i: v){
            push(i);
            while(st.back().ff && st.back().ss==k)
                push(st.back().ff-1);
        }
        if(!st[0].ff)l = k+1;
        else r = k;
    }
    cout << l << endl;
}


Measured memory_bytes: 1400
S=input()
left=int(S[:2])
right=int(S[2:])
mmyy,yymm=False,False
if 12>=left and left>=1:
    mmyy=True
if 12>=right and right>=1:
    yymm=True

if mmyy==True and yymm==False:
    print('MMYY')
elif mmyy==False and yymm==True:
    print('YYMM')
elif mmyy==True and yymm==True:
    print('AMBIGUOUS')
else:
    print('NA')


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
int main() {
	int l, n; std::cin >> l >> n;
	std::vector<int> clock_wise(n), counter_clock_wise;
	for (auto& x : clock_wise) std::cin >> x;
	for (auto i = 1; i <= n; ++i) {
		counter_clock_wise.push_back(l - clock_wise[clock_wise.size() - i]);
	}
	std::vector<long long int> sum_clock_wise(1, 0); std::copy(clock_wise.begin(), clock_wise.end(), std::back_inserter(sum_clock_wise));
	std::vector<long long int> sum_counter_clock_wise(1, 0); std::copy(counter_clock_wise.begin(), counter_clock_wise.end(), std::back_inserter(sum_counter_clock_wise));
	for (auto i = 1; i <= n; ++i) {
		sum_clock_wise[i] += sum_clock_wise[i - 1];
		sum_counter_clock_wise[i] += sum_counter_clock_wise[i - 1];
	}
	long long int max = std::max(clock_wise.back(), counter_clock_wise.back());
	for (auto small = 1; small * 2 <= n; ++small) {
		auto large = n - small;
		if (small != large) {
			auto cw = sum_clock_wise[small] * 2;
			auto ccw = (sum_counter_clock_wise[large] - sum_counter_clock_wise[large - small]) * 2;
			auto cmax = cw + ccw - std::min(counter_clock_wise[large - 1] - counter_clock_wise[large - small - 1] * 2, clock_wise[small - 1]);
			if (max < cmax) max = cmax;
		}
		else {
			auto cw = sum_clock_wise[small] * 2;
			auto ccw = (sum_counter_clock_wise[large] - sum_counter_clock_wise[large - small]) * 2;
			auto cmax = cw + ccw - std::min(counter_clock_wise[large - 1], clock_wise[small - 1]);
			if (max < cmax) max = cmax;
		}
	}
	for (auto small = 1; small * 2 <= n; ++small) {
		auto large = n - small;
		if (small != large) {
			auto cw = (sum_clock_wise[large] - sum_clock_wise[large - small]) * 2;
			auto ccw = sum_counter_clock_wise[small] * 2;
			auto cmax = cw + ccw - std::min(clock_wise[large - 1] - clock_wise[large - small - 1] * 2, counter_clock_wise[small - 1]);
			if (max < cmax) max = cmax;
		}
		else {
			auto cw = (sum_clock_wise[large] - sum_clock_wise[large - small]) * 2;
			auto ccw = sum_counter_clock_wise[small] * 2;
			auto cmax = cw + ccw - std::min(clock_wise[large - 1], counter_clock_wise[small - 1]);
			if (max < cmax) max = cmax;
		}
	}
	std::cout << max << std::endl;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
      cerr << fixed << setprecision(20);
    }
} iosetup;

int main() {
  int n; cin >> n;
  string s; cin >> s;
  int cnt = 0;
  for (int i = 0; i < 1000; ++i) {
    int f = 0;
    vector<int> vec = {i/100, (i/10)%10, i % 10};
    for (int j = 0; j < n; ++j) {
      if (s[j] == ('0' + vec[f])) f++;
      if (f == 3) break;
    }
    if (f == 3) cnt++;
  }
  cout << cnt << '\n';
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize ("Ofast")
#include <cstdio>
#include <cctype>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)

// inline int gc()noexcept { return getchar_unlocked(); }
inline int gc()noexcept { return getchar(); }
inline int in()noexcept {
	int v = 0; char c = gc();
	for (; isdigit(c); c = gc()) {
		v *= 10;
		v += c - '0';
	}
	return v;
}

using Weight = int;
constexpr Weight INF = numeric_limits<Weight>::max();
struct Edge {
	int to; Weight cost;
	Edge() :to(-1), cost(-1) {}
	Edge(int _to, Weight _cost = 1) :to(_to), cost(_cost) {}
};
bool operator>(const Edge& e1, const Edge& e2) { return e1.cost > e2.cost; }
struct Edge2 {
	int u, v; Weight cost;
	Edge2() :u(-1), v(-1), cost(0) {}
	Edge2(int _u, int _v, Weight _cost) :u(_u), v(_v), cost(_cost) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;
using UnWeightedGraph = vector<vector<int>>;

class UnionFind {
	vector<int> par, sz;
public:
	UnionFind(int n = 1) {
		init(n);
	}
	void init(int n) {
		par.resize(n); sz.resize(n);
		for (int i = 0; i < n; i++)par[i] = i, sz[i] = 1;
	}
	int root(int x) {
		if (par[x] == x)return x;
		else return par[x] = root(par[x]);
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int size(int x) {
		return sz[root(x)];
	}
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x == y)return false;
		par[y] = x;
		sz[x] += sz[y];
		return true;
	}
};

Weight Kruskal(int V, vector<Edge2>& graph) {
	sort(graph.begin(), graph.end(),
		[](const Edge2& e1, const Edge2& e2) {return e1.cost < e2.cost; });
	int E = graph.size(); Weight res = 0;
	UnionFind uf(V);
	for (auto e : graph) {
		if (uf.unite(e.u, e.v)) {
			res += e.cost;
		}
	}
	return res;
}

int main() {
	int n = in(), m = in();
	vector<Edge2> edges;
	rep(i, m) {
		int a = in(), b = in(); Weight c = in();
		edges.emplace_back(a, b, c);
		edges.emplace_back(b, a, c);
	}
	cout << Kruskal(n, edges) << endl;
}


Measured memory_bytes: 5856
for _ in [0]*input():
  A = "012345678954321"
  a, b = raw_input().split()
  n = 15
  for _ in [0]*A.count(a):
    I = A.index(a)
    A = A[I:]+A[:I]
    I = A.index(b)
    if n>I:
      n = I
      x = A[:I+1]
    A = A[1:]+A[0]
  print " ".join(x)

Measured memory_bytes: 4224
S = input()
alpha = "abcdefghijklmnopqrstuvwxyz"
D = {alpha[i]: [i, 0] for i in range(len(alpha))}
for i in S:
  D[i][1] += 1
L = [D[i] for i in D]
L.sort()
if min(L[i][1] for i in range(len(alpha))) >= 1:
  print("None")
else:
  for i in range(len(alpha)):
    if L[i][1] == 0:
      break
  print(alpha[i])

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  ll s, c;
  cin >> s >> c;

  ll ans = 0;

  ll hc = c / 2;

  if (hc > s) {
    ans += s;
    c -= s * 2;
    ans += c / 4;
  } else {
    ans += hc;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "1 1" ].solve == 1 );		// 追加ケース
	assert( [ "1 2" ].solve == 1 );		// 追加ケース
	assert( [ "1 3" ].solve == 0 );		// 追加ケース
	assert( [ "10 1" ].solve == 1000 );		// 追加ケース
	
	assert( [ "3 2" ].solve == 9 );
	assert( [ "5 3" ].solve == 1 );
	assert( [ "31415 9265" ].solve == 27 );
	assert( [ "35897 932" ].solve == 114191 );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = 0L;
	auto k = 0L;
	input.front.formattedRead!"%s %s"( n, k );
	
	auto ans = ( n / k ) ^^ 3;
	if( k % 2 == 0 ) ans += ( ( n / ( k / 2 ) + 1 ) / 2 ) ^^ 3;
	return ans;
}


Measured memory_bytes: 2864
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n,k=map(int, input().split()) 
for i in range(1,k+1):
    if  i > n-k+1:
        print(0)
    else:
        print(cmb(n-k+1,i)%(10**9+7)*cmb(k-1,i-1)%(10**9+7))

Measured memory_bytes: 3444
s = input()
lis=[]
for i in range(len(s)):
    if s[i] not in "ACGT":
        lis.append(i)
len_max = 0
for i in range(len(lis)-1):
    len_max = max(len_max,lis[i+1]-lis[i]-1)

if lis != []:
    print(max(len_max,lis[0],len(s)-lis[-1]-1))
else:
    print(len(s))

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0;i < N;i++){
        cin >> A.at(i);
    }
    int min = 0;
    for(int i = 1;i < N;i++){
        for(int k = min + i - 1;k < N;k++){
            if(A.at(k) == i){
                break;
            }
            else{
                min++; 
            }
        }
        if(i == 1 && min == N) break;
    } 
    if(min == N){
        cout << "-1" << endl;
    }
    else{
        cout << min << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define repeat(i,a,b) for(int i=(a),i##__end=(b);i<i##__end;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,i##__end=(a);i>=i##__end;i--)
#define mst(a,x) memset((a),(x),sizeof(a))
#define pii pair<int,int>
#define N 1000010
#define mod 2147483647
#define int ll
string s;
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	if(n%2==1){cout<<"No"<<endl;return 0;}
	cin>>s;
	repeat(i,0,n/2){
		if(s[i]!=s[i+n/2]){cout<<"No"<<endl;return 0;}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

   vector<string> grade;
   int m, f, r;

   cin >> m >> f >> r;

   while(!(m == -1 && f == -1 && r == -1)){
      int exam = m + f;
      
      if(m == -1 || f == -1){
         grade.push_back("F");
      }
      else if(exam >= 80){
         grade.push_back("A");
      }
      else if(exam >= 65){
         grade.push_back("B");
      }
      else if(exam >= 50){
         grade.push_back("C");
      }
      else if(exam >= 30){
         if(r >= 50){
            grade.push_back("C");
         }
         else{
            grade.push_back("D");
         }
      }
      else{
         grade.push_back("F");
      }

      cin >> m >> f >> r;

   }

   for(int i = 0; i < grade.size(); i++){
      cout << grade[i] << endl;
   }

   return 0;
}


Measured memory_bytes: 3172
s = Array.new(1001,  0)
1.upto(999) do |i|
    sum = i
    (i+1).upto(1000) do |j|
        sum += j
        break if sum > 1000
        s[sum] += 1
    end
end
loop do
    n = gets.to_i
    break if n == 0
    puts s[n]
end

Measured memory_bytes: 6084
#include<iostream>
using namespace std;
int main(){

	int x,i,j,num;
	char a,mark[4]={'S','H','C','D'};

	bool all[4][13]={};

	cin>>x;
	for(i=0;i<x;i++){
		cin>>a>>num;
		switch(a){
		case'S':
			all[0][num-1]=true;
			break;
		case'H':
			all[1][num-1]=true;
			break;
		case'C':
			all[2][num-1]=true;
			break;
		case'D':
			all[3][num-1]=true;
			break;
		}
	}

	for(i=0;i<4;i++){
		for(j=0;j<13;j++){
			if(all[i][j]==false){
				cout<<mark[i]<<" "<<j+1<<endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1164