akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,k;
vi a;

int main(){
	cin>>n>>k;
	int N=1<<n;
	if(k>=N){
		cout<<-1<<endl;
		return 0;
	}
	if(n==1){
		if(k==0) cout<<"0 0 1 1"<<endl;
		if(k==1) cout<<-1<<endl;
		return 0;
	}
	a.push_back(k);
	for(int i=0;i<N;i++) if(i!=k) a.push_back(i);
	a.push_back(k);
	for(int i=N-1;i>=0;i--) if(i!=k) a.push_back(i);
	for(int i=0;i<N*2;i++){
		if(i) cout<<' ';
		cout<<a[i];
	}
}

Measured memory_bytes: 2932
#include <bits/stdc++.h>
#define REP(i, start, end) for (int i=start, i##Len=(end); i < i##Len; ++i)
#define REPR(i, start, end) for (int i=start, i##Len=(end); i > i##Len; --i)
using ll = int64_t;
using namespace std;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, M, a, b;
    cin >> N;
    vector<vector<pair<ll, ll>>> adj(N);
    REP(i, 0, N-1) {
        cin >> a >> b;
        adj[--a].emplace_back(--b, 1LL << i);
        adj[b].emplace_back(a, 1LL << i);
    }

    cin >> M;
    vector<ll> edges(M, 0);
    REP(i, 0, M) {
        cin >> a >> b;
        --a; --b;

        deque<pair<ll, ll>> dq;
        dq.emplace_back(a, 0);

        ll v, bit;
        while (!dq.empty()) {
            tie(v, bit) = dq.front(); dq.pop_front();
            if (v == b) {
                edges[i] = bit;
                break;
            }
            for (auto e : adj[v]) if ((e.second & bit) == 0) {
                dq.emplace_back(e.first, bit | e.second);
            }
        }
    }

    ll ans = 1;
    REP(i, 0, N-1) ans *= 2;

    REP(bit, 1, 1 << M) {
        ll popc = 0;
        ll e = 0;
        REP(i, 0, M) if ((1L << i) & bit) {
            popc++;
            e |= edges[i];
        }

        ll e_comb = 1;
        ll count = 0;
        REP(i, 0, N-1) {
            if (((1L << i) & e) == 0) {
                e_comb *= 2;
                count++;
            }
        }
        if (popc & 1) ans -= e_comb;
        else ans += e_comb;
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++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())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}



int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin>>S;
  if(S[0]==S[1]&&S[2]==S[3]&&S[1]!=S[2]){
    cout<<"Yes"<<endl;
    return 0;
  }
  else if(S[0]==S[2]&&S[1]==S[3]&&S[0]!=S[1]){
    cout<<"Yes"<<endl;
    return 0;
  }
  else if(S[0]==S[3]&&S[1]==S[2]&&S[0]!=S[1]){
    cout<<"Yes"<<endl;
    return 0;
  }
  else{
    cout<<"No"<<endl;
    return 0;
  }
    
}
    
  
  


Measured memory_bytes: 256
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> Int
solve n = length $ filter (odd . length . show) [1..n]
    

main = do
    n <- readInt
    print $ solve n



