akhauriyash/Code-Regression huggingface dataset:
///*****************************************************///
///*.......................Faiyaj Bin Amin............................*///
///*...................................................................*///
///*.........................KUET CSE 2K17......................*///
///*...................................................*///
///*****************************************************///

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define fastio      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define ret return
#define rep(q, i, n) for(int q=i; q<n; q++)
#define forn(i, n) for(int i=0; i<n; i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define ll long long
#define pb push_back
#define em emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()
#define ff first
#define ss second
#define pii pair<int,int>
#define pdd pair<double, double>

#define see(x)        cerr<< __LINE__ << ": " << (#x) << " is "<< (x) <<'\n';
#define seecontent(v) for(auto x : v) { cout << x << " ";} cout << "\n\n";

#define PI 2*acos(0.0)
#define lcm(a, b)  ((a / __gcd(a, b) ) * b)

#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)

#define mx 100005
#define INF 1e18+3
#define MOD 1000000007
#define MIN 0

//template <typename T>  using orderedSet =
//    tree<T, null_type, less_equal<T>,
//    rb_tree_tag, tree_order_statistics_node_update>; //find_by_order, order_of_key


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0}; // Directional
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

/**------------------------------------BITMASK------------------------------------------**/
//int Change(int N, int pos){return N= N^(1<<pos);}
//bool Check(int N, int pos){return (bool)(N &(1<<pos));}  /// check bit 0 or 1
/**-----------------------------------------------------------------------------------------------**/

//using namespace __gnu_pbds;
using namespace std;

ll dp[mx][14];
int main()
{
    fastio;
    string s;
    cin >> s;

    dp[0][0]=1;
    forn(i, s.size())
    {
        int fl=100;
        if(s[i]!='?')
            fl=s[i]-'0';
        else
            fl=10;

        forn(j, 10)
        {
            if(fl==10 || fl==j)
            {
                forn(mul, 13)
                {
                    int val = (j+ mul * 10) % 13;
                    dp[i+1][val]+= dp[i][mul];
                    dp[i+1][val] = dp[i+1][val] % MOD;
                }
            }
        }
    }
    cout << dp[s.size()][5] << "\n";

    return 0;
}


Measured memory_bytes: 14684
using System;
using System.Linq;
using System.Collections.Generic;
class P
{
    static void Main()
    {
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        List<int> count = new List<int>();

        int last = a[0];
        int ncount = 1;
        for (int i = 1; i < a.Length; i++)
        {
            if (a[i] == last) ncount++;
            else
            {
                last = a[i];
                count.Add(ncount);
                ncount = 1;
            }
        }
        count.Add(ncount);
        int[] ocount = count.OrderBy(x => x).ToArray();
        Console.WriteLine(ocount.Take(Math.Max(0, ocount.Length - nk[1])).Sum());
    }
}

Measured memory_bytes: 41808
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

struct mint {
    ll x;  // typedef long long ll;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {}

    mint operator-() const { return mint(-x); }

    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }

    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(MOD - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;

        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
    // 順列の計算
    mint p(int n, int k) { return fact[n] * ifact[n - k]; }
};

int main() {
    INIT;

    ll N, K;
    cin >> N >> K;

    combination comb(10005);

    reps(i, 1, K + 1) {
        mint ans = comb(K - 1, i - 1) * comb(N - K + 1, N - K - i + 1);
        cout << ans << endl;
    }

    return 0;
}

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

#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef pair<ll, ll> pll;

const int INF = 100000000;
const ll LINF = 1e18+5;

