akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int n;
const int INF = 1001001001001001ll;
vector<int> tate,yoko,none;
int x[20],y[20],u[20];
int ans[20];
void check(vector<int> v){
	int ret = 0;
	tate.clear();
	yoko.clear();
	none.clear();
	rep(i,n){
		if(v[i] == 0)none.push_back(i);
		else if(v[i] == 1)yoko.push_back(i);
		else tate.push_back(i);
	}
	for(auto i:none){
		int tmp = min(abs(x[i]),abs(y[i]));
		for(auto idx:tate){
			tmp = min(tmp,abs(x[i] - x[idx]));
		}
		for(auto idx:yoko){
			tmp = min(tmp,abs(y[i] - y[idx]));
		}
		ret += tmp*u[i];
	}
	int siz = tate.size() + yoko.size();
	// trace(v,none,tate,yoko,ret);
	if(siz < n+1)ans[siz] = min(ans[siz],ret);
	return;
	
}
void dfs(int d,vector<int> &v){
	if(d == n){
		// trace(v);
		check(v);
		return;
	}
	int ret = INF;
	v.push_back(0);
	dfs(d+1,v);
	v.pop_back();
	v.push_back(1);
	dfs(d+1,v);
	v.pop_back();
	v.push_back(2);
	dfs(d+1,v);
	v.pop_back();
	return;
}
signed main(){
	cin >> n;
	rep(i,n)cin >> x[i] >> y[i] >> u[i];
	vector<int> v;
	rep(i,20)ans[i] = INF;
	dfs(0,v);
	rep(i,n+1)cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int n,x,y;

map <pair<int,int> ,int> m2;
void bfs(int s);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    n=nxt();x=nxt();y=nxt();


    for(int i=1;i<=n;i++)
        bfs(i);

    vector <int> count;
    count.resize(n,0);
    for(auto it=m2.begin();it!=m2.end();it++)
        count[it->second]++;
    for(int i=1;i<=n-1;i++)
        cout<<count[i]<<endl;


    

    
    
    return 0;   
}

void bfs(int s)
{
    vector <bool> visited;
    visited.resize(n+1,0);
    visited[s]=1;
    queue <int> q;
    q.push(s);
    vector <int> dist(n+1);
    dist[s]=0;
    while(q.size())
    {
        int cur=q.front();
        q.pop();
        if(cur+1<=n&&!visited[cur+1])
        {
            visited[cur+1]=1;
            q.push(cur+1);
            dist[cur+1]=dist[cur]+1;
            if(s<cur+1)
                m2[{s,cur+1}]=dist[cur+1];
            else
                m2[{cur+1,s}]=dist[cur+1];
        }
        if(cur-1>=1&&!visited[cur-1])
        {
            visited[cur-1]=1;
            q.push(cur-1);
            dist[cur-1]=dist[cur]+1;
            if(s<cur-1)
                m2[{s,cur-1}]=dist[cur-1];
            else
                m2[{cur-1,s}]=dist[cur-1];
        }
        if(cur==x&&!visited[y])
        {
            visited[y]=1;
            q.push(y);
            dist[y]=dist[cur]+1;
            if(s<y)
                m2[{s,y}]=dist[y];
            else
                m2[{y,s}]=dist[y];
        }
        if(cur==y&&!visited[x])
        {
            visited[x]=1;
            q.push(x);
            dist[x]=dist[cur]+1;
            if(s<x)
                m2[{s,x}]=dist[x];
            else
                m2[{x,s}]=dist[x];
        }
    }
}


 
 


Measured memory_bytes: 125568
#!/usr/bin/env python3

import math

q = int(input())
ab = [list(map(int, input().split())) for i in range(q)]

for a, b in ab:
    if a == b:
        print((a-1)*2)
        continue

    value = int((a*b)**0.5)

    if value**2 == a*b:
        ans = value*2-3
        # print(value, ans, 1)
    elif value*(value+1) >= a*b:
        ans = value*2-2
        # print(value, ans, 2)
    else:
        ans = value*2-1
        # print(value, ans, 3)
    print(ans)


Measured memory_bytes: 9276
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vector<int, int> > vvi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    string t;
    string s;
    cin >> s >> t;
    int cnt = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i]==t[i]) cnt++;
    }
    cout << cnt;
}

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

