akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include <deque>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<iostream>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include<numeric>
using namespace std;
#define ll  long long
#define pb push_back
#define sz(v)               ((int)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define REP(i, v)       for(int i=0;i<sz(v);i++)
using namespace std;
typedef pair<int,int> pii;
#define f first
#define s second

int main() {
	int n,m;
	scanf("%d %d",&n,&m);
	vector<pii> v;
	for (int i = 0 ; i < m ; ++i) {
		int x,y; scanf("%d %d",&x,&y);
		v.pb((pii(y,x)));
	}
	sort(all(v));
	int lst = -1;
	int ans = 0;
	REP(i,v) {
		if (lst <= v[i].s) {
			lst = v[i].f;
			++ans;
		}
	}

	cout << ans << "\n";

}


Measured memory_bytes: 1528
#!python3

def LI():
    return list(map(int, input().split()))

# input
N, M = LI()
XYZ = [LI() for _ in range(M)]


class Node:

    def __init__(self, num):
        self.num = num
        self.parent = None

    def root(self):
        if self.parent is None:
            return self
        self.parent = self.parent.root()
        return self.parent


class UnionFind:

    def __init__(self, n):
        self.n = n
        self.nodes = [Node(i) for i in range(n)]
        self.groups = {i: 1 for i in range(n)}
    
    def union(self, x, y):
        x = self.nodes[x].root().num
        y = self.nodes[y].root().num
        if x == y:
            return
        if self.groups[x] < self.groups[y]:
            x, y = y, x
        self.groups[x] += self.groups[y]
        del self.groups[y]
        self.nodes[y].parent = self.nodes[x]
    
    def same(self, x, y):
        a = self.nodes[x].root()
        b = self.nodes[y].root()
        return True if a == b else False
    

def main():
    uf = UnionFind(N)
    for x, y, z in XYZ:
        uf.union(x - 1, y - 1)
    
    ans = len(uf.groups)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 55472
import sys
X, K, D = map(int, input().split())
if X < 0:
    X *= -1
if K <= X // D:
    X -= D * K
    print(X)
    sys.exit()
N = X // D
K -= N
X -= N * D
if K % 2 == 0:
    print(X)
else:
    X -= D
    print(-X)

Measured memory_bytes: 9184
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <sstream>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <functional>
#include <utility>
#include <stdio.h>
#define ll long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define F first
#define S second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n,m;
vector<int> v[100010];
int ind[100010];
int d[100010];
queue<int> q;
int main()
{
	cin >>n>>m;
	for (int i=0;i<m;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		v[x].push_back(y);
		ind[y]++;
	}
	for (int i=0;i<n;i++) if (!ind[i]) q.push(i);
	while (!q.empty())
	{
		int x=q.front();
		q.pop();
		for (int i=0;i<v[x].size();i++)
		{
			int xi=v[x][i];
			ind[xi]--;
			if (!ind[xi]) q.push(xi);
			d[xi]=max(d[xi],d[x]+1);
		}
	}
	cout <<*max_element(d,d+n);
	return 0;
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const ll MOD = 1000000007;
const int MAX_N = 200, MAX_X = 100000;
int n,x;
int s[MAX_N+1];
ll dp[MAX_N][MAX_X+1];

long long mod_pow(long long a, long long b)
{
  if (b == 0) return 1;
  long long ret = mod_pow(a, b/2);
  ret = ret * ret % MOD;
  if (b % 2 == 1) ret = a * ret % MOD;
  return ret;
}

ll f(int i, int x) {
  if (i == n) return x;
  ll &res = dp[i][x];
  if (res < 0) {
    res = (f(i+1,x)*(n-i-1)%MOD + f(i+1,x%s[i])) % MOD;
    res = res * mod_pow(n-i, MOD-2) % MOD;
  }
  return res;
}



int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n >> x;
  forn (i,n) cin >> s[i];

  forn(i,n) forn(j,MAX_X+1) dp[i][j]= -1;

  sort(s,s+n);
  reverse(s,s+n);

  ll res = f(0,x);
  forn1 (i,n)
    res = res * i % MOD;

  cout << res << "\n";

  return 0;
}


