akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#define NO_SCORE -1

char calc_grading(int midterm_score, int final_score, int makeup_core) {
  if(midterm_score == NO_SCORE || final_score == NO_SCORE) {
    return 'F';
  }

  int total_score = midterm_score + final_score;
  if(total_score >= 80) {
    return 'A';
  }
  if(total_score >= 65) {
    return 'B';
  }
  if(total_score >= 50) {
    return 'C';
  }
  if(total_score >= 30) {
    if(makeup_core >= 50) {
      return 'C';
    }

    return 'D';
  }

  return 'F';
}

int main() {
  while(true) {
    int midterm_score, final_core, makeup_core;
    scanf("%d %d %d%*c", &midterm_score, &final_core, &makeup_core);

    if(midterm_score == NO_SCORE && final_core == NO_SCORE && makeup_core == NO_SCORE) {
      break;
    }

    char grading = calc_grading(midterm_score, final_core, makeup_core);

    printf("%c\n", grading);
  }
}



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

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


    double eight = ceil(a / 0.08);
    double  eight2 = floor((a + 1) / 0.08);

    for (;eight < eight2; eight++) {
        double t_1 = eight * 0.1;
        int t = floor(t_1);
        if (b == t) {
            cout << eight << endl;
            return 0;
        }
    }
    cout << "-1" << endl;

    return 0;
}


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

typedef long long ll;
static const ll MAX = 1e12;


int main(){
    ll x;
    cin>>x;
    
    for(ll a=-200; a<=200; a++){
        for(ll b =-200; b<=200; b++){
            if(((a*a*a*a*a) -(b*b*b*b*b)) == x){
                cout<<a<<" "<<b<<endl;
                return 0;
            }
        }
    }
    
}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<map>
#include<queue>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
const int inf = 1 << 30;
const int maxn = 1e5;
typedef long long LL;
int main(){
	int n;
	cin >> n;
	bool ans = true;
	int x = 0,y = 0;
	while(n--){
		int t,a,b;
		cin >> t >> a >> b;
		if(a-x+b-y>t) ans = false;
		else if((a-x+b-y<=t)&&(a+b-x-y)%2!=t%2) ans = false;
	}
	if(ans) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll S, W;
vector<ll> A;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

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

  cin >> S >> W;
  if (W >= S) {
    cout << "unsafe" << endl;
  } else {
    cout << "safe" << endl;
  }

  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep(j,n) for(int j = 0; j < n; j++)
using namespace std;

int main() {
	int X,Y;
	double x;
	cin >> X >> Y;
	int ans = 2 * X;
	int i = 0;
	while(i <= X){
		if(ans == Y){
			ans = -1;
			break;
		}
		ans += 2;
		i++;
	}
	if(ans == -1) cout << "Yes";
	else cout << "No";
	return 0;
}

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


int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  bool flag = 0;
  if(abs(a-c)<=d) flag=1;
  else if(abs(a-b)<=d&&abs(b-c)<=d) flag = 1;
  cout << (flag?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const ll MOD = 1000000007;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
 
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int n;
    cin >> n;
    bool flag = false;
    REP(i, 101){
        if(n - i * 4 >= 0 && (n - i * 4) % 7 == 0){
            flag = true;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  char c1, c2, c3, c4; std::cin >> c1 >> c2 >> c3 >> c4;
  int a = (c1-'0')*10 + (c2-'0'), b = (c3-'0')*10+(c4-'0');
  auto is_month = [](int m)->bool { return 1 <= m && m <= 12; };
  if(is_month(a)) {
    if(is_month(b)) fin("AMBIGUOUS");
    fin("MMYY");
  }
  if(is_month(b)) fin("YYMM");
  fin("NA");
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  long int H;
  cin >> H;
  long int i,n;
  long int ans = 1;
  n = 0;
  while(H > 0) {
    n++;
    H = H / 2;
  }
  for(i=0;i<=n-1;i++)
    ans *= 2;
  cout << ans - 1 << endl;
}

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

int main()
{
    
    string S;
    cin >> S;
    
    string str = "2018";
    
    for (int i = 0; i < 4; i++) {
        S[i] = str[i];
    }
    

    cout << S << endl;
    
    return 0;
}

Measured memory_bytes: 256
mod = 10**9+7
def fctr(n): 
    res=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            res.append([i,c])
            c=0
    if n!=1:
        res.append([n,1])
    return res
N = int(input())
A = list(map(int, input().split()))
A_inv = [pow(a, mod-2, mod) for a in A]
primes = [0]*(10**6+1)
for a in A:
    res = fctr(a)
    for i, c in res:
        primes[i] = max(primes[i], c)
m = 1
for i in range(1, 10**6+1):
    c = primes[i]
    m*=pow(i, c, mod)
    m%=mod
ans = 0
for a in A_inv:
    ans+=m*a
    ans%=mod
print(ans)




Measured memory_bytes: 53212
// SeeAlso: https://atcoder.jp/contests/abc142/tasks/abc142_c

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

ll N;

int main() {
    cin >> N;
    map<ll, ll> mm;

    REP(i, N) {
        ll a;
        cin >> a;
        mm.insert(make_pair(a, i));
    }    

    REP(i, N) {
        cout << mm.at(i+1)+1 << " ";

    }
    cout << endl;
    return 0;
}


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

namespace AGC025A
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Console.ReadLine().Select(x => int.Parse(x.ToString())).ToArray();

            if (N.Count(x => x == 1) == 1 && N.Count(x => x == 0) == N.Length - 1)
            {
                Console.WriteLine(10);
            }
            else
            {
                Console.WriteLine(N.Sum());
            }
        }
    }
}