int main() {
  int n,ans=0;
  cin >> n;
  for(int i=1;i<=n;i=i+2){
    int cnt=0;
    for(int j=1;j<=i;j++){
      if(i%j==0)cnt++;
    }
    if(cnt==8)ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

struct edge {
    int from;
    int to;
    int cost;
    edge(int _from, int _to, int _cost) : from(_from), to(_to), cost(_cost){};
};

vector<edge> ans;

// [add, add + L)のバイパスを作る
void bypass(int L, int add) {
    // cout << L << ":" << add << endl;

    if (L <= 0) return;
    for (int i = 0; i < 20; ++i) {
        if (i < 18 && L >= (1 << i)) continue;
        // [add, add + 2^(i - 1))まで作れた
        ans.push_back(edge(i, 20, add));
        bypass(L - (1 << (i - 1)), add + (1 << (i - 1)));
        return;
    }
    return;
}

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

    // 0の辺を全部張る
    for (int i = 1; i < 20; ++i) {
        ans.push_back(edge(i, i + 1, 0));
    }

    // 大まかにグラフを作る
    for (int i = 1; i <= 20; ++i) {
        if (i < 20 && L >= (1 << i)) {
            // [0, 2^i)まで作った
            ans.push_back(edge(i, i + 1, 1 << (i - 1)));
        } else {
            // [2^(i-1), L)を作る
            bypass(L - (1 << (i - 1)), 1 << (i - 1));
            break;
        }
    }

    cout << 20 << " " << ans.size() << endl;
    for (auto e : ans) {
        cout << e.from << " " << e.to << " " << e.cost << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//sort(l,l+N,greater<int>());	降順ソート
//sort(l,l+N);	昇順ソート
//string 変数　　変数.size()で数字化


int main(void)
{
	int n;
	cin >> n;
	int test[105];
	for (int i = 0; i < n; i++) {
		cin >> test[i];
	}
	sort(test, test + n);
	int ans = 0;
	test[n + 1] = test[n];
	for (int i = 0; i < n; i++) {
		if (test[i] != test[i + 1])
			ans++;
	}
	cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char a[112];
    scanf("%s",a);
    int i,j,k;
    int count = 0;

    k = strlen(a);
    for(i=0;i<(k/2);i++)
    {
        if(a[i] != a[k-1-i])
            count++;
    }
    printf("%d",count);
    return 0;
}


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

typedef long long ll;

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

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

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

    rep(i, m) {
        cin >> a[i] >> b[i];
        vector<int> t(b[i]);

        int bits = 0;
        rep(j, b[i]) {
            cin >> t[j];
            int p = 1 << t[j] - 1;
            bits += p;
        }
        c[i] = t;
        d[i] = bits;
        // cout << "bits " << d[i] << endl;
    }
    int anBit = 1 << n;
    map<ll, ll> state;
    for (int i = 0; i < 5000; ++i) {
        state[i] = INF;
    }

    for (int i = 0; i < m; ++i) {
        state[d[i]] = min<ll>(state[d[i]], a[i]);
        // cout << "i " << i << " " << d[i] << " " << state[d[i]] << endl;
        for (int j = 0; j < anBit+10; ++j) {
            if (state[j] != INF) {
                // cout << "   " << i << " " << (i | d[i]) << " ";
                int nex = j | d[i];
                // cout << a[i] + state[j] << endl;
                state[nex] = min(state[nex], a[i] + state[j]);
            }
        }
    }

    // cout << anBit- 1<< endl;
    if (state[anBit-1] == INF) {
        cout << -1 << endl;
    } else {
        cout << state[anBit - 1] << endl;
    }
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, clock()*1.0/CLOCKS_PER_SEC)

using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;

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

void sub(int &a, int b) {
  if ((a -= b) < 0) a += MOD;
}

int mul(int a, int b) {
  return (int) ((a * 1LL * b) % MOD);
}

int mpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

const int MAXN = 2010;
int cnk[MAXN][MAXN];
int cnks[MAXN][MAXN];
int cnkss[MAXN][MAXN];

int solve2(int a, int b) {
  if (b == 0) return 1;
  int ans1 = cnkss[b - 1][min(a, b - 1)];
  int ans2 = mul(max(0, a - b + 1), cnks[b - 1][b - 1]);
  add(ans1, ans2);
  return ans1;
}

int solve1(int a, int b) {
  int ans = 0;
  for (int i = 0; i <= b && i <= a; i++) {
    add(ans, mul(solve2(a - i, i), cnk[b][i]));
  }
  return ans;
}

int main() {
#ifdef LOCAL
  freopen("e.in", "r", stdin);
  freopen("e.out", "w", stdout);
#endif

  cnk[0][0] = 1;
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      if (i) add(cnk[i][j], cnk[i - 1][j]);
      if (i && j) add(cnk[i][j], cnk[i - 1][j - 1]);
    }
  }

  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      cnks[i][j] = cnk[i][j];
      if (j) add(cnks[i][j], cnks[i][j-1]);
    }
  }
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      cnkss[i][j] = cnks[i][j];
      if (j) add(cnkss[i][j], cnkss[i][j-1]);
    }
  }


  int a, b;
  while (scanf("%d%d", &a, &b) == 2) {

    int ans = 0;
    for (int i = 0; i <= a; i++) {
      add(ans, solve1(a - i, b - 1));
    }

    printf("%d\n", ans);
  }


  return 0;
}