Measured memory_bytes: 156544
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] a = new long[3 * N];
		for (int i = 0; i < 3 * N; i++)
			a[i] = sc.nextLong();
		Arrays.sort(a);
		int ind = 0;
		long ans = 0;
		for (int i = 3 * N; i - 2 > ind; i -= 2) {
			ans += a[i - 2];
			ind++;
		}
		System.out.println(ans);
	}
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }
    int answer = 0;
    bool op_end = false;
    while(true)
    {
        for(int i=0;i<N;i++){
            if(A.at(i)%2 ==0)
            {
                A.at(i) = A.at(i) / 2;
            }
            else{
                op_end = true;
                break;
            }
        }
        if(op_end){
            break;
        }
        answer++;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N;
	cin >> N;

	int n = N;
	int S = 0;
	while (N > 0) {
		S += N % 10;
		N /= 10;
	}
	if (n%S == 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N){
        cin >> a[i];
    }
    vector<pair<int,int> > p(0);
    int a_max = -1000005;
    int max_pointer = 0;
    int a_min = 1000005;
    int min_pointer = 0;
    rep(i,N){
        if (a_max < a[i]){
            a_max = a[i];
            max_pointer = i;
        }
        if (a_min > a[i]){
            a_min = a[i];
            min_pointer = i;
        }
    }
    if (a_min >= 0){
        rep(i,N - 1){
            p.push_back(pair<int,int> (i + 1, i + 2));
        }
    }
    else if (a_max <= 0){
        rep(i,N - 1){
            p.push_back(pair<int,int> (N - i, N - i - 1));
        }
    }
    else{
        if (a_max + a_min >= 0){
            rep(i,N){
                p.push_back(pair<int,int> (max_pointer + 1, i + 1));
            }
            rep(i,N - 1){
                p.push_back(pair<int,int> (i + 1, i + 2));
            }
        }
        else{
            rep(i,N){
                p.push_back(pair<int,int> (min_pointer + 1, i + 1));
            }
            rep(i,N - 1){
                p.push_back(pair<int,int> (N - i, N - i - 1));
            }
        }
    }
    int len = p.size();
    cout << len << endl;
    rep(i,len){
        cout << p[i].first << " " << p[i].second << endl;
    }
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  int dp[n];
  for(int i=0; i<=n; i++) dp[i] = n;
  dp[0] = 0;
  //cout << dp[3] << endl;
  
  for(int i=0; i<=n; i++){
    for(int pow6=1; pow6<=n; pow6*=6){
      if(i - pow6>=0) chmin(dp[i], dp[i - pow6] + 1);
    }
    for(int pow9=1; pow9<=n; pow9*=9){
      if(i - pow9>=0) chmin(dp[i], dp[i - pow9] + 1);
    }
    //chmin(dp[i+1], dp[i] + 1);
    //cout << dp[i] << endl;
  }
  
  cout << dp[n] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}

int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}

int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}