int main() {
    ll K,X;
    cin >> K >> X;
    if(K*500>=X) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n, d; cin >> n >> d;
    vector<bool> t(n, false);

    int cnt = 0;
    REP(i, n) {
        if(!t[i]) {
            FOR(j, i, min(n, i + 2*d + 1)) t[j] = true;
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n;
string cties[20];
int G[20][20];

int dist(string s1,string s2) {
    int ret=0;
    int m=min(s1.size(),s2.size());
    reverse(all(s1));
    rep(i,m) {
        string t=s1.substr(0,i);
        reverse(all(t));
        if(t==s2.substr(0,i)) ret=i;
    }


    return ret;
}
int dp[1<<16][16];
int dfs(int S,int v) {
    if(S+1==1<<n) return dp[S][v]=0;
    if(dp[S][v]!=-1) return dp[S][v];
    int ret=0;
    rep(u,n) {
        if(G[v][u]==INF) continue;
        if(!(S>>u&1)) ret=max(ret,dfs(S|1<<u,u)+G[v][u]);
    }

    return dp[S][v]=ret;
}
void solve() {
    int sum=0;
    vector<string> vec;
    rep(i,n) {
        bool f=true;
        rep(j,n) if(i!=j) {
            if(cties[j].find(cties[i])!=string::npos) f=false;
        }
        if(f) vec.pb(cties[i]);
    }
    rep(i,vec.size()) sum+=vec[i].size();
    rep(i,20) rep(j,20) G[i][j]=INF;
    rep(i,vec.size()) rep(j,vec.size()) if(i!=j) {
        G[i][j]=dist(vec[i],vec[j]);
        G[j][i]=dist(vec[j],vec[i]);
    }
    int ans=INF;
    rep(v,n) {
        memset(dp,-1,sizeof(dp));
        int t=dfs(1<<v,v);
        //cout<<t<<endl;
        ans=min(ans,sum-t);
    }

    cout<<ans<<endl;
}

int main() {
    while(cin>>n) {
        if(n==0) break;
        rep(i,n) cin>>cties[i];
        solve();
    }
    return 0;
}

Measured memory_bytes: 5324
//#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f_(i,a,b) for (int i=a;i>=b;i--)
#define f(i,a,b) for (int i=a;i<=b;i++)
const ll mod=1000000007;

int n,a[100005];
vector<pair<int,int> > ans;
int main() {
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	scanf("%d", &n);
	f(i,1,n) scanf("%d", &a[i]);
	sort(a+1,a+1+n);
	f_(i,n-1,2) {
		if (a[i]<0) break;
		ans.push_back(make_pair(a[1],a[i]));
		a[1]-=a[i];
	}
	f(i,2,n-1) {
		if (a[i]>=0) break;
		ans.push_back(make_pair(a[n],a[i]));
		a[n]-=a[i];
	}
	ans.push_back(make_pair(a[n],a[1]));
	a[n]-=a[1];
	printf("%d\n", a[n]);
	for (int i=0;i<ans.size();i++) printf("%d %d\n", ans[i].first, ans[i].second);
	return 0;
}

Measured memory_bytes: 3188
/**
 * @author      : omgursocute
 * @file        : A.cpp
 * @created     : 29/12/2019
 */

#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	int x, a;
	cin >> x >> a;
	if(x < a) cout << 0;
	else cout << 10;
	
	return 0;
}



Measured memory_bytes: 256
n = gets.to_i
ans = [1, 1]
for i in 1..n do
  x = i
  count = 0
  while (i % 2).zero?
    i = i / 2
    count += 1
  end
  if count >= ans[1]
    ans[0] = x
    ans[1] = count
  end
end
puts ans[0]

Measured memory_bytes: 1788
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
	int n, m;
	while(scanf("%d %d\n", &n, &m), n || m){
		long double g[n][n];
		/* dp[a][b]は、a回目にbの肥料を与えた時のaまでの成長率の最大値 */
		long double dp[m][n];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				scanf("%Lf", &g[i][j]);
			}
		}
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++){
				dp[i][j] = 0;
			}
		}
		for(int i = 0; i < n; i++) dp[0][i] = 1;
		
		for(int i = 1; i < m; i++){
			for(int j = 0; j < n; j++){
				for(int k = 0; k < n; k++){
					dp[i][j] = max(dp[i][j], dp[i - 1][k] * g[k][j]);
				}
			}
		}
		long double res = 0;
		for(int i = 0; i < n; i++){
			res = max(res, dp[m - 1][i]);
		}
		printf("%.2Lf\n", res);
	}
	
	return 0;
}

Measured memory_bytes: 1272
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

#define	MOD	1000000007

using namespace std;