Measured memory_bytes: 47744
using AtCoderBeginnerContest135.Questions;
using AtCoderBeginnerContest135.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest135.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var ab = inputStream.ReadIntArray();
            var a = ab[0];
            var b = ab[1];

            var k = (a + b) / 2;

            if (Math.Abs(a - k) == Math.Abs(b - k))
            {
                yield return k;
            }
            else
            {
                yield return "IMPOSSIBLE";
            }
        }
    }
}

namespace AtCoderBeginnerContest135
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest135.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest135.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
x = int(input())
if x == 2:
    print(2)
    exit()
elif x%2 == 0:
    x += 1
 
def get_prime(n):
    p = [2]
    for i in range(3, n, 2):
        if all(i%j!=0 for j in p):
            p.append(i)
    return p
 
p = get_prime(x)
 
while True:
    for prime in p:
        if x%prime == 0:
            break
    else:
        print(x)
        break
    x += 2

Measured memory_bytes: 41820
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>

using namespace std;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n;
    int c = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int d1, d2;
        cin >> d1 >> d2;
        if (d1 == d2) {
            c += 1;
        } else {
            c = 0;
        }
        if (c == 3) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

struct edge{
    int to, cost;
    edge(int to, int cost):to(to), cost(cost){}
};

const int INF = 1e12;
int d[100010];
int n, m, s;
vector<edge> G[100010];


void dijkstra(int s){
    priority_queue<P, vector<P>, greater<P> > q;//P
    fill(d, d + n, INF);//INF
    d[s] = 0;
    q.push(P(0, s));

    while(!q.empty()){
        P p = q.top(); q.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        rep(i, 0, G[v].size()){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                q.push(make_pair(d[e.to], e.to));
            }
        }
    }
}

signed main(){
    cin >> n >> m >> s;
    rep(i, 0, m){
        int a, b, c;
        cin >> a >> b >> c;
        G[a]. push_back(edge(b, c));
    }
    dijkstra(s);
    rep(i, 0, n){
        if(d[i] >= INF) cout << "INF" << endl;
        else cout << d[i] << endl;
    }
}

Measured memory_bytes: 19392
def ss(n):
    return n / s(n)


def s(n):
    return sum([int(a) for a in str(n)])


K = int(input())
n = 0
d = 1
while K > 0:
    t1 = ss(n + d)
    t2 = ss(n + 10 * d)
    if t1 > t2:
        d *= 10
    n += d
    print(n)
    K -= 1

Measured memory_bytes: 39152
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
if N%K==0:
    print(0)
else:
    print(1)


Measured memory_bytes: 65500
using System;

namespace A___Regular_Triangle
{
    class Program
    {
        static void Main (string[] args)
        {
            var input = Console.ReadLine ().Split (' ');
            if (input[0] == input[1] && input[1] == input[2])
                Console.WriteLine ("Yes");

            else
                Console.WriteLine ("No");
        }
    }
}

Measured memory_bytes: 13140
is_prime = Array.new(999_999, true)
is_prime[0] = is_prime[1] = false
(2..1000).each do |i|
  next unless is_prime[i]

  j = i * i
  while j < 999_999
    is_prime[j] = false
    j += i
  end