int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main(){
  string s,t;
  cin>>s>>t;
  string ss,tt;
  tt=t.substr(0,s.size());
  if(s==tt){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

Measured memory_bytes: 3596
using System;
using System.Linq;

namespace E
{
    class Program
    {
        static long[] A;
        static long[] F;
        static long K;
        static void Main(string[] args)
        {
            var NK = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            var N = (int)NK[0]; K = NK[1];
            A = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            F = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            A = A.OrderBy(n => n).ToArray();
            F = F.OrderByDescending(n => n).ToArray();

            var result = lower_bound(1000000000000, judge);
            Console.WriteLine(result);
        }
        static bool judge(long key)
        {
            var target = F.Select(x => (long)(key / x)).ToArray();
            long count = 0;
            for (int i = 0; i < A.Length; i++)
            {
                count += Math.Max(0, A[i] - target[i]);
            }
            return count <= K;
        }
        static long lower_bound(long length, Func<long, bool> pred)
        {
            long ng = -1;
            long ok = length;

            while (Math.Abs(ng - ok) > 1)
            {
                long mid = (ok + ng) / 2;

                if (pred(mid)) ok = mid;
                else ng = mid;
            }
            return ok;
        }
    }
}


Measured memory_bytes: 63184
#include <bits/stdc++.h>
#define X first
#define Y second
#define LL long long
#define MP make_pair
#define PB push_back
#define SZ(a) (LL)(a.size())
const LL INF = 1000 * 1000 * 1000 + 47;
const LL LINF = INF * (LL)INF;
using namespace std;
const LL MAX = 100005;
const LL MAGIC = 50;
int p[MAX];
LL comps;
LL m;
int n , q;
int u[MAX] , v[MAX] , type[MAX];
void pzdc()
{
	cout << "No" << endl;
	exit(0);
}
int find(int u)
{
	return p[u] = u == p[u] ? u : find(p[u]);
}
void unite(int u , int v)
{
	u = find(u); v = find(v);
	if(u == v)
		return;
	comps--;
	p[v] = u;
}
int main() 
{
	cin >> n >> m >> q;
	for(int i = 0; i < n; i++)
		p[i] = i;
	comps = n;
	bool was1 = false;
	for(int i = 0; i < q; i++)
	{
		cin >> u[i] >> v[i] >> type[i];
		was1 |= type[i];
		if(type[i] == 0)
			unite(u[i] , v[i]);
	}
	for(int i = 0; i < q; i++)
		if(type[i] == 1)
			if(find(u[i]) == find(v[i]))
				pzdc();
	LL lBound = n - 1 + was1 , rBound = n - comps + comps * (comps - 1) / 2;
	if(m < lBound || m > rBound)
		pzdc();
	
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)
typedef long long LL;
const int maxn = 1005;
const LL mod = 1e9 + 7;

int n, m;
LL p, cnt, a, b, c, d;
char s[maxn][maxn];
struct Mat {
	int n, m;
	LL a[2][2];
	void clear() { n = m = 0, memset(a, 0, sizeof(a)); }
} A, B;

void mul(Mat &a, Mat &b) {
	Mat ans;
	ans.clear();
	ans.n = a.n, ans.m = b.m;
	rep(i, 0, ans.n)
	    rep(j, 0, ans.m)
	        rep(k, 0, a.m)
	            ans.a[i][j] = (ans.a[i][j] + a.a[i][k]%mod*b.a[k][j]%mod)%mod;
	a = ans;
}

int main() {
	cin>>n>>m>>p;
	rep(i, 1, n)
	    rep(j, 1, m)
	        cin>>s[i][j];
	rep(i, 1, n)
	    rep(j, 1, m) {
	        if(s[i][j] == '#') cnt++;
	        if(s[i][j] == s[i][j - 1] && s[i][j] == '#') c++;
	        if(s[i][j] == s[i - 1][j] && s[i][j] == '#') d++;
	    }
	rep(i, 1, m)
	    if(s[1][i] == s[n][i] && s[1][i] == '#') b++;
	rep(i, 1, n)
	    if(s[i][1] == s[i][m] && s[i][1] == '#') a++;
	if(a && b) {
		cout<<1<<endl;
		return 0;
	}
	p--;
	if(!a && !b) {
		LL res = 1;
		while(p) {
			if(p&1) res = res*cnt%mod;
			p /= 2;
			cnt = cnt*cnt%mod;
		}
		cout<<res<<endl;
		return 0;
	}
	if(!a) swap(a, b), swap(c, d);
	A.clear();
	B.clear();
	A.n = 0, A.m = B.n = B.m = 1;
	A.a[0][0] = 1;
	B.a[0][0] = cnt;
	B.a[0][1] = c;
	B.a[1][1] = a;
	while(p) {
		if(p&(1ll)) mul(A, B);
		p = p>>1ll;
		mul(B, B);
	}
	cout<<(A.a[0][0] - A.a[0][1] + mod)%mod<<endl;
}

Measured memory_bytes: 4600
#include <bits/stdc++.h>
using namespace std;
int main() {
  string S; cin >> S;
  int A = (int)(S.at(0) - '0'), B = (int)(S.at(1) - '0'), C = (int)(S.at(2) - '0'), D = (int)(S.at(3) - '0');
  for(int i = 0; i < (1 << 3); i++) {
    bitset<3> bar(i);
    if(A + (bar.test(0) ? B : -B) + (bar.test(1) ? C : -C) + (bar.test(2) ? D : -D) == 7) {
      cout << A << (bar.test(0) ? '+' : '-') << B << (bar.test(1) ? '+' : '-') << C << (bar.test(2) ? '+' : '-') << D << "=7" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n;
    cin>>n;
    int b[n];

    for(int i=0;i<n-1;i++)
    {
        cin>>b[i];
    }
    ll sum=b[0];
        for(int i=0;i<n-2;i++)
        {
            if(b[i]<=b[i+1])
                sum+=b[i];
            else
                sum+=b[i+1];
        }
        sum+=b[n-2];
        cout<<sum<<endl;

}
//Alhamdulillah


















Measured memory_bytes: 3644
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()



int main(void){
	int N;
    cin >> N;
    int W[N];
    for(int i=0;i<N;i++){
        cin >> W[i];
    }

    int sum[N];
    
    sum[0] = W[0];
    for(int i=1;i<N;i++){
        sum[i] = sum[i-1] + W[i];
    }
    
    int i = 0;
    while(2*sum[i]-sum[N-1]<=0){
        i++;
    }

    

    cout << min(abs(2*sum[i+1]-sum[N-1]),min(abs(2*sum[i]-sum[N-1]),abs(2*sum[i-1]-sum[N-1]))) << endl;


    return 0;
}


Measured memory_bytes: 256
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define pb push_back
#define n_p next_permutation
#define p_p prev_permutation
#define in insert
#define rev reverse
#define pf push_front
#define pob pop_back
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define all(x) (x).begin(),(x).end()
#define pof pop_front
#define ios ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define scn scanf
#define prt printf
#define rep(i, a, n) for(int i = a; i < n; i++)
#define mod 1000000007
#define yes cout << "Yes\n"
#define no cout << "No\n";
#define take for(auto &it : a) cin >> it;
#define out cout << a << "\n";
#define l_b lower_bound
#define u_b upper_bound
#define Max 100005
template<typename T> T mymax(T x, T y) {
    return (x > y ? x : y);
}

using namespace std;

void solve() {
    int d, t, s;
    cin >> d >> t >> s;
    ld t2 = (ld) d / s;
    if(t2 <= t) yes;
    else no;
    return;
}

int main() {
    /*int tc;
    cin >> tc;
    while(tc-- > 0)*/
    solve();
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
#define endl '\n'


void GetDistAoki(vector<vector<int>>& adj, int start, vector<int>& dist) {
  int N = adj.size();
  dist[start] = 0;
  queue<int> q;
  q.push(start);
  int d = 1;
  while (q.size()) {
    for (int iq = q.size()-1; iq >= 0; --iq) {
      int from = q.front(); q.pop();
      for (auto to : adj[from]) {
        if (dist[to] == -1) {
          dist[to] = d;
          q.emplace(to);
        }
      }
    }
    ++d;
  }
}
void DFS(int from, vector<vector<int>>& adj, vector<int>& dist_aoki, ll steps, ll& ans, vector<array<int,2>>& max_steps) {
  if (max_steps[from][steps&1] >= steps) return;
  max_steps[from][steps&1] = steps;

  ans = max(ans, steps);
  for (auto to : adj[from]) {
    if (steps+1 < dist_aoki[to]) {
      DFS(to, adj, dist_aoki, steps+1, ans, max_steps);
    } else if (steps+1 == dist_aoki[to]) {
      ans = max(ans, steps+1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  ll N,U,A;
  cin >> N >> U >> A;
  --U,--A;
  vector<vector<int>> adj(N);
  for (int i = 0; i < N-1; ++i) {
    int u,v;
    cin >> u >> v;
    --u,--v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (U == A) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> dist_Aoki(N,-1);

  GetDistAoki(adj, A, dist_Aoki);
  for (int i = 0; i < N; ++i) {
    sort(adj[i].begin(), adj[i].end(), [&](const auto& a, const auto& b) {
                                         return dist_Aoki[a] < dist_Aoki[b];
                                       });
  }

  ll ans = 0;
  vector<array<int,2>> max_steps(N, {-1,-1});
  DFS(U, adj, dist_Aoki, 0, ans, max_steps);
  cout << ans << endl;
}


Measured memory_bytes: 16384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a;
    string s;
    cin>>a>>s;
    if(a>=3200){
    	cout<<s<<endl;
    }
    else{
    	cout<<"red"<<endl;
    }
    return 0;
}


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

using ll = long long;
vector<ll> RES;

void rec(int keta,ll now){
    RES.push_back(now);
    if(keta==10) return;

    if(now%10 != 0)rec(keta+1,now*10+now%10-1);
    rec(keta+1,now*10+now%10);
    if(now%10 != 9)rec(keta+1,now*10+now%10+1);
}

int main(){
    int K; cin>>K;
    for(int i = 1; i < 10; i++){
        rec(1,i);
    }
    sort(RES.begin(),RES.end());
    cout<<RES.at(K-1)<<endl;
}



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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main() {
    int N,M,K;
    cin >> N >> M >> K;

    bool ans = false;
    REP(i,N+1) REP(j,M+1) if(i*(M-j)+j*(N-i)==K){
        ans = true;
        break;
    }

    Yes(ans)

    return 0;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_b
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
ll MOD=998244353;
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
    std::ifstream in("./input.txt"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N; cin>>N;
    vector<ll> dn(N);
    for(auto&& d:dn){
        cin>>d;        
    }
    ll ans=1;
    if(dn.at(0)!=0)ans=0;
    sort(dn.begin(),dn.end());
    if(dn.at(0)==0&&dn.at(1)==1){
    } else {
        ans=0;
    }
    ll dist_num=1;
    ll prev_dist_num=1;
    FOR(i,1,dn.size()){
        ll d=dn.at(i);
        ll pd=dn.at(i-1);
        if(d!=pd){
            if (d-pd!=1) ans=0;
            prev_dist_num=dist_num;
            dist_num=0;
        }
		++dist_num;
		ans *= prev_dist_num;
		ans %= MOD;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;

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

}


Measured memory_bytes: 3624
using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Linq;

namespace problem
{
    class Test
    {
        static void Main()
        {
            int S = int.Parse(Console.ReadLine());
            int h = S / (60 * 60);
            int m = (S - h * 60 * 60) / 60;
            int s = S - h * 60 * 60 - m * 60;
            Console.WriteLine("{0}:{1}:{2}",h ,m ,s);
        }
    }
}


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

Int par[100001];
Int sz[100001];

Int root(Int x) {
    if (x == par[x]) return x;
    return par[x] = root(par[x]);
}

void unite(Int x, Int y) {
    Int rx = root(x);
    Int ry = root(y);
    if (rx == ry) return;
    par[ry] = rx;
    sz[rx] += sz[ry];
}

int main() {
    vector<Int> res;
    Int n, m;
    while (cin >> n >> m and n) {
        vector<pair<Int, pair<Int, Int>>> G(m);
        for (Int i = 0; i < m; i++) {
            cin >> G[i].se.fi >> G[i].se.se >> G[i].fi;
        }
        for (Int i = 0; i <= n; i++) {
            par[i] = i;
            sz[i] = 1;
        }
        sort(all(G));
        vector<Int> mst;
        for (Int i = 0; i < m; i++) {
            pair<Int, Int> p = G[i].se;
            if (root(p.fi) != root(p.se)) {
                mst.push_back(G[i].fi);
                unite(p.fi, p.se);
            }
        }
        sort(all(mst));
        res.push_back(mst[(n - 1) / 2]);
    }
    for (Int i = 0; i < (Int)res.size(); i++) {
        dump(res[i]);
    }
    return 0;
}



Measured memory_bytes: 3388
#include<stdio.h>

int main(){
    float a,b,c;
    float t;
    int sum =0;
    scanf("%f %f %f", &a, &b, &t);
    for(int i=1; i*a<t+0.5; i++){
        sum += b;
        c = i;
    }
    printf("%d", sum);
}

Measured memory_bytes: 128
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int w,h,x,y;
  cin >> w >> h >> x >> y;

  double ans = w*h;
  ans /= 2;

  cout << fixed << setprecision(12) << ans << " ";

  if(x*2 == w && y*2 == h) cout << 1 << endl;
  else cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

// min
int main(void){
  int k = 0;
  int gusu = 0;
  int kisu = 0;

  scanf("%d", &k);

  gusu = k / 2;
  if(k % 2 == 0){
    kisu = k / 2;
  }else {
    kisu = k / 2 + 1;
  }
  printf("%d\n", gusu * kisu);


  return 0;

}


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

int main(void)
{
    char a[7], b[4];
    int c, i, flag;
    flag = 0;
    scanf("%s%s", a, b);
    strcat(a, b);
    c = atoi(a);
    for (i=1; i<=316; i++)
    {
        if (i*i == c) {
            flag = 1;
            break;
        }
    }
    if (flag) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef int _int;
const int N=55;
#define int unsigned long long 
int a[N],ans[N];
int getans(int x,int val){
    if(!val)return 0;
    if(val==1)return x==0;--val;
    int Ans=0;
    if(val>a[x-1])Ans+=ans[x-1],val-=a[x-1];
    else return getans(x-1,val);
    --val,++Ans;
    if(!val)return Ans;
    else if(val<=a[x-1])return Ans+getans(x-1,val);
    else Ans+=ans[x-1];
    return Ans;
}
_int main(){
    ios::sync_with_stdio(false);
    int n,x;cin>>n>>x;
    a[0]=1;ans[0]=1;
    for(int i=1;i<=n;++i)
        a[i]=a[i-1]*2+3,ans[i]=ans[i-1]*2+1;
    cout<<getans(n,x)<<endl;
    return 0;
}


Measured memory_bytes: 256
//47
#include<iostream>
#include<queue>

using namespace std;

struct S{
  int x,y,d,t;
};

using namespace std;

int main(){
  for(int w,h;cin>>w>>h,w|h;){
    char g[20][20];
    int d=0;
    int m[20][20]={{}};
    int x,y;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>g[i][j];
	if(g[i][j]=='o'){
	  x=j;
	  y=i;
	}else if(g[i][j]=='*'){
	  m[i][j]=d++;
	}
      }
    }
    queue<S> que;
    S is={x,y,0,0};
    que.push(is);
    bool p[20][20][1<<10]={{{}}};
    while(!que.empty()){
      if(que.front().d==(1<<d)-1)break;
      S c=que.front();
      que.pop();
      if(p[c.y][c.x][c.d]++)continue;
      for(int i=0;i<4;i++){
	int d[]={0,1,0,-1,0};
	int ny=c.y+d[i];
	int nx=c.x+d[i+1];
	if(0<=ny&&ny<h&&0<=nx&&nx<w&&g[ny][nx]!='x'){
	  int nd=c.d;
	  if(g[ny][nx]=='*'){
	    nd|=1<<m[ny][nx];
	  }
	  S ns={nx,ny,nd,c.t+1};
	  que.push(ns);
	}
      }
    }
    cout<<(que.empty()?-1:que.front().t)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1932
#include "bits/stdc++.h"
using namespace std;
#define int long long

int n, m,c;


signed main() {
	cin >> n >> m >> c;
	vector<int> b(m);
	vector<vector<int>> a(n, vector<int>(m));

	for (size_t i = 0; i < m; i++)
	{
		cin >> b[i];
	}
	for (size_t i = 0; i < n; i++)
	{
		for (size_t j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
	}

	int cnt = 0;
	for (size_t i = 0; i < n; i++)
	{
		int sum = c;
		for (size_t j = 0; j < m; j++)
		{
			 sum += a[i][j] * b[j];
		}
		if (sum > 0) cnt++;
	}


	cout << cnt << endl;
}




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

int main() {

  int b,r,g,c,s,t;

  while(1) {

    cin >> b >> r >>g >> c >> s >> t;
    if(b == 0 && r == 0 && g == 0 && c == 0 && s == 0 && t == 0) break;
   
    int m = 100;
    m -= 3*t;
    int bornas = 5*b + 3*r;
    m += (b+r) * 15;
   
    for(int i=0;i<bornas;i++) m+=15;
    
    m +=7*g;
    m += 2*c;

    m += bornas + 3*s;

    cout << m << endl;

  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string w; cin >> w;
	int cnt[26] = {0};
	int n = (int)w.length();
	rep (i, n){
		++cnt[(int)(w[i] - 'a')];
	} // end rep

	bool ok = true;
	rep (i, 26){
		ok &= (cnt[i] % 2 == 0);
	} // end rep

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

Measured memory_bytes: 256
N,M=(int(x) for x in input().split())
a_list=[]
b_list=[]
for i in range(M):
  a,b=(int(x) for x in input().split())
  a_list.append(a)
  b_list.append(b)
count=[0]*N
c_list=a_list+b_list
for r in c_list:
  count[r-1]+=1

[print(l) for l in count]

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int i;
    for(i=0;i<s.size();i++){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
package main

import "fmt"

func main() {
  data := []int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
  var k int
  fmt.Scanf("%d", &k)
  fmt.Println(data[k-1])
}

Measured memory_bytes: 512
import math
import itertools

a,b=map(int,input().split())
X = [[int(i) for i in input().split()] for i in range(a)] 
#for i in range():
c = list(itertools.combinations(X, 2))


ans = 0

for i in range(len(c)):
  d = 0
  for j in range(b):
    d += (c[i][0][j]-c[i][1][j])**2
    if j == b-1:
      d = math.sqrt(d)
      if d.is_integer():
        ans = ans+1

print(ans)

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


int main()
{
    ll n;
    cin>>n;
    ll a[n];
    ll odd =1;
    for( int i=0;i<n;i++)
    {
        cin>>a[i];
        if( a[i]%2==0)
            odd *= 2;

    }
    ll ans = pow( 3,n) - odd;
    cout<<ans;
}

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

int main(){
	int n,k;
	cin >> n >> k;
	if(n%k==0) cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> vec(N);

    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }

    int stair = 1;

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

    for (int i = 0; i < N - 1; i++) {
        int j = i + 1;

        if (vec.at(i) != vec.at(j)) {
            stair++;
        }
    }

    cout << stair << endl;

}

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

void merge(int,int,int);
void mergeSort(int,int);

int S[500000],mar=0;
int main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  mergeSort(0,i);
  for(i=0;i<n;i++){
    if(i!=n-1)printf("%d ",S[i]);
    else printf("%d",S[i]);
  }
  printf("\n%d\n",mar);
  
  
  return 0;
}

void merge(int left,int mid,int right){
  int i=0,j=0,k,n1,n2,L[mid-left+1],R[right-mid+1];
  n1 = mid-left;
  n2 = right-mid;
  for(i=0;i<n1;i++)L[i] = S[left + i];
  for(i=0;i<n2;i++)R[i] = S[mid + i];
  L[n1] = 2000000000;
  R[n2] = 2000000000;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    mar++;
    if(L[i] <= R[j]){
      S[k] = L[i];
      i++;
    }
    else {
      S[k] = R[j];
      j++;
    }
  }
}

void mergeSort(int left,int right){
  int mid;
  if(left+1 < right){
    mid = (left+right)/2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
}



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

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

  int minM = 1 << 10;
  for (int i = 0; i < N; ++i) {
    int m;
    cin >> m;
    X -= m;
    minM = min(minM, m);
  }

  int ans = N + X / minM;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
c=list(map(int,input().split()))
c.sort()
# print(c) #DB
dp=[[0 for j in range(n+1)] for i in range(m)] # i番目(0<=i<=m-1)までのコインを使用してj円(0<=j<=n)を支払う際の最少の枚数
for j in range(n+1):
    dp[0][j]=j
for i in range(1,m):
    for j in range(n+1):
        if j<c[i]:
            dp[i][j]=dp[i-1][j]
        else:
            dp[i][j]=min(dp[i-1][j],dp[i][j-c[i]]+1)
    # print(c[i],dp[i]) #DB
print(dp[m-1][n])


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define PI (3.141592653589793238462643383279502884197169399375105820974944)
#define MP make_pair
#define n1 first
#define n2 second
#define ALL(x) (x).begin(), (x).end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDB pair<db,db>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define VS vector<string>
#define SZ(x) ((int)x.size())
#define din(x) int x; cin >> x

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const db eps = 0.000001;
const int INF = 1000000007;
const ll LINF = 1000000000000000555;
const int N = 450555;
const int M = 1155;

void solve() {
    ll n;
    cin >> n;

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

    ll ans = 0;
    for (auto now : m){
        int x = now.n2;
        int y = 1;
        int l = 1, r = x;
        while (l <= r){
            int mid = (l+r)/2;
            if (mid*(mid+1)/2 <= x){
                y = mid;
                l = mid+1;
            } else r = mid-1;
        }
        ans += y;
    }

    cout << ans;

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
typedef long long ll;

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


    // pair<int,int>はint2つの型
    vector<pair<int,int>> ab(n);
    for(int i=0;i<n;i++){
        ab[i] = make_pair(a[i],b[i]);
    }

    // 前の要素から比較される
    sort(ab.begin(),ab.end());

    int sum=0;
    ll ans=0;

    for(int i=0;i<n;i++){
        int num = min(m,ab[i].second);
        ans += (ll)num * ab[i].first;
        m -= num;
    }

    cout << ans << endl;

}

Measured memory_bytes: 1792
//=======================//
// coder: Andy - Tohrumi //
//=======================//

#include <bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(__typeof(b) i = a; i < b; i++)
#define Rep(i, a, b) for(__typeof(a) i = a; i > b; i--)

typedef vector<int> vi;		typedef vector<ll> vl;
typedef pair<int, int> ii; 	typedef vector<ii> vii;

const int mod = 1000000007;

// code start here //

ll f[200005];

void cal() {
	f[0] = 1;
	rep(i, 1, 200005) {
		f[i] = f[i - 1] * i;
		f[i] %= mod;
	}
}

ll binpow(ll a, ll b) {
	if(b == 0) return 1LL;
	ll x = binpow(a, b / 2);
	x *= x; x %= mod;
	if(b % 2) return (x * a) % mod;
	else return x;
}

ll bindiv(ll a, ll b) {
	ll x = binpow(b, mod - 2);
	return (a * x) % mod;
}

ll C(ll k, ll n) {
	if(k > n) return 0LL;
	ll x = (f[n - k] * f[k]) % mod;
	x = bindiv(f[n], x);
	return x;
}

signed main() {
	fastio;
	cal();
	ll n, m, a, b; cin >> n >> m >> a >> b;
	ll ans = 0, cur = 0;
//	cout << C(2, 3) << endl;
	rep(i, 0, n - a) {
		cur = C(i, i + b - 1);
		cur %= mod;
//		cout << cur << endl;
		ans = (ans + ((cur * C(n - i - 1, n - i + m - b - 2)) % mod)) % mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5208
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <set>
#include <utility>
#include <queue>
#include <bitset>
#include <math.h>
#include <numeric>
#include <stack>

using namespace std;
 
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vector<int> a(n);
    rep(i,0,n){
        cin >> a[i];
    }
    vector<int> res(n);
    rep(i,0,n){
        res[a[i]-1] = i+1;
    }
    rep(i,0,n){
        cout<<res[i]<<endl;
    }
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc101a
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = 0;
            var s = Console.ReadLine();
            for (var i = 0; i != s.Length; ++i)
                n += s[i] == '+' ? 1 : -1;
            Console.WriteLine(n);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

main() {
    int H,W; cin >> H >> W; bool can2=true;
    char c[H][W]; 
    rep(i,H){
        rep(j,W){
            cin >> c[i][j];
        }
    }
    rep(i,H){
        rep(j,W){
            if(c[i][j]=='#'){   
                bool can = false;
                rep(t,4){
                    int nx=j+dx[t],ny=i+dy[t];
                    if(0<=nx && nx<W && 0<=ny && ny<H &&
                    c[ny][nx]=='#'){
                        can = true; break;
                    }
                }    
                if(!can){can2=false;break;}
            }        
        }
        if(!can2) break;
    }
    if(can2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
st = gets.split(' ').map(&:to_s)
ab = gets.split(' ').map(&:to_i)
u  = gets.split(' ').map(&:to_s)

if st[0] == u[0] then
    ab[0] -= 1
elsif st[1] == u[0] then
    ab[1] -= 1
end
print(ab[0],' ',ab[1])

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <climits>
#include <ctime>
#include <random>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define inf 0x3f3f3f3f
#define mod 1000000007
using namespace std;
typedef unsigned char byte;

int main() {
    speed;
    ll n, k, ans = 0;
    cin >> n >> k;
    vector<int>v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    sort(v.rbegin(), v.rend());
    for (int i = k; i < n; ++i) {
        ans += v[i];
    }
    cout << ans;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<algorithm>
using namespace std;
long long int a[5];
int main()
{
	int i;
	for (i = 0; i < 5; i++)
	{
		scanf("%lld ", &a[i]);
	}
	sort(a, a + 5);
	for (i = 4; i>=0; i--)
	{ if (i!=0)
		printf("%lld ", a[i]);
	else
	{
		printf("%lld\n", a[i]);

	}
	}
	return 0;

}

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

int main() {
  vector<vector<int>> a(3,vector<int>(3));
  vector<vector<bool>> flag(3,vector<bool>(3,false));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>a[i][j];
    }
  }
  int N;
  cin>>N;
  for(int l=0;l<N;l++){
    int b;
    cin>>b;
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
  		if(a[i][j]==b) flag[i][j]=true;
      }
    }
  }
  bool flag_2=false;
  for(int i=0;i<3;i++){
  if(flag[i][0]&&flag[i][1]&&flag[i][2]) flag_2=true;
  if(flag[0][i]&&flag[1][i]&&flag[2][i]) flag_2=true;
  }
  if(flag[0][0]&&flag[1][1]&&flag[2][2]) flag_2=true;
  if(flag[0][2]&&flag[1][1]&&flag[2][0]) flag_2=true;
  if(flag_2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}
        
        

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef int ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 998244353
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
int main()
{
    fast;
    ll t=1;
    while(t--)
    {
        ll n,i,j,k;
        std::cin >> n>>i;
        cout<<n*i<<"\n";
    }
}

Measured memory_bytes: 3628