akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define ld double
    #define vv vector<ll>
    #define pp pair<ll,ll>
    #define ff first
    #define ss second
    #define vp vector<pp>
    #define pb push_back
    #define mp make_pair
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define maxn 105
    const ll mod=1e9+7;
    #define N 2750135
    bool prime[N];
    ll p[N];
    ll n,m;
    void isprime()
    {
        memset(prime,true,N);
        memset(p,-1,sizeof(p));
        for(ll i=2;i<N;i++)
        {
            if(p[i]==-1)
            {
            	p[i]=i;
                for(ll j=i*i;j<N;j+=i)
                {
                    if(p[j]==-1)
                    {
                    	p[j]=i;
					}
                }
            }
        }
    }
    ll power(ll a,ll n)
    {
        ll ans=1;
        a=a%mod;
        while(n>0)
        {
            if(n&1)
            {
                ans=(ans*a)%mod;
            }
            n=n>>1;
            a=(a*a)%mod;
        }
        return ans;
    }
    ll gcd(ll a,ll b)
    {
        if(b==0)
        return a;
        
        return gcd(b,a%b);
    }
    

    int main()
    {
    	fast;
        ll n,a,b;
        cin>>n>>a>>b;
        if(n*a < b)
        {
        	cout<<n*a;
		}
		else
		{
			cout<<b;
		}
        
		return 0;
	}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false),cin.tie(0);
#define F first
#define S second
using namespace std;
typedef long long ll;
ll n,a,b;
const ll maxn=200005;
const ll mod=1e9+7;
typedef pair<ll,ll> pii;
ll num[200005];
ll fro[200005],bac[200005];
ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%mod;
		a=a*a%mod;

		b>>=1;
	}
	return res;
}

int main()
{
    //IOS
    //freopen("class_treasurer.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    while(cin>>n>>a>>b)
    {
        cout<<min(n*a,b)<<"\n";
    }




}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){

    LD ans = 0.0,p,q;
    int n,k;

    cin >> n >> k;

    FOR(i,0,n){
        p = i+1;
        q = 1.0;

        while(p < k){
            p *= 2;
            q *= 0.5;
        }

        ans += 1/(LD)n * q;
    }
    
    printf("%.16Lf",ans);

    return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n, m;
int s[maxn];
int c[maxn];

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  cin>>n>>m;
  for (int i=0; i<m; i++) {
    cin>>s[i]>>c[i];
    s[i]--;
  }
    


  for (int x=0; x<=1e4; x++) {
    string buf = to_string(x);
    if (int(buf.length()) != n) continue;
    bool ok = true;
    for (int i=0; i<m; i++) {
      if (buf[s[i]]-'0' == c[i]) continue;
      ok = false;
    }
    if (ok) {
      out(x);
    }
  }


  out(-1);
  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 2304
let main () = Scanf.sscanf (read_line ()) "%d %d %d %d"
  (fun a b c d -> print_int(if b < c || d < a then 0
    else if b = d && a < c then d-c 
    else if b = d && a > c then d-a
    else if a = c && b < d then b-a
    else if a = c && b > d then d-a
    else if a < c && b > d then d-c
    else if a > c && d > b then b-a
    else if a < c && b < d then (((b-a)+(d-c)) -(d-a)) else (((b-a)+(d-c)) -(b-c))))
let _ = main()

Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int n,p[200],c[3][200];
  scanf("%d",&n);
  fill(p,p+n,0);
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      scanf("%d",&c[j][i]);
    }
  }
  for(int i=0;i<3;i++){
    int cnt[100];
    fill(cnt,cnt+100,0);
    for(int j=0;j<n;j++){
      cnt[c[i][j]-1]++;
    }
    for(int j=0;j<n;j++){
      if(cnt[c[i][j]-1]==1) p[j] += c[i][j];
    }
  }
  for(int i=0;i<n;i++) printf("%d\n",p[i]);
  return 0;
}

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

int n;
string s[200005];
int same[200005];
vector<vector<bool>> have[200005];
long long ans;

