akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main() {
	int x,y,z;
	while(cin >> x >> y >> z) {
		int a = 100*y+z;
		if(x < 1868) {cout << "pre-meiji"<< endl; } 
		else if(x == 1868) {
			if(a<908) {
				cout << "pre-meiji"<< endl;
			} else{
				cout << "meiji " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1912) {cout << "meiji " << x-1868+1 << " " << y << " " << z << endl; } 
		else if(x == 1912) {
			if(a<730) {
				cout << "meiji " << x-1868+1 << " " << y << " " << z << endl;
			} else{
				cout << "taisho " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1926) cout << "taisho " << x-1912+1 << " " << y << " " << z << endl;  
		else if(x == 1926) {
			if(a<1225) {
				cout << "taisho " << x-1912+1 << " " << y << " " << z << endl;
			} else{
				cout << "showa " << 1 << " " << y << " " << z << endl;
			}
		}

		else if(x < 1989) cout << "showa " << x-1926+1 << " " << y << " " << z << endl;  
		else if(x == 1989) {
			if(a<108) {
				cout << "showa " << x-1926+1 << " " << y << " " << z << endl;
			} else{
				cout << "heisei " << 1 << " " << y << " " << z << endl;
			}
		}
		else {
			cout << "heisei " << x-1989+1 << " " << y << " " << z << endl;
		}
	}
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second
const int inf=1001001001; const long long INF=1001001001001001001;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int to, from, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
//
//
//
//          ∧ ∧  ／￣￣￣￣￣￣￣￣￣￣￣￣￣
// ～′￣￣( ˚д˚)＜  Let's start coding!!
//  UU￣￣  U U  ＼
//                 ￣￣￣￣￣￣￣￣￣￣￣￣￣


int main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vv<string> w(n);
  cin >> w;
  char c;
  rep(i, 0, n) {
    rep(j, 0, i) {
      if (w[i] == w[j] || (i != 0 && c != w[i][0])) {
        cout << "No" << endl;
        return 0;
      } 
    }
    c = w[i][w[i].size()-1];
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
#define ll long long
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int main(){
	fastio();
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		if(a%2==0){
			if(a%3!=0 && a%5!=0){
				cout<<"DENIED";
				return 0;
			}
		}
		
	}
	cout<<"APPROVED";
}

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



template<int um> struct UF {
	vector<int> d; vector<pair<int, int>> history;
	UF() { d = vector<int>(um); clear(); }
	void clear() { rep(i, 0, um) d[i] = i; history.clear(); }
	int operator[](int x) { return d[x] == x ? x : d[x] = operator[](d[x]); }
	void operator()(int x, int y) {
		x = operator[](x); y = operator[](y); if (x == y) return;
		if (d[x] > d[y]) swap(x, y);
		if (d[x] == d[y]) history.push_back(make_pair(x, d[x])), d[x]--;
		history.push_back(make_pair(y, d[y]));
		d[y] = x;
	}
	void snapshot() { history.clear(); }
	void rollback() { while (history.size()) { d[history.back().first] = history.back().second; history.pop_back(); }}
};
//-----------------------------------------------------------------
int N, K, L;
UF<201010> uf1, uf2, uf3;
int cnt[201010];
int p[101010], q[101010];
int r[101010], s[101010];
map<pair<int, int>, int> ans;
//-----------------------------------------------------------------
int main() {
	cin >> N >> K >> L;

	rep(i, 0, K) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		p[i] = a; q[i] = b;

		uf1(a, b);
	}

	rep(i, 0, L) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		r[i] = a; s[i] = b;

		uf2(a, b);
	}

	rep(i, 0, N) cnt[i] = 1;

	rep(i, 0, N) ans[make_pair(uf1[i], uf2[i])]++;

	rep(i, 0, N) printf("%d ", ans[make_pair(uf1[i], uf2[i])]);
	cout << endl;
}

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

using namespace std;

#define int long long
#define double long double
#define pb push_back
#define fi first
#define se second

const int N = 4e4 + 5;
const double eps = 1e-10;
int n, a[N], b[N], c[N];
map<double, int> id;

struct Line {
    double A, B;
    Line(double A = 0, double B = 0) : A(A), B(B) {}
    bool operator< (const Line& rhs) const { return A == rhs.A ? B < rhs.B : A < rhs.A; }
} line[2][N];

struct Bit {
    int a[N];
    Bit() { memset(a, 0, sizeof a); }
    void update(int pos, int val) {
        for (; pos < N; pos += pos & -pos) a[pos] += val;
    }
    int get(int pos) {
        int ret = 0;
        for (; pos > 0; pos -= pos & -pos) ret += a[pos];
        return ret;
    }
} bit;

void solve(bool type) {
    sort(line[type] + 1, line[type] + n + 1);
    double l = -1e9, r = 1e9;
    while(r - l > eps) {
        double mid = (l + r) / 2;
        id.clear();
        for (int i = 1; i <= n; ++i) id[mid * line[type][i].A + line[type][i].B];
        int curId = 0;
        for (auto i : id) id[i.fi] = ++curId;
        bit = Bit();
        int cnt = 0;
        for (int i = 1; i <= n; ++i) {
            cnt += bit.get(id[mid * line[type][i].A + line[type][i].B]);
            bit.update(id[mid * line[type][i].A + line[type][i].B], 1);
        }
        int nn = n * (n - 1) / 2;
        if(cnt >= (nn + 1) / 2) r = mid;
        else l = mid;
    }
    cout << fixed << setprecision(15) << l;
}

signed main () {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
        line[0][i] = Line(-1.0 * a[i] / b[i], 1.0 * c[i] / b[i]);
        line[1][i] = Line(-1.0 * b[i] / a[i], 1.0 * c[i] / a[i]);
    }

    solve(0);
    cout << ' ';
    solve(1);

    return 0;
}


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