int main(int argc, char* argv[]) {

	long long X, Y, Z, K, S;
	long long ans = 0;

	cin >> K;
	cin >> S;

	for (X = 0; X <= K; X++) {
		for (Y = 0; Y <= K; Y++) {
			Z = S - X - Y;
			if (0 <= Z && Z <= K) {
				ans++;
			}
		}
	}

	cout << ans << endl;

	return 0;

}



Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1;
		cin >> n;
		if (n < 0) return 0;
		vector<LL> a(n), b;
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
		}
		LL ans = 1000;
		for (int i = 1; i < n; ++i) {
			if (a[i - 1] < a[i]) {
				LL s = ans / a[i - 1];
				ans = ans + s * (a[i] - a[i - 1]);
			}
		}
		cout << ans << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<double> p(n + 1, 0);
  vector<vector<double>> pb = vector<vector<double>>(n + 1, vector<double>(n + 1, 0));
  pb[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &p[i]);
    for (int j = 0; j < i; j++) {
      if (pb[i - 1][j] <= 1e-14) {
        continue;
      }
      pb[i][j] += pb[i - 1][j] * (1 - p[i]);
      pb[i][j + 1] += pb[i - 1][j] * p[i];
    }
  }
  double r = 0;
  for (int j = n / 2 + 1; j <= n; j++) {
    r += pb[n][j];
  }
  printf("%.10lf", r);
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  int count = 0;
  int a,b;
  bool flag = false;
  while(n--){
    cin >> a >> b;
    if(count == 3 ){
      flag = true;
    }
    if(a==b) count++;
    else count = 0;
  }
  if(count == 3) flag = true;
  if(flag) cout << "Yes";
  else cout << "No";
  return 0;
}


Measured memory_bytes: 3588
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
double dot(complex<double> a, complex<double> b) {
	return a.real() * b.real() + a.imag() * b.imag();
}
double gyaku_dot(complex<double> a, complex<double> b) {
	return a.real() * b.imag() - a.imag() * b.real();
}
double leng(complex<double> a) {
	return sqrt(a.real() * a.real() + a.imag() * a.imag());
}
double angles(complex<double> a, complex<double> b) {
	double cosine = dot(a, b) / (leng(a) * leng(b));
	double sine = gyaku_dot(a, b) / (leng(a) * leng(b));
	double kaku = acos(cosine);
	if (sine <= 0) {
		kaku = 2 * Ma_PI - kaku;
	}
	return kaku;
}
vector<int> convex_hull(vector<complex<double>> a) {
	vector<int> ans;
	double now_minnest = a[0].real();
	int now_itr = 0;
	REP(i, a.size()) {
		if (now_minnest > a[i].real()) {
			now_minnest = a[i].real();
			now_itr = i;
		}
	}
	ans.push_back(now_itr);
	complex<double> ba(0, 1);
	while (true) {
		int now_go = 0;
		double now_min = 0;
		int starter = ans[ans.size() - 1];
		for (int i = 0; i < a.size(); ++i) {
			if (i != starter) {
				double goa = angles(ba, a[i] - a[starter]);
				if (goa > now_min) {
					now_min = goa;
					now_go = i;
				}
			}
		}
		if (now_go == ans[0]) break;
		ans.push_back(now_go);
		ba = complex<double>(a[now_go] - a[starter]);
	}
	return ans;
}
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
long long ans[3000][3000] = {};
int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a, b;
	REP(i, n) {
		int c;
		cin >> c;
		a.push_back(c);
	}
	REP(i, m) {
		int c;
		cin >> c;
		b.push_back(c);
	}
	ans[0][0] = 1;
	for (int i = 0; i < n; ++i) {
		long long geko = 0;
		for (int q = 0; q < m; ++q) {
			ans[i + 1][q] += ans[i][q];
			ans[i + 1][q] %= MAX_MOD;
			geko += ans[i][q];
			geko %= MAX_MOD;
			if (a[i] == b[q]) {
				ans[i + 1][q + 1] += geko;
				ans[i + 1][q + 1] %= MAX_MOD;
			}
		}
		ans[i + 1][m] += ans[i][m];
		ans[i + 1][m] %= MAX_MOD;
	}
	long long final_ans = 0;
	for (long long i = 0; i <= m; ++i) {
		final_ans += ans[n][i];
		final_ans %= MAX_MOD;
	}
	cout << final_ans << endl;
	return 0;
}