int main(){

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

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
        reverse(s[i].begin(),s[i].end());
    }
    sort(s,s+n,[](const string &a,const string &b){
        return a.substr(0,a.size()-1)<b.substr(0,b.size()-1);
    });
    for(int i=0;i<n;i++){
        for(int &j=same[i];s[i][j]==s[i+1][j]&&j<s[i].size()&&j<s[i+1].size();j++);
        have[i].resize(s[i].size());
        have[i].back().resize(26);
        have[i].back()[s[i].back()-'a']=1;
        for(int j=s[i].size()-2;j>=0;j--){
            have[i][j]=have[i][j+1];
            have[i][j][s[i][j]-'a']=1;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;same[j-1]>=s[i].size()-1&&j<n;j++){
            ans+=have[j][s[i].size()-1][s[i].back()-'a'];
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

int main(void){
    double r;
    cin >> r;
    double s,l;
    s = M_PI * r * r;
    l = 2 * M_PI * r;

    cout << fixed << setprecision(8);
    cout << s << " " << l << endl;

    return 0;
}


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

int main()
{
ll n ;
cin >> n ;
vector<pair<ll,ll>> v;
vector<ll> vv;
auto f = [&](pair<ll,ll> a,pair<ll,ll> b){
  if(vv[a.first]<vv[b.first])swap(a.first,b.first);
  if(vv[a.first]<vv[b.second])swap(a.first,b.second);
  if(vv[a.second]<vv[b.first])swap(a.second,b.first);
  if(vv[a.second]<vv[b.second])swap(a.second,b.second);
  if(vv[b.first]<vv[b.second])swap(b.first,b.second);
  if(a.first==a.second)swap(a.second,b.first);
  if(a.first==a.second)swap(a.second,b.second);
  return a;
};
rep(i,1LL<<n){
  ll a;
  cin >> a;
  vv.push_back(a);
  v.emplace_back(i,0);
}
rep(i,1LL<<n)rep(j,n){
  if(!(1LL&(i>>j)))v[i|(1LL<<j)]=f(v[i|(1LL<<j)],v[i]);
}
ll mx=0;
rep(i,(1LL<<n) -1){
  mx=max(mx,vv[v[i+1].first]+vv[v[i+1].second]);
  cout << mx << endl;
}
return 0;
}

Measured memory_bytes: 9440
N = int(input())
L = list(map(int, input().split()))
sticks = {}
for l in L:
  if l in sticks:
    sticks[l] += 1
  else:
    sticks[l] = 1

sticks = sorted(sticks.items(), key=lambda x:x[0])
targetIndexes = [0, 1, 2]
res = 0
while targetIndexes[0] < len(sticks) - 2:
  if abs(sticks[targetIndexes[0]][0] - sticks[targetIndexes[1]][0]) < sticks[targetIndexes[2]][0] < sticks[targetIndexes[0]][0] + sticks[targetIndexes[1]][0]:
    res += sticks[targetIndexes[0]][1] * sticks[targetIndexes[1]][1] * sticks[targetIndexes[2]][1]

  if targetIndexes[2] < len(sticks) - 1:
    targetIndexes[2] += 1
  elif targetIndexes[1] < len(sticks) - 2:
    targetIndexes[1] += 1
    targetIndexes[2] = targetIndexes[1] + 1
  else:
    targetIndexes[0] += 1
    targetIndexes[1] = targetIndexes[0] + 1
    targetIndexes[2] = targetIndexes[1] + 1


print(res)

Measured memory_bytes: 67908
package main

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

func solve() {
	a, b := getInt(), getInt()
	ans := a * b
	if (a > 9) || (b > 9) {
		ans = -1
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

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

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll n;
    cin>>n;
    ll x=n%10;
    if(x==2 || x==4 || x==7 || x==9 || x==5)
        cout<<"hon";
    else if(x==0 || x==1 || x==6 || x==8)
        cout<<"pon";
    else if(x==3)
        cout<<"bon";
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
    string str;
    long long int k;
    cin >> str >> k;
    string ans;
    int i = 0;
    int ll = str.length();
    while(str[i] == '1' && i < ll){
        ans += str[i];
        i++;
    }
    ans += str[i];
    //cout << ans << endl;
    long long int l = ans.length();
    if(k < l){
        cout << 1 << endl;
    }else{
        cout << ans[l - 1] << endl;;
    }
    return 0;
}

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

int main()
{
	int a[1000];
	int n, m;
	while (cin >> n >> m, n) {
		int ans = 0;
		for (int i = 0;i < n;i++) {
			cin >> a[i];
		}
		for (int i = 0;i < n;i++) {
			for (int j = 0;j < n;j++) {
				if (a[i] + a[j] < m+1)
					if ((i!=j)&&(ans < a[i] + a[j]))
						ans = a[i] + a[j];
			}
		}
		if (ans > 0)
			cout << ans<<endl;
		else
			cout << "NONE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3084
a=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
s=str(input())
for i in range(len(a)):
  if a[i]not in s:
    print(a[i])
    exit()
print("None")

Measured memory_bytes: 9024
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

int main(void){
    int H, W;
    cin >> H >> W;
    vector<string> S(H, "");
    for(int i=0; i<H; i++){
        cin >> S[i];
    }
    vector<vector<int>> G(H*W, vector<int>());
    vector<vector<int>> distance(H*W, vector<int>(H*W, -1));
    for(int i=0; i<H-1; i++){
        for(int j=0; j<W; j++){
            if((S[i][j]=='.')&&(S[i+1][j]=='.')){
                G[i*W+j].push_back((i+1)*W+j);
                G[(i+1)*W+j].push_back(i*W+j);
            }
        }
    }
    for(int i=0; i<H; i++){
        for(int j=0; j<W-1; j++){
            if((S[i][j]=='.')&&(S[i][j+1]=='.')){
                G[i*W+j].push_back(i*W+j+1);
                G[i*W+j+1].push_back(i*W+j);
            }
        }
    }
    bool bp=false;
    int startpoint;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if(S[i][j]=='.'){
                startpoint=i*W+j;
                bp=true;
                break;
            }
        }
        if(bp)break;
    }
    queue<int> queG;
    for(int i=0; i<H*W; i++){
        if(S[i/W][i%W]!='.')continue;
        queG.push(i);
        distance[i][i]=0;
        while(!queG.empty()){
            int curpoint = queG.front();
            queG.pop();
            for(int nextpoint: G[curpoint]){
                if(distance[i][nextpoint]!=-1)continue;
                distance[i][nextpoint]=distance[i][curpoint]+1;
                queG.push(nextpoint);
            }
        }
    }
    vector<int> furthest(H*W, -1);
    for(int i=0; i<H*W; i++){
        for(int j=0; j<H*W; j++){
            if(distance[i][j] > furthest[i])furthest[i]=distance[i][j];
        }
    }

    cout << *max_element(furthest.begin(), furthest.end()) << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

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

    vector<int> cnt(m, 0);
    for(int i=0; i<n; i++){
        int k;
        cin >> k;
        for(int j=0; j<k; j++){
            int likeFood;
            cin >> likeFood;
            cnt[likeFood-1]++;
        }
    }

    int ans=0;
    for(int i=0; i<m; i++){
        if(cnt[i]==n){
            ans++;
        }
    }

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

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

#define ll long long

using namespace std;

const ll inf = 1e18;
const ll mod = 1e9 + 7;

const ll MAXN = 1e5 + 100;

ll t[MAXN * 4];
ll cnt[MAXN * 4];

void update(ll v, ll tl, ll tr, ll l, ll r, ll val) {
    if (l > r)
        return;
    if (tl == l && tr == r) {
        t[v] += val;
        ++cnt[v];
    } else {
        ll tm = (tl + tr) / 2;
        update(v * 2, tl, tm, l, min(r, tm), val);
        update(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, val);
    }
}

pair<ll, ll> get(ll v, ll tl, ll tr, ll pos) {
    if (tl == tr)
        return {t[v], cnt[v]};
    ll tm = (tl + tr) / 2;
    pair<ll, ll> res;
    if (pos <= tm)
        res = get(v * 2, tl, tm, pos);
    else
        res = get(v * 2 + 1, tm + 1, tr, pos);
    return {res.first + t[v], res.second + cnt[v]};
}

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    
    ll n, m;
    scanf("%lld %lld", &n, &m);
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    ll all = 0;
    for (ll i = 0; i + 1 < n; ++i) {
        if (a[i + 1] >= a[i]) {
            all += a[i + 1] - a[i];
            update(1, 0, MAXN - 1, a[i] + 1, a[i + 1], a[i]);
        }
        else {
            all += a[i + 1] + m - a[i];
            update(1, 0, MAXN - 1, a[i] + 1, m, a[i]);
            update(1, 0, MAXN - 1, 1, a[i + 1], a[i] - m);
        }
    }
    // cerr << "a " << all << endl;
    ll ans = inf;
    for (ll i = 1; i <= m; ++i) {
        pair<ll, ll> g = get(1, 0, MAXN - 1, i);
        ll cur = all - g.second * (i - 1) + g.first;
        ans = min(ans, cur);
        cerr << cur << endl;
    }
    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 7168
x1, y1, r1 = gets.split.map(&:to_i)
x2, y2, r2 = gets.split.map(&:to_i)
 
dist_o1_to_o2 = Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
 
o1_to_cross =
  (r1 ** 2 - r2 ** 2 + dist_o1_to_o2 ** 2) / (2 * dist_o1_to_o2)
 
dist_cross_half = Math.sqrt(r1 ** 2 - o1_to_cross ** 2)
 
r = o1_to_cross / dist_o1_to_o2
cx = x1 + r * (x2 - x1)
cy = y1 + r * (y2 - y1)
 
sin = (y2 - y1) / dist_o1_to_o2
cos = (x2 - x1) / dist_o1_to_o2
ans =  [[cx - dist_cross_half * sin, cy + dist_cross_half * cos], 
  [cx + dist_cross_half * sin, cy - dist_cross_half * cos]].sort.flatten
puts "%.9f %.9f %.9f %.9f" % ans

Measured memory_bytes: 8808
#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef long double ld;


vector<int> is_p(100005, 1);

vector<int> arr;

void sieve(){
    is_p[0] = is_p[1] = 0;
    for(int i = 4; i <= 100004; i+=2) is_p[i] = 0;
    for(ll i = 3; i <= 100004; i+=2){
        if(is_p[i]){
            for(ll j = i*i; j <= 100004; j += i){
                is_p[j] = 0;
            }
        }
    }

    for(int i = 3; i <= 100004; i += 2){
        if(is_p[i] and is_p[(i+1)/2]) arr.push_back(i);
    }

}

int main(int argc, char const *argv[]) {
    ios::sync_with_stdio(false);

    #ifdef DBG
        freopen("in", "r", stdin);
    #endif
    
    sieve();

    int q;
    cin>>q;
    while(q--){
        int l, r;
        cin>>l>>r;
        auto it = lower_bound(arr.begin(), arr.end(), l);
        if(*it > r){
            cout<<"0\n";
            continue;
        }
        auto ito = upper_bound(arr.begin(), arr.end(), r);
        ito--;
        if(*ito < l){
            cout<<"0\n";
            continue;
        }
        else cout<<(ito - arr.begin()) - (it - arr.begin()) + 1<<"\n";
    }

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

int main() {
    using namespace std;
    int n;
    string s,t, out;
    cin >> n;
    cin >> s >> t;
    // cout << s;
    out = "";
    for (int i=0; i<n; i++){
        // out += s[i] + t[i];
        cout << s[i] << t[i];
    }
    
}

Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    public class MainClass
    {

        static List<int> B;

        static int c;

        public static void Main(string[] args)
        {
            checked
            {
                var paramsList = Console.ReadLine().Split(' ').ToList();
                // nmc
                var n = int.Parse(paramsList[0]);
                var m = int.Parse(paramsList[1]);
                c = int.Parse(paramsList[2]);

                B = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();

                var res = EnumerablePlus
                    .Repeat(n, () => Console.ReadLine())
                    .Select(line => line.Split(' ').Select(s => int.Parse(s)).ToList())
                    .Where(Test)
                    .Count();

                Console.WriteLine(res);
            }
        }

        static bool Test(List<int> features)
        {
            var score = B.Zip(features, (b, f) => b * f).Sum() + c;
            return score > 0;
        }

    }

    public static class EnumerablePlus
    {
        ///<summary>出力文字列に変換。</summary>
        public static string MkString<T>(this IEnumerable<T> list)
        {
            return list.Aggregate(
                new System.Text.StringBuilder(),
                (a, b) => ((a.Length > 0) ? a.Append(' ') : a).Append(b)
                ).ToString();
        }

        ///<summary>添字付きfor。</summary>
        public static void ForEach<T>(this IEnumerable<T> list, Action<T, int> a)
        {
            int i = 0;
            foreach (var item in list)
            {
                a(item, i);
            }
        }

        ///<summary>指定回数デリゲートを呼び出す。</summary>
        public static IEnumerable<T> Repeat<T>(int n, Func<T> f)
        {
            for (int i = 0; i < n; i++)
            {
                yield return f();
            }
        }
    }

}


Measured memory_bytes: 13524
#include<stdio.h>

int main(){
	
	int A,B;
	int x,y,z;
	int largest;
	
	scanf("%d", &A);
	scanf("%d", &B);
	
	x = A+B;
	y= A-B;
	z= A*B;
	
	largest = x;
	
	if(largest < y){
		largest =y;
	}
	
	if(largest < z){
		largest =z;
	}
	
	printf("%d", largest);
	return 0;
}

Measured memory_bytes: 128
n = gets.chomp.to_i

ans = 0
1.upto(n) do |i|
  next if i.even?

  tmp = 0

  1.upto(i) do |j|
    next if j.even?
    if i%j==0
      tmp += 1
    end
  end

  if tmp == 8
    ans += 1
  end
end

p ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;


int main(){
    ll x;cin >> x;
    for(int i=-300;i<=300;i++)
        for(int j=-300;j<=300;j++){
            ll m=i*i,n=j*j;
            if(m*m*i-n*n*j==x){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    return 0;
}

Measured memory_bytes: 3600
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int a = 0;
	char s[11] = {0};
	scanf("%d", &a);
	scanf("%s", s);
	if (a < 3200) {
		printf("red\n");
	} else {
		printf("%s\n",s);
	}
    return 0;
}


Measured memory_bytes: 128
// WIP

#include <bits/stdc++.h>
using namespace std;

// Utility
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, X, Y) for (int I = (X); I < (Y); I++)
using ll = int64_t;
using ull = uint64_t;
template<typename T> struct is_container {
template<typename C> static char test(typename C::const_iterator*); template<typename> static int test(...);
static bool const value = sizeof(test<T>(nullptr)) == sizeof(char) && !std::is_same<std::string, T>::value;
};
namespace std {
template<class ...Ts>        istream& operator>>(istream& i, tuple<Ts...>& x) { apply([&](auto&&... ys){ ((i >> ys), ...); }, x); return i; }
template<class T1, class T2> istream& operator>>(istream& i, pair<T1, T2>& x) { i >> x.first >> x.second; return i; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
istream& operator>>(istream& i, T& x) { for (auto& y : x) { i >> y; } return i; }
}

// Debugging
#ifndef DEBUG
#define DEBUG 0
#endif
#define dbg(X) do { if (DEBUG) { cout << #X ": " << (X) << endl << flush; } } while (0)
#define dbg2(X) do { if (DEBUG) { cout << #X ":" << endl; for (auto& __x : (X)) { cout << __x << endl << flush; } } } while (0)
#define dbgv(...) do { if (DEBUG) { cout << "(" #__VA_ARGS__ "): " << make_tuple(__VA_ARGS__) << endl << flush; } } while (0)
namespace std {
template<class ...Ts>        ostream& operator<<(ostream& o, const tuple<Ts...>& x) { o << "("; apply([&](auto&& y, auto&&... ys){ o << y; ((o << ", " << ys), ...); }, x); o << ")"; return o; }
template<class T1, class T2> ostream& operator<<(ostream& o, const pair<T1, T2>& x) { o << tie(x.first, x.second); return o; }
template<class T, enable_if_t<is_container<T>::value, int> = 0>
ostream& operator<<(ostream& o, const T& x) { o << "{"; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) { o << ", "; } o << *it; } o << "}"; return o; }
}

// Segment tree for maximum
struct SegmentTree {
  int n = 1;
  vector<int> data;
  SegmentTree(int _n) {
    while (n < _n) { n *= 2; }
    data.resize(n * 2);
  }

  void set(int qi, int qv) {
    int j = qi + n;
    data[j] = qv;
    while (j > 1) {
      j /= 2;
      data[j] = max(data[j * 2], data[j * 2 + 1]);
    }
  }

  int _reduce(int ql, int qr, int l, int r, int j) {
    if (qr <= l || r <= ql) { return 0; }
    if (ql <= l && r <= qr) { return data[j]; }
    int v0 = _reduce(ql, qr, l, (l + r) / 2, j * 2);
    int v1 = _reduce(ql, qr, (l + r) / 2, r, j * 2 + 1);
    return max(v0, v1);
  }

  int reduce(int ql, int qr) {
    return _reduce(ql, qr, 0, n, 1);
  }
};

// Main
void mainCase() {
  int n, k; // [0, 3 x 10^5]
  cin >> n >> k;
  vector<int> ls(n); // [0, 3 x 10^5]
  cin >> ls;

  int m = *max_element(ALL(ls));

  // Value domain segments
  SegmentTree tree(m + 1);

  FOR(i, 0, n) {
    int x = ls[i];
    int l = tree.reduce(x - k, x + k + 1);
    tree.set(x, l + 1);
  }

  int res = tree.reduce(0, m + 1);
  cout << res << endl;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  mainCase();
  return 0;
}

/*
python misc/run.py atcoder/abl0/d/main.cpp --check

%%%% begin
10 3
1
5
4
3
8
6
9
7
2
4
%%%%
7
%%%% end
*/


Measured memory_bytes: 8484
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, m, k;
    cin >> n >> m >> k;

    vector<ll> a(n + 1, 0), b(m + 1, 0);
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        a[i + 1] = a[i] + t;
    }
    for (int j = 0; j < m; j++) {
        int t;
        cin >> t;
        b[j + 1] = b[j] + t;
    }

    int r = 0;
    for (int i = 0; i <= n; i++) {
        int j = upper_bound(b.begin(), b.end(), k - a[i]) - b.begin() - 1;
        if (j < 0) break;
        r = max(r, i + j);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 6280
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 1000000007, Answer;
long long N, A[1 << 18], B[1 << 18];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N; i++) B[i] = (B[i - 1] + A[i]) % mod;
	for (int i = 1; i <= N; i++) Answer += (A[i] * B[i - 1]) % mod;
	cout << Answer % mod << endl;
	return 0;
}

Measured memory_bytes: 6712
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
using namespace std;
const int ma = 55;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
int a[ma], n, k;
main()
{
    scanf("%lld%lld", &n, &k);
    rep(i, n) scanf("%lld", a + i);
    int ans = -1e10;
    for (int i = -1; i < n; i++)
    {
        for (int j = i + 1; j <= n; j++)
        {
            if (i + 1 + n - j > k)
                continue;
            int rest = k - (i + 1 + n - j);
            vector<int> v;
            rep(x, i + 1) v.emplace_back(a[x]);
            for (int x = j; x < n; x++)
                v.emplace_back(a[x]);
            sort(begin(v), end(v));
            int sum = 0;
            rep(i, v.size()) sum += v[i];
            rep(i, v.size())
            {
                if (rest == 0 || v[i] > 0)
                    continue;
                sum -= v[i];
                rest--;
            }
            ans = max(ans, sum);
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
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; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
            ll i;
            if(x < 2)return 0;
            else if(x == 2) return 1;
            if(x%2 == 0) return 0;
            for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
            return 1;
        }

signed main(void) 
{
    ll n;
    cin >> n;
    while (true) {
        if (isPrime (n) == 1) break;
        n++;
    }
    cout <<n;
    
   
}


Measured memory_bytes: 3608
///
// File:  a.go
// Author: ymiyamoto
//
// Created on Thu Dec 27 12:44:02 2018
//
package main

import (
  "fmt"
)

func min(a,b int)int{
	if a < b{
		return a
	}
	return b
}

func main(){
	var a, b int
	fmt.Scan(&a, &b)
	if b >= a {
		fmt.Println(a)
	} else {
		fmt.Println(a-1)
	}
}


Measured memory_bytes: 512
//
#include <vector>
#include <set>
#include <map>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
#define outD(fpv) cout << setprecision(20) << fpv << endl;
inline void yes(bool cond) { cond ? puts("YES") : puts("NO"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
template<typename Type> inline void unique(Type& arr) { sort(arr); arr.erase(unique(arr.begin(), arr.end()), arr.end()); }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<ll>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);

    int year, month, day;
    scanf("%d/%d/%d", &year, &month, &day);

    const auto f = [&]()
    {
        if (2019 < year)
            return false;
        if (4 < month)
            return false;
        if (30 < day)
            return false;
        return true;
    };
    if (f())
    {
        puts("Heisei");

    }
    else
    {
        puts("TBD");
    }


    //
    return 0;
}

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

int N,K;
int A[200000];

bool f(int x){
 int ans=0;
 rep(i,N){
  int tmp=(A[i]-1)/x;
  ans+=tmp;
 }
 return ans<=K;
}

int main(){

 scanf("%d%d",&N,&K);
 rep(i,N) scanf("%d",&A[i]);
 int l,r; l=0; r=1000000001;
 while(l+1<r){
  int m=(l+r)>>1;
  if(f(m)) r=m; else l=m;
 }
 printf("%d\n",r);
 
 return 0;
}


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

using namespace std;
#define LL long long

const int INF  = 0x3f3f3f3f;
const int MAXN = 512345;

const double eps = (double) 1e-8;

bool equal (LL X, LL y) {
	double Y = (double) X / 2.0;
	// cout << fixed << setprecision(8) << Y << ' ' << y << endl;
	return fabs (Y - (double)y) <= eps;
}

int main () {

	ios_base::sync_with_stdio(false); cin.tie(NULL);

	LL W, H, x, y;
	cin >> W >> H >> x >> y;

	// cout << equal (H, y) << endl;

	bool can = (equal(W, x) && equal (H, y));

	double area = (W * H) / 2.0;

	cout << fixed << setprecision(6) << area << ' ' << can << endl;


	return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int T = sc.nextInt();
    int c[] = new int[N];
    int t[] = new int[N];
    int cmin = 1001;
    int twithin = 1001;
    
    for(int i= 0;i<N;i++){
      c[i]=sc.nextInt();
      t[i]=sc.nextInt();
      
      if(t[i]<=T && cmin>c[i]){
        //tがT以内かつcが最小になるまで値をサーチ
        twithin=t[i];
        cmin=c[i];
      }
        
    }
    if(twithin==1001){
      System.out.println("TLE");
    }else{
      System.out.println(cmin);
    }
  }
}

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

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int cnt = 0;
    for (int i = 0; i <= 50 * c; i += 50) {
        for (int j = 0; j <= 100 * b; j += 100) {
            for (int k = 0; k <= 500 * a; k += 500) {
                if (x == i + j + k) cnt++;
            }
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3608
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0

for i in range(n):
    if a[i] >= b[i]:
        count += b[i]
    else:
        count += a[i]
        b[i] -= a[i]
        if b[i] >= a[i+1]:
            count += a[i+1]
            a[i+1] = 0
        else:
            count += b[i]
            a[i+1] -= b[i]

print(count)

Measured memory_bytes: 19116
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

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

#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sqr(x) (x) * (x)

using namespace std;
//using namespace __gnu_pbds;

mt19937_64 gen(time(0));

//typedef tree<
//pair <int, int>,
//null_type,
//less<pair <int, int>>,
//rb_tree_tag,
//tree_order_statistics_node_update>
//ordered_set;

//const int inf = 2e9 + 6555;
//const int mod = 1e9 + 7;
//const int maxn = 1e5 + 555;



signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif
    int n, x, t;
    cin >> n >> x >> t;
    cout << ((n + x - 1) / x) * t;
    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  ll ans = 0;
  int n = s.size();
  int m = t.size();
  vector<vector<int>> cindex(26);
  for (int i = 0; i < n; i++) {
    cindex[s[i] - 'a'].push_back(i);
  }
  int now = -1;
  for (int i = 0; i < m; i++) {
    if (cindex[t[i] - 'a'].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    auto it = upper_bound(cindex[t[i] - 'a'].begin(), cindex[t[i] - 'a'].end(), now);
    if (it == cindex[t[i] - 'a'].end()) {
      now = cindex[t[i] - 'a'][0];
      ans += n;
    } else {
      now = *it;
    }
  }
  ans += now + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1228
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

    private static void B_ResistorsInParallel() {

        final Scanner sc = new Scanner(System.in);
        final int numberOfInput = sc.nextInt();
        final List<Integer> inputs = new ArrayList<>();
        for (int i = 0; i < numberOfInput; i++) {
            inputs.add(sc.nextInt());
        }

        final double sum = inputs.stream()
                .mapToDouble(Integer::doubleValue)
                .map(dbl -> 1 / dbl)
                .sum();

        System.out.println(1 / sum);
    }
}


Measured memory_bytes: 27348
let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let rec digits acc = function
  | 0 -> acc
  | n -> digits (n mod 10 :: acc) (n / 10)
let digits = digits []

let () = Scanf.scanf "%d\n" (fun n ->
  let ds = digits n in
  select ds
  |> List.map (fun (l, x, r) ->
      x - 1 + 9 * List.length r + List.fold_left ( + ) 0 l)
  |> List.fold_left max (List.fold_left ( + ) 0 ds)
  |> Printf.printf "%d\n")

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


 bool isPrime (int n) {
    if (n == 1) return false;
    for (int i = 2; i * i <= n; i++) if (n % i == 0) return false;
    return true;
 }

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

   vector<pair<int, int>> lr(Q);

   rep(i, 0, Q) cin >> lr.at(i).first >> lr.at(i).second;

   vector<int> like;

   for (int i = 1; i < 100000; i += 2) {
     if (isPrime(i) && isPrime((i + 1) / 2)) like.push_back(i);
   }

   rep(i, 0, Q) {
     cout << upper_bound(like.begin(), like.end(), lr.at(i).second) - lower_bound(like.begin(), like.end(), lr.at(i).first) << endl;
   }

 }


Measured memory_bytes: 1408
#include <stdio.h>
main () {
    int n;
    scanf("%d",&n);
    long long a[n], ans=1, maxono=1e18;
    for(int i=0;i<n;i++) scanf("%lld",a+i);
    for(int i=0;i<n;i++) {
        if(a[i]==0) {
            printf("0");
            return 0;
        }
    }
    for(int i=0;i<n;i++) {
        if(a[i]<=maxono/ans) {
                ans*=a[i];
            }
        else {
            printf("-1");
            return 0;
        }
    }
    printf ("%lld",ans);
    // zz did for long time

}

Measured memory_bytes: 2464
#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;


#define MAX_V 10000
#define INF 1e9

struct edge{
    int to, cap, rev;
};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from, int to, int cap){
    G[from].push_back((edge){to, cap, (int)G[to].size()});
    G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

int dfs(int v, int t, int f){
    if (v==t) return f;
    used[v] = 1;
    REP(i,G[v].size()){
        edge &e = G[v][i];
        if (!used[e.to] && e.cap>0){
            int d = dfs(e.to, t, min(f, e.cap));
            if (d>0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t){
    int flow = 0;
    while(1){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if (f==0) return flow;
        flow += f;
    }
}

int gcd(int x, int y){
    if (y == 0) return x;
    return gcd(y, x % y);
}

int main() {
    int n, m;
    while (cin >> n >> m && n){
        VI b(n), r(m);
        REP(i,n) cin >> b[i];
        REP(i,m) cin >> r[i];
        int start = 1010, goal = 1011;
        REP(i,n) add_edge(start, i, 1);
        REP(i,m) add_edge(n+i, goal, 1);
        REP(i,n) REP(j,m){
            if (gcd(b[i], r[j]) > 1)
                add_edge(i, j+n, 1);
        }
        cout << max_flow(start, goal) << endl;

        REP(i,MAX_V){
            G[i].clear();
        }
    }

    return 0;
}

Measured memory_bytes: 9744
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

    vector<int> ans;

    for (int i = n; i > 0;) {
        bool flag = true;
        for (int j = m; j > 0; --j) {
            if (i - j >= 0 && s[i-j] == '0') {
                flag = false;
                i = i - j;
                ans.push_back(j);
                break;
            }
        }
        // cout << i << endl;
        if (flag) {
            cout << -1 << endl;
            return 0;
        }
    }

    reverse(ans.begin(), ans.end());
    for (auto itr : ans) {
        cout << itr << " ";
    }
    END;
}

Measured memory_bytes: 1144
import java.util.*;
import java.util.stream.IntStream;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<>();
        IntStream.range(0,n).forEach(i ->{
            int a = sc.nextInt();
            if(i%2==0){
                list.addFirst(a);
            }else {
                list.addLast(a);
            }
        });

        if(n%2==0){
            Collections.reverse(list);
        }

        for(int i : list){
            System.out.print(i);
            System.out.print(" ");
        }

//        list.stream().forEach(j -> {;
//
//                }
//        );

    }


}

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

// 
int main() {
    long long A, B, K, afterA, afterK;
    cin >> A >> B >> K;
    afterA = max(A - K, (long long)0);
    afterK = max(K - A, (long long)0);
    B = max(B - afterK, (long long)0);
    cout << afterA << " " << B;
}


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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}//modinv(i,mod)でi^-1のmodをとる。

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}//modpow(a,n,mod)でa^nのmodをとる

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<int64_t, int> prime_factor(int64_t n){
    map< int64_t, int> ret;
    for(int64_t i = 2; i * i <= n; i++){
        while(n % i == 0){
            ret[i]++;
            n /= i;
        }
    }
    if( n != 1) ret[n] = 1;
    return ret;
}

int main() {
    // 前処理
    COMinit();

    int N, M;
    cin >> N >> M;

    //vector<int> prime, pnum;
/*
    for(int i = 2; i < sqrt(M); i++){
        if(M % i == 0){
            prime.push_back(i);
            
        }
    }*/


    map< int64_t, int> ret = prime_factor(M);
    long long ans = 1;
    for(auto p : ret){
        ans = ans * COM(N + p.second - 1, N - 1) % MOD;
    }

    cout << ans << endl;

    // 計算例
//    cout << COM(100000, 50000) << endl;
}

Measured memory_bytes: 12160
x,y=map(int,input().split())

g_1=[1,3,5,7,8,10,12]
g_2=[4,6,9,11]
g_3=[2]

if x in g_1:
    if y in g_1:
        print("Yes")
    else:
        print("No")
if x in g_2:
    if y in g_2:
        print("Yes")
    else:
        print("No")
if x in g_3:
    if y in g_3:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#define ll unsigned long long
using namespace std;

int main(){
    int A,B,C,K,ans=0;
    string S;
    cin >> K >> S;
    if(S.size() <= K){
        cout << S << endl;
    }else{
        cout << S.substr(0,K) << "..." << endl;
    }
}

Measured memory_bytes: 3628
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>

using namespace std;

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

static const double eps = 10e-8;

class mycmp{
public:
	bool operator()(const P p1, const P p2){
		if(p1.first < p2.first) return true;
		else if(p1.second < p2.second) return true;
		else false;
	}
};

int main(){
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;
		vector<P> dolls;

		for(int i=0;i<n;i++){
			int h,r;
			scanf("%d %d",&h,&r);
			dolls.push_back(P(h,r));
		}

		int m;
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			int h,r;
			scanf("%d %d",&h,&r);
			dolls.push_back(P(h,r));
		}


		sort(dolls.begin(),dolls.end());

		int* dp = new int[n+m];
		memset(dp,0,sizeof(dp));
		for(int i=0;i<n+m;i++) dp[i] = 1;

		for(int i=0;i<dolls.size();i++){
			for(int j=0;j<dolls.size();j++){
				if(dolls[j].first < dolls[i].first
					&& dolls[j].second < dolls[i].second){
						dp[i] = max(dp[i],dp[j] + 1);
				}
			}
		}

		cout << dp[dolls.size()-1] << endl;
		delete[] dp;
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args)  {
	
		Scanner s = new Scanner(System.in);
		int H = s.nextInt();
		int W = s.nextInt();
		
		String[] array = new String[H];
		for(int i=0; i<H; i++){
			array[i] = s.next();	
		}
		
		// 表示
		for(int i=0; i<H; i++){
			System.out.println(array[i]);
			System.out.println(array[i]);
		}	
	}
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back
#define fi first
#define se second
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
#define INF (ll)1e18
#define ll long long
#define P pair<ll, ll>
#define vll vector<ll>
#define vvll vector<vll>