using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

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

  vector<string> s(2);
  for (int i = 0; i < 2; i++) {
    cin >> s[i];
  }

  vector<ll> p(53);
  p[0] = 1; p[1] = 3; p[2] = 6;

  int pos = 1, flag = 0;
  if (s[0][0] != s[1][0]) {
    p[1] = 6; pos = 2; flag = 1;
  }

  while (pos < n) {
    if (s[0][pos] == s[1][pos]) {
      if (flag) {
        p[pos + 1] = p[pos];
      } else {
        p[pos + 1] = 2 * p[pos] % mod;
      }
      pos++;
      flag = 0;
    } else {
      if (flag) {
        p[pos + 2] = p[pos + 1] = 3 * p[pos] % mod;
      } else {
        p[pos + 2] = p[pos + 1] = 2 * p[pos] % mod;
      }
      pos += 2;
      flag = 1;
    }
  }

  cout << p[n] % mod << endl;
  
  return 0;
}

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

vector<int>adj[sz];
int indeg[sz];

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

	int n, m; cin >> n >> m;
	while (m--)
	{
		int a, b; cin >> a >> b;
		adj[a].push_back(b);
		indeg[b]++;
	}
	queue<pair<int, int>>q;
	for (int i = 1; i <= n; i++)
	{
		if (indeg[i] == 0)
			q.push({i, 0});
	}
	int ans = 0;
	while (!q.empty())
	{
		auto x = q.front();
		ans = x.second;
		q.pop();
		for (auto it : adj[x.first])
		{
			indeg[it]--;
			if (indeg[it] == 0)
				q.push({it, x.second + 1});
		}
	}
	cout << ans;

	return 0;
}

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

h, w, m = map(int, input().split())

# 各行各列に何個ずつあるか
hs = [0] * h
ws = [0] * w
# 座標を記録
s = set()

readline = sys.stdin.readline
for _ in range(m):
    r, c = [int(i) for i in readline().split()]
    r -= 1
    c -= 1
    hs[r] += 1
    ws[c] += 1
    s.add((r, c))

# 最大値
mh = 0
mw = 0
for i in range(h):
    mh = max(mh, hs[i])
for j in range(w):
    mw = max(mw, ws[j])

# 最大値をとっている行・列
si = []
sj = []
for i in range(h):
    if mh == hs[i]:
        si.append(i)
for j in range(w):
    if mw == ws[j]:
        sj.append(j)

# 爆破対象がないマスに爆弾を設置できれば尚良し。そこでmh+mwをansに仮に記録して、１個でも見つかればその座標を出力。見つからなければ、爆破対象があるマスに爆弾を設置するのが最大となるので、ans=mh+mw-1となる
ans = mh + mw
for i in si:
    for j in sj:
        if (i, j) in s:
            continue
        print(ans)
        exit()
print(ans-1)


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

int main()
{
	string S;
	cin >> S;
	string m = S.substr(5,2);
	if (m == "01" || m == "02" || m == "03" || m == "04")
	{
		cout << "Heisei" << endl;
	}
	else
	{
		cout << "TBD" << endl;
	}
	return 0;
}

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

vector<long> div(long n) {
  vector<long> v;
  for (long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      if (i * i != n) v.push_back(n / i);
    }
  }
  sort(begin(v), end(v));
  return v;
}

int main() {
  int N, M;
  cin >> N >> M;
  auto V = div(M);
  int ans = 1;
  for (auto v : V) {
    if ((long) v * N > M) break;
    ans = v;
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 20420
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	ll N, K;

	cin >> N >> K;

	N %= K;

	cout << min(N, K - N) << endl;

	return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))

const double eps=1e-9;
const  int MOD=1e10;
const int N=1e5+9;
const int inf = 1LL<<32;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
int cnt=0,n;

