akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


void solve() {
	string S, T;
	int A, B; cin >> S >> T >> A >> B;
	string U; cin >> U;
	if (S == U)A--;
	else B--;
	pe(A); print(B);
}

signed main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a_dict = {}
s = sum(a)

for ai in a:
  if a_dict.get(ai):
    a_dict[ai] += 1
  else:
    a_dict[ai] = 1

q = int(input())
for _ in range(q):
  b, c = map(int, input().split())
  x = a_dict.get(b, 0)
  s += (c - b) * x
  if a_dict.get(c):
    a_dict[c] += x
  else:
    a_dict[c] = x
  a_dict[b] = 0
  print(s)


Measured memory_bytes: 23612
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int,int> > edge[100005];
int dis[100005];
bool check[100005];
priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		dis[i]=1e18;
	}
	int s=n+1;
	check[s]=1;
	dis[s]=0;
	for(int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		edge[u].push_back(make_pair(1,v));
		edge[v].push_back(make_pair(1,u));
	}
	int k;
	cin>>k;
	while(k--){
		int u,p;
		cin>>u>>p;
		check[u]=1;
		dis[u]=p;
		pq.push(make_pair(dis[u],u));
	}
	while(!pq.empty()){
		pair<int,int> t=pq.top();
		pq.pop();
		int u=t.second,val=t.first;
		if(dis[u]<val) continue;
		for(int i=0;i<edge[u].size();i++){
			pair<int,int> bang=edge[u][i];
			int cost=bang.first,v=bang.second;
			if(dis[u]+cost<dis[v]){
				if(check[v]){
					cout<<"No";
					return 0;
				}
				dis[v]=dis[u]+cost;
				pq.push(make_pair(dis[v],v));
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<edge[i].size();j++){
			if(dis[i]-dis[edge[i][j].second]!=1&&dis[edge[i][j].second]-dis[i]!=1){
				cout<<"No";
				return 0;
			}
		}
	}
	cout<<"Yes\n";
	for(int i=1;i<=n;i++){
		cout<<dis[i]<<"\n";
	}
}

Measured memory_bytes: 11248
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

ll n,m,x;
ll c[12];
ll a[12][12];
ll ans;
//string s;
void dfs(int i,ll mny,ll skl[12]){

	if(i==n){
		return;
	}
//	cout<<i<<" "<<mny<<" "<<endl;
//	rep(i,0,m) cout<<skl[i]<<" ";
//	cout<<endl;

	int ok=1;
	ll skl_tmp[m];
	ll mny_tmp;
	mny_tmp=mny+c[i];
	rep(k,0,m){
		skl_tmp[k]=skl[k]+a[i][k];
		if(skl_tmp[k]<x) ok=0;
	}
	if(ok){
		if(ans>mny_tmp) ans=mny_tmp;
	}
    dfs(i+1,mny,skl);
    dfs(i+1,mny_tmp,skl_tmp);
	return;
}