ll n, m, st;
vector<vector<P> > g;

void solve1(void) {
    vll dist(n, INF);
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0, st)); 
    dist[st] = 0; // "見た"
    while (q.size()) { 
        // q = {(d, v)} : 頂点vに距離dで到達できる（dは最適とは限らない）
        // dist[v] : 今までに見た中で、vに到達するための最短距離
        //
        // vの初出がここに来た時点で、dist[v]が最適であることは保証されている！
        // あとは、d = dist[v]のものだけ遷移すれば良い
        P st = q.top(); q.pop();
        ll d = st.fi, v = st.se;
        if (d > dist[v]) continue; // 同じvに異なる距離dで到達可能だが、最適なものだけを見ればよい
        rep(i, g[v].size()) {
            P edge = g[v][i];
            ll u = edge.fi, cost = edge.se;
            if (dist[v] + cost >= dist[u]) continue;
            dist[u] = dist[v] + cost; // "見た"
            q.push(P(dist[v] + cost, u));
        }
    }
    rep(i, n) {
        if (dist[i] == INF) 
            cout << "INF" << endl;
        else
            cout << dist[i] << endl;
    }
}

void solve2(void) {
    vll dist(n, INF); 
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0, st));  
    while (q.size()) { 
        // q = {(d, v)}: vにdで到達できる（dは最適とは限らない）
        // dist[v]: 今までに"見た"中で、vに到達するための最短距離
        P st = q.top(); q.pop();
        ll d = st.fi, v = st.se;
        if (d >= dist[v]) continue; 
        chmin(dist[v], d); // "見た"
        rep(i, g[v].size()) {
            P edge = g[v][i];
            ll u = edge.fi, cost = edge.se;
            q.push(P(dist[v] + cost, u));
        }
    }
    rep(i, n) {
        if (dist[i] == INF) 
            cout << "INF" << endl;
        else
            cout << dist[i] << endl;
    }
}

void solve3(void) {
    vll dist(n, INF); 
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0, st));  
    while (q.size()) { 
        // q = {(d, v)}: vにdで到達できる（dは最適とは限らない）
        // dist[v]: 今までに"見た"中で、vに到達するための最短距離
        P st = q.top(); q.pop();
        ll d = st.fi, v = st.se;
        if (dist[v] != INF) continue; 
        chmin(dist[v], d); // "見た"
        rep(i, g[v].size()) {
            P edge = g[v][i];
            ll u = edge.fi, cost = edge.se;
            q.push(P(dist[v] + cost, u));
        }
    }
    rep(i, n) {
        if (dist[i] == INF) 
            cout << "INF" << endl;
        else
            cout << dist[i] << endl;
    }
}

int main(void) {
    cin >> n >> m >> st;
    g.resize(n);
    rep(i, m) {
        ll u, v, d; cin >> u >> v >> d;
        g[u].pb(P(v, d));
    }
    solve1();
//    solve2();

    return 0;
}



Measured memory_bytes: 19328