end

while line = gets
  n = line.to_i
  puts is_prime[0, n + 1].count { |p| p }
end

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

int main()
{
    char c;
    cin >> c;

    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 3612
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string N;
  cin >> N;
  bool ans = N.find('7') != string::npos;
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
   // freopen("in.txt","r",stdin);
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
    {
        cout<<(n/x)*t<<endl;
    }
    else 
    {
        int p=ceil(n/(x*1.0));
        //cout<<p<<endl;
        cout<<p*t<<endl;
    }
}

Measured memory_bytes: 3740
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 500 * a + 100 * b + 50 * c == X:
        count += 1

print(count)


Measured memory_bytes: 3060
N,M=map(int, input().split())


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

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
n = 2*10 ** 5  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p) 階乗のmod
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

# *////**//
F = factorization(M)

if N==1:
    print(1)
    exit()
if M==1:
    print(1)
    exit()
ans=1
for l in F:
    ans*=cmb(N-1+l[1], l[1], p)
    ans%=p

print(ans)

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

int main(){
	string s;
	cin >> s;
	int n = s.size();
	int ans = 0;
	rep(i,n){
		if(i == 0){
			ans += s[i] - '0';
			ans--;
		}else{
			ans += 9;
		}
	}
	bool reigai = true;
	rep(i,n){
		if(i > 0){
			if(s[i] != '9'){
				reigai = false;
			}
		}
	}
	if(reigai){
		cout << ans + 1 << endl;
	}else{
		cout << ans << endl;
	}
    return 0;
}

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

using namespace std;

int main() {
	string str = "    ";
	for (int i = 0; i < 4; i++) {
		cin >> str[i];
	}
	sort(str.begin(), str.end());
	if (str == "1479") {
		puts("YES");
	} else {
		puts("NO");
	}
	return 0;
}

Measured memory_bytes: 384
/*Lucky_Glass*/
#include<cmath>
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
    double H,A;scanf("%lf%lf",&H,&A);
    printf("%d\n",(int)ceil(H/A));
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  ll a,b;
  cin >> a >> b;
  if(a+b >= 10)
    cout << "error" << endl;
  else
    cout << a+b << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cout16 cout << setprecision(16) 
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using P = std::pair<int,int>;
using vp = std::vector<P>;
using namespace std;
#define INF 1001001001
#define LL_INF 1001001001001001001
#define fi first
#define se second

int main(void) {
	int n; cin >> n;
	vi a(n); rep(i,n) cin >> a[i];
	SORT(a);
	int ai,aj;
	aj = a[n-1];
	int b = -1;
	rep(i,n-1) {
		int l = min(a[i]-0,aj-a[i]);
		if(b<l){
			b = l;
			ai = a[i];
		}
	}
	cout << aj << " " << ai << endl;
}


Measured memory_bytes: 640
import itertools

N = int(input())
F = [tuple(map(int, input().split())) for _ in range(N)]
P = [tuple(map(int, input().split())) for _ in range(N)]

it = itertools.product((0, 1), repeat=10)
next(it)

ans = -float('inf')
for t in it:
    p_sum = 0
    for i in range(N):
        c = sum(F[i][x] * t[x] for x in range(10))
        p_sum += P[i][c]
    ans = max(ans, p_sum)

print(ans)


Measured memory_bytes: 3188
### main

loop do
  n, m = gets.strip.split(' ').map{|s| s.to_i}
  break if (n | m) == 0

  msums = m.times.map{0}

  n.times do
    as = gets.strip.split(' ').map{|s| s.to_i}
    for i in (0...m)
      msums[i] += as[i]
    end
  end
  #p msums

  mps = (1..m).zip(msums)
  mps.sort!{|a, b| (cmp = b[1] <=> a[1]) != 0 ? cmp : a[0] <=> b[0]}

  puts mps.map{|mp| mp[0]}.join(' ')
end