signed main(){
	acc_io;
	cin>>n>>m>>x;
	rep(i,0,n){
		cin>>c[i];
		rep(j,0,m){
			cin>>a[i][j];
		}
	}
	ans=1e9;
	ll skl[12]={0};
	dfs(0,0,skl);
	if(ans==1e9) ans=-1;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3668
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

int main()
{
    int n,m,i,temp,temp2;
    scanf("%d %d",&n,&m);
    if(n<m)
        temp=n;
    else temp=m;

    if(n>m)
        temp2=n;
    else temp2=m;
    for(i=0; i<temp2; i++)
        printf("%d",temp);
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
		int count = 0;
		String str;
		
		for(int i=A; i<=B; i++) {
			str = ""+A;
			if(str.charAt(0) == str.charAt(4) && str.charAt(1) == str.charAt(3)) {
				count++;
			}
			A++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 30804
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define inf (int)(3e18)
#define all(v) v.begin(),v.end()
#define mod (int)(1e9+7)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int X,Y,A,B,C;
int p[100005],q[100005],r[100005];
int sum[200005],sum2[200005];
signed main() {
	cin>>X>>Y>>A>>B>>C;
	rep(i,A)cin>>p[i];
	sort(p,p+A,greater<>());
	rep(i,B)cin>>q[i];
	sort(q,q+B,greater<>());
	rep(i,C)cin>>r[i];
	sort(r,r+C,greater<>());
	vector<int>v;
	rep(i,X)v.push_back(p[i]);
	rep(i,Y)v.push_back(q[i]);
	sort(all(v),greater<>());
	rep(i,X+Y)sum[i+1]=sum[i]+v[i];
	rep(i,C)sum2[i+1]=sum2[i]+r[i];
	int ans=-inf;
	rep(i,X+Y+1){
		if(X+Y-i<=C){
			chmax(ans,sum[i]+sum2[X+Y-i]);
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 6512
// ddcc_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;


int func(string n){

    int cnt = 0;
    while (n.size() > 1){
        int sm = ((n[0] - '0') + (n[1] - '0'));
        n = to_string(sm) + n.substr(2, n.size()-2);
        cnt++;
    }

    return cnt;

}


int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll M;
    cin >> M;

    vector<ll> A(10, 0);
    REP(i, M){
        ll d, c;
        cin >> d >> c;
        A[d] += c;
    }

    ll ans = 0;

    bool update = true;
    while (update){
        update = false;

        ans += A[0];
        A[0] = 0;

        REPN(d, 1, 10){
            if (A[d] < 2) continue;
            update = true;
            int x = d * 2;
            ans += A[d] / 2;
            if (x < 10){
                A[x] += A[d] / 2;
                A[d] = A[d] % 2;
            } else {
                A[1] += A[d] / 2;
                A[x % 10] += A[d] / 2;
                A[d] = A[d] % 2;
            }
        }
    }


    string n;
    REP(d, 10){
        if (A[d] == 1) {
            n += to_string(d);
        }
    }


    ans += func(n);

    print(ans);


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a>b) cout << a-1 << endl;
  else cout << a << endl;

}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(500000)

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    S = input()
    N = len(S)//2
    for i in range(1, N+1):
        t = S[:2*N-2*i]
        n = len(t)//2
        if t[:n] == t[n:]:
            print(2*n)
            return

if __name__ == '__main__':
    main()


Measured memory_bytes: 61932
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {

	int n, m, x;
	cin >> n >> m >> x;
	vector<int>a(m);
	int mas[110] = { 0 };
	
	for (int i = 0; i < m; i++){
		cin >> a[i];
		mas[a[i]] = 1;
	}

	int right, left;
	right = left = 0;

	for (int i = x; i < n; i++)
		if (mas[i] == 1)
			left++;

	for (int i = 0; i < x; i++)
		if (mas[i] == 1)
			right++;

	cout << min(right, left) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define NFOR(i,a,b) for(int i = (int)(a); i >= (int)(b); --i)
#define endl "\n"
#define mp make_pair
#define X first
#define Y second
#define inf 1e9
#define mod 1000000007
#define pb push_back
#define Case cout<<"Case #"<<++cas<<": ";
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(v) v.begin(),v.end()
#define sz(x) int(x.size())
// #define lli int
typedef long long int lli;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<lli,lli> pll;
typedef vector<lli> vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef complex <long double> complex_t;
const long double PI = acos((long double)-1.0);

#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}

int main() {
    int n;
    vi a, b, c;
    cin >> n;
    ll answer1 = 0;
    FOR(i, 0, n-1) {
        int temp; cin >> temp; a.pb(temp);
    }
    FOR(i, 0, n-1) {
        int temp; cin >> temp; b.pb(temp);
    }
    FOR(i, 0, n-1) {
        int temp; cin >> temp; c.pb(temp);
    }
    sort(all(a)), sort(all(b)), sort(all(c));
    FOR(i, 0, n-1) {
        auto firstPosition = lower_bound(a.begin(), a.end(), b[i]);
        auto secondPosition = upper_bound(c.begin(), c.end(), b[i]);
        ll temp = 0;
        if (firstPosition == a.begin() || secondPosition == c.end()) continue;
        firstPosition--;
        temp = (firstPosition - a.begin() + 1) * 1LL * (c.end() - secondPosition);
        answer1 += temp;
    }
    cout << answer1 << endl;
return 0;}

Measured memory_bytes: 1784
#include<iostream>
#include<vector>
#include<ctype.h>
#include<string>
using namespace std;

string s,p;

int main(){
    cin>>s>>p;
    s+=s;
    if(s.find(p) != string::npos){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

int main(){
	dhoom;
	string s;
	cin >> s;
	cout << "2018" << s.substr(4,s.size() - 4);
	return 0;
}


Measured memory_bytes: 256
s=input()
l=2**3

for i in range(l):
    j=i
    c=int(s[0])
    n=1
    for x in range(3):
        if i & 1 ==1:
            c+=int(s[n])
        else:
            c-=int(s[n])
        i=i>>1
        n+=1
    #print(c,j)
    if c==7:
        break

ss=[s[0]]
for i in range(3):
    if j & 1 ==1:
        ss.append('+')
    else:
        ss.append('-')
    ss.append(s[i+1])
    j=j>>1
print(''.join(ss)+'=7')

Measured memory_bytes: 38256
#include <stdio.h>

int main(){
	int n, i, a, min, max;
	long sum;
	scanf("%d %d", &n, &min);
	max = min;
	sum = min;
	for(i = 1; i < n; i++){
		scanf("%d", &a);
		if(min > a){
			min = a;
		}
		if(max < a){
			max = a;
		}
		sum += a;
	}
	printf("%d %d %ld\n", min, max, sum);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=0,a=0,b=0;
std::cin >>x;
while(1){
  if(IsPrime(x)){
    std::cout << x << '\n';
    return 0;
  }else{
    x++;
  }
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;


int main() {
  int n;cin >> n;
  if(n%2)cout << double((n+1)/2)/double(n);
  else cout << fixed << setprecision(10)<<0.5;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d)cout<<"Yes"<<endl;
    else if(abs(a-b)<=d&&abs(b-c)<=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
        cerr << fixed << setprecision(10);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }



signed main() {

	int m1, m2, d1, d2;

	cin >> m1 >> d1 >> m2 >> d2;

	cout << (m2 > m1) << endl; 

    return 0;
}



Measured memory_bytes: 256
import java.util.Map;
import java.util.Scanner;

public class Main {

    /**
     * 本処理を実行します。
     */
    public static void execute() {
        Scanner sc = new Scanner(System.in);

        int n = nextInt(sc);
        int k = nextInt(sc);
        int num = 1;

        for (int i = 0; i < n; i++) {
            if (num < k) {
                num *= 2;
            } else {
                num += k;
            }
        }

        out(num);
    }

    /**
     * 次の標準入力をintで受け取ります。
     * @return 標準入力値(int)
     */
    public static int nextInt(Scanner sc) {
        return sc.nextInt();
    }

    /**
     * 次の標準入力をStringで受け取ります。
     * @return 標準入力値(String)
     */
    public static String nextString(Scanner sc) {
        return sc.next();
    }

    /**
     * 次の標準入力を指定回数分intで受け取ります。
     * @param n 取得回数
     * @return 取得した標準入力値の配列(int)
     */
    public static int[] nextInts(Scanner sc, int n) {
        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = nextInt(sc);
        }

        return arr;
    }

    /**
     * 標準出力にオブジェクトを出力します。
     * @param o 出力対象
     */
    public static void out(Object o) {
        System.out.println(o);
    }

    public static void main(String[] args) {
        execute();
    }

    public static void putCountMap(Map<Integer, Integer> map, int value) {
        if (map.containsKey(value)) {
            map.put(value, map.get(value) + 1);
        } else {
            map.put(value, 1);
        }
    }
}



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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	REP(i, n) {
		cin >> v[i];
	}
	sort(ALL(v));
	reverse(ALL(v));
	int res = 0;
	REP(i, k) {
		res += v[i];
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1&&b==2){
    cout<<3;
  }
  else if(a==2&&b==1){
    cout<<3;
  }
  else if(a==1&&b==3){
    cout<<2;
  }
  else if(a==3&&b==1){
    cout<<2;
  }
  else if(a==2&&b==3){
    cout<<1;
  }
  else if(a==3&&b==2){
    cout<<1;
  }
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if (a == b+c || b == a+c || c == a+b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main(){
    int n;
    cin >> n;
    double L = n/3.0;
    double ans = L*L*L;
    cout << std::setprecision(12) << ans <<endl;
    return 0;
}



Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let X = xs[0];
   let A = xs[1];
   let B = xs[2];
   
   if(B-A<=0){
     console.log('delicious');
   }else if(B-A<=X){
     console.log('safe');
   }else{
     console.log('dangerous');
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
while line = gets
  n = line.to_i
  cnt = 0
  if n > 36
    puts 0
  else
    (0..9).each do |a|
      (0..9).each do |b|
        (0..9).each do |c|
          (0..9).each do |d|
            cnt += 1 if a + b + c + d == n
          end
        end
      end
    end
    puts cnt
  end
end

Measured memory_bytes: 8600
// fahadmd16(IIEST Shibpur)
#include<bits/stdc++.h>
#include <algorithm>
using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define db double
#define pll pair<ll, ll>
#define ALL(a) (a).begin(),(a).end()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define forn(i, n) for (ll i = 0; i < n; i++)
#define forn1(i, n) for (ll i = 1; i < n; i++)
#define forab(i,a,b) for(ll i=a;i<b;i++)
#define clr(x) memset(x, 0, sizeof(x))
#define count_bit(x) __builtin_popcount(x)
#define endl "\n"
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define eps 1e-10
#define nedl endl
const ll sz = 1001;
const ll mod = 1e9 + 7;
typedef vector<ll> VL;
typedef vector<pll > VLL;
typedef vector<vector<ll> > VVL;

ll power(ll n, ll k, ll m) {
    ll ans = 1;
    while (k) {
        if (k & 1)ans = (ans * n) % m;
        k /= 2;
        n = (n * n) % m;
    }
    return ans;
}


int main() {
    IOS;

    ll T = 1; //cin >> T;
    while (T--) {
        ll x,y,z;cin>>x>>y>>z;
        swap(x,y);
        swap(x,z);
        cout<<x<<" "<<y<<" "<<z<<endl;
		

		
		
    }
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	N := ReadInt()
	m := make(map[string]int)
	maxCount := 0
	for i := 0; i < N; i++ {
		s := ReadString()
		m[s]++
		if m[s] > maxCount {
			maxCount = m[s]
		}
	}
	ans := make([]string, 0)
	for s, c := range m {
		if c == maxCount {
			ans = append(ans, s)
		}
	}
	sort.Strings(ans)
	for _, s := range ans {
		fmt.Println(s)
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }


Measured memory_bytes: 33844
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
#include<regex>
#include<numeric>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
	int ans[100000];
	int n;
	vector<pair<int,int>> edge[100000];
	queue<int> zero;
	queue<int> one;
	int num;
	cin >> n;
	for (int i = 0; i < n-1; i++) {
		ll a, b, c;
		cin >> a >> b >> c;
		b--;
		a--;
		edge[a].push_back(make_pair(b, c % 2));
		edge[b].push_back(make_pair(a, c % 2));
	}
	num = n;
	fill(ans, ans + n, -1);

	zero.push(0);
	while((!zero.empty())||(!one.empty())){
		if (!zero.empty()) {
			int now = zero.front();
			zero.pop();
			for (int i = 0; i < edge[now].size(); i++) {
				if (ans[edge[now][i].first] == -1) {
					if (edge[now][i].second == 0) {
						zero.push(edge[now][i].first);
						ans[edge[now][i].first] = 0;
					}
					else {
						one.push(edge[now][i].first);
						ans[edge[now][i].first] = 1;
					}
				}
			}
		}
		if (!one.empty()) {
			int now = one.front();
			one.pop();
			for (int i = 0; i < edge[now].size(); i++) {
				if (ans[edge[now][i].first] == -1) {
					if (edge[now][i].second == 0) {
						one.push(edge[now][i].first);
						ans[edge[now][i].first] = 1;
					}
					else {
						zero.push(edge[now][i].first);
						ans[edge[now][i].first] = 0;
					}
				}
			}
		}
	}
	for (int i = 0; i < n ; i++)cout << ans[i] << endl;

}



Measured memory_bytes: 6784
## coding: UTF-8
X = int(input())

N = 10**5 + 10
#素数列挙
Fresh = [False, False] + [True] * (N-1)

for i in range(int((N+1)**0.5) + 1):
#for i in range(N+1):
    if(Fresh[i] == True):
        for j in range(i*2, N+1, i):
            Fresh[j] = False
        #print(Fresh)

#print([i for i in range(N+1) if Fresh[i] == True])

for i in range(X, N+1):
    if(Fresh[i] == True):
        print(i)
        break



#print(Fresh)



Measured memory_bytes: 40304
#include<stdio.h>

int main(){
    int width,height,x,y,r;
    scanf("%d%d%d%d%d",&width,&height,&x,&y,&r);

    if(x>0 && y > 0){
        if( r <= x && x <= width-r && r <= y && y <= height-r){
                printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else{
        printf("No\n");
    }

    return 0;
}


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

int main(void){
  int n;
  cin >> n;
  int c = 4;
  int d = 7;
  int m;
  bool flag = false;
  for(int i = 0; i <=n; i += c){
    m = n;
    m -= i;
    if(m % d == 0){
      flag = true;
      break;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+100;
const int mod = 1e9+7;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
int main(){
    ll n;
    read(n);
    if(n%2==0){
        cout<<n/2-1<<endl;
        return 0;
    }
    cout<<n/2<<endl;
    return 0;
}

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

#[fastout]
fn main() {
    input! {
        mut n: i64,
        k: i64,
    }

    let mut ans = 1;
    for i in k..=n {
        let small = sum(i-1);
        let large = sum(n) - sum(n-i);
        if large > small {
            ans = (ans + large - small + 1)%1_000_000_007;
        }
    }
    println!("{}", ans);
}

fn sum(n: i64) -> i64 {
    n*(n+1)/2
}

fn sum_from_to(start: i64, end:i64) -> i64 {
    sum(end) - sum(start-1)
}


Measured memory_bytes: 2192
# https://atcoder.jp/contests/abc048/tasks/arc064_a
# C - Boxes and Candies

N, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))

c = 0
for i in range(N-1):
    s = a_list[i] + a_list[i+1]
    if s < x:
        # すでにクリアしているので何もしなくてよい
        continue
    elif s > x:
        # どちらを減らすか？ iとi+1あわせてs-x個分食べれば良い
        # 0の時点を考えると、先にある1を食べれるだけ食べた方が効率が良い
        if s - x < a_list[i+1]:
            a_list[i+1] -= s - x
        else:
            nokori = x - a_list[i+1]
            a_list[i+1] = 0
            a_list[i] -= nokori
        c += s - x

print(c)

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

// max, min, log, input is defined

using namespace std; 

int s[100100];
int ev[50050], od[50050],even[50050], odd[50050];
int rei1, rej1;
int maxi1 = 0, maxj1 = 0, maxi2 = 0, maxj2 = 0;

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

	for (int i = 0; i < n; ++i)
	{
		cin >> s[i];
	}
	
	for (int i = 0; i < n; ++i)
	{
		int m = i % 2;
		if(m==0) ev[i/2] = s[i];
		else od[i/2] = s[i];
	}

	sort(ev,ev+n/2);
	sort(od,od+n/2);

	int cou = 1;

	for (int i = 0; i < n/2; ++i)
	{
		if(ev[i]==ev[i+1]) {
			cou++;
		}
		else{
			if (cou > maxi1){
				rei1 = ev[i];
				maxi1 = cou;
			}
			even[i] = cou;
			cou = 1;
		}
	}

	cou = 1;
	for (int i = 0; i < n/2; ++i)
	{
		if(od[i]==od[i+1]) {
			cou++;
		}
		else{
			if (cou > maxj1){
				rej1 = od[i];
				maxj1 = cou;
			}
			odd[i] = cou;
			cou = 1;
		}
	}

	sort(even, even+n/2);
	sort(odd, odd+n/2);
	maxi1 = even[n/2-1]; maxi2 = even[n/2-2];
	maxj1 = odd[n/2-1]; maxj2 = odd[n/2-2];

	// cout << rei1 << ' ' << rej1 << endl;
	// cout << maxi1 << ' ' << maxj1 << ' ' << maxi2 << ' ' << maxj2 << endl;

	if (rei1!=rej1){
		// cout << 1;
		cout << n-maxi1-maxj1;
	}
	else if (maxi1 > maxj1){
		// cout << 2;
		cout << n-maxi1-maxj2;
	}
	else if (maxi1 < maxj1){
		// cout << 3;
		cout << n-maxi2-maxj1;
	}
	else if (maxi2>maxj2){
		// cout << 4;
		cout << n-maxi2-maxj1;
	}
	else if (maxi2<=maxj2){
		// cout << 5;
		cout << n-maxj2-maxi1;
	}
	else {
		cout << "err";
	}

	return 0;
}

Measured memory_bytes: 1408
/*
 * FileName:     B_fix
 * CreatedDate:  2020-05-17 14:34:05 +0900
 * LastModified: 2020-05-17 15:04:03 +0900
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    int n,k;
    scanf("%d %d",&n,&k);
    int *h = malloc(n*sizeof(int));
    for(int i=0;i<n;i++){
        scanf("%d",h+i);
    }
    int *dp = malloc(n*sizeof(int));
    memset(dp,-1,n*sizeof(int));
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<i+k+1&&j<n;j++){
            int relative = abs(h[i]-h[j]);
            if(dp[j]==-1){
                dp[j]=dp[i]+relative;
            }
            else{
                if(dp[j]>dp[i]+relative){
                    dp[j]=dp[i]+relative;
                }
            }
        }
/*        printf("\n");
        for(int j=0;j<n;j++){
            printf("%d ",dp[j]);
        }*/
    }
    printf("%d\n",dp[n-1]);
    free(dp);
    free(h);
    return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int main() {
	int n, m;
	cin >> n;
	vector<string> sn(n);
	rep(i, n) {
		cin >> sn[i];
	}
	cin >> m;
	bool open = true;
	rep(i, m) {
		string in;
		cin >> in;
		bool match = false;
		rep(j, n) {
			if( sn[j] == in ) {
				match = true;
				break;
			}
		}
		if(match) {
			cout << (open ? "Opened by " : "Closed by ");
			open = !open;
		} else {
			cout << "Unknown ";
		}
		cout << in << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int n;
	cin>>n;
	string v;
	cin>>v;
	int p=n-1,cnt=0;
	for(int i=0;i<v.size();){
		while(v[p]!='R'&&p>i) p--;
		while(v[i]!='W'&&i<p) i++;
		if(i==p) break;
		swap(v[i],v[p]); cnt++;
	}
	cout<<cnt<<'\n';
	return 0;
}

Measured memory_bytes: 3744
#include<stdio.h>
int main(){
  int n,t,i;
  scanf("%d%d",&n,&t);
  int time[n+1];
  long long sum=t;
  for(i=1;i<=n;i++)
    scanf("%d",&time[i]);
  for(i=2;i<=n;i++){
    if(time[i]>time[i-1]+t)
      sum+=(long long)t;
    else
      sum+=(long long)time[i]-(long long)time[i-1];
  }
  printf("%lld\n",sum);
  return 0;
}


Measured memory_bytes: 2416
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int n;cin>>n;
  vector<int> a(n);rep(i,n)cin>>a[i];
  int s = a[n-1];
  rep(i,n-1){
    s ^= a[i];
  }
  rep(i,n)cout<<(a[i]^s)<<" \n"[i == n-1];
  return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (int)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

int main()
{
    ll n,k,ans;
    cin >> n >> k;

    ans = n - k + 1;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val loopCnt =  io.StdIn.readInt
  (1 to loopCnt).foreach {i=>
    val n = io.StdIn.readLine.split(' ').map { _.toInt }.sorted
    val ans = if (n(0) * n(0) + n(1) * n(1) == n(2)* n(2)) "YES" else "NO"
    println(ans)
  }
}

Measured memory_bytes: 45184
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        //int[] p = new int[n];
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            //p[i] = sc.nextInt();
            set.add(sc.nextInt());
        }

        if (!set.contains(x)) {
            System.out.println(x);
            return;
        }

        int can1 = x - 1;
        int can2 = x + 1;
        while (true) {
            if (!set.contains(can1)) {
                System.out.println(can1);
                return;
            }
            if (!set.contains(can2)) {
                System.out.println(can2);
                return;
            }
            can1--;
            can2++;
        }
    }

}

Measured memory_bytes: 35856
p=print
while 1:
    m,f,r=map(int,input().split())
    x=m+f
    if m==f==r==-1:break
    elif m==-1 or f==-1 or x<30:p('F')
    elif x>=80:p('A')
    elif 65<=x<80:p('B')
    elif 50<=x<65 or r>=50:p('C')
    else:p('D')

Measured memory_bytes: 7716
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
vector<int> g[100000];
int rec(int i){

    if(g[i].size()==0){
        return 0;
    }else{
        vector<int> v;
        for(int j=0; j<g[i].size(); j++){
            v.push_back(rec(g[i][j]));
        }
        sort(v.rbegin(), v.rend());
        int ret=0;
        for(int j=0; j<v.size(); j++){
            ret=max(ret, v[j]+(j+1));
        }
        return ret;
    }

}


int main(){

    int N;
    cin>> N;
    for(int i=0; i<N-1; i++){
        int a;
        cin>> a;
        g[a-1].push_back(i+1);
    }

    cout<< rec(0)<< endl;

    return 0;
}


Measured memory_bytes: 15104
#include <iostream>
#include <string>
using namespace std;
int main() {
	string c;
	cin >> c;
	if (c == "a" ||
		c == "i" ||
		c == "u" ||
		c == "e" ||
		c == "o")
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(n) for(int i=0;i<n;++i)

int main()
{
    int n;
    cin >> n;
    vector<double> v;
    int a;
    FOR(n){
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    FOR(n-1){
        v.push_back((v[0]+v[1])/2);
        if(!v.empty()){
            v.erase(v.begin(),v.begin()+2);
        }
        sort(v.begin(),v.end());
    }
    printf("%.6g\n",v[0]);
    return 0;
}

Measured memory_bytes: 256
import collections
if __name__ == "__main__":
    w = input()
    d = collections.defaultdict(int)
    for c in w:
        d[c] += 1
    is_beautiful = True
    for v in d.values():
        if v % 2 != 0:
            is_beautiful = False
            break
    print("Yes" if is_beautiful else "No")

Measured memory_bytes: 3316
#include <cstdlib>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    int N, M;
    map<ll, int> drink;
    ll a;
    int b;
    int drinkNum = 0;
    ll ans = 0;


    //input
    cin >> N >> M;
    for(int i = 0; i < N; i++){
        cin >> a >> b;
        if(drink.find(a) != drink.end()){
            drink[a] += b;
        }else{
            drink[a] = b;
        }
    }

    auto itr = drink.begin();
    while(drinkNum < M){
        if(drinkNum + itr->second <= M){
            ans += itr->first * itr->second;
            drinkNum += itr->second;
            itr++;
        }else{
            while(drinkNum < M){
                ans += itr->first;
                drinkNum++;
            }
        }
    }

    //output
    cout << ans << endl;
}


Measured memory_bytes: 6528
#define _GLIBCXX_DEBUG
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)

void solve() {
    int N, ans = 0;
    string S;
    cin >> N >> S;
    for (int c = 0; c < 1000; c++) {
        string T = "00" + to_string(c);
        T = T.substr(T.size() - 3, 3);
        int i = 0;
        for (auto &s : S) {
            if (T[i] == s) {
                i++;
            }
            if (2 < i) break;
        }
        if (i == 3) ans++;
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 384
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, k := scanInt(), scanInt()
	c := map[int]int{}
	for i := 0; i < n; i++ {
		c[scanInt()]++
	}
	a := []int{}
	for _, e := range c {
		a = append(a, e)
	}
	sort.Ints(a)
	k = min(k, len(a))
	b := 0
	for i := 0; i < k; i++ {
		b += a[len(a)-1-i]
	}
	fmt.Fprintln(wr, n-b)

}


Measured memory_bytes: 18276
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		int c = Math.max(a,b);
        int d = 0;
        for(int i=0;i<c;i++){d+=Math.min(a,b)*Math.pow(10,i);}
          System.out.println(d);                                
    }
}


Measured memory_bytes: 19796
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,f[105][100005],w[1000],v[1000];
main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i];cin>>v[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(j-w[i]<0)
                f[i][j]=f[i-1][j];
            else
                f[i][j]=max(f[i-1][j],f[i-1][j-w[i]]+v[i]);
        }
    }
    cout<<f[n][m];
}


Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 

int main()
{
	ll t,x; 
	cin>>t>>x;
	ll count=0;
	ll  point[t][2];
	for(ll i=0;i<t;i++){cin>>point[i][0]>>point[i][1];}
	for(ll i=0;i<t;i++)
	{
		ll a=(point[i][0]*point[i][0]);
		ll b=(point[i][1]*point[i][1]);
		ll c=ceil(sqrt(a+b));
		if(c<=x)
		{
			count++;
		}
	}
	cout<<count;
	return 0;
}

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

long long int r = 1e9 + 7;

long long int fastexpo(long long int ba, long long int a){
if (a == 0) return 1;
if (a % 2 == 0){
	long long int c = fastexpo(ba,a/2) % r;
 	return (c * c) % r;	
}
return (ba * fastexpo(ba,a-1)) % r;
}

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, a, b;
  cin >> n >> a >> b;
  long long int ans = fastexpo(2, n);
  ans = (ans - 1 + r) % r;
 	long long int p=1;
  for (int i = 1; i <= a; ++i){
	p = (p * (n-a + i)) % r;
	p = (p * fastexpo(i,r-2)) % r;
  }
	ans = (ans - p + r) % r;
	p=1; 
  for (int i = 1; i <= b; ++i){
	p = (p * (n-b + i)) % r;
	p = (p * fastexpo(i,r-2)) % r;
  }
	ans = (ans - p + r) % r;
	cout << ans << "\n";
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7ffffffe
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double dl;
using namespace std;

string s;
map<int,ll> mod;
int main(){
	int n,p,m=0,pw=1;
	cin>>n>>p>>s;
	if(p==2||p==5){
		ll x=0;
		rep(i,n){
			if((s[i]-'0')%p==0){
				x+=(i+1);
			}
		}
		cout<<x;
		return 0;
	}
	ll ans=0ll;
	mod[0]=1ll;
	repr(i,n){
		int cur=s[i]-'0';
		m=(m+pw*cur)%p;
		pw=(pw*10)%p;
		ans+=mod[m];
		mod[m]++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int>arr(n);
	priority_queue<int>pq;
	int i;
	for(i=0;i<n;i++){
		cin>>arr[i];
		pq.push(arr[i]);
	}
	for(i=0;i<n;i++){
		if(arr[i]==pq.top()){
			int x=pq.top();
			pq.pop();
			cout<<pq.top()<<endl;
			pq.push(x);
		}
		else
		cout<<pq.top()<<endl;
	}
	return 0;
}

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

using ll = int64_t;
#define rep(i,n) for(int64_t i = 0;i < n;i++)

int64_t dp[100010];

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

    int64_t n,k;cin >> n >> k;
    vector<int64_t> a(n);
    for(auto& i : a){
        cin >> i;
    }

    for(int i = 1;i <= k;i++){
        for(int j = 0;j < n;j++){
            if(i - a[j] >= 0) dp[i] |= !dp[i - a[j]];
        }
    }

    if(dp[k]) cout << "First" << '\n';
    else cout << "Second" << '\n';

    return 0;
}


Measured memory_bytes: 1024