Measured memory_bytes: 892
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <cstdio>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i, 0, n) cin >> p[i];
    vector<double> val(n);
    double ans = 0;
    double sum = 0;
    double sum2 = 0;
    rep(i, 0, n) {  
        sum = (2+(p[i]-1))*p[i]/2.0;
        val[i] = double(sum/p[i]);
        if(i < k) {
            sum2 += val[i];
        }
    }

    double tmp = sum2;
    ans = sum2;
    rep(i, k, n) {
        ans = max(ans, tmp-val[i-k]+val[i]);
        tmp = tmp-val[i-k]+val[i];
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

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

    REP(i, n + 1)
    {
        if (y - i * 10000 < 0)
            break;

        if ((5000 * (n - i) - (y - i * 10000)) % 4000 != 0)
            continue;

        int b = (5000 * (n - i) - (y - i * 10000)) / 4000;

        if (b < 0 || n - i - b < 0)
            continue;

        cout << i << " " << n - i - b << " " << b << endl;

        return 0;
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}

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

int main() {
    ll n;
    while (cin >> n) {
        ll shift = 50;
        while ((1LL << shift) - 1 > n) shift--;
        cout << shift << endl;
    }
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <algorithm> //sort,二分探査など
#include <atcoder/dsu>
//#include<bitset>
//#include<cmath>//pow,logなど
//#include<deque>
//#include<functional>
//#include<iterator>
//#include<map>
//#include<numeric>//gcd,lcm
//#include<queue>
//#include<set>
//#include<stack>
//#include<string>
//#include<utility>//pair

//QCFium法
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

//浮動小数点処理高速化
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace atcoder;
using i64 = int64_t;
using f80 = __float80;
using u64 = uint_fast64_t;

constexpr i64 INF = 1010000000000000017LL;
constexpr u64 MOD = 1000000007LL;
constexpr f80 PI = 3.14159265358979323846;

#define _overload3(_1, _2, _3, name, ...) name
#define repi(i, start, end) for (int i = (int)(start); i < (int)(end); ++i)
#define _rep(i, n) repi(i, 0, n)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(i, start, end) for (int i = (int)(start); i > (int)(end); --i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()

#define v(T) vector<T>
#define vv(T) v(v(T))
#define vvv(T) v(v(v(T)))
typedef v(int) vi;

#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>

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;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
  rep(i, v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
  for (T &in : v)
    is >> in;
  return is;
}

//sort(rng(P),[](const vi &a, const vi &b){return a[1]<b[1];});

void Main()
{
  int N, M;
  cin >> N >> M;

  dsu d(N);

  rep(i, M)
  {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    d.merge(A, B);
  }

  int ans = -1;
  rep(i, N)
  {
    if (d.leader(i) == i)
      ans++;
  }

  cout << ans << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //  cout << fixed << setprecision(15);
  Main();
}

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

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s,c,a="",b="";
    int q,t,f;
    cin>>s>>q;
    bool rev=false;
    for(int i=0;i<q;i++){
        cin>>t;
        if(t==1)rev^=true;
        else{
            cin>>f>>c;
            if(rev==false){
                if(f==1){
                    a=c+a;
                }
                else{
                    b+=c;
                }
            }
            else{
                if(f==1){
                    b+=c;
                }
                else{
                    a=c+a;
                }
            }
        }
    }
    if(rev){
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        reverse(s.begin(),s.end());
        cout<<b+s+a<<endl;
    }
    else{
        cout<<a+s+b<<endl;
    }
    return 0;
}

Measured memory_bytes: 1416
a,b,c = map(int, input().split())
k=int(input())
if (a < b and b < c):
    print("Yes")
    exit()
else:
    for i in range(k):
        if (a >= b):
            b *= 2
        elif (b >= c):
            c *= 2
        elif (a >= c):
            c *= 2
if (a < b and b < c):
    print("Yes")
else: print("No")

Measured memory_bytes: 9184
s = input()
t = input()
dct = dict()
 
bool =True
for a,b in zip(s,t):
    if a in dct and dct[a]!=b:
        bool =False
        break
    dct[a]=b
#print(dct)
#print(len(dct.values()))
#print(len(dct))
if len(dct.values())!=len(set(dct.values())):
    bool =False
print('Yes' if bool else 'No')

Measured memory_bytes: 3632
//noob
#include<bits/stdc++.h>
using namespace std;
#define fori(x) for(int i=0;i<x;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long int 
#define ld long double
#define ull unsigned long long int
#define pi acos(-1)
#define test() int T,t=1;cin>>T;
typedef vector<int> VI;
typedef pair<int,int> PII;


void solve()
{
   //freopen("input.txt","r",stdin);
   string s;cin>>s;
   
   int sum=0;
   fori(s.size()) sum+=s[i]-'0';
   if(sum%9) cout<<"No"<<endl;
   else cout<<"Yes"<<endl;

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

solve();


	return 0;
}

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

int main() {
  int A,B;
  cin >> A >> B;
  if(A%3==0 || B%3==0 || (A+B)%3==0){
    cout << "Possible" << endl;
  }else{
    cout << "Impossible";
  }
}


Measured memory_bytes: 764
a, b, c, d = map(int, input().split())
MOD = 998244353

dp = [[0] * (d + 1) for _ in range(c + 1)]
dp[a][b] = 1

for i in range(a + 1, c + 1):
    dp[i][b] = dp[i - 1][b] * b % MOD

for j in range(b + 1, d + 1):
    dp[a][j] = dp[a][j - 1] * a % MOD

for i in range(a + 1, c + 1):
    for j in range(b + 1, d + 1):
        dp[i][j] = (dp[i][j - 1] * i + dp[i - 1][j] * j - dp[i - 1][j - 1] * (i - 1) * (j - 1)) % MOD

print(dp[c][d])


Measured memory_bytes: 133836
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x;
    cin >> n >> x;
    int l[n];
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    int c=1,sum=0;
    for(int i=0;i<n;i++){
        sum+=l[i];
        if(sum <= x){
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
n = [x for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"
    fomula = list(sum(zip(n,op),()))
    fomula.append(n[-1]) 

    if eval(''.join(fomula))== 7:
    	print(''.join(fomula) +'=7')
    	break



Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stdbool.h>
#include<math.h>
#include<sstream>
typedef long long ll;
#define N (1000000000+7)
using namespace std;
typedef pair<int, int> P;

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

int sum[100010] = { 0 };

int main(void) {
	ll n, t, a, past = 0, ans = 0;
	cin >> n >> t;
	for (int i = 0;i < n;i++) {
		cin >> a;
		if (a <= past) {
			ans += (a + t) - past;
		}
		else ans += t;
		past = a + t;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

constexpr ll MOD = 1e9 + 7;

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

    vector<ll> dp(n + 1);
    dp[n] = n;
    ll sum = dp[n];
    for (int i = n - 1; i > 0; i--) {
        //next is 1
        dp[i] = sum;
        if (i + 2 <= n)dp[i] += MOD - dp[i + 2];
        dp[i] += min((int) n - 1, i + 1), dp[i] %= MOD;
        //next is not 1
        dp[i] += (n - 1) * (n - 1), dp[i] %= MOD;
        sum += dp[i], sum %= MOD;
    }

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

Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	string s; cin >> s;
	int64_t k; cin >> k;

	vector<int> nums;
	char c = ' ';
	int  n = 0;
	FOR_LT(i, 0, s.size()) {
		if (c != s[i]) {
			if (n != 0) {
				nums.push_back(n);
			}
			n = 0;
		}
		c = s[i];
		n++;
	}
	nums.push_back(n);

	if (nums.size() == 1) {
		cout << (s.size() * k) / 2 << endl;
		return 0;
	}

	int64_t sum = 0;
	for (int i : nums) {
		sum += i / 2;
	}
	sum *= k;

	if (s[0] == s[s.size() - 1]) {
		if (nums.front() & 1 && nums.back() & 1) {
			sum += k - 1;
		}
	}

	cout << sum << endl;


	return 0;
}

Measured memory_bytes: 256
import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

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

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

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

        if x == y:
            return

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

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

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

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

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

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

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

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

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


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#ここから書き始める
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

cnt = 0
ans = [[0 for j in range(w)] for i in range(h)]
for i in range(1, n + 1):
    for j in range(a[i - 1]):
        ans[cnt // w][cnt % w] = i
        cnt += 1
# print(ans)
for i in range(h):
    if i % 2 == 1:
        ans[i] = ans[i][::-1]
# print(ans)
for i in range(h):
    for j in range(w):
        print(ans[i][j], end=" ")
    print()




Measured memory_bytes: 5940
#include<iostream>
#include<vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <limits>
#include <map>

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

using namespace std;
using p = pair<int, int>;
using ll = long long;

vector< vector<int> > memo;

int gcd(int a, int b, int c) {
	int min_num = (a > b) ? b : a;
	if (min_num > c) min_num = c;
	while (min_num != 1) {
		if (a % min_num == 0 && b % min_num == 0 && c % min_num == 0) return min_num;
		for (int i = 2; i < min_num; i++) {
			if (min_num % i == 0) {
				min_num /= i;
				break;
			}
		}
	}
	return min_num;
}

int main() {
	int n;
	ll ans = 0;
	cin >> n;
	
	for (ll i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0) ans += i;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main() {
    long long n,m,k;
    cin>>n>>m>>k;
    n=abs(n);
    if(n/m>=k) {
        cout<<n-m*k;
        return 0;
    }
    else {
        long long y=n%k;
        long long t=(n-y)/k;
        if((m-t)%2) {
            cout<<abs(y-k)<<endl;
        }
        else {
            cout<<abs(y)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3632
N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)

for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])


Measured memory_bytes: 13104
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
long long intpow(int x,int y){
	if (y == 0) return 1;
	long long xx = x;
	long long xin = x;
	REP(i,y-1){
		xx = xx * xin;
	}
	return xx;
}

int main(){
	int X; SCD(X);
	int ans = 1;
	FORq(i,1,35){
		FORq(j,2,10){
			int y = intpow(i,j);
			if (y <= X){
				ans = max(ans,y);
			}
		}
	}
	
	PRINTD(ans);
	
	return 0;
}

Measured memory_bytes: 256
// デバッグ実行：Ctrl+F5

using System;
using System.Collections.Generic;
using System.Linq;
class Program
{

    static void Main(string[] args)
    {
        String line;
        line = Console.ReadLine();
        String[] words = line.Split(' ');

        long A = long.Parse(words[0]);
        int N;
        if (A > int.MaxValue) N = int.MaxValue;
        else N = (int)A;
        long P = long.Parse(words[1]);
        if (N == 1)
        {
            Console.WriteLine(P);
            return;
        }

        var yakusu = Soinsu(P, N).ToList();
        yakusu.Sort();
        long Kouyakusu = 1;
        if (N > int.MaxValue) N = int.MaxValue;
        for (int i = 0; i < yakusu.Count - N + 1; i++)
        {
            var kouho = yakusu[i];
            var OK = true; // 約数としてOKかどうか
            for (int j = i + 1; j < i + N; j++)
            {
                if (kouho != yakusu[j])
                {
                    OK = false;
                    i = j - 1;
                    break;
                }
            }
            if (OK)
            {
                Kouyakusu *= kouho;
                i = i + N - 1;
            }
        }

        Console.WriteLine(Kouyakusu);
    }

    static IEnumerable<long> Soinsu(long N, int kaisu)
    {
        long j = 2;
        long now = N;
        long limit = N;
        int keisan_limit = (int)Math.Sqrt(kaisu) + 1;
        for (int i = 0; i < keisan_limit - 1; i++)
        {
            limit = (long)Math.Sqrt(limit) + 1;
            if (limit <= 3) break;
        }
        while (j <= limit)
        {
            if (now % j == 0)
            {
                now /= j;
                yield return j;
            }
            else
            {
                j++;
            }
        }
    }
    //static IEnumerable<long> Soinsu(long N, List<long> SosuList)
    //{
    //    int i = 0;
    //    long now = N;
    //    while (true)
    //    {
    //        if (i >= SosuList.Count) break;
    //        if (SosuList[i] > N) break;
    //        if (now % SosuList[i] == 0)
    //        {
    //            now /= SosuList[i];
    //            yield return SosuList[i];
    //        }
    //        else
    //        {
    //            i++;
    //        }
    //    }
    //}

    //static List<long> MakeSosuList(long N, int kaisu)
    //{
    //    var list = new List<long>();
    //    if (N < 2)
    //    {
    //        return list;
    //    }

    //    long limit = N;
    //    int keisan_limit = (int)Math.Sqrt(kaisu) + 1;
    //    for (int i = 0; i < keisan_limit - 1; i++)
    //    {
    //        limit = (long)Math.Sqrt(limit) + 1;
    //        if (limit <= 3) break;
    //    }
    //    for(long i = 2; i < limit; i++)
    //    {
    //        var OK = true;
    //        foreach(long sosu in list)
    //        {
    //            if (i % sosu == 0)
    //            {
    //                OK = false;
    //                break;
    //            }
    //        }
    //        if (!OK) continue;
    //        list.Add(i);
    //    }
    //    return list;
    //}
}

Measured memory_bytes: 11348
import java.util.Scanner;
class Main{
	static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
		while(sc.hasNext()){
			int n = sc.nextInt();
			System.out.println(answar(n));
		}

	}
	static long answar(int n){
		long ans=1;
		for(int i=1;i<=n;i++){
			ans *= i;
		}

		return ans;
	}
}

Measured memory_bytes: 26328
#include<bits/stdc++.h>
using namespace std;
#define INF 1e15
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
typedef pair<int, int> P;
#define END system("PAUSE");return 0
int n, a[1111111];
map<int, int>mp;
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	for (int i = 1; i < n; i++)a[i] += a[i - 1];
	rep(i, n)mp[a[i]]++;
	mp[0]++;
	int ans = 0;
	for (auto p : mp) {
		ans += (p.second)*(p.second - 1) / 2;
	}
	
	cout << ans << endl;
	END;
}


Measured memory_bytes: 14584
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <cmath>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int ret[7] ={0, 2, 3, 5, 8, 13, 21};
int amida(int num){
  if(num <=0){
    return 1;
  }
  return ret[num];
}

int main(int argc, char const *argv[]) {
  int H, W, K;
  std::cin >> H >> W >> K;
  vvl dp = vv(H+1, W+2, 0, ll);
  if(W==1){
    std::cout << 1 << '\n';
    return 0;
  }
  if(W==2){
    dp[1][1] = dp[1][2] = 1;
  }else{
    dp[1][1] = amida(W-2);
    dp[1][2] = amida(W-3);
  }
  ll a, b, c;
  ranges(i, 2, H+1){
    ranges(j, 1, W+1){
      a = (dp[i-1][j]*amida(j-2)*amida(W-j-1))%MODs;
      b = (dp[i-1][j-1]*amida(j-3)*amida(W-j-1))%MODs;
      c = (dp[i-1][j+1]*amida(j-2)*amida(W-j-2))%MODs;
      dp[i][j] = (a+b+c)%MODs;
    }
  }
  std::cout << dp[H][K] << endl;
  return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <queue>
# define MOD 1000000000+7
# define INF 1000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;
long long int a = 0, b = 0, c = 0, ans = 0, x = 0, y = 0, z = 0, n = 0, m = 0, maxy = 0, mini = 9999, counter = 0, counter2 = 0, endp = 0, checker = 0;

std::vector <char> vec{}, vecsec{}, vecth{};
long long int iremono[100001], sec[100001];
long long int iremono2[100001], check[100001];
std::vector<long long int>kinds{}, kaku{};
char maze[1000][1000];
int sx, sy;
int gx, gy;

bool relation[1000][1000];
int twod[1001][1001];
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
bool okada = false, okada2 = false;
std::string output, output2, input, input2,input3;
char rev[100001];


int ctoi(const char c) {
	if ('0' <= c && c <= '9') return (c - '0');
	return -1;
}
unsigned long long int LCM(unsigned long long int a, unsigned long long int b) {
	unsigned long long int i, j;
	i = a; j = b;
	while (true) {

		c = i % j;
		i = j;
		if (c != 0) {

			j = c;

		}
		else {
			break;
		}
	}
	return j * (a / j) * (b / j);
}
int kaizyo(int k) {
	int sum = 1;
	for (int i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

int N, M;//はんい
int bfs() {
	queue<pair<int, int>> que;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			twod[i][j] = INF;
		}
	}
	que.push(pair<int, int>(sx, sy));
	twod[sx][sy] = 1;
	while (que.size()) {
		pair<int, int> p = que.front();
		que.pop();
		if (p.first == gy && p.second == gx) {
			break;
		}
		for (int i = 0; i < 4; i++) {
			int nx = p.first + dx[i], ny = p.second + dy[i];
			if (1 <= nx && nx <= N && 1 <= ny && ny <= M && maze[nx][ny] != '#'&&twod[nx][ny] == INF) {
				que.push(pair<int, int>(nx, ny));
				twod[nx][ny] = twod[p.first][p.second] + 1;
			}
		}
	}
	return twod[gy][gx];
}
vector <int> g[100100];
int main()
{
		mini = 125;
		maxy = 0;

	rep(i, 5) {
		cin >> iremono[i];
	
		if (iremono[i] > maxy) {
			maxy = iremono[i];
		}
		if (iremono[i] < mini) {
			mini = iremono[i];
		}
		
	}
	cin >> a;
	
	if (a < maxy - mini) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}
}

Measured memory_bytes: 6400
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, n) for (size_t i = 0; i < (n); i++)
#define REP(n) FOR(i, n)
#define cinv(v, n) REP(n) {cin>>(v)[i];}
#define nvec(T, v, n) vector<T> v(n); cinv(v, n)
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define pub push_back
#define pof pop_front
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define GCD(v) gcd(ALL(v), 0l)

template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}

class Prob{
public:
  int num;
  string res;
};

int main(){
  int n,m;
  cin>>n>>m;
  vector<Prob> prob(m);
  for (size_t i = 0; i < m; i++) {
    cin>>prob[i].num>>prob[i].res;
  }
  
  vector<long> monndai(n+1,0);
  for (size_t i = 0; i < m; i++) {
    if(prob[i].res=="AC"){
      monndai[prob[i].num]+=200000;
    }else if(monndai[prob[i].num]<200000){
      ++monndai[prob[i].num];
    }
  }

  int ac=0;
  int pe=0;
  for (size_t i = 1; i <= n; i++) {
    if(monndai[i]>=200000){
      ++ac;
      pe+=monndai[i]%200000;
    }
  }
  cout<<ac<<" "<<pe;
}






/* きょむ〜 */

Measured memory_bytes: 7296
#include <iostream>
#include <stack>

using namespace std;

int main() {
    stack<int> st;

    for(int n; cin >> n;) {
        if(n == 0) {
            cout << st.top() << endl;
            st.pop();
        }
        else {
            st.push(n);
        }
    }



    return 0;
}

Measured memory_bytes: 2992
#include<stdio.h>
int Merge(int *,int,int,int);
int MergeSort(int *,int,int);
int sum=0;
int main()
{
  int i,n;
  int S[500000];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  MergeSort(S,0,n);

  for(i=0;i<n-1;i++){
    printf("%d ",S[i]);
  }
  printf("%d\n",S[i]);
  printf("%d\n",sum);
  return 0;
}

int MergeSort(int *A,int left,int right)
{  
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
  else return 0;
}

int Merge(int *A,int left,int mid,int right)
{
  int k,n1,n2,L[500000],R[500000],i,j;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=999999999;
  R[n2]=999999999;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i++;
      sum++;
    }
    else{
      A[k]=R[j];
      j++;
      sum++;
    }
  }
}




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

using ll = long long;

int main() {
    int N, A, B, minB = 2e9;
    cin >> N;
    ll s = 0, ans;
    rep(i, N) {
        cin >> A >> B;
        s += B;
        if (A > B) {
            minB = min(minB, B);
        }
    }
    if (minB == 2e9) ans = 0;
    else ans = s - minB;
    cout << ans << endl;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int n,m; cin>>n>>m;
   vector<int> a(m),b(m);
   rep(i,0,m){
      cin>>a[i]>>b[i];
      a[i]--; b[i]--;
   }
   vector<int> cnt(n,1);
   set<int> rs; rs.insert(0);
   rep(i,0,m){
      cnt[a[i]]--; cnt[b[i]]++;
      if(rs.count(a[i])){
         rs.insert(b[i]);
         if(cnt[a[i]]==0)rs.erase(a[i]);
      }
   }
   cout<<rs.size()<<endl;
   return 0;
}

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

int main (){
  int N,K;
  cin >> N >> K;
  vector <int> vec(N,0);
  for (int i =0;i<N;i++){
    int a;
    
    cin >> a;
    vec.at(i)=a;
  }
  int64_t  S=0;
  sort(vec.begin(),vec.end());

  if (N<=K){
    cout << 0 << endl;
  }
  
  else{
    for (int i=0; i<N-K;i++){
      S+= vec.at(i);
    }
    cout << S << endl;
  }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

bool comp(const string& i, const string& j){
	return (i > j);
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int n, ans=0;
	cin >> n;
	vector<int> h(n);
	rep(i,n) cin >> h[i];

	while(true){
		bool on = false;
		bool pass = true;
		rep(i,n){
			if(h[i] > 0){
				if(!on){
					ans++;
					on = true;
					pass = false;
				}
				h[i]--;
			}else{
				on = false;
			}
		}
		if(pass) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize
    }
    let mut d =  vec![0; n + 1];
    let mut dp =  vec![vec![0; 76]; n + 1];
    dp[1][1] = 1;
    for i in 1..=n {
        for j in divisor(i) {
            d[j] += 1;
        }
    }
    for i in 1..n {
        for j in 0..=75 {
            for k in 0..=d[i + 1] {
                if j * (k + 1) <= 75 {
                    dp[i + 1][j * (k + 1)] += dp[i][j];
                }
            }
        }
    }
    println!("{}", dp[n][75]);
}

fn divisor(m: usize) -> Vec<usize> {
    let mut l = Vec::new();
    let mut m = m;
    for i in 2.. {
        if i * i > m {break}
        while m % i == 0 {
            l.push(i);
            m /= i;
        }
    }
    if m > 1 {
        l.push(m);
    }
    l
}




Measured memory_bytes: 2168
import math
from functools import reduce
import sys
sys.setrecursionlimit(2000000)

k = int(input())

wa = 0

for a in range(1,k+1):
    for b in range(a+1,k+1):
        for c in range(b+1,k+1):
            li = [a,b,c]
            wa += reduce(math.gcd,li)*6

for a in range(1,k+1):
    for b in range(a+1,k+1):
        wa += math.gcd(a,b)*6

for a in range(1,k+1):
    wa += a
    

print(wa)


Measured memory_bytes: 9556
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  while(1){
    getline(cin,s);
    if(s==".")break;
    stack<char> st;
    bool flg=true;
    
    for(int i=0;i<s.size();i++){
      if(s[i]=='('||s[i]=='['){
	st.push(s[i]);
      }else if(s[i]==')'){
	if(st.empty()){
	  flg=false;
	  break;
	}
	if(st.top()=='('){
	  st.pop();
	}else{
	  flg=false;
	  break;
	}
      }else if(s[i]==']'){
	if(st.empty()){
	  flg=false;
	  break;
	}
	if(st.top()=='['){
	  st.pop();
	}else{
	  flg=false;
	  break;
	}
      }
    }
    if(flg==false||!st.empty()){
      cout<<"no"<<endl;
    }else{
      cout<<"yes"<<endl;
    }
  }
      //if(s=="()." || s=="[]." ||s==" .")cout << " yes" ;
      //else cout << "no" ;
      //if(getline==.)break;
  return 0;
}



Measured memory_bytes: 3196
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


const int INF = 1e9;

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

int R, W, H, X, Y;
int sz[2];
VI need[2];
VII L, used;

struct room
{
	int l, x, y;
	room(int l, int x, int y) :l(l), x(x), y(y) {}
	bool operator< (const room& r) const {
		return l > r.l;
	}
};

int main() {
	while (cin >> R, R)
	{
		rep(k, 2) {
			cin >> W >> H >> X >> Y;
			need[k] = VI(W*H+1);
			sz[k] = min(R, W*H);
			L = used = VII(W+2, VI(H+2));
			rep(j, H) {
				rep(i, W) {
					cin >> L[i+1][j+1];
				}
			}

			int cnt = 0;
			priority_queue<room> pq;
			pq.emplace(1, X, Y);
			while (!pq.empty())
			{
				room now = pq.top(); pq.pop();
				used[now.x][now.y] = true;

				cnt++;
				need[k][cnt] = max(need[k][cnt - 1], now.l);

				rep(i, 4) {
					int nx = now.x + dx[i], ny = now.y + dy[i];
					if (L[nx][ny] == 0) continue;
					if (used[nx][ny]) continue;
					used[nx][ny] = true;
					pq.emplace(L[nx][ny], nx, ny);
				}

				if (cnt > R) break;
			}
		}

		int ans = INF;
		rep(i, sz[0] + 1) {
			if (R - i <= sz[1]) {
				ans = min(ans, need[0][i] + need[1][R - i]);
			}
		}

		cout << ans << endl;
	}

	return 0;
}



Measured memory_bytes: 7760
/* Ford-Fulkerson O((E+V)F*) time
O(E) memory
*/
#include<bits/stdc++.h>


using namespace std;
const int maxN=1e3+10;

int n,st,fn,m;
bool mark[maxN];
int cap[maxN][maxN];
vector<int> g[maxN],path;
#define PB push_back


void input()
{
  cin>>n>>m;
  //  cin>>st>>fn;
  st=0;
  fn=n-1;
  for(int i=1;i<=m;i++)
    {
      int k1,k2,val;
      cin>>k1>>k2>>val;
      g[k1].push_back(k2);
      g[k2].push_back(k1);
      cap[k1][k2]=val;
    }
}
bool dfs(int v)
{
  mark[v]=true;
  path.PB(v);
  if(v==fn)
    return true;
  for(auto u : g[v])
    if(!mark[u] && cap[v][u]>0 )
      {
	if(dfs(u)==true)
	  return true;
      }
  path.pop_back();
  return false;
}

void show()
{
  cout<<"Path=";
  for(auto u :path)
    cout<<u<<" ";
  cout<<endl;
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++)
      cout<<cap[i][j]<< " ";
      cout<<endl;}
}
int Ford_Fulkerson()
{
  int MaxFlow=0;
  while(dfs(st))
    {
      //show();
      int minCap=INT_MAX;
      for(int i=1;i<path.size();i++)
	minCap=min(minCap,cap[path[i-1]][path[i]]);
      for(int i=1;i<path.size();i++)
	{
	  cap[path[i-1]][path[i]]-=minCap;
	  cap[path[i]][path[i-1]]+=minCap;
	}
      MaxFlow+=minCap;
      path.clear();
      //      memset(mark,0,sizeof(mark));
      fill(mark,mark+n+10,0);
    }
  return MaxFlow;
}
int main()
{
  input();
  int ans=Ford_Fulkerson();
  cout<<ans<<endl;
  //show();
  
  return 0;
}