Measured memory_bytes: 6140
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int h,w;
  cin>>h>>w;
  vector<vector<int> > vec(h, vector<int>(w));
  rep(i,h) rep(j,w) cin>>vec[i][j];
  vector<vector<int> > v(h+w, vector<int>(max(h,w),-1));
  rep(k,h+w-1){
    int i=k,j=0;
    if(k>=h){ i=h-1; j=k-h+1;}
    int d=j;
    while(i>=0 && j<w){
      v[k][d] = vec[i][j];
      i--;j++;d++;
    }
  }

  int d=w;
  vector<vector<int>> prev(d,vector<int>(d,-1));
  prev[0][0]=0;
  rep(k, h+w-1){
    vector<vector<int>> nxt(d,vector<int>(d,-1));
    rep(j,d)rep(i,j+1)if(prev[i][j]>=0){
      auto c = [&](int a,int b){
        if(v[k][a]<0 || v[k][b]<0) return -INF;
        else if(a==b) return v[k][a];
        else return v[k][a]+v[k][b];
      };
      nxt[i][j] = max(nxt[i][j], prev[i][j]+c(i,j));
      if(i+1<=j) nxt[i+1][j] = max(nxt[i+1][j], prev[i][j]+c(i+1,j));
      if(j+1<d){
        nxt[i+1][j+1] = max(nxt[i+1][j+1], prev[i][j]+c(i+1,j+1));
        nxt[i][j+1] = max(nxt[i][j+1], prev[i][j]+c(i,j+1));
      }
    }
    swap(prev,nxt);
  }

  cout << prev[d-1][d-1] << endl;
  return 0;
}


Measured memory_bytes: 1120
a = str(input())
b = str(input())
p=0
if len(a) != len(b):
    print("No")
else:
    for j in range(len(a)):
        s=b[:1]
        b=b+s
        b=b[1:]
        #print(b)
        if a==b:
            p=1
    if p==1:
        print("Yes")
    else:
        print("No")
    

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
int main(){
    long long int a,b,c;
    cin >> a >> b >> c;
    if((a%2)*(b%2)*(c%2)) cout << min(a*b,min(b*c,c*a))<<endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A%10
b=B%10
c=C%10
d=D%10
e=E%10
A+=bool(a)*10-a
B+=bool(b)*10-b
C+=bool(c)*10-c
D+=bool(d)*10-d
E+=bool(e)*10-e
print(A+B+C+D+E-max(-a%10,-b%10,-c%10,-d%10,-e%10))


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

int main() {
  int n=0;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n);

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

  a.at(n)=a.at(0);

  for(int i=0;i<n;i++){

    if(i%2==0){
      b.at(0)+=a.at(i);
    }
    else{
      b.at(0)-=a.at(i);
    }
    
  }

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

    b.at(i+1)=2*a.at(i)-b.at(i);
  
  }

  for(int i=0;i<n;i++){
    cout << b.at(i) << endl;
  }

}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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 string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, std::vector<long long> A) {
    for(int i = K ; i < N ; i++){
        cout << (A[i-K]<A[i]?YES:NO) << endl;
    }
}

int main() {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, K, std::move(A));
  return 0;
}


Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    vector<int> v{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};

    int n; cin >> n;
    OUT(v[n-1])

    return 0;
}

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

using namespace std;