Measured memory_bytes: 13396
#include <stdio.h>

int	main(void)
{
  	int	a;
  	int	b;
  	int	num;
  	int	i;
  
  	num = scanf("%d %d", &a, &b);
  	if (num != 2)
      	return (0);
  
  	if (a < b)
    {
      	for(i=0; i<b; i++)
        {
          	printf("%d", a);
        }
    }
  	else
    {
      	for(i=0; i<a; i++)
        {
          	printf("%d", b);
        }
    }
  	return (0);
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int n,x,cnt,i,j,k;
	
	while(1){
	cnt = 0;

		scanf("%d %d",&n,&x);
		if(n==0 && x==0){break;}
	
	for(i=1;i<=n-2;i++){
		if(i>x){break;}
		for(j=i+1;j<=n-1;j++){
			if(i+j>x){break;}
			for(k=j+1;k<=n;k++){
				if(i+j+k == x){cnt++;}
				else if(i+j+k>x){break;}
			}
		}
	}
	printf("%d\n",cnt);
	}
	return 0;
}

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

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define REP_R(i,n,m) for(int i=m; i<n; i++)
#define MAX 100

int N;
ll Y;

int main() {
  cin >> N >> Y;
  int flag = false;
  int x,y,z;

  // i: 10000, j: 5000, k: 1000
  for (int i = 0; i <= N; i++) {
    x = i;
    for (int j = 0; j <= N - i; j++) {
      int k = (N - i) - j;
      ll tt = i * 10000 + j * 5000 + k * 1000;
      if (tt == Y) {
        flag = true;
        y = j; z = k;
        break;
      }
    }

    if (flag) {
      printf("%d %d %d\n", x,y,z);
      return 0;
    }
  }

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


Measured memory_bytes: 256
#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 LL mod = 1e9 + 7;
// head
const int maxn = 2e3 + 5;
int n, k;
LL f[maxn][maxn], fac[maxn*maxn], inv[maxn*maxn];

LL ksm(LL a, LL b) {
	LL res = 1;
	while(b) {
		if(b%2) res = res*a%mod;
		b /= 2;
		a = a*a%mod;
	}
	return res;
}

LL comb(LL a, LL b) {
	return fac[a]*inv[b]%mod*inv[a - b]%mod;
}

int main() {
	cin>>n>>k;
	if(k == 1) { 
		cout<<1<<endl;
		return 0;
	}
	fac[0] = inv[0] = 1;
	rep(i, 1, n*k)
	    fac[i] = fac[i - 1]*i%mod, inv[i] = ksm(fac[i], mod - 2);
	f[0][0] = 1;
	rep(i, 1, n)
	    rep(j, 0, i) {
	    	if(i > j) f[i][j] = (f[i][j] + f[i - 1][j])%mod;
	    	if(j) f[i][j] = (f[i][j] + f[i][j - 1]*(n - j + 1)%mod*comb(n*k - i - (j - 1)*(k - 1) - 1, k - 2)%mod)%mod;
	    }
	cout<<f[n][n]<<endl;
}

Measured memory_bytes: 88728
import sys
input = sys.stdin.readline
import numpy as np

MOD = 10 ** 9 + 7

N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

# (i,j) に j^i を入れる
kth_pow = np.ones((1024, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
    kth_pow[i] = kth_pow[i-1] * rng % MOD
kth_pow_cum = kth_pow.cumsum(axis = 1) % MOD
kth_pow_cum[C+1:] = 0

def convolve(A,B,n=32):
    if n == 8:
        return np.rint(np.fft.irfft(np.fft.rfft(A) * np.fft.rfft(B))).astype(np.int64)
    n //= 2
    M = 1 << n
    A1 = A // M
    A2 = A - M * A1
    B1 = A // M
    B2 = B - M * B1
    X = convolve(A1,B1,n)
    Y = convolve(A1-A2,B1-B2,n)
    Z = convolve(A2,B2,n)
    return (X * (M * M % MOD) + (X + Z - Y) * M + Z) % MOD

dp = np.zeros(1024, dtype=np.int64) # これまで配った個数、合計点
dp[0] = 1
for a,b in zip(A,B):
    arr = kth_pow_cum[:,b] - kth_pow_cum[:,a-1]
    dp = convolve(dp,arr)
    dp[C+1:] = 0

answer = dp[C]
print(answer)

Measured memory_bytes: 22036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

template <ll mod>
struct modular {
    ll value;
    modular(ll x = 0) {
        value = x % mod;
        if (value < 0) value += mod;
    }

    modular& operator+=(modular other) {
        if ((value += other.value) >= mod) value -= mod;
        return *this;
    }
    modular& operator-=(modular other) {
        if ((value -= other.value) < 0) value += mod;
        return *this;
    }
    modular& operator*=(modular other) {
        value = value * other.value % mod;
        return *this;
    }
    modular& operator/=(modular other) {
        ll a = 0, b = 1, c = other.value, m = mod;
        while (c != 0) {
            ll t = m / c;
            m -= t * c;
            swap(c, m);
            a -= t * b;
            swap(a, b);
        }
        a %= mod;
        if (a < 0) a += mod;
        value = value * a % mod;
        return *this;
    }
    modular& operator^=(modular other) {
        ll r = 1, x = value, n = other.value;
        while (n > 0) {
            if (n & 1) r = r * x % mod;
            x = x * x % mod;
            n >>= 1;
        }
        value = r;
        return *this;
    }
    modular operator+(modular rhs) {
        return modular(*this) += rhs;
    }
    modular operator-(modular rhs) {
        return modular(*this) -= rhs;
    }
    modular operator*(modular rhs) {
        return modular(*this) *= rhs;
    }
    modular operator/(modular rhs) {
        return modular(*this) /= rhs;
    }
    modular operator^(modular rhs) {
        return modular(*this) ^= rhs;
    }
    bool operator==(modular rhs) {
        return value == rhs.value;
    };
    bool operator!=(modular rhs) {
        return value != rhs.value;
    };
    bool operator<(modular rhs) {
        return value < rhs.value;
    }
};
template <ll mod>
string to_string(modular<mod> x) {
    return to_string(x.value);
}
template <ll mod>
ostream& operator<<(ostream& stream, modular<mod> x) {
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream << x.value;
}
template <ll mod>
istream& operator>>(istream& stream, modular<mod>& x) {
    stream >> x.value;
    x.value %= mod;
    if (x.value < 0) x.value += mod;
    return stream;
}
const ll mod = 998244353;
using mint = modular<mod>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    vector<ll> a(1000010);
    rep(i, 0, n) {
        int x;
        cin >> x;
        a[x] += 1;
    }
    vector<mint> w(1000010, 1);
    rep(i, 1, 1000010) {
        w[i] /= (mint)i;
    }
    rep(i, 1, 1000010) {
        for (int j = i * 2; j < 1000010; j += i) {
            w[j] -= w[i];
        }
    }
    mint ans = 0;
    rep(i, 1, 1000010) {
        mint sum1, sum2;
        for (int j = i; j < 1000010; j += i) {
            sum1 += a[j] * j;
            sum2 += a[j] * j * j;
        }
        ans += (sum1 * sum1 - sum2) / (mint)2 * w[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 15872
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int):
    def manhattan_distance(x1, y1, x2, y2):
        return abs(x1-x2) + abs(y1-y2)
    return min(manhattan_distance(1, 1, i, N//i) for i in range(1, int(math.sqrt(N))+1) if N % i == 0)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(f'{solve(N)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 70396
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.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;
	} 
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
#define pb push_back

int n,m;
int from[100005];
vector<int> to[100005];
queue<int> q;
int ans[100005];

int main()
{
	
	cin>>n>>m;
	for(int i=0;i<n+m-1;i++)
	{
		int x,y;
		cin>>x>>y;
		x--;
		y--;
		from[y]++;
		to[x].pb(y);
	}
	
	for(int i=0;i<n;i++)
		if(!from[i])
		{
			q.push(i);
			break;
		}
	while(!q.empty())
	{ 
		int x=q.front(); 
		q.pop();
		for(int i=0;i<to[x].size();i++)
		{
			from[to[x][i]]--;
			if(!from[to[x][i]])
			{
				ans[to[x][i]]=x+1;
				q.push(to[x][i]);
			}
		}
	}
	for(int i=0;i<n;i++)
		cout<<ans[i]<<'\n';
	
	return 0;
}

Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+100;
const int inf=0x3f3f3f3f;
const int m=2019;
typedef pair<int,int> P;

map<string,int>mp;
int main()
{
    int a,b,c,d;
    cin>>a>>b;
    if(b>=a)
        puts("unsafe");
    else
        puts("safe");
    return 0;
}
/*

*/


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    int N;
    string S;
    cin >> N;
    vector<int> t(N+1),x(N+1),y(N+1);

    REPS(i, N){
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }

    t.at(0) = 0;
    x.at(0) = 0;
    y.at(0) = 0;

    bool flag = true;

    REP(i,N){
        int T = t.at(i + 1) - t.at(i);
        int X = abs(x.at(i + 1) - x.at(i));
        int Y = abs(y.at(i + 1) - y.at(i));

        if(T<(X+Y)){
            flag = false;
            break;
        }
        int T_mod = T % 2;
        int R_mod = (X + Y) % 2;
        if(!(T_mod==R_mod)){
            flag = false;
            break;
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pl;
const ll asize=1e5+5,inf=1e15;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(NULL);
	ll n,k,c=1,x,p,ans=0,minb[asize],maxb[asize];
	vector<ll>v;
	cin>>n;
	for(int i=0;i<=n;i++)cin>>k,v.push_back(k);
	if(n==0&&v[0]==0){
		cout<<-1;
		return 0;
	}
//	reverse(v.begin(),v.end());
	minb[n]=maxb[n]=0;
	for(int i=n-1;i>=0;i--){
		maxb[i]=maxb[i+1]+v[i+1];
		minb[i]=(minb[i+1]+v[i+1]+1)/2;
	}
	c=1;
	for(int i=0;i<=n;i++){
//		cout<<"i="<<i<<"c="<<c<<"\n";
		ans+=c;
		c-=v[i];
		if(c<minb[i]){
			cout<<-1;
			return 0;
		}
		if(i<n){
			c*=2;
			c=min(c,maxb[i+1]+v[i+1]);
		}
	}
	cout<<ans;
	return 0;
//	cout<<"ans="<<ans<<"\n";
//	for(int i=0;i<=n;i++){
//		cout<<i<<": "<<minb[i]<<" "<<maxb[i]<<" "<<v[i]<<"\n";
	//	ans+=maxb[i];
//	}
	return 0;
//	cout<<"maxbsum="<<ans;
/*	for(int i=0;i<=n;i++){
		cout<<"i="<<i<<" c="<<c<<"\n";
		ans+=c;
		if(c<minb[i]){
			cout<<-1;
			return 0;
		}
		c=min(2*c,maxb[i]);
	}
	cout<<ans;*/
	//cout<<c<<" "<<ans<<"\n";
	return 0;
}
/*	for(auto x:v){
		c-=x;
		ans+=c;
		if(c<0){
			cout<<-1;
			return 0;
		}
		c*=2;
	}
	cout<<ans;
	return 0;*/
/*	if(v[0]!='0'){
		if(v[0]=='1'){
			if(n>0)cout<<-1;
			else cout<<1;
			return 0;
		}
		else cout<<-1;
		return 0;
	}*/

Measured memory_bytes: 5576
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/

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

int main(){

  int n;
 cin>>n;
 bool isOK = false;

 for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
        if(i*j == n){
          cout<<"Yes"<<endl;
         isOK = true;
            return 0;
           }
    }
 }

 if(isOK == false)
 cout<<"No"<<endl;

return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    private static void solve() {
        Scanner scanner = new Scanner(System.in);

        while (scanner.hasNextInt()) {
            int d = scanner.nextInt();
            int result = 0;
            for (int i = 1; i < 600 / d; i++) {
                result += d * d * i * d * i;
            }
            System.out.println(result);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
#define pb push_back 
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << x << '\n'; return 0;}while(0)
#define FIRSTWIN do{cout << "Monocarp\n"; return 0;}while(0)
#define SECONDWIN do{cout << "Bicarp\n"; return 0;}while(0)
 
const int MAXN = 1e6+5;
const int MOD = 1e9+7;
const int INF = 1e9+1;

int N;
char S[30002];
int dp1[11];
int dp2[101];
int dp3[1001];

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    cin >> S;

    dp1[S[N-1]-'0'] = 1;
    ford(i,N-2) {
        if(i < N-2) {
            int d = (S[i]-'0')*100;
            fori(k,100) if(dp2[k]) dp3[d+k] = 1;
        }

        int d = S[i]-'0';
        fori(k,10) {
            if(dp1[k]) dp2[d*10+k] = 1;
        }
        dp1[d] = 1;
    }

    int ans = 0;
    fori(i,1000) ans += dp3[i];
    cout << ans << endl;
    return 0;
}


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

sx, sy, tx, ty = map(int,input().split())

ans = ""

ans += "R" * (tx-sx)
ans += "U" * (ty-sy)

ans += "L" * (tx-sx)
ans += "D" * (ty-sy)

ans += "D"
ans += "R" * (tx-sx+1)
ans += "U" * (ty-sy+1)
ans += "L"

ans += "U"
ans += "L" * (tx-sx+1)
ans += "D" * (ty-sy+1)
ans += "R"

print(ans)


Measured memory_bytes: 3064
#include <cstdio>  //{{{
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>

#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) std::cerr << #x << ':' << x << '\n';

typedef long long ll;
// clang-format off
template<typename T,typename U>inline bool chmax(T&x,U a){if(x>=a)return 0;x=a;return 1;}
template<typename T,typename U>inline bool chmin(T&x,U a){if(x<=a)return 0;x=a;return 1;}
inline int in(){int x;scanf("%d", &x);return x;}
// clang-format on
// }}}

//{{{ graph.hpp
#ifndef INCLUDE_GRAPH_HPP
#define INCLUDE_GRAPH_HPP
#include <vector>
#include <climits>
namespace orliv {
namespace graph {
struct Edge {
  typedef int weight_type;
  static constexpr weight_type INF =
      std::numeric_limits<weight_type>::max() - 100;

  int from, to;
  weight_type w;
  Edge(int from, int to, weight_type w = 1) : from(from), to(to), w(w) {}
  bool operator<(const Edge& rhs) const {
    if (w != rhs.w) return w > rhs.w;
    if (from != rhs.from) return from < rhs.from;
    return to < rhs.to;
  }
};

typedef Edge::weight_type Weight;
typedef std::vector<Edge> Edges;
typedef std::vector<Weight> Weights;
typedef std::vector<int> Path;
typedef std::vector<int> Nodes;
}
typedef std::vector<graph::Edges> Graph;
}
#endif
//}}}
// {{{ topological_sort.cc
#ifndef INCLUDE_GRAPH_HPP
#include "graph.hpp"
#endif

namespace orliv {
namespace graph {
namespace topological_internal {
struct TopologicalImpl {
  const Graph& G;
  std::vector<int> color;
  Nodes order;
  TopologicalImpl(const Graph& g) : G(g), color(g.size()) {}
  Nodes get() {
    for (int v = 0; v < G.size(); v++) {
      if (!color[v] && !dfs(v)) return Nodes();
    }
    reverse(order.begin(), order.end());
    return std::move(order);
  }

 private:
  bool dfs(int v) {
    color[v] = 1;
    for (const auto& e : G[v]) {
      int u = e.to;
      if (color[u] == 2) continue;
      if (color[u] == 1) return false;
      if (!dfs(u)) return false;
    }
    order.emplace_back(v);
    color[v] = 2;
    return true;
  }
};
}

Nodes topologicalSort(const Graph& g) {
  return std::move(topological_internal::TopologicalImpl(g).get());
}
}
}
// }}}

using namespace std;

int main() {
  int V = in(), E = in();
  orliv::Graph g(V);
  for (int i = 0; i < E; i++) {
    int s = in(), t = in();
    g[s].emplace_back(s, t);
  }
  auto order = orliv::graph::topologicalSort(g);
  for (auto v : order) {
    cout << v << endl;
  }
  return 0;
}

Measured memory_bytes: 2416
R, C, K = map(int, input().split())
item = [[0 for _ in range(C + 1)] for _ in range(R + 1)]
for _ in range(K):
    r, c, v = map(int, input().split())
    item[r][c] = v

# 多次元配列を生成する際、使いたい引数を逆順で書くと上手くいく

# dp = [[[0 for _ in range(4)] for _ in range(C + 1)] for _ in range(R + 1)]
# とするとTLEだった。(R+1)*4(C+1)だと通るみたいだが、あまり本質的ではない気がする。
# 以下ではdp0,dp1,dp2,dp3という4つの配列を作ることにする。

dp0 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp1 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp2 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp3 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]

for i in range(R + 1):
    for j in range(C + 1):
        now0 = dp0[i][j]
        now1 = dp1[i][j]
        now2 = dp2[i][j]
        now3 = dp3[i][j]
        # 下に移動する場合、アイテムの個数はリセットされる
        # i == Rの時は下に移動できない
        if i <= R - 1:
            # 移動先のアイテムを取らない場合
            dp0[i + 1][j] = max(dp0[i + 1][j],
                                now0,
                                now1,
                                now2,
                                now3)
            # 移動先のアイテムを取る場合
            dp1[i + 1][j] = max(dp1[i + 1][j],
                                now0 + item[i + 1][j],
                                now1 + item[i + 1][j],
                                now2 + item[i + 1][j],
                                now3 + item[i + 1][j])

        # 右に移動する場合、アイテムの個数は維持される
        # j == Cの時は右に移動できない
        if j <= C - 1:
            dp0[i][j + 1] = max(dp0[i][j + 1], now0)
            dp1[i][j + 1] = max(dp1[i][j + 1], now1)
            dp2[i][j + 1] = max(dp2[i][j + 1], now2)
            dp3[i][j + 1] = max(dp3[i][j + 1], now3)

            # 現在のkが3未満(0 or 1 or 2)の場合、移動先のアイテムをとることが可能                             [k + 1], now + item[i][j + 1])
            dp1[i][j + 1] = max(dp1[i][j + 1], now0 + item[i][j + 1])
            dp2[i][j + 1] = max(dp2[i][j + 1], now1 + item[i][j + 1])
            dp3[i][j + 1] = max(dp3[i][j + 1], now2 + item[i][j + 1])

# 最終的にR行で取るアイテムの個数についてそれぞれ調べる、3個が最適とは限らない
ans = max(dp0[-1][-1], dp1[-1][-1], dp2[-1][-1], dp3[-1][-1])
print(ans)


Measured memory_bytes: 473764
n, m=map(int, input().split())
p=[0]+list(map(int, input().split()))

par=[i for i in range(n+1)]
cnt=0
def root(i):
    if par[i]==i:
        return i
    else:
        par[i]=root(par[i])
        return par[i]


for i in range(m):
    x, y=map(int, input().split())
    if root(x)==root(y):
        0
        #print(par[1:])
    else:
        par[root(y)]=root(x)
        #print(par[1:])

ans=0
for i in range(n):
    n=1+i
    if root(n)==root(p[n]):
        ans=ans+1
print(ans)
'''
print(par[1:])

root_ls=[0]+[root(i+1) for i in range(n)]
print(par[1:])
print(root_ls[1:])
'''

Measured memory_bytes: 14004
#include<stdio.h>
#include<stdlib.h>

static const int N = 100;

int main(){
  int M[N][N];
  int n,u,k,v,i,j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++)
      M[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;

    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)
	printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }

  return 0;
}



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

int main()
{
    int n;
    ll out = 0;
    cin >> n;

    for (int i = 1; i <= n; ++i)
    {
        if (i % 3 == 0 || i % 5 == 0)
        {
        }
        else
        {
            out += i;
        }
    }

    cout << out << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>

int main(void) {
   int n;
   scanf("%d",&n);

   if(n%10 == 7 || (n/10)%10 == 7 || (n/100)%10 == 7) {
      printf("Yes");
   } else {
      printf("No");
   }

   return 0;
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S, T;
    cin >> S >> T;

    int count = 0;
    int N = S.length();

    for (int i = 0; i < N; i ++){
        if (S == T) {
            count++;
        }
        S = S.substr(N-1, 1) + S.substr(0, N-1);
    }
    
    if (count > 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
import math
S = input()
L = S[:math.ceil(len(S)/2)]
R = S[len(S)//2:]
#print(L, R)
if L[-1] == R[0]:
  j = 1
  i = 1
  while i < len(L):
    if R[0] == R[i] and L[-i-1] == R[i]:
      #print(-i-1, i)
      #print(L[-i-1], R[i])
      j += 1
      #print(j)
    else:
      break
    i+=1
    #print(i)
else:
  j = 0 
  
#print(j)
print(math.floor(len(S)/2) + j)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
const int inf = 0x3f3f3f3f;
const int mod = 1000000007;
const int N = 1e6 + 5;
int n,m,k;


ll fac[N],inv[N];
ll pow_mod(ll a,ll n)
{
    ll ret =1;
    while(n)
    {
        if(n&1) ret=ret*a%mod;
          a=a*a%mod;
          n>>=1;
    }
    return ret;
}
void init()
{
    fac[0]=1;
    for(int i=1;i<N;i++)
    {
        fac[i]=fac[i-1]*i%mod;
    }
}
ll Cc(ll x, ll y)
{
    return fac[x]*pow_mod(fac[y]*fac[x-y]%mod,mod-2)%mod;
}



int x, y;
bool ok(){
    if(y > 2*x || x > 2*y) return 0;
    if(y == 2*x || x == 2*y) return 1;
    if((x+y) % 3 == 0) return 1;
    return 0;
}

int main(){
    init();
    scanf("%d%d", &x, &y);
    if(!ok()) puts("0");
    else{
        ll k = (x+y)/3;
        int dx = 2*k, dy=k;
        m=1;
        while(1){
            if(dx==x&&dy==y){
                printf("%lld\n", Cc(k,m-1));
                break;
            }
            m++;
            dx--;
            dy++;
        }
    }
    return 0;
}


Measured memory_bytes: 9728
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int H,W;
	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2604
N, L = map(int, input().split())

result = 0
if L > 0:
    current = L + 1
    for i in range(0, N - 1):
        result = result + current
        current = current + 1
elif L + N - 1 < 0:
    current = L
    for i in range(0, N - 1):
        result = result + current
        current = current + 1
else:
    current = L
    for i in range(0, N):
        result = result + current
        current = current + 1
print(result)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main()
{
    int a, b;
    std::cin >> a >> b;
    std::cout << ((a-2*b >0) ? a-2*b : 0) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, j) for (long long i = 0; i < j; i++)
#define int long long
#define debug(var)                  \
    do {                            \
        std::cout << #var << " : "; \
        view(var);                  \
    } while (0)
template <typename T>
void view(T e)
{
    std::cout << e << std::endl;
}
template <typename T>
void view(const std::vector<T>& v)
{
    for (const auto& e : v) {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>>& vv)
{
    for (const auto& v : vv) {
        view(v);
    }
}

using namespace std;

signed main()
{
    int N;
    cin >> N;
    if (N % 2 == 0) {
        cout << N / 2 - 1;
    } else {
        cout << N / 2;
    }
}


Measured memory_bytes: 256
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

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

#define all(x) (x).begin(),(x).end()

typedef long long LL;
typedef long double LD;

bool compare_by_a(pair<int, int> a, pair<int, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    } else {
        return a.second < a.second;
    }
}

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL N;

int dfs(LL M)
{
    int ret = 0;

    //if M > N then return 0 and quit
    if (M > N) return 0;

    int cnt[3] = {0, 0, 0};
    int nums[3] = {3, 5, 7};
    int digits = 1 + (int)log10(M);
    ostringstream oss;
    oss << M;
    string s = oss.str();

    for (int i = 0; i < digits; i++) {
        for (int j = 0; j < 3; j++) {
            if (s[i]-'0' == nums[j]) {
                cnt[j]++;
            }
        }
    }

    int temp = 1;
    for (int j = 0; j < 3; j++)
        temp *= cnt[j];

    if (temp > 0) ret += 1;

    for (int j = 0; j < 3; j++)
        ret += dfs(10*M + (LL)nums[j]);

    return ret;
}

int main()
{
    cin >> N;

    cout << dfs(0) << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
     cin>>s;

/*     string arr[]={"sunny","cloudy","Rainy"};
*/

       if(s=="Sunny")
        cout<<"Cloudy";

        else if(s=="Cloudy")
        cout<<"Rainy";

        else
        cout<<"Sunny";

}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int X,A;
    scanf("%d%d",&X,&A);
        if(X>=0 && X<=9 && A>=0 && A<=9)
    {
    if(X<A)
        printf("0\n",X,A);
    else if(X>=A)
        printf("10\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include <functional>
#include<iostream>
#include<cmath>

using namespace std;

int N,a[100],alice=0,bob=0,ans;
int main(){
  cin >> N;
    for(int i = 0;i < N;i++){
        cin >> a[i];
    }
    sort(a,a+N,greater<int>());
    for(int i = 0;i<N;i++){
        if(i%2==0){
            ans += a[i];
        }else{
            ans -= a[i];
        }
    }
    cout << ans << endl;
}

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

int MOD=1000000007;
int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}

int gyaku(int n){
    return modpow(n,MOD-2);
}

signed main() {
  int k;
  cin>>k;
vector<int>run={1,2,3,4,5,6,7,8,9};
int x=0;
while(x<=100001){
  int t=run.at(x);
  if(t%10==0){
      run.push_back(t*10);
      run.push_back(t*10+1);
  }
  else if(t%10==9){
    run.push_back(t*10+8);
    run.push_back(t*10+9);
  }
  else{
    int t2=t%10;
    run.push_back(t*10+t2-1);
    run.push_back(t*10+t2);
    run.push_back(t*10+t2+1);
  }
  x++;
}
cout<<run.at(k-1)<<endl;
}


Measured memory_bytes: 5740
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int n = s.length();
  vector<int> to(n);
  for (int i = 0; i < n;) {
    int pos = s.find((s[i] == 'L' ? 'R' : 'L'), i);
    if (pos == s.npos) pos = n;
    FOR(j, i, pos) to[j] = (s[j] == 'L' ? i - 1 : pos);
    i = pos;
  }
  vector<int> ans(n, 0);
  REP(i, n) {
    int dist = abs(i - to[i]);
    if (dist % 2 == 0) {
      ++ans[to[i]];
    } else {
      if (s[i] == 'L') ++ans[to[i] + 1];
      else ++ans[to[i] - 1];
    }
  }
  REP(i, n) cout << ans[i] << (i == n - 1 ? '\n' : ' ');
  return 0;
}


Measured memory_bytes: 1488
import java.util.*;
public class Main {
	public static void main(String [] args) {
		Scanner x=new Scanner(System.in);
		int a=x.nextInt();
		if(a==1) {
			System.out.println("Hello World");
		}
		else if(a==2) {
			int b=x.nextInt();
			int c=x.nextInt();
			System.out.println(b+c);
		}
	}
}

Measured memory_bytes: 23252
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;

vector<ll> fac(300001);
vector<ll> ifac(300001);

ll mpow(ll x, ll n){
  ll ans = 1;
  while(n != 0){
    if(n&1) ans = ans*x % MOD;
    x = x*x % MOD;
    n = n >> 1;
  }
  return ans;
}

ll comb(ll a, ll b){
  if(a == 0 && b == 0)return 1;
  if(a < b || a < 0)return 0;
  ll tmp = ifac[a-b]* ifac[b] % MOD;
  return tmp * fac[a] % MOD;
}

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

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

  fac[0] = 1;
  ifac[0] = 1;
  for(ll i = 0; i<300000; i++){
    fac[i+1] = fac[i]*(i+1) % MOD;
    ifac[i+1] = ifac[i]*mpow(i+1, MOD-2) % MOD;
  }

  map<ll,int> pf = primeFactor(m);
  ll ans = 1;
  for (auto& x : pf) {
    // cout << x.first << "," << x.second << ":" << comb(n+x.second-1,n-1) <<endl;
    ll f = x.second;
    ans = ans * comb(n+f-1, n-1) % MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4992
n = int(input())
w = []
history = []
for i in range(n):
    w.append(input())

for i, word in enumerate(w):
    if i is not 0:
        if word[0] is not w[i-1][-1] or word in history:
            print("No")
            exit()
    history.append(word)
print("Yes")

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<int, string> PSI;

int n;
string s;

int num;
int cnt[100];
int field;

int main(){
	while (cin >> n&&n){
		cin >> s;
		num = 0;
		field = 0;
		fill(cnt, cnt + 100, 0);

		REP(i, s.size()){
			if (s[i] == 'M')cnt[num]++;
			else if (s[i] == 'S'){
				field += cnt[num] + 1;
				cnt[num] = 0;
			}
			else{
				cnt[num] += field + 1;
				field = 0;
			}
			num++;
			if (n == num)num = 0;
		}

		sort(cnt, cnt + n);
		REP(i, n){
			if (i == 0)cout << cnt[i];
			else cout << " " << cnt[i];
		}
		cout << " " << field << endl;
	}
}

Measured memory_bytes: 1224
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<cctype>
#include<climits>
#include<bitset>
#include<stack>

using namespace std;

typedef long long ll;

const int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
const int MAX = 19;
int W, H, fld[10][10];
int P, sx, sy;
map<pair<pair<int, int>, int>, int> memo;

inline int CountBit(int s)
{
	int res = 0;
	for (int i = 0; i < P; i++) res += (s >> i) & 1;
	return res;
}

inline bool IsInside(int x, int y)
{
	return 0 <= x && x < W && 0 <= y && y < H;
}

inline bool CanDown(int x, int y, int s, int noBits)
{
	if (x == sx && y == sy && noBits == P) return true;
	if (fld[y][x] == -1) return false;
	return ((s >> fld[y][x]) & 1) == 0;
}

int DFS(int x, int y, int s)
{
	int cnt = CountBit(s);
	if (x == sx && y == sy && cnt == P) return 1;
	pair<pair<int, int>, int> state = make_pair(make_pair(x, y), s);
	if (cnt < MAX)
	{
		map<pair<pair<int, int>, int>, int>::iterator itr = memo.find(state);
		if (itr != memo.end()) return itr->second;
	}
	int sum = 0;
	for (int i = 0; i < 4; i++)
	{
		int nx = x + dx[i], ny = y + dy[i];
		while (IsInside(nx, ny) && !CanDown(nx, ny, s, cnt))
			nx += dx[i], ny += dy[i];
		if (!IsInside(nx, ny)) continue;
		sum += DFS(nx, ny, s | (1 << fld[ny][nx]));
	}
	if (cnt < MAX && !(cnt >= 10 && sum == 0)) memo[state] = sum;
	return sum;
}

signed main()
{
	while (cin >> W >> H, W || H)
	{
		memo.clear();
		P = 0;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < W; j++)
			{
				cin >> fld[i][j];
				if (fld[i][j] == 0) fld[i][j] = -1;
				else if (fld[i][j] == 1) fld[i][j] = P++;
				else sx = j, sy = i, fld[i][j] = -1;
			}
		}
		printf("%d\n", DFS(sx, sy, 0));
	}
	return 0;
}

Measured memory_bytes: 24372
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
int main()
{
	char ch;
	cin>>ch;
	cout<<(char)(ch+1)<<endl;
	return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
	"""Compute the greatest common divisor of a and b"""
	while b > 0:
		a, b = b, a % b
	return a

def lcm(a, b):
	"""Compute the lowest common multiple of a and b"""
	return a * b // gcd(a, b)

def resolve():
	n = int(input())
	t = [int(input()) for _ in range(n)]
	ans = t[0]
	for i in t[1:]:
		ans = lcm(ans, i)
	print(ans)
resolve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b>>c;
    if(a>b){printf("0\n");}
    else
    {
       if(a*c<b)
       {
           printf("%d\n",c);
       }
       else
       {
           printf("%d\n",(b/a));
       }
    }
    return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
#define ALL(x)    (x).begin(),(x).end()
#define UNIQ(c)   (c).erase(unique(ALL((c))), end((c)))
#define mp        make_pair
#define eb        emplace_back
#define REP(i, a) for (int i = 0; i < (a); i++)

int main() {
	LL I, O, T, J, L, S, Z;
	cin >> I >> O >> T >> J >> L >> S >> Z;
	LL ans = 0;
	if (I && J && L) {
		LL ni = I - 1, nj = J - 1, nl = L - 1;
		LL temp = 0;
		temp += ni / 2;
		temp += nj / 2;
		temp += nl / 2;
		ans=max(ans, temp * 2 + 3);
	}
	LL temp = 0;
	temp += I / 2;
	temp += L / 2;
	temp += J / 2;
	ans=max(ans, temp * 2);

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

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


using namespace std;

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

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	vector<int> h(10);

	for (int i = 0; i < 10; i++) {
		cin >> h[i];
	}

	sort(h.begin(), h.end(), greater<int>());

	for (int i = 0; i < 3; i++) {
		cout << h[i] << endl;
	}

	return 0;
}




Measured memory_bytes: 3176