akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;

int h, w, n, mx, d[405][405];
char b[25][25];

void f(int p, int q) {d[p][q] = d[q][p] = 1;}

int main() {
	int i, j, k;
	cin >> h >> w;
	for(i=0; i<h; i++) cin >> b[i];
	n = h*w;
	for(i=0; i<n; i++) for(j=0; j<n; j++) if(i!=j) d[i][j] = 1e9;
	for(i=0; i<h; i++) for(j=0; j<w; j++) {
		if(b[i][j]=='.' && b[i][j+1]=='.') f(i*w+j, i*w+j+1);
		if(b[i][j]=='.' && b[i+1][j]=='.') f(i*w+j, (i+1)*w+j);
	}
	for(k=0; k<n; k++) for(i=0; i<n; i++) for(j=0; j<n; j++) {
		d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
	}
	for(i=0; i<n; i++) for(j=0; j<n; j++) {
		if(d[i][j] < 1e9) mx = max(mx, d[i][j]);
	}
	cout << mx;
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); if(a && b){ return gcd(b, a % b); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    int A[N], B[N], C[N - 1];
    cins(A, A + N);
    cins(B, B + N);
    cins(C, C + N - 1);
    int ans = 0;
    for(int i = 0; i < N; i++){
        A[i]--;
        ans += B[A[i]];
        if(i != 0 && A[i - 1] + 1 == A[i]){
            ans += C[A[i] - 1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}

using namespace std;


int main(){
   int x,n;
   cin>>x>>n;
   vector<int> a;

   rep(i,n){
      int b;
      cin>>b;
      a.push_back(b);
   }
   sort(a.begin(),a.end());

   int ans=0;
   rep(i,1000){
      bool f=true;
      rep(j,n){
         if(a[j]==i){
            f=false;
            break;
         }
      }
      if(f==true){
         if(abs(x-i)<abs(x-ans)){
            ans=i;
         }
      }
      
   }
   cout<<ans;

   

   
return 0;
}



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

int main(){
    int p = 700;
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++){
        if (s[i] == 'o'){
            p += 100;
        }
    }

    cout << p << endl;
}

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

using namespace std;

int main()
{
    int n;
     cin>>n;
     set<string> s;
     for(int i=0;i<n;i++)
     {
     	string t;
     	 cin>>t;
     	 s.insert(t);
	 }
	 cout<<s.size()<<endl;
	return 0;
	
}


Measured memory_bytes: 19204
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

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

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

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

    int x, y, a, b, c; cin>>x>>y>>a>>b>>c;
    vector<int> p(a), q(b), r(c);
    for(int i=0; i<a; i++) cin>>p[i];
    sort(all(p), greater<int>());
    for(int i=0; i<b; i++) cin>>q[i];
    sort(all(q), greater<int>());
    for(int i=0; i<c; i++) cin>>r[i];
    sort(all(r), greater<int>());

    priority_queue<int, vector<int>, greater<int>> R, G;
    for(int i=0; i<x; i++) R.emplace(p[i]);
    for(int i=0; i<y; i++) G.emplace(q[i]);

    for(int i=0; i<c; i++){
        if(R.top() <= G.top()){
            if(R.top() < r[i]){
                R.pop();
                R.emplace(r[i]);
            }
        }
        else{
            if(G.top() < r[i]){
                G.pop();
                G.emplace(r[i]);
            }
        }
    }

    ll ans = 0;
    while(R.size()){
        ans += R.top(); R.pop();
    }
    while(G.size()){
        ans += G.top(); G.pop();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2552
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdio>
#define REP(i,n) for (int i=0;i<(n);++i)
using namespace std;

string s, t;

int main() {
  cin >> s >> t;

  cout << t + s << endl;
  return 0;
}



Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use std::cmp::min;

#[fastout]
fn main() {
    input! {
    n: usize,
    m: usize,
    x: usize,
    ca:[[usize; m + 1]; n]
    }
    let mut ans = std::usize::MAX;
    for i in 0..1<<n {
        let mut c = 0;
        let mut t = vec![0; m];
        for j in 0..n {
            if i >> j & 1 == 1{
                for k in 0..m {
                    t[k] += ca[j][k + 1];
                }
                c += ca[j][0];
            }
        }
        if m == t.iter().filter(|&&y| y >= x ).count(){
            ans = min(ans, c);
        }
    }
    if ans != std::usize::MAX{
        println!("{}", ans);
    } else {
        println!("{}", -1);

    }
}


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

int N, W, w[105], v[105];
ll d[105][100005];

int main(){
    scanf("%d %d", &N, &W);
    for(int i = 1; i <= N; i++) scanf("%d %d", &w[i], &v[i]);
    for(int i = 1; i <= N; i++) for(int j = 0; j <= W; j++){
        d[i][j] = d[i - 1][j];
        if(w[i] <= j) d[i][j] = max(d[i][j], d[i - 1][j - w[i]] + v[i]);
    }
    printf("%lld", d[N][W]);
    return 0;
}

Measured memory_bytes: 79360
from collections import deque

n,m=map(int,input().split())

node=[[]for _ in range(n)]

for i in range(m):
  x,y=map(int,input().split())
  node[x-1].append(y-1)
  node[y-1].append(x-1)

d=deque()
seen=[-1]*n
d.append(0)

while d:
  vi=d.popleft()
  for i in node[vi]:
    if seen[i]==-1:
      d.append(i)
      seen[i]=vi

if "-1" in seen:
  print("No")
else:
  print("Yes")
  for i in range(1,len(seen)):
    print(seen[i]+1)

Measured memory_bytes: 34156
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#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 <ctime>
#include <cstring>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define VS vector<string>
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back

using namespace std;

int main(){
    int n, k;
    while(cin >> n >> k, n+k){
        vi c;
        for(int i=0; i < n; i++){
            int m;
            cin >> m;
            c.push_back(m);
        }

        int ck=0;
        for(int i=0; i <= c.size()-k; i++){
            int sum = 1;
            for(int j=0; j < k; j++){
                sum *= c[i+j];
            }
            if(ck < sum) ck = sum;
        }
        int ans = 0;
        for(int i=0; i < c.size(); i++){
            for(int j=i+1; j < c.size(); j++){
                swap(c[i], c[j]);
                for(int l=0; l <= c.size()-k; l++){
                    int sum = 1;
                    for(int o=0; o < k; o++){
                        sum *= c[l+o];
                    }
                    ans = max(ans, sum);
                }
		swap(c[i], c[j]);
            }
        }
        if(ck <= ans) cout << ans-ck << endl;
        else cout << "NO GAME" << endl;
    }
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a,b,c=1;
  cin>>a>>b;
  for(int i=0;i<a;i++){
	if(c<b) c*=2;
    else c+=b;
  }
  cout<<c<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <ctype.h>
 
int main(void) {
	char w[11], t[1001];
	int ans = 0;
	int i;
	
	scanf("%s", w);
	
	for (i = 0; w[i] != '\0'; i++) w[i] = tolower(w[i]);
	
	while (scanf("%s", t), strcmp(t, "END_OF_TEXT")){
		for (i = 0; t[i] != '\0'; i++) t[i] = tolower(t[i]);
		
		if (strcmp(t, w) == 0) ans++;
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 552
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    string str;
    cin>>str;
    ll x,y,z,i,j;
    i=(str[0]-'0')*10;
    j=(str[1]-'0');
        x=i+j;
    y=(str[2]-'0')*10+(str[3]-'0');
     if(x<=12 && y<=12 && x != 0 && y != 0)cout<<"AMBIGUOUS"<<endl;
    else if(x<=12 && x >=1 )cout<<"MMYY"<<endl;
    else if(y>=1 && y<=12)cout<<"YYMM"<<endl;

    else cout<<"NA"<<endl;
return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, i, j, k, ans, x, nn, ct;
	cin >> n >> k;
	nn = n * (n + 1) / 2;
	vector<long long> a(n + 1), s(n + 1, 0), v(nn);
	for (i = 1; i <= n; i++) {
		cin >> a[i];
		s[i] = s[i - 1] + a[i];
	}
	ct = 0;
	for (i = 1; i <= n; i++) {
		for (j = i; j <= n; j++) {
			v[ct++] = s[j] - s[i - 1];
		}
	}

	ans = 0;
	for (i = 55; i >= 0; i--) {
		x = 1LL << i;
		ct = 0;
		for (auto p : v) {
			if (((p & ans) == ans) && ((p & x) == x)) ct++;
		}
		if (ct >= k) {
			ans += x;
		}
	}

	cout << ans << "\n";

		
	return 0;
}


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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

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

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

int main()
{
    int a[3][3];
    bool b[3][3];
    REP(i, 3)
    {
        REP(j, 3)
        {
            cin >> a[i][j];
            b[i][j] = false;
        }
    }

    int n;
    cin >> n;
    REP(k, n)
    {
        int c;
        cin >> c;
        REP(i, 3)
        REP(j, 3)
        if (a[i][j] == c) {
            b[i][j] = true;
        }
    }
    if((b[0][0]&&b[0][1]&&b[0][2])||
    (b[1][0]&&b[1][1]&&b[1][2])||
    (b[2][0]&&b[2][1]&&b[2][2])||
    (b[0][0]&&b[1][0]&&b[2][0])||
    (b[0][1]&&b[1][1]&&b[2][1])||
    (b[0][2]&&b[1][2]&&b[2][2])||
    (b[0][0]&&b[1][1]&&b[2][2])||
    (b[0][2]&&b[1][1]&&b[2][0]))
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    
    
}

Measured memory_bytes: 3632
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll power(ll x, ll n){
    if(n == 0) return 1LL;
    ll res = power(x * x % MOD, n/2);
    if(n % 2 == 1) res = res * x % MOD;
    return res;
}

ll dp[410][410] = {};
ll sum[410][410] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,C;
    cin >> N >> C;
    ll A[410], B[410];
    rep(i,0,N) cin >> A[i];
    rep(i,0,N) cin >> B[i];
    dp[0][0] = 1;
    rep(i,0,401){
        rep(j,1,401){
            sum[i][j+1] = sum[i][j] + power(j, i);
            sum[i][j+1] %= MOD;
        }
    }

    rep(i,0,N){
        rep(j,0,C+1){
            rep(k,0,j+1){
                // dp[i+1][j] += dp[i][j-k] * power(A[i], k);
                dp[i+1][j] += dp[i][j-k] * (sum[k][B[i]+1] - sum[k][A[i]] + MOD) % MOD;
                dp[i+1][j] %= MOD;
            }
        }
    }
    print(dp[N][C]);


}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define rep(k,nu)    for(int i=k; i<nu;  i++)
#define rep2(k,n)   for(int j=k; j<n;  j++)
#define INF 1000000000000 //1e+12
#define MOD 10000007 //1e9+7
#define ll long long
#define pb pop_back
template<typename T> inline void chMin(T* a, T* b) {if(*a>*b) *a=*b;}
template<typename T> inline void chMax(T* a, T* b) {if(*a<*b) *a=*b;}
template<typename T> inline int  divUp(T a, T b)   {return ((a+b-1)/b);}
const double PI = acos(-1);

int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(0,n) cin >> a[i];

    sort(a.begin(),a.end());
    rep(0,n){
        if(a[i] == a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}
/*
3 3
1 7
3 2
1 7
*/


Measured memory_bytes: 4676
#include <stdio.h>
#include <math.h>
#define MAX 123456
int main(void) {
    int num,sieve[MAX*2+1]={0},i,j,count;
    for (i=4; i<=2*MAX; i+=2) sieve[i]=1;
    for (i=3; i<=sqrt(MAX*2); i+=2) {
        if (sieve[i]==0) for (j=2*i; j<=2*MAX; j+=i) sieve[j]=1;
    }
    while (1) {
        scanf("%d",&num);
        if (num==0) break;
        count=0;
        for (i=num+1; i<=num*2; i++) {
            if (sieve[i]==0) count++;
        }
        printf("%d\n",count);
    }
    return 0;
}

Measured memory_bytes: 1572
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a[100001],dp[100001],i;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
dp[0]=0;
dp[1]=abs(a[0]-a[1]);
for(i=2;i<n;i++){
    dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
}
cout<<dp[n-1];
return 0;
}


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

int main() {
  string S;
  cin >> S;
  if (S == "SUN")
    cout << 7 << endl;
  if (S == "MON")
    cout << 6 << endl;
  if (S == "TUE")
    cout << 5 << endl;
  if (S == "WED")
    cout << 4 << endl;
  if (S == "THU")
    cout << 3 << endl;
  if (S == "FRI")
    cout << 2 << endl;
  if (S == "SAT")
    cout << 1 << endl;
}

Measured memory_bytes: 256
/*input
2 16
*/

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

#define ll long long int
#define db long double
const int N=3010;
db dp[N][N], arr[N];


int main () {
	int n,m;
	cin>>n>>m;
	if ((n+m) %2!=0)cout<<"IMPOSSIBLE";
	else cout<<(n+m)/2;
	return 0;
}

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

using namespace std;
bool sorta(pair<string, string> &a,pair<string, string> &b){
    return a.second=="dominant"||a.second=="non-existent"||a.second=="recessive";
}
int main() {
    int t;
    cin >> t;
    long long freq[300]={0};
   char charcter[5]={'M','A','R','C','H'};
    while(t--){
        string s;cin>>s;
        if(s[0]=='M'||s[0]=='A'||s[0]=='R'||s[0]=='C'||s[0]=='H'){
            freq[s[0]]++;
        }
    }
    long long answer=0;
    for (int i = 0; i < 5; ++i) {
        for (int j = i+1; j <5 ; ++j) {
            for (int k = j+1; k <5 ; ++k) {
                answer+=(freq[charcter[i]]*freq[charcter[j]]*freq[charcter[k]]);
            }
        }
    }
    cout<<answer;


    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//const ll INF = 1e18;
//const ll MOD = 1e9+7;
//const double pi = 3.14159265358979;
using vl = vector<ll>;
using P = pair<ll, ll>;
# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((ll)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((ll)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()

// Sieve of Eratosthenes
// https://youtu.be/UTVg7wzMWQc?t=2774
struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
  vector<pair<ll,int>> factor(ll x) {
    vector<pair<ll,int>> res;
    for (int p : primes) {
      int y = 0;
      while (x%p == 0) x /= p, ++y;
      if (y != 0) res.emplace_back(p,y);
    }
    if (x != 1) res.emplace_back(x,1);
    return res;
  }
};

const ll M = 1000005;
ll N;
ll Main() {
    ll n;
    cin >> n;
   
    Sieve s(1000005);
    auto fs = s.factor(n);
    
    int ans = 0;
    for (auto p : fs) {
      int x = p.second;
      int b = 1;
      while (b <= x) {
        x -= b;
        b++;
        ans++;
      }
    }
    cout << ans << endl;
    return 0;
}
 
int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

int f(ll a,ll b){
	int ca=0,cb=0;
	while(a>0){ca++;a/=10;}
	while(b>0){cb++;b/=10;}
	return max(ca,cb);
}


//
int main(){
	ll N;cin>>N;

	int ans = INF;
	
	for(ll i=1; i*i <= N; ++i){
		if(N%i == 0)
			ans = min(ans,f(i,(ll)N/i));
	}

	cout << ans << endl;

	return 0;
}




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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;

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

const std::string winners = "ABC";
string S[3];
int is[3];

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    for(int i=0;i<3;++i){
        std::cin >> S[i];        
    }

    int cur = 0;
    while(is[cur] < S[cur].size()){
        int next_cur = S[cur][is[cur]] - 'a';
        ++is[cur];
        cur = next_cur;
    }

    std::cout << winners[cur] << std::endl;
}


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

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

#define INF 1000000000

int MAZE[20][20];
int D[20 * 20][20 * 20];

int main(void)
{

    int H, W;
    cin >> H >> W;
    char c;
    rep(i, H)
    {
        rep(j, W)
        {
            cin >> c;
            if (c == '.')
                MAZE[i][j] = 1;
            else
                MAZE[i][j] = 0;
        }
    }

    rep(i, 20 * 20)
        rep(j, 20 * 20)
            D[i][j] = INF;

    vector<pair<int, int>> DIFFS = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
    rep(i, H)
    {
        rep(j, W)
        {
            if (MAZE[i][j] == 0)
                continue;
            auto node = W * i + j;
            for (auto p : DIFFS)
            {
                auto ni = i + p.first;
                auto nj = j + p.second;
                if (ni < 0 || ni >= H || nj < 0 || nj >= W || MAZE[ni][nj] == 0)
                {
                    continue;
                }
                auto next_node = W * ni + nj;
                D[node][next_node] = 1;
                D[next_node][node] = 1;
            }
        }
    }
    rep(k, H * W)
    {
        rep(i, H * W)
        {
            rep(j, H * W)
            {
                D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
            }
        }
    }

    int ret = 0;
    rep(i, H * W)
    {
        rep(j, H * W)
        {
            if (D[i][j] != INF && i != j && D[i][j] > ret)
            {
                ret = D[i][j];
            }
        }
    }
    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 4240
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define int long long
#define print(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = (1LL << 30);
const ll MOD = 1000000007;

//=============================================================
//=============================================================

/*
 */

int N, K, L, M, A, B, D;
int X[11][10];
void solve()
{
    int ans = 0;
    rep(i, N)
    {
        rep(j, N)
        {
            if (i == j)
                continue;
            int t = 0;
            rep(k, D)
            {
                t += abs(X[i][k] - X[j][k]) * abs(X[i][k] - X[j][k]);
            }

            for(int i=1; i<=t;++i)
            {
                if (i * i == t)
                {
                    //cout<<i<<" " << t <<endl;
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans/2 << endl;
}
signed main()
{
    cin >> N >> D;
    rep(i, N)
    {
        rep(j, D)
        {
            cin >> X[i][j];
        }
    }

    solve();
    return 0;
}

Measured memory_bytes: 256
import sys
H, W = map(int, input().split())

S =[list(input()) for i in range(H)]
dy = [-1, 0, 1, 0]
dx = [0, 1, 0, -1]

for y in range(H):
    for x in range(W):
        if S[y][x] == "#":
            count = 0
            for i in range(4):
                    if not (0 <= y + dy[i] < H) or not(0 <= x + dx[i] < W):
                        continue
                    else:
                        if S[y + dy[i]][x + dx[i]] == ".":
                            count += 1
            if count == 4:
                print("No")
                sys.exit()
#if 0 > y + dy  or y + dy >= H or 0 > x + dx or x +dx >= W:
print("Yes")

Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }

        static void Solve()
        {
            var (H, W, D) = Slice3<long>();
            var Ddsts = Enumerable.Repeat(0, (int)D).Select(_ => new List<(long a, long x, long y)>()).ToArray();

            for (var i = 0; i < H; ++i)
            {
                var Aij = Sarray();
                for (var j = 0; j < W; ++j)
                    Ddsts[(Aij[j] - 1) % D].Add((Aij[j] - 1, i, j));
            }
            var ruis = new long[D][];
            for (var i = 0; i < D; ++i)
            {
                Ddsts[i].Sort();
                var dsts = Ddsts[i];
                var rui = new long[dsts.Count];
                for (var j = 1; j < Ddsts[i].Count; ++j)
                    rui[j] = rui[j - 1] + Abs(dsts[j].x - dsts[j - 1].x) + Abs(dsts[j].y - dsts[j - 1].y);
                ruis[i] = rui;
            }

            var Q = Sarray()[0];
            for (var i = 0; i < Q; ++i)
            {
                var (L, R) = Slice2<long>();
                --L; --R;
                var g = L % D;
                var b = L / D;
                var e = R / D;
                WriteLine(ruis[g][e] - ruis[g][b]);
            }
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 67724
import numpy as np
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
XYH = (tuple(map(int, input().split())) for _ in range(N))
XYH = np.array([input().split() for _ in range(N)], dtype=int)
X, Y, H = XYH.T

z = np.argmax(H)
x, y, h = XYH[z]

for Cx in range(0, 101):
    for Cy in range(0, 101):
        estH = h + abs(Cx - x) + abs(Cy - y)
        tmpH = np.maximum(0, estH - np.abs(X - Cx) - np.abs(Y - Cy))
        if np.all(H == tmpH):
            print(Cx, Cy, estH)
            exit()


Measured memory_bytes: 12432
#include <cstdio>
#include"atcoder/all"

using namespace std;
using namespace atcoder;
typedef long long ll;
int main() {
    int n, q;
    scanf("%d %d", &n, &q);

    fenwick_tree<ll> fw(n);
    for (int i = 0; i < n; i++) {
        int a;
        scanf("%d", &a);
        fw.add(i, a);
    }

    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        if (t == 0) {
            int p, x;
            scanf("%d %d", &p, &x);
            fw.add(p, x);
        } else {
            int l, r;
            scanf("%d %d", &l, &r);
            printf("%lld\n", fw.sum(l, r));
        }
    }
}

Measured memory_bytes: 8216
#include<bits/stdc++.h>
using namespace std;
char Grid[310][310];
int Ans[310][310],P;
int main()
{
	int H,W,K;
	cin>>H>>W>>K;
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			cin>>Grid[i][j];
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			if(Grid[i][j]=='#')
			{
				P++;
				Ans[i][j]=P;
				for(int k=i-1;k>=0&&Ans[k][j]==0&&Grid[k][j]!='#';k--)
					Ans[k][j]=P;
				for(int k=i+1;k<H&&Ans[k][j]==0&&Grid[k][j]!='#';k++)
					Ans[k][j]=P;
			}
	for(int i=0;i<H;i++)
		for(int j=0;j<W;j++)
			if(Ans[i][j]==0)
			{
				int k;
				for(k=j-1;k>=0&&Ans[i][k]==0;k--);
//				cout<<i<<" "<<j<<" "<<k<<endl;
				if(k!=-1)
					Ans[i][j]=Ans[i][k];
				else
				{
					for(k=j+1;k<W&&Ans[i][k]==0;k++);
					Ans[i][j]=Ans[i][k];
				}
			}
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
			cout<<Ans[i][j]<<" ";
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

using ll = long long;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define tc() int t; cin>>t; while(t--)
#define print(n) cout<<n<<"\n"
#define inp(n) int n; cin>>n
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define maxn 1000010
#define mod 1e9+7
#define ff  first
#define ss  second
#define fora(var, start, end) for(int var = start; var < end; var++)
int main()
{
    fast();
    
    string s;
    cin>>s;
    if(s[2]==s[3] and s[4]==s[5])print("Yes");
    else print("No");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int h, w, k;
    char c[6][6];
    cin >> h >> w >> k;
    rep(i, h) rep(j, w) cin >> c[i][j];

    int ans = 0;
    for (int hb = 0; hb < (1 << h); hb++) {
        for (int wb = 0; wb < (1 << w); wb++) {
            int cnt = 0;
            rep(i, h) rep(j, w) {
                if (!(hb & (1<<i))) {
                    if (!(wb & (1 << j))) {
                        if (c[i][j] == '#') cnt++;
                    }
                }
            }
            if (cnt == k) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
import sys

input = sys.stdin.readline

N = int(input())
F = [int(input().replace(' ', ''), 2) for _ in range(N)]
P = [[int(x) for x in input().split()] for _ in range(N)]

ans = float('-inf')
for i in range(1, 2**10):
    res = 0
    for f, p in zip(F, P):
        cnt = bin(i & f).count('1')
        res += p[cnt]
    ans = max(ans, res)
print(ans)

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

//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 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)
//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();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------


LL ori;
LL sn;
LL N;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> ori;

    N = ori;

    while( N){

        sn += N % 10;
        N /= 10;
    }


    LL a = ori % sn;

    //dump(a);

    if(a){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }



    return 0;
}


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

int main() {
  int A,B;
  cin >> A >> B;
  int C;
  if(B < 10) {
    C = A * 10 + B;
  }
  else if(B < 100) {
    C = A * 100 + B;
  }
  else if(B == 100){
    C = A * 1000 + B;
  }
  bool D = false;
  for(int i = 1;i < 330;i++) {
    if(i * i == C) {
      D = true;
    }
  }
  if(D == true) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    alpahbet = [chr(ord("a") + i) for i in range(26)]

    ans = []
    while N:
        N -= 1
        ans.append(alpahbet[N % 26])
        N //= 26

    print(*ans[::-1], sep="")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9460
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==
*/

f(Z, N) :- X is 800 * N, Y is (N div 15) * 200, Z is X - Y.

main :-
    get_number(N),
    f(Z, N),
    writeln(Z).


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

int main(void)
{
    IOS
    int n; cin >> n;
    deque<string> v;
    bool b = n % 2 == 0 ? true : false;

    REP(i,n) {
        string x; cin >> x;
        if (b) v.push_back(x);
        else v.push_front(x);
        b = !b;
    }

    string ans = "";
    REP(i,n) {
        ans += v[i] + " ";
    }
    ans.pop_back();

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 15236
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin>>n;

    int p[1001][1001];
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>p[i][j];
        }

        sort(p[i],p[i]+3);
    }

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

        for(int j=i+1;j<n;j++){
            if(p[i][0]==p[j][0]&&p[i][1]==p[j][1]&&p[i][2]==p[j][2]){
                ans++;
                sum++;
            }
        }

        if(sum>=2){
            ans-=sum-1;
        }
    }

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


Measured memory_bytes: 7136
#include<bits/stdc++.h>
using namespace std;
#define int               long long
#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define loop(i,a,b)        for(int i=a;i<b;i++)
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
#define br                break
#define con               continue

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.fr>>a.sc;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.fr<<" "<<a.sc;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
 
const long long INF=1e18;
const int32_t M=1e9+7;
const int32_t MM=998244353;

priority_queue<pii, vector<pii>, greater<pii> >q;
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output1.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
    float d,t,s;
    cin>>d>>t>>s;
    if(d/s<=t)
        cout<<"Yes"<<endl;
    else 
        cout<<"No"<<endl;
 
}


Measured memory_bytes: 3712
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[][] AB = new int[N][2];
        for (int i = 0; i < N; i++) {
            AB[i][0] = sc.nextInt();
            AB[i][1] = sc.nextInt();
        }

        Arrays.sort(AB, new Comparator<int[]>() {
            public int compare(int[] a, int[] b) {
                return Integer.compare(a[0], b[0]);
            }
        });

        int[][] ot = new int[N+1][T];
        int[][] ft = new int[N+1][T];

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < T; j++) {
                int finishTime = ft[i][j];
                if (j >= AB[i][0]) {
                    finishTime = Math.max(finishTime, ft[i][j-AB[i][0]] + AB[i][1]);
                }
                ft[i+1][j] = finishTime;

                ot[i+1][j] = Math.max(ot[i][j], ft[i][j] + AB[i][1]);
            }
        }
        System.out.println(ot[N][T-1]);
    }
}


Measured memory_bytes: 121176
#include <iostream>
#include <map>
#include <random>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cstring>
#include <cstdio>
int main(void) {
	int n;
	int even = 0, odd = 0;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		uint64_t x;
		std::cin >> x;
		if (x % 2 == 0)even++;
		else odd++;
	}
	even += odd / 2;
	odd = odd % 2;
	if (even >= 2)even = 1;
	if (odd + even == 1) {
		std::cout << "YES" << std::endl;
	}
	else {
		std::cout << "NO" << std::endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

string s;

long long total, n;

void solve(long long step, long long ss) {
	total += stoll(s.substr(step)) + ss;

	long long i;
	for (i = step; i < n - 1; i++) {
		solve(i + 1, ss + stoll(s.substr(step, i - step + 1)));
	}
}

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

	cin >> s;
	n = s.length();
	total = 0;
	solve(0, 0);

	cout << total << "\n";

	return 0;
}



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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    vector<int> num_balls(N+1);
    REP(i, N) ++num_balls[A[i]];

    long long ans = 0;
    REP(i, N+1) ans += (long long) num_balls[i]*(num_balls[i]-1)/2;
    REP(k, N) cout << ans - (num_balls[A[k]]-1) << endl; 

    return 0;
}

Measured memory_bytes: 4096
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll Q;
    cin >> Q;
    
    priority_queue<ll> left_pq;
    priority_queue<ll, vector<ll>, greater<>> right_pq;
    left_pq.push(LLONG_MIN);
    right_pq.push(LLONG_MAX);

    ll sum_b = 0;
    ll min_v = 0;

    for (ll i = 0; i < Q; i++) {
        ll op;
        cin >> op;
        if (op == 1) {
            ll a, b;
            cin >> a >> b;
            sum_b += b;

            if (left_pq.size() == right_pq.size()) {
                if (a < left_pq.top()) {
                    min_v += left_pq.top() - a;
                }
                if (a > right_pq.top()) {
                    min_v += a - right_pq.top();
                }
            } else {
                min_v += abs(left_pq.top() - a);
            }

            if (a >= right_pq.top()) {
                right_pq.push(a);
            } else {
                left_pq.push(a);
            }

            if (right_pq.size() > left_pq.size()) {
                left_pq.push(right_pq.top());
                right_pq.pop();
            } else if (left_pq.size() > right_pq.size() + 1) {
                right_pq.push(left_pq.top());
                left_pq.pop();
            }
        } else {
            cout << left_pq.top() << " " << min_v + sum_b << endl;
        }
    }
}

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

int main(){
	int n;
	cin>>n;
	vector<int> s(n);
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>s[i];
		sum+=s[i];
	}
	sort(s.begin(),s.end());
	
	if(sum%10==0){
		for(int i=0;i<n;i++){
			if(s[i]%10!=0){
				sum-=s[i];
				break;
			}
		}
	}
	
	if(sum%10==0)sum=0;
	
	cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;

immutable limitList = 100000;



void main() {
    int input;
    bool[] listNumbers = new bool[](limitList);
    int[] listPrimeNumbers; //List of prime numbers.

    listNumbers.fill(true);
    listNumbers[0..2] = false;
    foreach (i; 2..limitList.to!double.sqrt.to!int) {
        if (listNumbers[i]) {
            for (int j = i*2; j < limitList; j += i) listNumbers[j] = false;
        }
    }

    while ((input = readln.chomp.to!int) != 0) {
        uint count = 0;

        foreach (i; 0..(input/2)+1) {
            if(listNumbers[i] && listNumbers[input-i]) count++;
        }

        writeln(count);
    }
}

Measured memory_bytes: 1248
#include <iostream>
#include <map>
using namespace std;
int n, m, a[200];
int x, y, p;
map<int, int>dic;
int main()
{
	cin >> n >> m;
	for (int i = 0; i < m; i++)	{
		cin >> x >> y;
		for (int j = 0; j < y; j++)	{
			p = (x + j) % n;
			a[p] = a[p + n] = 1;
		}
	}
	x = 1;
	for (int i = 0; i < n; i++)	{
		if (a[i])
			continue;
		x = 0;
		break;
	}
	if (x)	{
		cout << n << ' ' << 1 << endl;
		return 0;
	}

	int f = a[0];
	for (int i = 0; i <= n;){

		if (a[i]){
			if (f){
				i++; continue;
			}
			for (int j = i; j < 2 * n; j++)	{
				if (a[j])continue;
				else {
					dic[j - i]++;
					i = j; break;
				}
			}
		}
		else f = 0;
		i++;
	}
	for (auto it = dic.rbegin(); it != dic.rend(); ++it){
		auto p = *it;
		cout << p.first << ' ' << p.second << endl;
	}

	return 0;
}


Measured memory_bytes: 1200
#include<bits/stdc++.h>
using namespace std;
int n,a[200010],l=0,r=2e9,mid,b[200010],ans;

void get_b(){
	for(int i=1;i<=2*n-1;i++){
		if(a[i]>mid) b[i]=1;
		else b[i]=0;
	}
}

int work(){
	if(b[n]==b[n-1]||b[n]==b[n+1]) return b[n];
	int g=n-1,f=n+1;
	while(g){
		if(b[g]==b[g-1]) break;
		g--;
	}
	while(f<=2*n-1){
		if(b[f]==b[f+1]) break;
		f++;
	}
	if(g==0&&f==2*n){
		if(n&1) return b[n];
		else return b[n]^1;
	}
	if(f-n<n-g)	return b[f];
	else return b[g];
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;i++) scanf("%d",&a[i]);
	b[0]=-1;
	while(l<=r){
		mid=(l+r)/2;
		get_b();
		if(work()==0) ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N;
	cin >> N;
	vector<double>p(N);
	rep(i, N)cin >> p[i];
	vector<vector<double>>dp(N + 1, vector<double>(N + 1));
	//dp[i][j] : i枚のコインを投げた時、表がj枚となる確率
	dp[0][0] = 1;
	for (int i = 1; i <= N ; ++i) {
		for (int j = 0; j <= i; ++j) {
			if (j > 0)dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]) + dp[i - 1][j - 1] * p[i - 1];
			else dp[i][j] = dp[i - 1][j] * (1 - p[i - 1]);
		}
	}
	double ans = 0;
	for (int i = N / 2 + 1; i <= N ; i++)ans += dp[N][i];
	printf("%.10f", ans);
}

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

int main() {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int s = abs(x1 - x2), t = abs(y1 - y2);
  int x3, y3, x4, y4;
  
  if (x1 <= x2 && y1 <= y2) {
    x3 = x2 - t; y3 = y2 + s;
    x4 = x3 - s; y4 = y3 - t;
  } else if (x1 >= x2 && y1 <= y2){
    x3 = x2 - t; y3 = y2 - s;
    x4 = x3 + s; y4 = y3 - t;
  } else if (x1 >= x2 && y1 >= y2) {
    x3 = x2 + t; y3 = y2 - s;
    x4 = x3 + s; y4 = y3 + t;
  } else if (x1 <= x2 && y1 >= y2){
    x3 = x2 + t; y3 = y2 + s;
    x4 = x3 - s; y4 = y3 + t;
  }

  cout << x3 << " " << y3 << " ";
  cout << x4 << " " << y4 << endl;
}

Measured memory_bytes: 256