Measured memory_bytes: 46976
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARemainingBalls solver = new ARemainingBalls();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARemainingBalls {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            String st1 = n();
            String st2 = n();
            int x = ni();
            int y = ni();
            if (n().equals(st1))
                x--;
            else
                y--;
            pn(x + " " + y);

        }

        String n() {
            return in.next();
        }

        int ni() {
            return in.nextInt();
        }

        void pn(String zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll a,b;cin>>a>>b;
  cout<<a*b/gcd(a,b)<<endl;
  return 0;
}

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

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

  int Nmod;

  Nmod = N%500;

  if (Nmod <= A) {
    cout << "Yes" << endl;
  }

  else{
    cout << "No"<< endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
int main(void){
    // Your code here!
    long long N, M, S, T;
    cin >> N >> M;
    
    vector<vector<long long>> edges(N, vector<long long>());
    for(long long i = 0; i < M; i++){
        long long u, v;
        cin >> u >> v;
        edges[u-1].push_back(v-1);
    }
    cin >> S >> T;
    
    vector<vector<bool>> memo(N, vector<bool>(3, false));
    
    queue<vector<long long>> q;
    vector<long long> temp{S-1, 0, 0};
    q.push(temp);
    memo[S-1][0] = true;
    while(q.size() > 0){
        vector<long long> cur = q.front();
        q.pop();
        for(auto e:edges[cur[0]]){
            if(memo[e][(cur[1]+1)%3] == false){
                if(e == T-1 && (cur[1]+1)%3 == 0){
                    cout << cur[2]+1 << endl;
                    return 0;
                }
                vector<long long> temp{e, (cur[1]+1)%3};
                if((cur[1]+1)%3==0)
                    temp.push_back(cur[2]+1);
                else
                    temp.push_back(cur[2]);
                q.push(temp);
                memo[e][(cur[1]+1)%3] = true;
            }
        }
    }

    cout << -1 << endl;
    
}


Measured memory_bytes: 12800
fun main(args: Array<String>) {
    val (R,G,B,N)=readLine()!!.split(" ").map { it.toInt() }
    var count=0
    var sum=0
    for(r in 0 .. 3000){
        sum=R*r
        if(sum>N) break
        for(g in 0 .. 3000){
            sum=R*r+G*g
            if(sum>N) break
            if((N-sum)%B==0)count+=1
        }
    }
    print(count)
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

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

    double N;
    cin >> N;

    for(int i = 1; i <= 50000; ++i) {
        int n_tmp = static_cast<int>(static_cast<double>(i) * 1.08);
        if(n_tmp == N) {
            printf("%lld\n", i);
            return 0;
        }
    }
    printf(":(\n");

    return 0;
}


Measured memory_bytes: 256
<?php
$fp = fopen('php://stdin', 'r');
$nums = array();
for ($i=0; $i<10; $i++) {
  for ($j=0; $j<10; $j++) {
    array_push($nums, $i+$j); 
  }
}
$uniq_nums = array_count_values($nums);
while (feof($fp) == false) {
  $n = (int)fgets($fp);
  if ($n == "") break;
  $sum = 0;
  foreach ($uniq_nums as $key => $val) {
    foreach ($uniq_nums as $key2 => $val2) {
      if ($key + $key2 == $n) {
        $sum += $val * $val2;
      }   
    }   
  }
  echo $sum.PHP_EOL;
}

Measured memory_bytes: 6624
#include <stdio.h>
#include <math.h>

typedef struct{
  double x;
  double y;
}Point;

void koch(int,Point,Point);

int main(){

  int n;
  Point p1;
  Point p2;

  p1.x = 0.0;
  p1.y = 0.0;
  p2.x = 100.0;
  p2.y = 0.0;
  
  scanf("%d",&n);
  
  printf("%f %f\n",p1.x,p1.y);
  
  koch(n,p1,p2);
  
  printf("%f %f\n",p2.x,p2.y);

  return 0;
}

void koch(int n,Point p1,Point p2){

  Point s;
  Point t;
  Point u;  
  
  if(n==0) return;

    s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
    s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
    
    t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
    t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;

    u.x = (t.x - s.x) * cos( M_PI/3.0 ) - (t.y -s.y) * sin( M_PI/3.0 ) + s.x;
    u.y = (t.x - s.x) * sin( M_PI/3.0 ) + (t.y -s.y) * cos( M_PI/3.0 ) + s.y;

    koch(n-1, p1, s);
    printf("%f %f\n",s.x,s.y);
    koch(n-1, s, u);
    printf("%f %f\n",u.x,u.y);
    koch(n-1, u, t);
    printf("%f %f\n",t.x,t.y);
    koch(n-1, t, p2);
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a%m+b%m);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a%m-b%m);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int n;
	cin >> n ;
	n=n%1000;
	if(n==0)cout << 0;
	else
	cout << 1000-n<< endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

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