Measured memory_bytes: 3592
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

//Dimensional Analysis
public class Main{

	char[] s;
	int id;
	char get(){
		return s[id++];
	}
	
	int[][] q;
	Map<String, Integer> ref;
	String[] name;
	int ID;
	void reg(String s){
		if(ref.containsKey(s))return;
		name[ID] = s;
		ref.put(s, ID++);
	}
	int n, m, p;
	boolean error;
	Map<String, String> var;
	
	int[] formula(){
		int[] res = term();
		for(;;){
			char ch = get();
			if(ch=='+'||ch=='-'){
				int[] t = term();
				for(int i=0;i<n;i++)if(res[i]!=t[i])error = true;
			}
			else break;
		}
		id--;
		return res;
	}
	
	int[] term(){
		int[] res = factor();
		for(;;){
			char ch = get();
			if(ch=='*'){
				int[] f = factor();
				for(int i=0;i<n;i++)res[i]+=f[i];
			}
			else if(ch=='/'){
				int[] f = factor();
				for(int i=0;i<n;i++)res[i]-=f[i];
			}
			else break;
		}
		id--;
		return res;
	}
	
	int[] factor(){
		char ch = get();
		if(ch=='('){
			int[] res = formula();
			get();
			return res;
		}
		String t = "";
		while(Character.isUpperCase(ch)||Character.isLowerCase(ch)){
			t+=ch; ch = get();
		}
		id--;
		int[] res = new int[n];
		int idx = ref.get(var.get(t));
		for(int i=0;i<n;i++)res[i]=q[idx][i];
		return res;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt(); m = sc.nextInt(); p = sc.nextInt();
			if((n|m|p)==0)break;
			ref = new HashMap<String, Integer>();
			ID = 0;
			name = new String[m];
			q = new int[m][n];
			for(int i=0;i<m;i++){
				reg(sc.next());
				for(int j=0;j<n;j++)q[i][j]=sc.nextInt();
			}
			s = (sc.next()+"$").toCharArray();
			id = 0;
			var = new HashMap<String, String>();
			while(p--!=0)var.put(sc.next(), sc.next());
			error = false;
			int[] res = formula();
			if(error){
				System.out.println("error"); continue;
			}
			String r = "undefined";
			for(int i=0;i<m;i++){
				boolean ok = true;
				for(int j=0;j<n;j++)if(res[j]!=q[i][j])ok = false;
				if(ok)r = name[i];
			}
			System.out.println(r);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10**6)


def dfs(v):
    global dp
    if dp[v] != -1:
        return dp[v]
    res = 0
    for next_v in e[v]:
        res = max(dfs(next_v) + 1, res)
    dp[v] = res
    return res


def main():
    N, M = map(int, input().split())
    global e
    e = [[] for _ in range(N)]
    for i in range(M):
        u, v = map(int, input().split())
        u -= 1
        v -= 1
        e[u].append(v)
    global dp
    dp = [-1]*N
    ans = -1
    for v in range(N):
        ans = max(ans, dfs(v))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 59008
#!/usr/bin/env python3
# coding: utf-8

import sys
import math
#from pprint import pprint
#import numpy as np
def myinput_int():
    return list(map(int, input().split()))
def myinput_str():
    return list(input().split())

N,D = myinput_int()

print(math.ceil(N/(D*2+1)))


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   long gcd(long x, long y) {
      if( y == 0 ) return x;
      return gcd(y, x % y);
   }
   long lcm(long x, long y) {
      return x / gcd(x, y) * y;
   }
   void solve() {
      long n; scan(n);
      long res = 1;
      for(long i = 0; i < n; ++i) {
         long x; scan(x);
         res = lcm(res, x);
      }
      printf("%ld\n", res);
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

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

  vector<int> vec;
  int now = 1;
  int cnt = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ('0' + now)) {
      cnt++;
    } else {
      vec.push_back(cnt);
      now ^= 1;
      cnt = 1;
    }
  }
  if (cnt > 0) {
    vec.push_back(cnt);
  }
  if (vec.size() % 2 == 0) {
    vec.push_back(0);
  }
  int add = 2 * k + 1;
  long long res = 0;
  
  int right = 0;
  long long sum = 0;
  for (int left = 0; left < vec.size(); left+=2) {
    while (right < min(left + add, (int)vec.size())) {
      sum += vec[right];
      ++right;
    }
    res = max(res, sum);
    
    if (right == left) ++right;
    else sum -= vec[left] + vec[left + 1];
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1020
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main{
	static int n,k;
	static LinkedList<Integer>[] g;
	static edge[] e;
	static int cal(int x){
		int[] ans=bfs(x);
		int res=0;
		for(int i=0;i<n;i++) if(2*ans[i]>k) res++;
		return res;
	}
	static int cal(int x,int y){
		int[] a1=bfs(x);
		int[] a2=bfs(y);
		int res=0;
		for(int i=0;i<n;i++) if(2*a1[i]>k && 2*a2[i]>k) res++;
		return res;
	}
	static int[] bfs(int x){
		int[] res=new int[n];
		Arrays.fill(res,-1);
		Queue<state> que=new ArrayDeque<state>();
		que.add(new state(x,-1));
		res[x]=0;
		while(!que.isEmpty()){
			state now=que.poll();
			for(int e:g[now.x]){
				if(e!=now.p && res[e]==-1){
					res[e]=res[now.x]+1;
					que.add(new state(e,now.x));
				}
			}
		}
		return res;
	}
	static class state{
		int x,p;
		public state(int a,int b){
			x=a; p=b;
		}
	}
	static class edge{
		int s,t;
		public edge(int a,int b){
			s=a; t=b;
		}
	}
	@SuppressWarnings("unchecked")
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			n=sc.nextInt();
			k=sc.nextInt();
			g=new LinkedList[n]; for(int i=0;i<n;i++) g[i]=new LinkedList<Integer>();
			edge[] e=new edge[n-1];
			for(int i=0;i<n-1;i++){
				int a=sc.nextInt(); a--;
				int b=sc.nextInt(); b--;
				g[a].add(b);
				g[b].add(a);
				e[i]=new edge(a,b);
			}
			int min=Integer.MAX_VALUE;
			if(k%2==0) for(int i=0;i<n;i++) min=Math.min(min,cal(i));
			else for(int i=0;i<n-1;i++) min=Math.min(min,cal(e[i].s,e[i].t));
			System.out.println(min);
		}
	}
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define repi(i,a,b) for(int i = (a); i<= (b); i++)
#define repA(i,n) for(int i=n; i>=0; i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (int)(a.size())