int main(void) {
	int N;
	cin >> N;
	vector<long long> B(N);
	for (int i = 1; i <= N; i++) {
		long long A;
		cin >> A;
		B[i - 1] = A - i;
	}
	sort(B.begin(), B.end());
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		ans += abs(B[i] - B[N / 2]);
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

long long get(long long num,long long K){
	long long ret = 0;
	long long temp = 1;
	for(int i=0;i<K;i++){
		temp *= num-i;
		temp /= i+1;
		ret += temp;
	}
	return ret;
}	

int main(){
	
	int N,K,S,T;
	cin>>N>>K>>S>>T;
	
	for(int i=0;i<18;i++){
		int a = (S>>i)&1;
		int b = (T>>i)&1;
		if(a==1&&b==0){
			cout<<0<<endl;
			return 0;
		}
	}
	
	vector<int> A;
	for(int i=0;i<N;i++){
		int x;
		cin>>x;
		bool f = true;
		for(int j=0;j<18;j++){
			int t = (x>>j)&1;
			int a = (S>>j)&1;
			int b = (T>>j)&1;
			if(t==1&&b==0){
				f=false;
				break;
			}
			if(t==0&&a==1){
				f=false;
				break;
			}
		}
		if(f){
			A.push_back(x);
		}
	}
	
	N = A.size();
	
	vector<int> valid;
	for(int i=0;i<18;i++){
		int a = (S>>i)&1;
		int b = (T>>i)&1;
		if(a==0&&b==1){
			valid.push_back(i);
		}
	}
	
	vector<long long> calc(N+1);
	for(int i=0;i<=N;i++)calc[i] = get(i,K);
	
	long long ans = 0;
	for(int i=0;i<(1<<valid.size());i++){
		int cnt = 0;
		map<int,long long> mp;
		
		int X = 0;
		for(int j=0;j<valid.size();j++){
			if((i>>j)&1){
				X ^= (1<<valid[j]);
				cnt++;
			}
		}
		
		for(int j=0;j<N;j++){
			mp[A[j]&X] ++;
		}
		long long temp = 0;
		for(auto a:mp){
			temp += calc[a.second];
		}
		if(cnt%2==0)ans += temp;
		else ans -= temp;
	}
	
	cout<<ans<<endl;
			

		
		
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  ll N,C;
  cin >> N >> C;
  vl x(N),c(N);
  rep(i,N) {
    cin >> x[i] >> c[i];
  }
  vl la(N,0),lb(N,0);
  la[0] = c[0]-x[0];
  lb[0] = la[0]-x[0];
  srep(i,1,N) {
    la[i] = la[i-1]+c[i]-(x[i]-x[i-1]);
    lb[i] = max(la[i]-x[i],lb[i-1]);
  }
  vl ra(N,0),rb(N,0);
  ra[N-1] = c.back()-(C-x.back());
  rb[N-1] = ra.back()-(C-x.back());
  drep(i,N-1) {
    ra[i] = ra[i+1]+c[i]-(x[i+1]-x[i]);
    rb[i] = max(ra[i]-(C-x[i]),rb[i+1]);
  }
  ll ans = 0;
  chmax(ans,la.back());
  chmax(ans,ra[0]);
  rep(i,N-1) {
    chmax(ans,la[i]+max(0ll,rb[i+1]));
    chmax(ans,max(0ll,lb[i])+ra[i+1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FOR1(i, n) for(int (i)=1; (i)<=(n); (i)++)

int main(int argc, char** argv) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (argc == 2 && atoi(argv[1]) == 123456789)
        freopen("d:\\code\\cpp\\stdin", "r", stdin);

    int a,b,c;
    cin >> a >> b >> c;


    int sol = b;
    sol += min(a+b+1, c);
    cout << sol;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,m,q;
int a[51],b[51],c[51],d[51];
int A[20],ans;
void dfs(int dep,int pre){
    if(dep==n+1){
        int x =0;
        for(int i =0;i<q;i++){
            if(A[b[i]]-A[a[i]]==c[i])x+=d[i];
        }
        ans = max(ans,x);
        return;
    }
    for(int i =pre;i<=m;i++){
        A[dep] = i;
        dfs(dep+1,i);
    }
}
int main(){
    cin>>n>>m>>q;
    for(int i =0;i<q;i++)cin>>a[i]>>b[i]>>c[i]>>d[i];
    dfs(1,1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3128
#include <stdio.h>

int main (void){

int a,b,c;

int i;

int count=0;

scanf("%d %d %d",&a,&b,&c);

for(i=a;i<=b;i++){

if(c%i==0){

count++;

}

}

printf("%d\n",count);

return 0;

}

Measured memory_bytes: 596
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;



int main() {
  int n, q;
  cin >> n >> q;
  atcoder::dsu d(n);
  rep(i, q) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) d.merge(u, v);
    if (t == 1) cout << d.same(u, v) << endl;
  }
  return 0;
}

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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    
    int N, K;
    cin >> N >> K;
   
   if(K%2==1){
       ll b = 0;
        for(int i = 1; i <= N; i++){
            if(i%K == 0)b++;
        }
        cout << b*b*b << endl;
    }
    else{
        ll a = 0, b= 0;
        for(int i = 1; i <= N; i++){
            if(i%K == K/2)a++;
            if(i%K == 0)b++;
        }
        cout << a*a*a + b*b*b << endl;
    }



    return 0;
}






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

int main() {
  int n, m; cin >> n >> m;
  vector<int> vis(m + 1, 0);
  for (int i = 1; i <= n; i++) {
    int k; cin >> k;
    while (k--) {
      int x; cin >> x;
      vis[x]++;
    }
  }
  int cnt = 0;
  for (int i = 1; i <= m; i++) {
    if (vis[i] == n) ++cnt;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
c = {}

for _ in range(m):
    d, f = map(int, input().split())
    if d in c and c[d] != f:
        print(-1)
        break
    else:
        c[d] = f
        
    if 1 in c and n != 1:
        if c[1]==0:
            print(-1)
            break
else:
    if 1 in c:
        o = str(c[1])
    elif m == 0 and n == 1:
        o='0'
    else:
        o='1'

    for i in range(1, n):
        if i+1 in c:
            o += str(c[i+1])
        else:
            o += '0'
    print(o)

Measured memory_bytes: 3064
#include <iostream>
	#include <iomanip>
	#include<math.h>
	#include<list>
	#include <algorithm>
	#include<set>
	#include<vector>
	#include<math.h>
	#include<map>
	#include<string>
	#include <numeric>
	#include <queue>
	#include <sstream>
	#include <bitset>
	#include<stack>

	using namespace std;
	using ll = long long;
	using vll = vector<long long>;
	using sll = set<long long>;

	template<typename T>
	T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
	template<typename T>
	T lcm(T a, T b) { return a / gcd(a, b) * b; }

	template<typename T>
	map<T, T> getPrimeFactor(T n) {
		map<T, T> res;
		for (T i = 2; i * i <= n; ++i) {
			while (n % i == 0) {
				res[i] ++;
				n /= i;
			}
		}
		if (n != 1) res[n] = 1;
		return res;
	}

	template<typename T>
	bool IsPrimeNumber(T num)
	{
		if (num <= 2) return true;
		else if (num % 2 == 0) return false;

		double sqrtNum = sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				return false;
			}
		}

		return true;
	}

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

	#define rep(i,s,e) for(ll i=s;i<e;i++)
	#define repeq(i,s,e) for(ll i=s;i<=e;i++)

	int main() {
		const ll mod = 1e9 + 7;
		ll N;
		cin >> N;
		map<ll, ll> t;

		repeq(i, 1, N) {
			auto ret = getPrimeFactor(i);
			for (auto itr = ret.begin(); itr != ret.end(); itr++) {
				t[itr->first] += itr->second;
			}
		}

		ll ans = 1;
		for (auto itr = t.begin(); itr != t.end(); itr++) {
			ans *= itr->second + 1;
			ans %= mod;
		}
		cout << ans << endl;
		return 0;
	}


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

using namespace std;

const int N = (int)1e5 + 5;

struct Person {
  int g, s;
  bool operator < (const Person& other) const {
    return g - s < other.g - other.s;
  }
} ps[N];

priority_queue <long long, vector <long long>, greater<long long>> p;
long long gs[N], ss[N];

int main()
{
  ios::sync_with_stdio(false);
  int x, y, z, n;
  cin >> x >> y >> z;
  n = x + y + z;
  long long cs = 0;
  int a, b, c;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b >> c;
    ps[i].g = a - c;
    ps[i].s = b - c;
    cs += c;
  }
  sort(ps, ps + n);
  ss[0] = 0;
  for (int i = 1; i <= y; ++i) {
    ss[i] = ss[i - 1] + ps[i - 1].s;
    p.push(ps[i - 1].s);
  }
  for (int i = y + 1; i <= n; ++i) {
    ss[i] = ss[i - 1];
    long long d = p.top();
    if (ps[i - 1].s > d) {
      ss[i] = ss[i] - d + ps[i - 1].s;
      p.pop();
      p.push(ps[i - 1].s);
    }
  }
  while (!p.empty())
    p.pop();
  gs[n + 1] = 0;
  for (int i = n; i >= n - x + 1; --i) {
    gs[i] = gs[i + 1] + ps[i - 1].g;
    p.push(ps[i - 1].g);
  }
  for (int i = n - x; i >= 1; --i) {
    gs[i] = gs[i + 1];
    long long d = p.top();
    if (ps[i - 1].g > d) {
      gs[i] = gs[i] - d + ps[i - 1].g;
      p.pop();
      p.push(ps[i - 1].g);
    }
  }
  long long ans = -(long long)1e18;
  for (int i = y; i <= n - x; ++i) {
    ans = max(ans, ss[i] + gs[i + 1]);
  }
  cout << ans + cs << endl;
  return 0;
}

Measured memory_bytes: 3448
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] h =new int[N];
        for(int i = 0; i < N; i++) h[i] = scanner.nextInt();
        int[] dp = new int[N];
        Arrays.fill(dp,Integer.MAX_VALUE/2);
        dp[0] = 0;
        for(int i = 1; i < N; i++)
            for(int j = 1; j <= K && j <= i; j++)
                dp[i] = Math.min(dp[i], dp[i-j] + Math.abs(h[i] - h[i-j]));
//                min = Math.min(min, dp[i-j] + Math.abs(h[i] - h[i-j]));
//            dp[i] = min;
        out.println(dp[N-1]);
        out.flush();
    }
    
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        
        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }
        
        public FastScanner() {
            this(new InputStreamReader(System.in));
        }
        
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        int nextInt() {
            return Integer.parseInt(next());
        }
        
        long nextLong() {
            return Long.parseLong(next());
        }
        
        double nextDouble() {
            return Double.parseDouble(next());
        }
        
        String readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        
        int[] readIntArray(int n) {
            int[] a = new int[n];
            for (int idx = 0; idx < n; idx++) {
                a[idx] = nextInt();
            }
            return a;
        }
    }
}