void dfs(int num,int mask){
    if(num>n)return;
    if(mask==7)
    cnt++;
    dfs(num*10+5,mask|4);
    dfs(num*10+7,mask|2);
    dfs(num*10+3,mask|1);
}
int32_t main() {
    IOS;
cin>>n;
dfs(0,0);
cout<<cnt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 1000010
int prime[MAX_N];//i番目の素数
bool is_prime[MAX_N+1];

//n以下の素数の数を返す
int sieve(int n){
  int p=0;
  for(int i=0;i<=n;i++)is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<=n;i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i;j<=n;j+=i)is_prime[j]=false;
    }
  }
  return p;
}

int ma[1501][1501];
int h[1000001][2];
int dp[1501][1501];
int main(){
  sieve(1000010);
  int x=750,y=750,k=0;
  int dy[4]={1,0,-1,0};
  int dx[4]={0,-1,0,1};
  int N=1;
  for(int i=1;N<=1000000;i++){
    for(int j=0;j<2;j++,k++){
      for(int l=0;l<i;l++){
	ma[x][y]=N;
	h[N][0]=x;
	h[N++][1]=y;
	x+=dx[k%4];
	y+=dy[k%4];
	if(N==1000001)break;
      }
      if(N==1000001)break;
    }
    if(N==1000001)break;
  }
  //	cout<<h[1000000][0]<<" "<<h[1000000][1]<<endl;
  int m,n;
  while(cin>>m>>n,n){
    memset(dp,0,sizeof(dp));
    int x=h[n][0];
    int y=h[n][1];
    //cout<<x<<" "<<y<<endl;
    int ans=0,man=0;
    for(int i=1;;i+=2){
      int f=1;
      for(int j=0;j<i;j++){
	if(x<=0||x>=1500||y+j<=0||y+j>=1500)continue;
	if(ma[x][y+j]>m)continue;
	f=0;
	int t=ma[x][y+j];
	//	cout<<t<<" ";
	int ty=y+j;
	if(is_prime[t]){
	  //  cout<<'a'<<endl;
	  dp[x][ty]++;
	  if(dp[x][ty]==ans&&t>man)man=t;
	  if(dp[x][ty]>ans){
	    ans=dp[x][ty];
	    man=t;
	  }
	}
	dp[x+1][ty]=max(dp[x+1][ty],dp[x][ty]);
	dp[x+1][ty+1]=max(dp[x+1][ty+1],dp[x][ty]);
	dp[x+1][ty-1]=max(dp[x+1][ty-1],dp[x][ty]);
      }
      //	cout<<endl;
      if(f)break;
      x++;
      y--;
    }
    if(ans==0)man=0;
    cout<<ans<<" "<<man<<endl;
  }
  return 0;
}




Measured memory_bytes: 26852
import java.util.*;

public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      List<Integer> list = new ArrayList<>();
      for(int i = 0;i < 3;i++){
        int n = sc.nextInt();
        if(!list.contains(n))
          list.add(n);
      }
      System.out.println(list.size());
    }
}

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

N=int(input())

G=[[] for i in range(N)]
for i in range(N-1):
	a,b,c=map(lambda x:int(x)-1,input().split())
	G[a].append([b,c+1])
	G[b].append([a,c+1])

Q,K=map(int,input().split())
A=[list(map(int,input().split())) for i in range(Q)]


depth=[0 for i in range(N)]
depth[K-1]=0

def dfs(cur,p,d):
	for i,j in G[cur]:
		if i!=p:
			depth[i]=d+j
			dfs(i,cur,d+j)

dfs(K-1,-1,0)


for i,j in A:
	print(depth[i-1]+depth[j-1])

Measured memory_bytes: 169400
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