typedef long long ll;
typedef long double ld;
const ll mod = (ll)(1e9+7);//998244353;
const int N = (int)(2e6+5);

void pre() {

}

void solve() {
	string s,t;
  	cin>>s>>t;
  	int ans = 0;
  	rep(i,sz(s)) {
      if(s[i]!=t[i])	ans++;
    }
  cout<<ans;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  #endif
  int t = 1;
  pre();
  //cin>>t;
  rep(i,t)  {
    //cout<<"\nCase #"<<(i+1)<<"\n";
    solve();
    cout<<'\n';
  }
  return 0;
}


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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
#define FIO ios_base::sync_with_stdio(false);  cin.tie(NULL);
ll n;
ll c = 0;
void nmbr(ll x, bool f1, bool f2, bool f3) {
    if(x > n)
        return;
    if(f1 && f2 && f3)
        c++;
        nmbr(x*10+3, true, f2, f3);
        nmbr(x*10+5, f1, true, f3);
        nmbr(x*10+7, f1, f2, true);

}

int main() {
    cin >> n;
    nmbr(0, 0, 0, 0);
    cout << c << endl;
}



Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int d = reader.nextInt();
        int n = reader.nextInt();
        System.out.println((int) Math.pow(100, d) * (n + n / 100));
        reader.close();
    }
}

Measured memory_bytes: 23508