Measured memory_bytes: 33012
#!/usr/bin/perl
#A - ABC333

use strict;
use warnings;

my ($ret) = 'No';

# データ取得
my ($a,$b,$ans);
{
    my ($data) = <STDIN>;
    ($a,$b) = split(/ / , $data);
}

# 3を定数とするべきか？
my ($c);
for ($c = 1 ; $c <= 3 ; $c++) {
    $ans = $a * $b * $c;

    if ($ans & 0x01) {

        $ret = 'Yes';
        last;
    }
}

print("$ret\n");

exit(0);


Measured memory_bytes: 640
n = gets.to_i
book = Hash.new
s = gets.chomp.chars
s.each do |c|
  book[c] ||= Array.new(n, 0)
  book[c][0] += 1
end

(n - 1).times do |i|
  s = gets.chomp.chars
  s.each do |c|
    next if book[c].nil?
    book[c][i + 1] += 1
  end
end

res = ""
("a".."z").each do |c|
  next if book[c].nil?
  res += c * book[c].min
end
puts res

Measured memory_bytes: 3836
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	char line[1000];
	cin.getline(line,sizeof(line));
	REP(i,200){
		if(line[i]>='a' && line[i]<='z'){
			line[i] = toupper(line[i]);
		}
	}
	
	out(line);
	return 0;
}