template<typename T1, typename T2>
ostream& operator << (ostream& os, const pair<T1, T2>& p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

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

class range {
  struct Iterator {
    int val, inc;
    int operator*() {return val;}
    bool operator!=(Iterator& rhs) {return val < rhs.val;}
    void operator++() {val += inc;}
  };
  Iterator i, n;
public:
  range(int e) : i({0, 1}), n({e, 1}) {}
  range(int b, int e) : i({b, 1}), n({e, 1}) {}
  range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {}
  Iterator& begin() {return i;}
  Iterator& end() {return n;}
};

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

struct UnionFind {
    vector<int> data;
    UnionFind(int N) : data(N, -1) { }
    // x??¨y???????????????
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[x] > data[y]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    // x??¨y???????????????????????????????????????
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    // x??????????????????????´???°????±???????
    int size(int x) {
        return -data[root(x)];
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
};
int main(){
    iostream_init();
    int N;
    cin >> N;
    UnionFind uf(N);
    map<string,int> index;
    vector<int> val;
    REP(i, N) {
        string s;
        int x;
        cin >> s >> x;
        val.push_back(x);
        index[s] = i;
    }

    int M;
    cin >> M;
    REP(i, M) {
        string a, b;
        cin >> a >> b;
        int x = index[a];
        int y = index[b];
        uf.unite(x, y);
    }

    vector<int> min_val(N, INT_MAX);
    REP(i, N) {
        int r = uf.root(i);
        min_val[r] = min(min_val[r], val[i]);
    }
    int ans = 0;
    REP(i, N) {
        ans += min_val[ uf.root(i) ];
    }
    cout << ans << endl;
    return 0;
}

/* vim:set foldmethod=marker: */

Measured memory_bytes: 1856
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vvd= vector<vd>;
using vc= vector<char>;
using vs= vector<string>;
using vb= vector<bool>;
using vl= vector<ll>;
#define rep(i,x,n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()

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

  if(n%k){
    cout << 1;
  }else{
    cout << 0;
  }
  
  return 0;
}


Measured memory_bytes: 768
import sys
stdin = sys.stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
a,b = map(int, stdin.readline().rstrip().split())

c = a * b
if c % 2 == 1:
    print("Odd")
else:
    print("Even")


Measured memory_bytes: 2940
A,B=map(int,input().split())
S=input()
flag=True
for i in range(A):
    if S[i] not in '0123456789':
        flag=False
        break
if S[A]!='-':
    flag=False
for i in range(B):
    if S[i+A+1] not in '0123456789':
        flag=False
        break
if flag:print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
from itertools import accumulate as ac
s=input()
n=len(s)
mod=int(1e9)+7

*aca,=ac([0]+[1 if i=="A" else 0 for i in s])
*acc,=ac([0]+[1 if i=="C" else 0 for i in s])
*acq,=ac([0]+[1 if i=="?" else 0 for i in s])

v=0
for i in range(1,n-1):
  if s[i]=="B" or s[i]=="?":
    a=aca[i]
    l=acq[i]
    c=acc[n]-acc[i+1]
    r=acq[n]-acq[i+1]
    v+=(a*c*pow(3,l+r,mod))
    if l+r-1>=0:
      v+=(a*r*pow(3,l+r-1,mod))+(l*c*pow(3,l+r-1,mod))
    if l+r-2>=0:
      v+=(l*r*pow(3,l+r-2,mod))
    v%=mod
print(v)

Measured memory_bytes: 17220
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <queue>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <map>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace gnu_pbds;

#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define ppb pop_back
#define pii pair<int, int>
#define piii pair<int, pii>
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define int long long
// #define ld long double


const int N = 1e5 + 20, mod = 1e9 + 7, inf = 2e9 + 9;
const ll INF = 1e18 + 20;

vector<int> g[N];
int dp[N];

void dfs(int v) {
    for(int to: g[v]) {
        if(!dp[to]) dfs(to);
        dp[v] = max(dp[v], dp[to] + 1);
    }
}

signed main() { __
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    int n, m;
    cin>>n>>m;
    for(int i = 1; i <= m; i++) {
        int x, y;
        cin>>x>>y;
        g[x].pb(y);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(!dp[i]) {
            dfs(i);
        }
        ans = max(ans, dp[i]);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 7680
#include<iostream>
#include<algorithm>
#include <stdio.h>
#include <time.h>
#include <queue>
#include <ctype.h>
using namespace std;
long long check(long long a,long long b){
    long long c;
    while(true){
        c=a%b;
        a=b;
        b=c;
        if(c==0) return a;
    }
}
int main(){
    int n;
    long long x,y;
    cin>>n>>x;
    for(int i=0;i<n-1;i++){
        cin>>y;
        x*=(y/check(x,y));
    }
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it = (c).begin(); it != (c).end(); it++)
#define X first
#define Y second

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int T = 721;
const int DEL = 540;
const int MM = 10001;
const int NN = 1001;

bool t_t[MM][T];

int main(void){
    for(int N, M; cin >> N >> M, N;){
        memset(t_t, false, MM * T);
     
        map<pii, int> dic;
        int r; cin >> r;
        while(r--){
            int t, n, m, s; cin >> t >> n >> m >> s;
            t -= DEL;

            if(!s)
                for(int i = dic[mp(m, n)]; i < t; i++)
                    t_t[m][i] = true;
            else dic[mp(m, n)] = t; 
        }   
        
        int q; cin >> q;
        while(q--){
            int ts, te, m; cin >> ts >> te >> m;
            ts -= DEL, te -= DEL;

            cout << count(t_t[m] + ts, t_t[m] + te, true) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 8268
#include<cstdio>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef pair<int,int> PP;
typedef pair<int,int>P;
int wa[1000001];
P wa2[1000001];
int main(void)
{
	priority_queue<PP> qu;
	int n,r,l,yy,x1,y2,x2,t,y,x,tt,a,i;
	scanf("%d %d %d",&n,&r,&l);
	for(i=1;i<=n;i++){
		wa2[i].second=-i;
		wa2[i].first=0;
		wa[i]=0;
	}
	for(i=0;i<r;i++){
		scanf("%d %d %d",&a,&t,&x1);
		if(i>0){
			wa2[yy].first+=(t-tt);
		}
		tt=t;
		wa[a]+=x1;
		qu.push(PP(wa[a],-a));
		while(1){
			x=qu.top().first;
			y=-qu.top().second;
			if(wa[y]==x){
				yy=y;
				break;
			}
			else{
				qu.pop();
			}
		}
	}
	wa2[yy].first+=(l-t);
	sort(wa2+1,wa2+n+1);
	printf("%d\n",-wa2[n].second);
	return 0;
}


Measured memory_bytes: 18900
N, K, Q = map(int, input().split())

A = [int(input()) for _ in range(Q)]

loose_point = [0 for _ in range(N)]



for i in range(Q):
	loose_point[A[i] - 1] += 1
	# print(A[k] - 1)



for i in range(N):
	if Q-K >= loose_point[i]:
		print("No")
	else:
		print("Yes")		

Measured memory_bytes: 58200
N,*A=$<.map &:to_i;A.sort!;n=N/2-1;p 2*(A[n+2..-1]||[]).reduce(0,:+)-2*A[0,n].reduce(0,:+)+A[n+1]-A[n]-(N%2<1 ? 0 : [A[n]+A[n+2],2*A[n+1]].min)

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


  int n;
  cin>>n;
  vector<int> a(n+1);
  vector<int> b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
int64_t ans=0;
 int64_t m=0;
  
  for(int i=0;i<n;i++){
    m=min(a[i],b[i]);
    ans+=m;
    a[i]-=m;
    b[i]-=m;
    m=min(a[i+1],b[i]);
    ans+=m;
    a[i+1]-=m;
    b[i]-=m;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define ll long long int
#define pair <ll, ll> pi
#define vector <ll> vi
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define SQ(a) (a) * (a)
#define ordered_set tree<ll, null_type, greater_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> //greater_equal<ll> or less<ll>
// find_by_key()   order_of_key()
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/*bool comp(string a, string b) {
if (a.size() != b.size()) return a.size() < b.size();
return a < b;
}*/

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen('input.txt', 'r', stdin);
    //freopen('output.txt', 'w', stdout);
    ll i, j, k, n, m, b, d, t, ans = 0,a,x,y,w,h;
    cin>>w>>h>>n;
    ll dp[5];
    dp[1]=0;
    dp[2]=w;
    dp[3]=0;
    dp[4]=h;
    while(n--){
        cin>>x>>y>>a;
        if(a==1){
            if(x>dp[1]){
                
                dp[1]=x;
            }
        }
        if(a==2){
            if(x<dp[2]){
              
                dp[2]=x;
            }
        }
        if(a==3){
            if(y>dp[3]){
                
                dp[3]=y;
            }
        }
        if(a==4){
            if(y<dp[4]){
                
                dp[4]=y;
            }
        }
    }
    if(dp[2]-dp[1]>=0&&dp[4]-dp[3]>=0){
        cout<<abs(dp[1]-dp[2])*abs(dp[3]-dp[4])<<endl;
    }
    else{
        cout<<0<<endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define F               first
#define S               second
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18 + 1
#define endl            '\n'
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define forI(i,a,n)     for(int i=a;i<=n;i++)
#define forD(i,a,n)     for(int i=n;i>=a;i--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
void init(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

int dp[3001][3001];

void compute(string &s, int n){
    dp[n][0] = (s[n-2] == '>' ? 1 : 0);
    dp[n][1] = (s[n-2] == '<' ? 1 : 0);
    forD(i, 2, n-1){
        int total = n - i + 1;;
        forI(g, 0, total){
            if(g == 0){
                if(i == n)    continue;
                dp[i][g] = 0;
                if(s[i-2] == '<')
                    continue;
                forI(j, 1, total){
                    dp[i][g] = (dp[i][g] + dp[i+1][total-j])%mod;
                }
            }else{
                if(s[i-2] == '>')
                    dp[i][g] = (dp[i][g-1] - dp[i+1][g-1] + mod)%mod;
                else
                    dp[i][g] = (dp[i][g-1] + dp[i+1][g-1])%mod;

            }
        }
    }
}

void solve(){
    int n;  cin>>n;
    string s;   cin>>s;
    int ans=0;
    compute(s, n);
    forD(gr, 0, n-1)
        ans = (ans+dp[2][gr])%mod;
    cout<<ans;
}   

int32_t main(){
    init();
    // w(t) 
    solve();
    return 0;
}

Measured memory_bytes: 49660
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100017;
bool cutted[maxn];
int cuts[maxn],cmp[maxn],used[maxn];
vector<int> G[maxn], sG[maxn];
set<vector<int> >S;
int route[maxn],sz;
void dfs(int v, int p) {
    used[v] = true;
    route[sz++]=v;
    for (auto i:sG[v]){
        if (i==p)continue;
        if (!used[i]) dfs(i,v);
        else{
            vector<int> va,vb;
            for(int p = sz-1;p>=0&&route[p]!=i;--p) va.push_back(route[p]);
            va.push_back(i);
            int minx = 0;
            for (int p = 1; p < va.size(); p++) if (va[p] < va[minx]) minx = p;
            for (int j = minx; j < va.size(); j++) vb.push_back(va[j]);
            for (int j = 0; j < minx; j++) vb.push_back(va[j]);
            S.insert(vb);
        }
    }
    --sz;
    used[v] = false;
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i = 0; i < m; i++) {
        int x,y;
        scanf("%d%d",&x,&y);
        --x, --y;
        G[x].push_back(y),G[y].push_back(x);
    }
    if (m <= n) return printf("%d\n", m-n+1), 0;
    queue<int> que;
    for (int i = 0; i < n; i++) {
        if (G[i].size() == 1) cutted[i] = true,que.push(i);
    }
    while (que.size()) {
        int v = que.front(); que.pop();
        for (auto i:G[v]) {
            ++cuts[i];
            if (cuts[i] + 1 == G[i].size()) cutted[i] = true, que.push(i);
        }
    }
    int all = 0;
    memset(cmp, -1, sizeof cmp);
    for (int i = 0; i < n; i++) {
        if (G[i].size()-cuts[i]>=3){
            cmp[i] = all++;
            for (auto j:G[i]) {
                if (cmp[j]==-1 && !cutted[j] && G[j].size() - cuts[j] == 2) cmp[j] = all++, que.push(j);
            }
        }
    }
    while (que.size()) {
        int v = que.front(); que.pop();
        for (auto i:G[v]) {
            if (!cutted[i] && cmp[i] == -1) cmp[i] = cmp[v], que.push(i);
        }
    }
    for (int i = 0; i < n; i++) {
        if (cmp[i] == -1) continue;
        for (auto j:G[i]) {
            if (cmp[j] != -1 && cmp[i] != cmp[j]) sG[cmp[i]].push_back(cmp[j]);
        }
    }
    for (int i = 0; i < all; i++){
        sort(sG[i].begin(), sG[i].end());
        sG[i].erase(unique(sG[i].begin(),sG[i].end()),sG[i].end());
    }
    dfs(0,-1);
    printf("%d\n",S.size()/2);
}


Measured memory_bytes: 33516
#include<bits/stdc++.h>
#define MAX 1024
#define inf 1<<29
#define linf 1e18
#define eps (1e-8)
#define mod 1000000007
#define pi M_PI
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,int> pdi;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

bool check(int a){
  ostringstream os;
  os<<a;
  string s=os.str();
  FOR(i,1,s.length())if(s[i]!=s[i-1]+1)return false;
  return true;
}

int main()
{
  int n,a[MAX],ans=-1;

  cin>>n;
  FOR(i,0,n)cin>>a[i];

  FOR(i,0,n){
    FOR(j,i+1,n){
      int pro=a[i]*a[j];
      if(check(pro))ans=max(ans,pro);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3180
#include<iostream>
#include<string>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  bool flag = 0;
  string s, ss;
  cin >> s >> ss;
  
  rep(i, 0, s.size()){
    if(s[i] != ss[i]){
      flag = 1;
      cout << "No";
      break;
    }
  }
  
  if(flag == 0){
    cout << "Yes";
  }
}
  

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

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

    int n, k;
    cin >> n >> k;
    int Snuke[n] = {0};

    while(k--){
        int curr_f;
        cin >> curr_f;
        for(int i = 0; i< curr_f; i++){
            int curr;
            cin >> curr;
            Snuke[curr-1]++;
        }
    }
    int ans=0;
    for (int x : Snuke){
        if(x==0){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<string, ll>;



int main(int argc, char const *argv[]) {
    ll n, m=0;
    cin >> n;
    map<string, ll> v;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        v[s]++;
        if(m<v[s]){
            m=v[s];
        }
//        cout << m;
    }
    for (auto a: v){
        if(a.second==m){
            cout << a.first<< endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216
K = gets.chomp.to_i
rc = []
K.times do |i|
  rc[i] = gets.chomp.split.map(&:to_i)
end

(0..7).to_a.permutation(8) do |arr|
  flag = false
  rc.each do |ar|
    r,c = ar
    unless arr[r] == c
      flag = true
      break
    end
  end
  next if flag

  (0..7).to_a.combination(2) do |ar|
    r1,r2 = ar
    if (arr[r1] - arr[r2]).abs == (r1 - r2).abs
      flag = true
      break
    end
  end
  next if flag

  8.times do |i|
    ar = []
    8.times do |j|
      if arr[i] == j
        ar.push('Q')
      else
        ar.push('.')
      end
    end
    puts ar.join('')
  end
end



Measured memory_bytes: 9340
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>

#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;
ll const MAX_N = 100005;
ll const MAX = 5000;
ll grid[MAX][MAX];
ll ci[MAX_N], cj[MAX_N];

int main() {
	ll n, k;
	REP(i, 0, MAX - 1) {
		REP(j, 0, MAX - 1) {
			grid[i][j] = 0;
		}
	}
	cin >> n >> k;
	REP(i, 1, n) {
		ll a, b; char c;
		cin >> a >> b >> c;
		if (c == 'B') {
			b += k;
		}
		ll K = 2 * k;
		a = a % K + K * (a%K == 0);
		b = b % K + K * (b%K == 0);
		if (a <= k) {
			if (b <= k) {
				a += k;
				b += k;
			}
			else {
				a += K;
			}
		}
		else if (b <= k) {
			a += k;
			b += k;
		}
		ci[i] = a;
		cj[i] = b;
	}
	REP(l, 1, n) {
		ll a = ci[l], b = cj[l];
		grid[a][b]++;
		grid[a][b - k]--;
		grid[a - k][b]--;
		grid[a - k][b - k]++;
	}
	for (ll i = 3 * k; i >= 0; i--) {
		for (ll j = 2 * k - 1; j >= 0; j--) {
			grid[i][j] += grid[i][j + 1];
		}
	}
	for (ll j = 2 * k; j >= 0; j--) {
		for (ll i = 3 * k - 1; i >= 0; i--) {
			grid[i][j] += grid[i + 1][j];
		}
	}

	REP(i, k + 1, 3 * k) {
		REP(j, k + 1, 2 * k) {
			grid[i - k][j - k] += grid[i][j];
			grid[i][j] = 0;
		}
	}
	REP(i, 1, k) {
		REP(j, k + 1, 2 * k) {
			grid[i + k][j - k] += grid[i][j];
			grid[i][j] = 0;
		}
	}
	REP(i, 2 * k + 1, 3 * k) {
		REP(j, 1, k) {
			grid[i - 2 * k][j] += grid[i][j];
			grid[i][j] = 0;
		}
	}
	ll ans = -1;
	REP(i, 1, k * 2) {
		REP(j, 1, k) {
			ans = max(ans, grid[i][j]);
		}
	}
	cout << ans << endl;
	/*
	REP(j, 1, k * 4) {
		REP(i, 1, k * 4) {
			cout << grid[i][j] << " ";
		}
		cout << endl;
	}
	*/

}

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

using namespace std;

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

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

  printf("%.3f\n",n*2*3.1415);
  
}

Measured memory_bytes: 3784
#include<stdio.h>
int main()
{
    int a,b,count=0,n;
    scanf("%d%d",&a,&b);
    for(int i=0;i<=a;i++){
        for(int j=0;j<=a;j++){
         n=b-(i+j);
         if(n>=0&&n<=a){
            count++;
         }
        }
        }

    printf("%d",count);
    return 0;

}


Measured memory_bytes: 1696
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    ll c=0,n,m;
    ll f=0,i,a,b;
    cin>>n>>m;
    m = m/1000;
    for(i = 0;i <=n;i++){
        for(a = 0;a<=n;a++){
            if(n-i-a<0){
                break;
            }
            f = (n-i-a)*10+a*5+i;

            if(f==m){
                cout<<(n-i-a)<<' '<<a<<' '<<i;
                return 0;
            }

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

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

int x,y,z,n;
ll a[1234],b[1234],c[1234];
vector<ll> v,u;

int main(void){
	int i,j,k;
	cin >> x >> y >> z >> n;
	for(i=0; i<x; ++i){
		cin >> a[i];
	}
	for(j=0; j<y; ++j){
		cin >> b[j];
	}
	for(k=0; k<z; ++k){
		cin >> c[k];
	}
	for(i=0; i<x; ++i){
		for(j=0; j<y; ++j){
			u.push_back(a[i]+b[j]);
		}
	}
	sort(u.begin(),u.end(),greater<ll>());
	for(i=0; i<min(n,x*y); ++i){
		for(k=0; k<z; ++k){
			v.push_back(u[i]+c[k]);
		}
	}
	sort(v.begin(),v.end(),greater<ll>());
	for(i=0; i<n; ++i){
		cout << v[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 43108
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
const ll N = 1e6+1;
ll solve(ll n){
	ll l=0 , r=1e7;
	ll ans=0;
	while(l<=r){
		ll mid=(l+r)/2;
		ll pj=(mid*(mid+1))/2;
		if(pj<=n){
			ans=mid;
			l=mid+1;
		}
		else{
			r=mid-1;
		}
	}
	return ans ;
}
void solve(){
	ll n ;
	cin>> n ;
	ll ans=0;
	for(ll i=2;i*i<=n ; i++){
		ll ps=0;
		while(n%i==0){
			n/=i;
			ps++;
		}
		ans+=solve(ps);
		// cerr<<ans<<" "<<ps<<endl;
	}
	if(n>1)ans++;
	cout<<ans<<endl;
}
int main(){
	//mahakal(),fast;
	ll t=1 ;
	// cin>> t;
	while(t--)solve();

	return 0;
}

Measured memory_bytes: 3604
S=input()
a=0
b=[0]*2019
No=[None]*2019
for i in S:
    l=No.copy()
    k=int(i)
    for j in range(2019):
        l[(j*10+k)%2019]=b[j]
    l[k]+=1
    a+=l[0]
    b=l
print(a)


Measured memory_bytes: 78932
//Daniel Grzegorzewski
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

const int N = 3005;

int n, m, dp[N][N];
string s, t;

int main() {
  init_ios();
  cin >> s >> t;
  n = s.size();
  m = t.size();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (s[i-1] == t[j-1])
        dp[i][j] = 1+dp[i-1][j-1];
      else
        dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    }
  int x1 = n, x2 = m;
  string res = "";
  while (x1 > 0 && x2 > 0) {
    if (dp[x1][x2] == dp[x1-1][x2]) {
      --x1;
    }
    else if (dp[x1][x2] == dp[x1][x2-1]) {
      --x2;
    }
    else {
      res += s[x1-1];
      --x1;
      --x2;
    }
  }
  reverse(res.begin(), res.end());
  cout<<res<<"\n";
}

Measured memory_bytes: 35456
s = input()[::-1] # 右からn桁の数についてループを回していきたいので、文字列を反転させる

sum_of_digits = 0 # 余りの値
cnts = [0] * 2019 # 余りの値ごとに余りが同じ値の数を格納する変数。2019で割る場合、余りは0~2018までの2019通りあるので、リストの長さは2019
cnts[0] = 1 # ※1
d = 1 # sum_of_digitsの計算に使う10の累乗値

# まず余りの値ごとに余りが同じ値の数を数える
for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019 # ※2
    cnts[sum_of_digits] += 1

# 次に余りの値ごとにその組み合わせを計算し、足し合わせる
ans = 0
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)

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

namespace testing
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            string c = Console.ReadLine();
            if (a[0] == c) { Console.WriteLine((b[0] - 1) + " " + b[1]); }
            if (a[1] == c) { Console.WriteLine( b[0] + " " + (b[1] - 1 )); }
        }
    }
}


Measured memory_bytes: 28040
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;

int n;
pair<int, string> p[20];
vector<int> v[30];

int main() {
  while(cin >> n && n) {
    for(int i = 0; i < 30; ++i) v[i].clear();
    for(int i = 0; i < n; ++i) {
      int m;
      cin >> p[i].second >> m;
      p[i].first = 0;
      for(int j = 0; j < m; ++j) {
	int d;
	cin >> d;
	v[d].push_back(i);
      }
    }

    for(int i = 0; i < 30; ++i) {
      for(int j = 0; j < v[i].size(); ++j) {
	if(v[i].size() == n) p[v[i][j]].first += 1;
	else p[v[i][j]].first += n+1-v[i].size();
      }
    }
    sort(p, p+n);
    cout << p[0].first << " " << p[0].second << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, k;
    cin >> n >> k;
    
    string s;
    cin >> s;
    
    vector<pair<ll, ll>> v;
    
    for(ll i=0; i<n; i++){
        if(s[i] == '0'){
            for(ll j=i; j<=n; j++){
                if(s[j] == '1' || j == n){
                    v.push_back(make_pair(i, j));
                    i = j;
                    break;
                }
            }
        }
    }
    
    if(v.size() <= k){
        cout << n << endl;
        return 0;
    }
    
    ll ans;
    
    ans = v[k].first;
    ans = max(ans, n-v[v.size()-k-1].second);
    
    for(ll i=0; i+k+1 <v.size(); i++)
        ans = max(ans, v[i+k+1].first - v[i].second);
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1528
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n;
vector<double> v;

void solve() {
  cin >> n;
  REP(i, n) {
    double d;
    cin >> d;
    v.push_back(d);
  }
  sort(ALL(v));
  double res = (v[0]+v[1])/2;
  FOR(i, 2, n) {
    res = (res + v[i])/2;
  }
  printf("%.10f\n", res);
}

int main() {
	solve();
	return 0;
}


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

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] a = Input.ScanIntArray();
          
          Console.WriteLine(a[0]<=8 && a[1]<=8 ? "Yay!" : ":(");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public double[] ScanDoubleArray() { return Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  rep(i, n) cin >> a[i];
  sort(a, a + n);
  vector<int> v;
  int count = 1;
  rep(i, n - 1) {
    if (a[i] == a[i + 1]) {
      count++;
      if (i == n - 2) {
        v.emplace_back(count);
      }
      continue;
    } else {
      v.emplace_back(count);
      count = 1;
      if (i == n - 2) {
        v.emplace_back(1);
      }
    }
  }
  sort(v.begin(), v.end());

  if (v.size() <= k) {
    cout << 0 << endl;
  } else {
    int ans = 0;
    rep(i, v.size() - k) ans += v[i];
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,c=0;
  cin>>A>>B;
  
  for(int i=0;i<2;i++){
  if(A>B){
    c+=A;
    A--;
  }
  else{
    c+=B;
    B--;
  }
  }
  
  cout<<c;
  
  return 0;
}

Measured memory_bytes: 256