akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

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

    // input
    int N;
    cin >> N;

    map<int, int> mp;
    FOR(i, 0, N){
        int a;
        cin >> a;
        mp[a]++;
    }

    ll excess = 0;
    for(auto p : mp){
        int count = p.second;
        if(count > 1){
            excess += count - 1;
        }
    }

    ll num = excess / 2;
    if(excess%2 == 1){
        num++;
    }
    
    ll answer = N - 2 * num;
    
    p(answer);

    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <bits/stdc++.h>

#define unsigned int long long
#define p(a, b) pair<a,b>

using namespace std;

//ifstream cin("Input.txt");
//ofstream cout("Output.txt");



int main() {
    int a, b;
    cin >> a >> b;
    cout << a * b - a - (b - 1);
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>
int main()
{
    int n, k; std::cin >> n >> k;
    auto c = [k](long p)
    {
        if(p >= k) return 0;
        for(int i = 1;;)
        {
            p *= 2;
            if(p >= k) return i;
            ++i;            
            
        }
    };
    double re = 0;
    std::cout << std::setprecision(12);
    for(int i = 1; i <= n; ++i)
    {
        re += 1.0/n * pow(0.5, c(i));                
    }
    std::cout << re;
    
    
}


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

ll visit[200],ar[200],b[200],c[200],len=0,ans1=0;
map<string , int>mp;
string s,ss[100000];
vector<int>ve;



int main()
{

    ll i,j,k,n,ans=0;
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>ar[i];
    for(i=1;i<=n;i++)
        cin>>b[i];
    for(i=1;i<=n-1;i++)
        cin>>c[i];

    for(i=1;i<=n;i++)
    {
        ans+=b[ar[i]];
        if(i>1)
        {
            if(ar[i]-ar[i-1]==1) ans+=c[ar[i-1]];
        }
    }
    cout<<ans<<endl;






    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
	public static final Scanner sc = new Scanner(System.in);
  	public static void main(String[] args){
    	int n = sc.nextInt();
      	long ans = 0;
      	for (int i=1; i<=3; i++){
        	ans += Math.pow(n, i);
        }
      	System.out.println(ans);
    }
}


Measured memory_bytes: 35924
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,cnt=0;
  cin>>N;
  vector<int> freq(N+1,0);
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    if(a>N){cnt++;continue;}
    else{freq.at(a)++;}
  }
  for(int i=1;i<=N;i++){
    if(freq.at(i)==i){continue;}
    else if(freq.at(i)>i){cnt+=freq.at(i)-i;}
    else{cnt+=freq.at(i);}
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

struct SegmentTree{
   private:
       int n;
       vector<ll> node;
   public:
       SegmentTree(int sz,ll init){
           n=1;
           while(n<sz)n*=2;
           node.resize(2*n-1,init);
       }
       void update(int k,ll x){
           k+=n-1;
           node[k]=x;
           while(k>0){
               k=(k-1)/2;
               node[k]=min(node[2*k+1],node[2*k+2]);
           }
       }
       //[a,b)でのminを返す
       ll get(int a,int b,int k=0,int l=0,int r=-1){
           if(r<0)r=n;
           if(r<=a||b<=l)return longinf;
           if(a<=l&&r<=b)return node[k];
           ll xl=get(a,b,2*k+1,l,(l+r)/2);
           ll xr=get(a,b,2*k+2,(l+r)/2,r);
           return min(xl,xr);
       }
   };
int main(){
    int n;
    cin>>n;
    n++;
    ll init=(1LL<<31)-1;
    SegmentTree Seg(n,init);
    int q;cin>>q;
    rep(i,q){
        int a,x,y;
        cin>>a>>x>>y;
        if(a)cout<<Seg.get(x,y+1)<<endl;
        else Seg.update(x,y);
    }
   return 0;
}


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

int main() {
	int n;
	int total;
	int me[6];
	int b;
	string s;
	cin >> n;
	while(n){
		total=1;
		me[0]=1,me[1]=2,me[2]=3,me[3]=5,me[4]=4;me[5]=6;
		for(int i=0;i<n;i++){
			cin >> s;
			if(s=="North"){
				b=me[0];
				me[0]=me[1];
				me[1]=me[5];
				me[5]=me[3];
				me[3]=b;
			}else if(s=="East"){
				b=me[0];
				me[0]=me[4];
				me[4]=me[5];
				me[5]=me[2];
				me[2]=b;
			}else if(s=="West"){
				b=me[0];
				me[0]=me[2];
				me[2]=me[5];
				me[5]=me[4];
				me[4]=b;
			}else if(s=="South"){
				b=me[0];
				me[0]=me[3];
				me[3]=me[5];
				me[5]=me[1];
				me[1]=b;
			}else if(s=="Right"){
				b=me[1];
				me[1]=me[2];
				me[2]=me[3];
				me[3]=me[4];
				me[4]=b;
			}else if(s=="Left"){
				b=me[1];
				me[1]=me[4];
				me[4]=me[3];
				me[3]=me[2];
				me[2]=b;
			}
			total+=me[0];
		}
		cout << total << endl;
		cin >> n;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
*/

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

  vi x(m);
  rep(i, m){
    cin >> x[i];
  }

  if(n >= m){
    cout << 0 << endl;
    return 0;
  }

  sort(all(x));

  vl d(m-1);
  rep(i, m-1){
    d[i] = x[i+1]-x[i];
  }

  sort(all(d));

  ll ans = 0;
  rep(i, m-n){
    ans += d[i];
  }

  cout << ans << endl;

  return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0, sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int fib[50];

int rec(int n){
    if(fib[n] != -1) return fib[n];
    return fib[n] = rec(n-2) + rec(n-1);
}

int main(void){
    int n; cin >> n;
    REP(i,50) fib[i] = -1;
    fib[0] = 1; fib[1] = 1;
    int ans = rec(n);
    cout << ans << en;
    return 0;
}


Measured memory_bytes: 3112
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))


//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(){
    int N, M;
    cin >> N >> M;
    int ans = 1;
    if(N == 1) ans = M;
    else {
        for(int i = 2; i * i <= M; i++) {
            if(M % i == 0) {
                if(M / i >= N && ans < i) ans = i;
                if(i >= N && ans < M / i) ans = M / i;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        _n: usize,
        s: chars,
    }
    let ans = if s[..s.len() / 2] == s[s.len() / 2..] {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 18:35:23 2020

@author: NEC-PCuser
"""
import heapq

N, M = map(int, input().split())
A = [-int(n) for n in input().split(" ")]

heapq.heapify(A)

for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)
    
print(-sum(A))

Measured memory_bytes: 14380
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 5;

void solve(){
    int n, d;  cin>>n>>d;
    vector<vector<double>> v(n+1,vector<double>(d+1));
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= d; j++){
            cin>>v[i][j];
        }
    }
    int ans=0;
    for(int i = 1; i < n; i++){
        for(int j = i+1; j <= n; j++){
            double t=0;
            for(int k=1; k<=d; k++){
                t+=pow(v[i][k]-v[j][k],2);
            }
            t=sqrt(t);
            int a=(int)t;
            if(a==t) ans++;
        }
    }
    cout<<ans;
}
int main(){
    int T=1;        //! COMMENT IF THERE IS NO TEST CASES
    //cin>>T;             
    for(int i = 0; i < T; i++) solve(); 
}

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

namespace abc162a
{
    class Program
    {
        static void Main(string[] args)
        {
            //==========================================================================================================================
            //1) input
            string input1 = Console.ReadLine();


            //==========================================================================================================================



            



            //==========================================================================================================================
            //2) output
            string output = "No";


            if (input1.Contains("7"))
            {
                output = "Yes";
            }



            Console.WriteLine(output);

            //==========================================================================================================================

        }
    }
}


Measured memory_bytes: 25796
n=gets.to_i
r=(1..n).map{gets.split.map &:to_i}.sort{|s,t|t[1]<=>s[1]} #y zahyo dekai jun
b=(1..n).map{gets.split.map &:to_i}.sort{|s,t|s[0]<=>t[0]} #x zahyo tittyai jun
flg_r=Array.new(n,true)
cnt=0

b.each{|xb,yb|
    for i in 0...n
        if flg_r[i]&&r[i][0]<xb&&r[i][1]<yb
            cnt+=1
            flg_r[i]=false
            break
        end
    end
}

p cnt

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

typedef long long ll;
ll a, n, m;

int main() {
  scanf("%lld%lld%lld", &a, &n, &m);
  ll ans = 0;
  for (ll i = 1;; i++) {
    ll p = 1;
    for (ll j = 0; j < n; j++) p *= i;
    if (p > m) break;
    ll c = p, temp = 0;
    while (c) temp += c%10, c /= 10;
    if (i == temp + a) ans++;
  }
  printf("%lld\n", ans);
}



Measured memory_bytes: 2744
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

#define int long long
#define Graph vector<vector<int> >
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数定義や変数宣言
int N,Q;
vector<int> counter(200005,0);
int p,x;
Graph G(200005);

int num=0;

void dfs(const Graph &G ,int node,int parent= -1)
{
	

	for (auto next_node:G[node])
	{

		if (next_node==parent)
		{
			continue; 
		}

		counter[next_node]+=counter[node];

		
		dfs(G,next_node,node);

	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

cin>>N>>Q;



REP(i,N-1){
	int a,b;
	cin >> a>>b;
	G[a].push_back(b);
	G[b].push_back(a);

}


REP(i,Q){
	cin>>p>>x;
	counter[p]+=x;
}


dfs(G,1);


FOR(i,1,N){
	cout<<counter[i]<<" ";
}



return 0;

}

Measured memory_bytes: 28220
#include<stdio.h>

#define true 1
#define false 0

typedef char bool;

int main(){
	bool S[13];
	bool H[13];
	bool C[13];
	bool D[13];
	int A;
	int B;
	int N;
	char E;	
	for(A=0;A<13;A++)
		S[A]=H[A]=C[A]=D[A]=false;
	scanf("%d",&N);
	getchar();
	for(A=0;A<N;A++){
		scanf("%c %d%*c",&E,&B);
		if(E=='S')
			S[B-1]++;
		else if(E=='H')
			H[B-1]++;
		else if(E=='C')
			C[B-1]++;
		else if(E=='D')
			D[B-1]++;
	}
	for(B=0;B<4;B++)
		for(A=0;A<13;A++){
			if(B==0 && !S[A])
				printf("S %d\n",A+1);
			else if(B==1 && !H[A])
				printf("H %d\n",A+1);
			else if(B==2 && !C[A])
				printf("C %d\n",A+1);
			else if(B==3 && !D[A])
				printf("D %d\n",A+1);
		}
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  map<int,int> mp;
  rep(i,n) {
    int d;
    cin >> d;
    mp[d]++;
  }
  int m;
  cin >> m;
  rep(i,m) {
    int t;
    cin >> t;
    if(mp[t]!=0) mp[t]--;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
string S;
int N, sum, answer;

int main(){
 cin >> N >> S;

 for(int i = 1; i < N; i++){
    if(S[i] == 'E') sum++;
    answer = sum;
 }

 for(int i = 1; i < N; i++){
    if(S[i] == 'E') sum--;
    if(S[i-1] == 'W') sum++;
    answer = min(answer, sum);
 }

 cout << answer << endl;
 return 0;
}


Measured memory_bytes: 900
#include <cstdio>
#include <string>
#include <iostream>
using namespace std;

int main(){
    string S, T, U;
    int A, B;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(S == U) A -= 1;
    if(T == U) B -= 1;

    cout << A << " " << B << "\n";

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"os"
)

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	var n, x, y int
	fmt.Fscan(fp, &n)
	tree := make([][]int, n+1)
	visited := make([]int, n+1)
	dp := make([][]int64, 2)
	dp[0] = make([]int64, n+1)
	dp[1] = make([]int64, n+1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(fp, &x, &y)
		tree[x] = append(tree[x], y)
		tree[y] = append(tree[y], x)
	}
	chokudai(1, tree, visited, dp)
	fmt.Println((dp[0][1] + dp[1][1]) % 1000000007)
}

func chokudai(node int, tree [][]int, visited []int, dp [][]int64) {
	l := len(tree[node])
	a := int64(1)
	b := int64(1)
	visited[node] = 1
	for i := 0; i < l; i++ {
		if visited[tree[node][i]] == 1 {
			continue
		}
		visited[tree[node][i]] = 1
		chokudai(tree[node][i], tree, visited, dp)
		a = (a * (dp[0][tree[node][i]] + dp[1][tree[node][i]])) % 1000000007
		b = (b * dp[0][tree[node][i]]) % 1000000007
	}
	dp[0][node] = a
	dp[1][node] = b
}


Measured memory_bytes: 42752
s=list(str(input()))
t=list(str(input()))
def swap(s):
            s_a=s[:-1]
            s_b=list(s[-1])
            s_b.extend(s_a)
            sb="".join(s_b)
            return s_b
for i in range(len(s)):
            s=swap(s)
            if s==t:
                        print('Yes')
                        exit()
print('No')
         


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define INF 1e8
typedef long long int ll;
const double PI = acos(-1);

using Graph = vector<vector<int>>;
int main()
{
  ll k, n;
  cin >> k >> n;
  vector<ll> a(n);
  rep(i, n)
  {
    cin >> a[i];
  }
  ll ans = 0;
  rep(i, n - 1)
  {
    ans = max(ans, a[i + 1] - a[i]);
  }
  ans = max(ans, k - a[a.size() - 1] + a[0]);
  cout << k - ans << endl;
}


Measured memory_bytes: 4820
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

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

  string s;
  cin >> s;

  int ans = INT_MAX;
  for(int i = 0; i + 2 < s.length(); i++){
    int n = 100 * (s[i] - '0') + 10 * (s[i + 1] - '0') + (s[i + 2] - '0');
    ans = min(ans, abs(n - 753));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

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

  string s;
  cin >> s;
  int a, b;
  a = b = 0;
  rep(i, s.size()){
    if(s[i] == '0'){
      a ++;
    } else {
      b ++;
    }
  }
  cout << min(a, b) * 2 << '\n';
  return 0;
}


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

#define ll long long

#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define output_s(a) printf("%s\n",(a).c_str())

//library----------------------------------------------


int main(){
    int a,b; cin>>a>>b;
  	if(a>=13) printf("%d\n",b);
  	else if(a>=6&&a<13) printf("%d\n",b/2);
  	else if(a<6) printf("0");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll floor(ll a,ll b){
    return a/b;
}

ll f(ll x){
    return x*x*x*x*x;
}

int main(){
    fast_io
    
    ll x;
    cin>>x;


    for(int i=-150;i<=150;i++){
        for(int j=-150;j<=150;j++){
            if(f(i)-f(j) == x){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3668
import java.util.*;
/**
 * Created by 卢嘉昊 on 2017/8/12.
 */
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        long clock[] = new long[N];
        for(int i=0;i<N;i++){
            clock[i] = scan.nextLong();
        }
        long res = 1;
        for(int i=0;i<N;i++){
            res = nextRes(res,clock[i]);
        }
        System.out.println(res);
    }

    public static long nextRes(long res,long num){
        if(res%num==0) return res;
        long g = gcd(num,res);
        return res*(num/g);
    }

    public static long gcd(long s,long b){
        if(s == 1) return 1;
        if(b%s == 0) return s;
        return gcd(b%s,s);
    }

}

Measured memory_bytes: 23764
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n)  cin >> a[i];
  sort(ALL(a), greater<int>());
  int x = a[0];
  int y;
  int dist_min = 1e9;
  FOR(i,1,n){
    if(abs(x/2 - a[i]) < dist_min){
      dist_min = abs(x/2 - a[i]);
  	  y = a[i];
    }
  }
  cout << x << " " << y << '\n';
  return 0;
}

Measured memory_bytes: 640
def Area(x,y):
    return x*y


def Perimeter(x,y):
    return 2*x+2*y


text = input()

a, b= text.split(" ")

ANS_1 = Area(int(a),int(b))
ANS_2 = Perimeter(int(a),int(b))

ANSWER = str(ANS_1) + " " + str(ANS_2)

print(ANSWER)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
struct point{int x;int y;};
int i,j,k,count1=0,count2=0;
bool binarySearch(vector<int> a,int key){
    int left=0;
    int right=a.size();
    int mid;
    while(left<right){
        mid=(left+right)/2;
        if(a[mid]==key){
            return true;
        }else if(key<a[mid]){
            right=mid;
        }else{
            left=mid+1;
        }
    }
    return false;
}

int main(){
    int n,m;
    cin>>n;
    vector<int> vec(n);
    for(i=0;i<n;i++){
        cin>>vec[i];
    }
    cin>>m;
    vector<int> vec2(m);
    for(i=0;i<m;i++){
        cin>>vec2[i];
    }
    int ans=0;
    for(i=0;i<vec2.size();i++){
        if(binarySearch(vec,vec2[i])){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3856
# coding: utf-8

#S = input()
N = int(input())
#A,B = input().split()
#A,B = map(int, input().split())
#List = list(map(int, input().split()))

if 400<=N and N<600:
    print(8)
elif 600<=N and N<800:
    print(7)
elif 800<=N and N<1000:
    print(6)
elif 1000<=N and N<1200:
    print(5)
elif 1200<=N and N<1400:
    print(4)
elif 1400<=N and N<1600:
    print(3)
elif 1600<=N and N<1800:
    print(2)
elif 1800<=N and N<2000:
    print(1)

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

void solve() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    fori (i, 0, n) {
        int k ;
        cin >> k;
        s.insert(k);
    }
    int best_diff = (int) 1e9;
    int best_el = -1;
    fori (i, -1000, 1000 + 1) {
        if (s.count(i)) continue;
        int diff = abs(i - x);
        if (best_diff > diff) {
            best_diff = diff;
            best_el = i;
        }
    }
    cout << best_el << endl;
}

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



Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long int
#define F(i,j,k,in) for(int i=j;i<k;i+=in)
#define DF(i,j,k,in) for(int i=j;i>=k;i-=in)
#define feach(it,l) for (auto it = l.begin(); it != l.end(); ++it)
#define fall(a) a.begin(),a.end()
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define eq equal_range
#define fs first
#define ss second
#define ins insert
#define mkp make_pair
#define endl "\n"
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vin;
typedef vector<char> vch;
typedef vector<string> vst;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvin;
typedef vector<pair<ll,ll>> vpll;
typedef vector<pair<int,int>> vpin;
typedef set<ll> sll;
typedef set<int> sint;
typedef set<char> sch;
typedef set<string> sst;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef queue<int> qin;
typedef priority_queue<int> pqin;
typedef map<ll,ll> mpll;
typedef map<int,int> mpin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
const ll MOD=1000000007;
const long double PI=3.1415926535897932384626433832795;
ll pwr(ll b,ll p){ll res=1;while(p){if(p&1) {res*=b; p--;}else{b*=b; p>>=1;}}return res;}
//const int maxn =101;
//ll pr[maxn];
ll fac (ll n) {
  ll ans=1;
  F (i,2,n+1,1) {
    ans=(ans*i)%MOD;
  }
  return ans;
}
int main()
{
ios_base::sync_with_stdio(false) , cin.tie(NULL) , cout.tie(NULL);
int n , m;
cin>>n>>m;
if (abs(n-m)>=2) cout<<0;
else {
  ll ans=(fac(n)*fac(m))%MOD;
  if (n==m) cout<<(2*ans)%MOD;
  else cout<<ans;

}
return 0;
}



Measured memory_bytes: 3608
#include<iostream>
#include<cstdio>
using namespace std;
main(){
  double a;
  while(~scanf("%lf",&a)){
    double S[11];
    S[0]=a;
    for(int i=1;i<10;i++){
      if(i%2) S[i]=S[i-1]*2.0f;
      else S[i]=S[i-1]/3.0f;
    } 
    double res =0.0f;
    for(int i=0;i<10;i++) res += S[i];
    printf("%.8lf\n",res);
  }
}

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

int n,a[2000001],freq[100100];

void countingsort(int a[]){
    for(int i=1;i<=n;i++){
        freq[a[i]]++;
    }
    int idx=0;
    for(int i=0;i<=10000;i++){
        for(int j=1;j<=freq[i];j++){
            idx++;
            a[idx]=i;
        }
    }
}

int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    countingsort(a);
    for(int i=1;i<=n;i++){
        cout<<a[i];
        if(i==n){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }
}


Measured memory_bytes: 10940
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

bool is_valid(int p, int k, const vector<int> & ws){
    int num_trucks = 1;
    int load = 0;
    for (const auto w : ws){
        if (load + w <= p){
            load += w;
        }else{
            num_trucks += 1;
            if (num_trucks > k) return false;
            load = w;
        }
    }
    return true;
}

int main()
{
    int n = 0;
    int k = 0;
    cin >> n >> k;
    vector<int> ws(n);
    for (auto & w : ws) cin >> w;
    int sum_w = accumulate(ws.begin(), ws.end(), 0);
    int minP = max((sum_w / k), *max_element(ws.begin(), ws.end())) - 1;
    int maxP = sum_w;
    while (minP + 1 < maxP){
        int midP = (minP + maxP) / 2;
        if (is_valid(midP, k, ws)){
            maxP = midP;
        }else{
            minP = midP;
        }
    }
    cout << maxP << endl;
    
    return 0;
}

Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
using namespace std;

int main()
{
	string s, t; cin >> s >> t;
	for (int i = 0; i < s.length(); i++) {
		s = s[s.length() - 1] +
			s.substr(0, s.length() - 1);
		if (s == t) {
			cout << "Yes" << endl;
			break;
		}
		else if (i == s.length() - 1) {
			cout << "No" << endl;
		}
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう

int main(){
    ll a,b,x;
    std::cin >> a>>b>>x;
    ll ans=b/x-a/x;
    if(a%x==0ll)ans++;
    std::cout << ans << std::endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int intArray[] = new int[n];
		for(int i = 0; i < n; i++) {
			intArray[i] = sc.nextInt();
		}
		// ????°????????±???????????????°??????
		int min = 0;
        for(int i = 1; i < n; i++) {
            if(intArray[i] < intArray[min]) {
                min = i;
            }
        }
        // ?????§???????±???????????????°??????
        int max = 0;
        for(int i = 1; i < n; i++) {
        	if(intArray[max] < intArray[i]) {
        		max = i;
        	}
        }
        // ????¨????????±???????????????°??????
		long sum = 0;
		for(int i = 0; i < n; i++) {
			sum += intArray[i];
		}
		System.out.println(intArray[min] + " " + intArray[max] + " " + sum);
	}

}

Measured memory_bytes: 43168
class Unionfind:
     
    def __init__(self,n):
        self.uf = [-1]*n
 
    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]
 
    def same(self,x,y):
        return self.find(x) == self.find(y)
 
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x
        return True
 
    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

n,m = map(int,input().split())

u = Unionfind(n)
count = 0
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    u.union(a,b)

s = set()
for i in range(n):
    s.add(u.find(i))
print(len(s)-1)

Measured memory_bytes: 18240
n = int(input())
H = list(map(int,input().split()))
dp = [0]+[10**10]*(n-1)
dp[1] = abs(H[1]-H[0])
for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[n-1])

Measured memory_bytes: 13976
import java.io.*;
 
class Main{
    public static void main (String[ ] args) throws Exception{
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        String str = br.readLine();
        String[] strarr = str.split(" ");
        int a[] = new int[2];

        a[0] = Integer.parseInt(strarr[0]);
        a[1] = Integer.parseInt(strarr[1]);
        
        int ans[] = new int[2];
        ans[1] = a[0]+a[1]+a[0]+a[1];
        
        System.out.println((a[0]*a[1]) + " " + ans[1]);
    }
}

Measured memory_bytes: 24052
def rec(a, b, c, k, n=0):
    if n == k:
        if c > b > a:
            return 1
        else:
            return 0
    return rec(2*a, b, c, k, n+1) + rec(a, 2*b, c, k, n+1) + rec(a, b, 2*c, k, n+1)


def main():
    A, B, C = map(int, input().split())
    K = int(input())
    if rec(A, B, C, K) > 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
  int maxL;
  for (int i = 0; i < N; i++) {
    maxL = max(maxL, L.at(i));
  }
  int rest;
  for (int i = 0; i < N; i++) {
    rest += L.at(i);
  }
  rest -= maxL;
  if (maxL < rest) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}



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

int main()
{
	string s;
	cin >> s;

	string elimx = "";
	rep(i,s.size())
	{
		if (s[i] != 'x') elimx += s[i];
	}
	rep(i,elimx.size()/2)
	{
		if (elimx[i] != elimx[elimx.size()-1-i])
		{
			cout << "-1" << endl;
			return 0;
		}
	}
	int l = 0, r = s.size()-1, ans = 0;
	while(l < r)
	{
		if (s[l] == 'x' && s[r] != 'x')
		{
			ans++;
			l++;
		}
		else if (s[l] != 'x' && s[r] == 'x')
		{
			ans++;
			r--;
		}
		else
		{
			l++; r--;
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(auto i = (a); i != (b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

bool run(int N)
{
	unordered_set<string> seenBefore;
	string W;
	char lastChar = '\0';

	while (N--) {
		cin >> W;

		if (seenBefore.find(W) != seenBefore.end())
			return false;

		if (lastChar != '\0' && lastChar != W[0])
			return false;

		lastChar = W.back();
		seenBefore.insert(W);
	}
	return true;
}

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

	int N;
	cin >> N;

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

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

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

  ll ans = 0;
  if (n % 2 == 0) {
    for (ll i = 5; i <= n; i *= 5) {
      ans += n / i / 2;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define MAXN 2550
#define pii pair<int, int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x < n and y >= 0 and y < n)
using namespace std;
const ll mod = 1e9 + 7;


int main() {
    ios_base::sync_with_stdio(false);
    ll ans = 1, n;
    map<int, int> m;
    vector<int> prime, check(1010, 1);
    cin >> n;

    for (int i=2; i<=n; i++){
        if (check[i] == 1){
            prime.push_back(i);
            for (int j=i+i;j <=n; j+=i) check[j] = 0;
        }
    }

    for (int i=2; i<=n; i++){
        int tmp = i;

        for (auto x: prime){
            if (x > tmp) break;

            while (tmp%x == 0) tmp/=x, m[x]++;
        }
    }

    for (int i=2; i<=n; i++){
        ans *= (m[i]+1);
        ans%=mod;
    }

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

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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  ul n;
  cin >> n;
  vector< ll > c(0);
  for (ul i=0; i<n; ++i) {
    ll a;
    cin >> a;
    a *= -1;
    if (c.size() == 0) {
      //cerr << "push_back " << a << endl;
      c.push_back(a);
      continue;
    }
    if (c[c.size()-1] <= a) {
      //cerr << "push_back " << a << endl;
      c.push_back(a);
      continue;
    }
    ul idx = upper_bound(c.begin(), c.end(), a) - c.begin();
    //cerr << idx << " " << c[idx] << "->" << a << endl;
    c[idx] = a;
  }
  cout << c.size() << endl;
  return 0;
}


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

void fnBubbleSort(vector<int> &a_rviSort, int &a_riSortCnt)
{
  int ixSorting = 0;
  bool bSorting = true;

  while (bSorting)
  {
    bSorting = false;
    for (int i = a_rviSort.size() - 1; i > ixSorting; i--)
    {
      if (a_rviSort[i] < a_rviSort[i - 1])
      {
        bSorting = true;
        swap(a_rviSort[i], a_rviSort[i - 1]);
        a_riSortCnt++;
      }
    }
    ixSorting++;
  }
}

void fnOutput(const vector<int> &a_cnrviSort, int a_iSortCnt)
{
  for (int i = 0; i < a_cnrviSort.size(); i++)
  {
    if (i) cout << " ";
    cout << a_cnrviSort[i];
  }
  cout << endl;
  cout << a_iSortCnt << endl;
}
    
int main()
{
  int iSortCnt = 0;
  vector<int> viSort;
  int iMaxSize;
  
  cin >> iMaxSize;
  for (int i = 0; i < iMaxSize; i++)
  {
    int iNum;
    cin >> iNum;
    viSort.push_back(iNum);
  }

  fnBubbleSort(viSort, iSortCnt);
  fnOutput(viSort, iSortCnt);

  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
using namespace std;
typedef long long ll;
int main(){
  ll l,r;
  cin >> l >> r;
  ll ans = 0;
  ans = INT_MAX;
  for(ll i = l;i <= r;i++){
    for(ll j = i + 1;j <= r;j++){
      ans = min(ans,(i * j) % 2019);
      //cout << i << " " << j << " " << ans << endl;
      if(ans == 0){
        i = r + 1;
        j = r + 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

string b = "aeiou";

int main()
{
	//fuck
	string s;
	cin >> s;
	for (int i = 0; i < 5; i++)
	{
		if (s[0] == b[i])
		{
			cout << "vowel" << endl;
			return 0;
		}
	}
	cout << "consonant" << endl;
	return 0;
}

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

const int MAXN = 1e5;
struct edge{int to,color,length;};
vector<vector<edge>> to(MAXN);
vector<int> G[MAXN];
struct LCA{
    static const int BITLEN_MAX = 30;
    vector<int> parent[BITLEN_MAX];
    vector<int> depth;
    int bitlen;

    void initialize(int N, const vector<int> edges[]){
        int root = 0;
        bitlen = 1;
        while((1<<bitlen) < N) bitlen += 1;
        for(int i=0; i<bitlen; i++) parent[i].resize(N);
        depth.resize(N, -1);

        dfs(root, -1, 0, edges);
        for(int k=0; k<bitlen-1; k++){
            for(int v=0; v<N; v++){
                if(depth[v] == -1) continue;
                if(parent[k][v] < 0){
                    parent[k+1][v] = -1;
                }else{
                    parent[k+1][v] = parent[k][parent[k][v]];
                }
            }
        }
    }

    void dfs(int v, int p, int d, const vector<int> edges[]){
        parent[0][v] = p;
        depth[v] = d;
        for(auto u : edges[v]){
            if(u != p) dfs(u, v, d+1, edges);
        }
    }

    int calc_lca(int u, int v){
        if(depth[u] > depth[v]) swap(u, v);
        for(int k=0; k<bitlen; k++){
            if( ((depth[v]-depth[u]) >> k) & 1 ) v = parent[k][v];
        }
        if(u == v) return u;
        for(int k=bitlen-1; k>=0; k--){
            if(parent[k][u] != parent[k][v]){
                u = parent[k][u];
                v = parent[k][v];
            }
        }
        return parent[0][u];
    }

    int calc_dist(int u, int v){
        int l = calc_lca(u, v);
        return depth[u] + depth[v] - depth[l]*2;
    }
};

int dist[MAXN]; // 頂点iへの距離
vector<int> needcol[MAXN]; // 頂点iに必要な色
int colcnt[100000]; // 現在通った辺のうち色iの総和
int colsum[100000]; // 現在通った辺のうち色iの総和
map<int,int> cnt[MAXN], sum[MAXN];
void dfs2(int v, int p){
	
	// 現在の総和を（必要がある場合だけ）memo
	for(auto col : needcol[v]){
		cnt[v][col] = colcnt[col];
		sum[v][col] = colsum[col];
	}
	
	for(auto e : to[v]){
		if(e.to == p) continue;
		dist[e.to] = dist[v] + e.length;
		
		// 進んだ分足す
		colcnt[e.color]++;
		colsum[e.color] += e.length;
		
		dfs2(e.to,v);
		
		// 戻るので引く
		colcnt[e.color]--;
		colsum[e.color] -= e.length;
	}
	return;
}

int main(){
	
	int n,q;
	cin >> n >> q;
	
	rep(i,n-1){
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		--a; --b; --c;
		to[a].push_back(edge{b,c,d});
		to[b].push_back(edge{a,c,d});
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	LCA lca;
	lca.initialize(n, G);
	
	int X[100000], Y[100000], U[100000], V[100000], L[100000];
	rep(i,q){
        cin >> X[i] >> Y[i] >> U[i] >> V[i];
        X[i]--; U[i]--; V[i]--;
		L[i] = lca.calc_lca(U[i], V[i]);
        needcol[U[i]].push_back(X[i]);
        needcol[V[i]].push_back(X[i]);
        needcol[L[i]].push_back(X[i]);
	}

	dfs2(0,-1);
	
	
	rep(i,q){
		int x = X[i], y = Y[i], u = U[i], v = V[i], lcauv = L[i];
		
		int nowd = dist[u] + dist[v] - 2*dist[lcauv];
		int nowsum = sum[u][x] + sum[v][x] - 2*sum[lcauv][x];
		int nowcnt = cnt[u][x] + cnt[v][x] - 2*cnt[lcauv][x];
		cout << nowd - nowsum + nowcnt*y << endl;
	}
	return 0;
}


Measured memory_bytes: 64824