long long dp[110][2][110];
string s;
int k;


long long solve(int n, int N, int flag, int qtd){
	if (n==N){
		if (qtd!=k) return 0;
		else return 1;
	}
	
	if (dp[n][flag][qtd]!=-1) return dp[n][flag][qtd];
	
	if (flag==0){
		int k=s[n]-'0';
		
		if (k==0) dp[n][flag][qtd]=solve(n+1, N, 0, qtd);
		else dp[n][flag][qtd]=solve(n+1, N, 1, qtd)+(k-1)*solve(n+1, N, 1, qtd+1)+solve(n+1, N, 0, qtd+1);
	}
	
	else{
		dp[n][flag][qtd]=solve(n+1, N, 1, qtd)+9*solve(n+1, N, 1, qtd+1);
	}
	
	return dp[n][flag][qtd];

}


int main(){
		cin>>s;
		cin>>k;
		int t=(int)s.size();
		memset(dp, -1, sizeof(dp));
		long long x=solve(0, t, 0, 0);
		
		printf("%lld\n", x);
		



}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,0,n)
#define SORT(V) sort((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
using namespace std;

int main(){
  string S,a;
  cin>>S;
  for(int i=0; i<S.size(); ++i){
    if(S.at(i)=='0') a+='0';
    if(S.at(i)=='1') a+='1';
    if(S.at(i)=='B' && a.size()>0){
      string b;
      for(int i=0; i<a.size()-1; ++i) b+=a.at(i);
      a=b;
    }
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    VL a(n);
    REP(i,n) scanf("%lld", &a[i]);
    REP(i,n){
        a.push_back(a[i]);
    }
    VL s(2*n+1);
    REP(i,2*n) s[i+1] = s[i] + a[i];
    s.push_back(1e17);
    s.push_back(2e17);
    s.push_back(3e17);
    ll l = 1, r = 1e16;
    while (r - l > 1){
        ll m = (l + r) / 2;
        bool pos = 0;
        REP(i,n){
            int x = i;
            REP(j,3){
                x = lower_bound(s.begin(), s.end(), s[x] + m) - s.begin();
            }
            if (x <= i + n){
                pos = 1;
                break;
            }
        }
        if (pos) l = m;
        else r = m;
    }

    cout << l << endl;

    return 0;
}

Measured memory_bytes: 7472
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

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

using namespace std;

typedef long long ll;

int N,M;

bool same(vector<string> &A,vector<string> &B,int bx,int by) {
  rep(dx,M) {
    rep(dy,M) {
      int x = bx + dx;
      int y = by + dy;
      if( !( x < N && y < N ) ) return false;
      if( A[y][x] != B[dy][dx] ) return false;
    }
  }
  return true;
}

bool comp(vector<string> &A,vector<string> &B) {
  rep(i,N-M+1) {
    rep(j,N-M+1) {
      if( same(A,B,j,i) ) return true;
    }
  }
  return false;
}

int main() {
  cin >> N >> M;
  vector<string> A(N);
  rep(i,N) cin >> A[i];
  vector<string> B(M);
  rep(i,N) cin >> B[i];
  puts(comp(A,B)?"Yes":"No");
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double[] a = new double[2];
		double[] b = new double[2];
		
		a[0] = 0;
		a[1] = 0;
		b[0] = 100;
		b[1] = 0;
		double z = 1;
		System.out.printf("%.8f %.8f", a[0], a[1]);
		System.out.println();
		koch(n, a, b);
		System.out.printf("%.8f %.8f", b[0], b[1]);
		System.out.println();
		
	}
	
	public static void koch(int n, double[] a, double[] b){
		if(n == 0) return;
		
		double[] s = new double[2];
		double[] t = new double[2];
		double[] u = new double[2];
		double th = Math.PI * 60.0 / 180.0;
		
		s[0] = (2.0 * a[0] + 1.0 * b[0]) / 3.0;
		s[1] = (2.0 * a[1] + 1.0 * b[1]) / 3.0;
		t[0] = (1.0 * a[0] + 2.0 * b[0]) / 3.0;
		t[1] = (1.0 * a[1] + 2.0 * b[1]) / 3.0;
		u[0] = (t[0] - s[0]) * Math.cos(th) - (t[1] - s[1]) * Math.sin(th) + s[0];
		u[1] = (t[0] - s[0]) * Math.sin(th) + (t[1] - s[1]) * Math.cos(th) + s[1];
		
		koch(n - 1, a, s);
		System.out.printf("%.8f %.8f", s[0], s[1]);
		System.out.println();
		koch(n - 1, s, u);
		System.out.printf("%.8f %.8f", u[0], u[1]);
		System.out.println();
		koch(n - 1, u, t);
		System.out.printf("%.8f %.8f", t[0], t[1]);
		System.out.println();
		koch(n - 1, t, b);
	}

}