Measured memory_bytes: 3088
import sys
input = sys.stdin.readline

n,a,b,c = map(int,input().split())
la = [a,b,c]
lt = [int(input()) for i in range(n)]

import itertools as it
ans = 3000
for p in it.product(range(4),repeat=n):
  ll = [0]*4
  lc = [0]*4
  for i in range(n):
    ll[p[i]] += lt[i]
    lc[p[i]] += 1
  if lc[0]*lc[1]*lc[2] > 0:
    mp = 10*(sum(lc[:3])-3) + sum(abs(ll[i]-la[i]) for i in range(3))
    ans = min(ans, mp)
print(ans)

Measured memory_bytes: 3188
n = int(input())
list_a = list((map(int, input().split())))
list_a.sort()
list_alice = list_a[-1::-2]
if n == 1:
    list_bob = []
else:
    list_bob = list_a[-2::-2]
ans_alice = 0
ans_bob = 0
for number in list_alice:
    ans_alice += number
for number in list_bob:
    ans_bob += number
print(ans_alice - ans_bob)


Measured memory_bytes: 3060
n,m = map(int,raw_input().split(" "))

pos = []
for a in range(100001):
  pos.append([a,0])

def check(i):
  k,x = pos[i]
  if k != i:
    k2,x2 = check(k)
    pos[i] = [k2,x+x2]
  return pos[i]

for a in range(m):
  l,r,d = map(int,raw_input().split(" "))

  lk,lx = check(l)
  rk,rx = check(r)

  if lk != rk:
    t = d+lx-rx
    if t >= 0:
      pos[rk] = [lk,t]
    else:
      pos[lk] = [rk,-t]
  else:
    if rx - lx != d:
      print "No"
      exit(0)
print "Yes"


Measured memory_bytes: 24436