Measured memory_bytes: 40240
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int p=0,q=0,r=0,t=0;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        if(s=="AC")
            p++;
                if(s=="TLE")
                q++;
        if(s=="WA")
            r++;
        if(s=="RE")
            t++;
    }
    cout<<"AC x "<<p<<endl;
     cout<<"WA x "<<r<<endl;
      cout<<"TLE x "<<q<<endl;
       cout<<"RE x "<<t<<endl;
}



Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, a[111], s = 0;

  std::cin >> N;

  for (int i = 0; i < N; i ++) {
    std::cin >> a[i];

    s += a[i];
  }

  double m = 1. * s / N;

  std::vector<std::pair<double, int>> pairs;

  for (int i = 0; i < N; i ++)
    pairs.emplace_back(std::abs(a[i] - m), i);

  std::sort(ALL(pairs));

  std::cout << pairs[0].second << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
/*ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}*/
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
bool isprime(ll x)
{
    if(x==1)
        return(false);
    for(ll i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return(false);
    }
    return(true);
}
//vector<ll> v[100005];
void solve()
{
    ll n;
    cin>>n;
    for(ll i=-155;i<=155;i++)
    {
        for(ll j=-155;j<=155;j++)
        {
            if((pow(i,5)-pow(j,5))==n)
            {
                cout<<i<<" "<<j<<endl;
                return;
            }
        }
    }
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


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

using namespace std;

const int N = 1e5 + 7;
int n, m;

int main() {
    std :: ios :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int ans = 0;
    cin >> n;
    //vector < int > vt(n + 1);
    for(int i = 1 ; i <= n ; ++i) {
        int a;
        cin >> a;
        if(i % 2 == 1 and a % 2 == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3648
MAX = 100
INF = 1000000
WHITE = 0
GRAY = 1
BLACK = 2
n = int(raw_input())

M = [[0 for i in range(n)]for j in range(n)]
d = [0 for i in range(MAX)]
p = [0 for i in range(MAX)]
Color = [0 for i in range(MAX)]
for i in range(n):
    a = map(int, raw_input().split())
    for j in range(n):
        e = a[j]
        if e == -1:
            M[i][j] = INF
        else:
            M[i][j] = e

#def prim():
for i in range(n):
    d[i] = INF
    p[i] = -1
    Color[i] = WHITE
d[0] = 0
    
while True:
    minv = INF
    u = -1
    for i in range(n):
        if minv > d[i] and Color[i] != BLACK:
            u = i
            minv = d[i]
    if u == -1:
        break
    Color[u] = BLACK
    for v in range(n):
        if Color[v] != BLACK and M[u][v] != INF:
            if d[v] > M[u][v]:
                d[v] = M[u][v]
                p[v] = u
                Color[v] = GRAY
sum = 0
for i in range(n):
    if p[i] != -1:
        sum += M[i][p[i]]
print sum

Measured memory_bytes: 6492
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
//////////////////////////////////

int main(){
  int n, k; cin >> n >> k;
  vector<int> h(n);
  for(int i=0; i<n; i++) cin >> h[i];
  sort(all(h));
  long long cnt = 0;
  for(int i=0; i<n-k; i++) cnt += h[i];
  cout << cnt << endl;

  return 0;
}

// EOF


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>
#include<unordered_map>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 30;
constexpr ll MOD = ll(1e9 + 7);

ll a[2], c[2];

int main(void) {
	cin >> a[0] >> a[1] >> c[0] >> c[1];
	ll ret = a[0] * c[0];
	for(int i=0;i<2;i++)
		for (int j = 0; j < 2; j++) {
			if (ret < a[i] * c[j])
				ret = a[i] * c[j];
		}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main(){
	long long int N,A,B,n,i,j,t,num=0;
	scanf("%lld%lld%lld",&N,&A,&B);
	scanf("%lld",&n);
	t=n;
	for(i=0;i<N-1;i++){
		scanf("%lld",&n);
		if((n-t)*A<B){
			num+=(n-t)*A;
		}
		else{
			num+=B;
		}
		t=n;
	}
	printf("%lld",num);
	return 0;
}

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

void push(int);
int pop();

int top=0,S[1000];





int main(){
 
  int a,b;

  char s[100];

  while(scanf("%s",s)!=EOF){
    if(s[0]=='+'){
      a=pop();
      b=pop();
      push(a+b);
    }
    else if(s[0]=='-'){
      b=pop();
      a=pop();
      push(a-b);
    }else if(s[0]=='*'){
      a=pop();
      b=pop();
      push(a*b);
    }else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}

  
void push(int x){
  top++;
  S[top]=x;
  
}

int pop(){
  top--;
  return S[top+1];
}

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

#define MAX_NUM (1000000000 + 7)

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

template <typename T>
static inline T ArraySum(vector<T>& A) {
  T res = 0;
  for (auto itr = A.begin(); itr < A.end(); ++itr) res += *itr;
  return res;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

i64 modinv(i64 a, i64 m) {
  i64 b = m, u = 1, v = 0;
  while (b) {
    i64 t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

  return b ? gcd(b, a % b) : a;
}

u64 My_Combination(u32 n, u32 k, i64 m) {
  if (n < k) return 0;
  if (k == 0 || n == k) return 1;
  u64 res = 1;
  for (u64 i = 1; i <= k; ++i) res = (res * modinv(i, m) * i) % m;
  for (u64 i = k + 1; i <= n; ++i) res = (res * i) % m;
  for (u64 i = 1; i <= n - k; ++i) res = (res * modinv(i, m)) % m;
  return res;
}

int main() {
  cout << setprecision(18);
  u32 N, K;
  cin >> N >> K;

  for (u32 i = 1; i <= K; ++i) {
    cout << ((My_Combination(N - K + 1, i, MAX_NUM) % MAX_NUM) *
             (My_Combination(K - 1, i - 1, MAX_NUM) % MAX_NUM)) %
                MAX_NUM
         << endl;
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
b = list(map(int, input().split()))

answer = [0]*N

def p(b):
  global answer
  
  if sum([1 if i+1==bi else 0 for i,bi in enumerate(b)]) >= 1  and sum([1 if i+1<bi else 0 for i,bi in enumerate(b)]) == 0 :
    x = max([i+1 if i+1==bi else 0 for i,bi in enumerate(b)])
    answer[len(b)-1] = x
    del b[x-1]
    if b:
      p(b)
    return 
  else:
    answer = False
    return
  
p(b)

if answer:
  for _ in answer:
    print(_)
else:
  print('-1')
  
  



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<28)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> s;
    bool flag = false;
    rep(i, 0, s.size()) {
        if (s[i] == 'C') flag = true;
        else if (flag && s[i] == 'F') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout <<  "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long int
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
using namespace std;
const int N=1e5+50;
const int mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	ll tc=1;
	for(ll T=1; T<=tc;T++){
		string s; cin>>s;
		if(s[2] == s[3] and s[4] == s[5]){
			cout<<"Yes\n";
		}
		else cout<<"No\n";
	}
	return 0;
}

	

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
using namespace std;
#define INF 100000
#define MAX 100000
#define MOD 1000000007n
typedef long long ll;
typedef pair<int,int> P;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)

double dp[610];

int main(){
    int N,M;
    cin>>N>>M;
    vector<int> V[610];
    for(int i=0;i<M;i++){
        int s,t;
        cin>>s>>t;
        s--; t--;
        V[s].push_back(t);
    }
    double ans=1000;
    for(int i=-1;i<N-1;i++){
        if(i!=-1 && V[i].size()==1) continue;
        for(int j=0;j<610;j++) dp[j]=0;
        dp[N-1]=0;
        for(int j=N-2;j>=0;j--){
            double maxc=0;
            for(int to : V[j]){
                dp[j]+=dp[to];
                maxc=max(maxc,dp[to]);
            }
            int n=V[j].size();
            if(j==i){
                dp[j]-=maxc;
                dp[j]=dp[j]/(n-1)+1;
            }else{
                dp[j]=dp[j]/n+1;
            }
        }
        ans=min(ans,dp[0]);
    }
    printf("%.10lf\n",ans);
}



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

int main() {
    int N,Y;
    cin >> N >> Y;

    for(int i=0;i<=N;i++){
        for(int j=0;j<=N-i;j++){
            int k = N - i - j;
            if(i*1000+j*5000+k*10000==Y&&k>=0){
                cout << k <<" "<< j <<" "<< i << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 3604
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N, M, K, A[112345], B[112345], C[112345], D[112345];

int main() {

	cin >> N >> M >> K;

	rep(i, M) cin >> A[i] >> B[i];
	rep(i, K) cin >> C[i] >> D[i];

	vector<vector<int>> FF(N), BLC(N);


	rep(i, M) {
		FF[A[i] - 1].push_back(B[i] - 1);
		FF[B[i] - 1].push_back(A[i] - 1);
	}
	rep(i, K) {
		BLC[C[i] - 1].push_back(D[i] - 1);
		BLC[D[i] - 1].push_back(C[i] - 1);
	}

	vector<set<int>> Friends;
	vector<bool> Checked(N, false);
	vector<int> F_c(N);

	int c = 0;
	rep(i, N) {
		if (Checked[i] == false) {
			Checked[i] = true;
			queue<int> Next;
			Next.push(i);
			set<int> F;
			F.insert(i);
			F_c[i] = c;
			while (!Next.empty()) {
				int cur = Next.front();
				Next.pop();
				for (auto ff : FF[cur]) {
					if (Checked[ff] == false) {
						Next.push(ff);
						Checked[ff] = true;
						F.insert(ff);
						F_c[ff] = c;
					}
				}
			}
			Friends.push_back(F);
			c++;
		}
	}

	rep(i, N) {
		int Friend_c = Friends[F_c[i]].size() - 1;
		int Already = FF[i].size();
		int block = 0;
		for (auto blc : BLC[i]) {
			if (Friends[F_c[i]].find(blc) != Friends[F_c[i]].end()) {
				block++;
			}
		}
		cout << Friend_c - Already - block << " ";
	}

	return 0;
}


Measured memory_bytes: 23160
a = int(input())
al = list(map(int, input().split())) 

als = list(set(al))

from collections import Counter
count = Counter(al)

import itertools
ll = list(itertools.combinations(als, 3))

res = 0
for i in ll:
    if sum(i) -max(i)*2 >0:
        res += count[i[0]]*count[i[1]]*count[i[2]]
print(res)

Measured memory_bytes: 20704
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;

  cout << (op == '+' ? a + b : a - b) << endl;



  
  return 0;
}

Measured memory_bytes: 256