akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int[] d = in.nextIntArray(n);

        long ans = 0;
        for (int i=0; i < n-1; i++) {
            for (int j=i+1; j < n; j++) {
                ans += d[i] * d[j];
            }
        }
        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 23252
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x)     x.begin(),x.end()
#define tc   int tt; scf(tt); while(tt--)
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll M =1e9+7;
const int N = 1e5+7;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

// vector<int> adj[N];
// bool vis[N]={0};

// void dfs(int x)
// {
//     vis[x]=1;
        
//     for(auto it:adj[x])   
//     if(!vis[it])
//     dfs(it);
        
// }




int main()
{
    ll n,ans=0;
    lscf(n);

    int a[n];

    rep(i,0,n)
    scf(a[i]);

    rep(i,0,n)
    {
        if(a[i]%2==0)
        {while(a[i]%2==0)
        a[i]/=2,ans++;}
    }



    lprin(ans);
    
    }

    
 

    


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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
    int a; cin >> a;
    if(a%1000 != 0)
        cout << 1000-a%1000 << "\n";
    else
        cout << 0 << "\n";
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<ll>>;
struct edge{ll to ; ll cost ;} ;
using graph =vector<vector<edge>> ;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 

 int main(){
  ll x, y; cin>> x>> y ;
  if(abs(x-y)<=1) cout<<"Brown"<<endl ;
  else cout<<"Alice"<<endl ;
   return 0 ;
 }



Measured memory_bytes: 3624
#include <iostream>
#include <string>
int main() {
	std::string S;
	std::cin >> S;
	std::cout << S[0] << S[1] << S[2] << S[3]  << " "<< S[4] << S[5] << S[6] << S[7] << S[8] << S[9] << S[10] << S[11]<< std::endl;
}

Measured memory_bytes: 256
/*
 
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
 
using namespace std;
 
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, long long> pil;
typedef pair <int, string> pis;
typedef pair <int, char> pic;
typedef pair <long long, int> pli;
typedef pair <long long, string> pls;
typedef pair <long long, char> plc;
typedef pair <string, int> psi;
typedef pair <string, long long> psl;
typedef pair <string, char> psc;
typedef pair <char, int> pci;
typedef pair <char, long long> pcl;
typedef pair <char, string> pcs;
 
int n, m;
 
int main () {
	cin >> n >> m;
	cout << 6 - (n + m);
	return 0;
}

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

int main(){
    int n, k; cin >> n >> k;
    string s; cin >> s;
    vector<int> memo(n,0);
    // 左端は0個の'1'とする
    // 右端も0個の'1'とする
    int bcnt = 0;
    int wcnt = 0;
    int pre_is_b = 1;
    int now_index = 0;
    // memo構築
    rep(i,n){
        if(s[i] == '0'){
            if(pre_is_b){ //前の数が1
                memo[now_index] = bcnt;
                ++now_index;
                bcnt = 0;
                pre_is_b = 0;
            }
            ++wcnt;
        }else{
            if(!pre_is_b){ // 前の数が0
                memo[now_index] = wcnt;
                ++now_index;
                wcnt = 0;
                pre_is_b = 1;
            }
            ++bcnt;
        }
    }
    // 右端操作
    if(pre_is_b){
        memo[now_index] = bcnt;
    }else{
        memo[now_index] = wcnt;
        ++now_index;
        memo[now_index] = 0;
    }
    ++now_index;

    vector<int> a_sum(now_index+1);
    a_sum[0] = 0;
    rep(i,now_index) a_sum[i+1] = a_sum[i] + memo[i];
    if(2*k >= now_index){
        cout << a_sum[now_index]-a_sum[0] << endl;
        return 0;
    }
    int ans = 0;
    for(int i = 0; 2*k+i < now_index; i+=2) ans = max(ans, a_sum[2*k+i+1]-a_sum[i]);
    cout << ans << endl;
}


Measured memory_bytes: 1280
#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll a, b, x;
    cin >> a >> b >> x;
    if (a % x != 0)
        a = a - (a % x) + x;
    if (b % x != 0)
        b = b - (b % x);
    if (a <= b)
        cout << (b - a) / x + 1;
    else
        cout << "0";
    return 0;
}


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

int a[100]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
void solve(long long K)
{
    cout<<a[K]<<endl;
}

int main()
{
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
int a,b;

int main(){
	io;
	cin>>a>>b;
	for(int i=1;i<=1250;i++){
		if(i/10==b&&(i*8)/100==a){ cout<<i<<endl;return 0; }
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
struct node{
    int c,s,f;
};
int main(int argc, const char * argv[]) {
    
    
    int n;
    struct node train[501];
    scanf("%d",&n);
    
    for(int i=0;i<n-1;i++){
        scanf("%d %d %d",&train[i].c,&train[i].s,&train[i].f);
    }
    
    for(int i=0;i<n-1;i++){
        int arrive = train[i].s + train[i].c;
        for(int j=i+1;j<n-1;j++){
            if(arrive <= train[j].s) arrive = train[j].s +train[j].c;
            else if( ( (arrive-train[j].s) % train[j].f) == 0) arrive += train[j].c;
            else arrive = (arrive/train[j].f + 1) * train[j].f + train[j].c;
        }
        printf("%d\n",arrive);
    }
    printf("0\n");
    return 0;
}

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

#define mfor(i,a,b) for(int i=(a);i<=(b);i++)

set<int> D;

bool dislikes(int N) {
    while (N) {
        if (D.count(N % 10))
            return true;
        N /= 10;
    }
    return false;
}

void solve() {
    int N, K; cin >> N >> K;

    mfor(i, 1, K) {
        int d; cin >> d;
        D.insert(d);
    }

    while (dislikes(N))
        N++;

    cout << N << '\n';
}

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

    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
const int Inf = 1e9 + 5;
 
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<int> freq(4);
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s == "AC") {
            freq[0]++;
        } else if (s == "WA") {
            freq[1]++;
        } else if (s == "TLE") {
            freq[2]++;
        } else {
            freq[3]++;
        }
    }
    for (int i = 0; i < 4; i++) {
        if (i == 0) {
            cout << "AC x " << freq[0] << endl;  
        } else if (i == 1) {
            cout << "WA x " << freq[1] << endl;  
        } else if (i == 2) {
            cout << "TLE x " << freq[2] << endl;  
        } else {
            cout << "RE x " << freq[3] << endl;  
        }
    }
    return 0;
}

Measured memory_bytes: 3620
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
s.sort()
m = sum(s)
if m % 10 != 0:
    print(m)
else:
    for i in range(n):
        if (m-s[i]) % 10 != 0:
            print(m-s[i])
            break
    else:
        print(0)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <stack>

using namespace std;

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s).begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

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

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#ifdef _DEBUG
#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#else
#define DEBUG(x)
#endif

#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 

#define INF 1001001001
#define LLINF 1001001001001001001LL

typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

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

/*
AOJ 1347: Problem C: Shopping
https://onlinejudge.u-aizu.ac.jp/problems/1347

所要時間
    考察 10分くらい
    コーディング 10分くらい
    座席 左中央

学んだこと
    貪欲だと知って解くとすぐに解けた。
    バグりそうなところは手で解くことであらかじめ把握できたので，一発で通った。

参考資料
なし

指針
    [a, b)の間を一度戻ると，最初から最後まで突っ走るのと比べて余計に2(b-a)だけ歩かなければならない
    →戻る距離を最小化したい
    →戻らなければならない範囲が重なっていたら，和集合をとって戻るのが得
    戻らなければならない範囲だけ進むのに3距離単位だけかかると考えると実装が楽
*/


int dp[112][11234]; // 戻らなければならない範囲ならtrue

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
    int N, W;
    cin>>N>>W;
    rep(i, N+5) dp[i][0]=0;
    rep(i,W+5) dp[0][i]=0;
    FOR(i, 1, N+1) {
                    int v, w;
            cin>>v>>w;
        FOR(c, 1, W+1) {

            dp[i][c] = max(dp[i-1][c], max(dp[i][c-1], c-w>=0?dp[i][c-w]+v:0));
        }
    }
    cout<<dp[N][W]<<endl;
	return 0;
}


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

int divide_prime(int n)
{
    int ans = 1;

    vector<int> x(n + 1);
    int num = n;

    for (int i = 2; i <= n; i++)
    {
        while (num % i == 0)
        {
            x.at(i)++;
            num /= i;
        }
    }

    for (int i = 2; i <= n; i++)
    {
        ans *= x.at(i) + 1;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    if (n < 105)
    {
        cout << 0 << endl;
        return 0;
    }
    else
    {
        for (int i = 105; i <= n; i++)
        {
            if (i%2==1&&divide_prime(i) == 8)
            {
                ans++;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const AB = arg.slice(1, N + 1).map(n=>n.split(" ").map(l=>parseInt(l)));
    
    AB.sort((a,b)=>a[1] - b[1]);
    
    let now = 0;
    
    for(let i in AB) {
        const A = AB[i][0];
        const B = AB[i][1];
        
        if(now + A > B) {
            console.log("No");
            return;
        }
        
        now += A;
    }
    
    console.log("Yes");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 74508
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

ll a, b, n;

ll f(ll x)
{
    return (a * x) / b - a * (x / b);
}
int main()
{
    cin >> a >> b >> n;
    cout << f(min(n, b - 1));
    // ll lo = 0, hi = b, mx = 0;
    // while (lo < hi)
    // {
    //     ll mid = (lo + hi) / 2;
    //     if (f(mid) > mx)
    //         lo = mid;
    // }
}


Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(){
  long n;
  long a[5];
  cin >> n;
  cin >> a[0];
  cin >> a[1];
  cin >> a[2];
  cin >> a[3];
  cin >> a[4];

  long min=a[0];
  for(int i=0;i<5;i++){
    if(min>a[i]){
      min=a[i];
    }
  }
  if(n%min!=0){
    cout << n/min + 5 << "\n";
  }
  else{
    cout << n/min +4 << "\n";
  }
  
  return 0;
}
  


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

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
char board[4][4];
int main(){
	string str;
	while(cin>>str){
		bool flag=false;
		if(str=="0")break;
		board[0][0]=str[0];
		board[0][1]=str[1];
		board[0][2]=str[2];
		for(int i =1;i <3;i++){
			for(int j =0;j <3;j++){
				cin>>board[i][j];
			}
		}
		for(int i =0;i <3;i++){
			if((board[i][0]=='b'||board[i][0]=='w')&&
			   !flag&&board[i][0]==board[i][1]&&board[i][1]==board[i][2]){
				cout <<board[i][0]<<endl;
				flag =true;
				break;
			}
		}
		if(flag)continue;
		for(int j =0;j <3;j++){
			if((board[0][j]=='b'||board[0][j]=='w')&&
			   !flag&&board[0][j]==board[1][j]&&board[1][j]==board[2][j]){
				cout <<board[0][j]<<endl;
				flag =true;
				break;
			}
		}
		if(flag)continue;
		if((board[0][0]=='b'||board[0][0]=='w')
		   &&board[0][0]==board[1][1]&&board[1][1]==board[2][2]){
			cout <<board[0][0]<<endl;
			flag=true;
		}
		if(flag)continue;
		if((board[0][2]=='b'||board[0][2]=='w')
		   &&board[0][2]==board[1][1]&&board[0][2]==board[2][0]){
			cout <<board[0][2]<<endl;
			flag =true;
		}
		if(flag)continue;
		if(!flag)cout <<"NA"<<endl;
	}
	return 0;
}

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


long long f(long long a,long long x){
    if(a==-1){
        return 0;
    }
    return a/x+1;
}
int main(void){
    // Your code here!
    long long a,b,x;
    cin>>a>>b>>x;
    
    cout<<f(b,x)-f(a-1,x)<<endl;
    return 0;
}
    

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    string s;
    map<char,string> ma1;
    ma1[' '] = "101";
    ma1['\''] = "000000";
    ma1[','] = "000011";
    ma1['-'] = "10010001";
    ma1['.'] = "010001";
    ma1['?'] = "000001";
    ma1['A'] = "100101";
    ma1['B'] = "10011010";
    ma1['C'] = "0101";
    ma1['D'] = "0001";
    ma1['E'] = "110";
    ma1['F'] = "01001";
    ma1['G'] = "10011011";
    ma1['H'] = "010000";
    ma1['I'] = "0111";
    ma1['J'] = "10011000";
    ma1['K'] = "0110";
    ma1['L'] = "00100";

    ma1['M'] = "10011001";
    ma1['N'] = "10011110";
    ma1['O'] = "00101";
    ma1['P'] = "111";
    ma1['Q'] = "10011111";
    ma1['R'] = "1000";
    ma1['S'] = "00110";
    ma1['T'] = "00111";
    ma1['U'] = "10011100";
    ma1['V'] = "10011101";
    ma1['W'] = "000010";
    ma1['X'] = "10010010";
    ma1['Y'] = "10010011";
    ma1['Z'] = "10010000";
    map<string,string>ma2;
    ma2["00000"] = "A";
    ma2["00001"] = "B";
    ma2["00010"] = "C";
    ma2["00011"] = "D";
    ma2["00100"] = "E";
    ma2["00101"] = "F";
    ma2["00110"] = "G";
    ma2["00111"] = "H";
    ma2["01000"] = "I";
    ma2["01001"] = "J";
    ma2["01010"] = "K";
    ma2["01011"] = "L";
    ma2["01100"] = "M";
    ma2["01101"] = "N";
    ma2["01110"] = "O";
    ma2["01111"] = "P";
    ma2["10000"] = "Q";
    ma2["10001"] = "R";
    ma2["10010"] = "S";
    ma2["10011"] = "T";
    ma2["10100"] = "U";
    ma2["10101"] = "V";
    ma2["10110"] = "W";
    ma2["10111"] = "X";
    ma2["11000"] = "Y";
    ma2["11001"] = "Z";
    ma2["11010"] = " ";
    ma2["11011"] = ".";
    ma2["11100"] = ",";
    ma2["11101"] = "-";
    ma2["11110"] = "'";
    ma2["11111"] = "?";
    while(getline(cin,s)){
        int n = s.size();
        string t = "";
        rep(i,n)t += ma1[s[i]];
        while(t.size() % 5)t += "0";
        rep(i,t.size()/5){
            cout << ma2[t.substr(i*5,5)];
        }
        cout << endl;
    }
}



Measured memory_bytes: 3008
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
typedef long long Int;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int R, C, M, pc[64][64], on[64][64], off[64][64], px[64][64], py[64][64];
char f[64][64];
vector<int> zt[64][64];

void rec(int cx, int cy) {
    rep(d, 4) {
        const int x=cx+dx[d], y=cy+dy[d];
        if(f[x][y]!='#' && px[x][y]==-1) {
            px[x][y] = cx;
            py[x][y] = cy;
            rec(x, y);
        }
    }
}

int main() {
    memset(f, '#', sizeof(f));
    scanf("%d%d%d", &R, &C, &M);
    rep(i, R) rep(j, C) scanf(" %c", &f[i+1][j+1]);
    rep(i, R) rep(j, C) scanf("%d", &pc[i+1][j+1]);
    rep(i, R) rep(j, C) scanf("%d", &on[i+1][j+1]);
    rep(i, R) rep(j, C) scanf("%d", &off[i+1][j+1]);
    int cx=-1, cy=-1, t=0;
    rep(i, M) {
        int x, y;
        scanf("%d%d", &x, &y);
        x++, y++;
        if(i>0) {
            memset(px, -1, sizeof(px));
            rec(x, y);
            while(cx!=x || cy!=y) {
                zt[cx][cy].push_back(t++);
                int tx=cx, ty=cy;
                cx = px[tx][ty], cy = py[tx][ty];
            }
        }
        cx = x; cy = y;
    }
    zt[cx][cy].push_back(t);
    Int ans = 0;
    rep(i, R+2) rep(j, C+2) if(zt[i][j].size()) {
        ans += on[i][j];
        ans += off[i][j];
        rep(k, zt[i][j].size()-1) {
            int dt = zt[i][j][k+1]-zt[i][j][k];
            ans += min((Int)on[i][j]+off[i][j], (Int)dt*pc[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int mod = 1e9 + 7;
const int M = 100000;

typedef long long ll;

int n;
int cnt[2][100100];
int pre[2][100100], suf[2][100100];
int tot[2];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  cin >> n;
  for(int i = 0; i < n; ++i) {
    int x; cin >> x;
    cnt[i % 2][x]++;
    tot[i % 2]++;
  }

  for(int i = 0; i < 2; ++i) {
    for(int j = 1; j <= M; ++j) {
      pre[i][j] = max(pre[i][j-1], cnt[i][j]);
    }
    for(int j = M; j >= 1; --j) {
      suf[i][j] = max(suf[i][j+1], cnt[i][j]);
    }
  }
  
  int ans = mod;
  for(int i = 0; i < 2; ++i) {
    for(int j = 1; j <= M; ++j) {
      int maxInOther = max(suf[i ^ 1][j + 1], pre[i ^ 1][j - 1]);
      ans = min(ans, tot[i] - cnt[i][j] + tot[i ^ 1] - maxInOther);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define PB push_back
#define MP make_pair
typedef pair<int, int> pii;

#ifdef LOCAL
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define INF 1000000000
#define N 212345
int n, q, m;
vector<pair<int, int>> e;
vector<pair<int, int>> g[N];
int d[N];
int c[N];
queue<int> que;
bool f[N];
bool h[N];

int main(){
	scanf("%d%d%d", &n, &m, &q);
	REP(i, m){
		int a, b;
		scanf("%d%d", &a, &b); a--; b--;
		g[a].PB(MP(b, i));
		g[b].PB(MP(a, i));
		e.PB(MP(a, b));
	}
	fill(c, c+N, 0);
	fill(d, d+N, -1);
	fill(f, f+N, false);
	fill(h, h+N, true);
	que.push(0);
	d[0]=0;
	while(que.size()){
		int i=que.front(); que.pop();
		for(pii &p:g[i]){
			int j=p.first;
			if(~d[j]){
			}else{
				d[j]=d[i]+1;
				que.push(j);
			}
		}
	}
	REP(i, m){
		int x=e[i].first,
				y=e[i].second;
		if(d[x]==d[y]) continue;
		if(d[x]>d[y]) swap(x, y);
		c[y]++;
	}
	REP(i, n){
		DEBUG("%d c=%d d=%d\n", i+1, c[i], d[i]);
	}
	int ans=0;
	int z=0;
	DEBUG("\n");
	REP(cnt___, q){
		int a; scanf("%d", &a); a--;
		int x=e[a].first,
				y=e[a].second;
		if(d[x]==d[y]) goto prt;
		if(d[x]>d[y]) swap(x, y);
		if(!h[a]) goto prt;
		h[a]=false;
		DEBUG(" %d(%d)->%d(%d)\n", x+1, d[x], y+1, d[y]);
		que.push(y);
		while(que.size()){
			int i=que.front(); que.pop();
			DEBUG("   %d minus\n", i+1);
			c[i]--;
			if(c[i]<0){
				DEBUG("  c[%d]=%d\n", i+1, c[i]);
			 	while(1) z++;
			}
			if(c[i]) continue;
			ans++;
			for(pii &p:g[i]){
				int j=p.first, k=p.second;
				if(d[j]<=d[i]) continue;
				if(!h[k]) continue;
				DEBUG(" %d->%d\n", i+1, j+1);
				que.push(j);
				h[k]=false;
			}
		}
prt:
		if(ans>=n){
			DEBUG("  ans=%d\n", ans);
			while(1) z++;
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 17912
S=input()
T=input()

D1={}
D2={}

ans=1
for s,t in zip(S,T):
    x=D1.get(t, '')
    if x=='':
        D1[t]=s
    else:
        if x!=s:
            ans=0
            break
            
    x=D2.get(s, '')
    if x=='':
        D2[s]=t
    else:
        if x!=t:
            ans=0
            break

print('Yes' if ans else 'No')

Measured memory_bytes: 9380
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	int n;
	cin >> n;
	vector<ll> l(n);
	rep(i, n) {
		cin >> l[i];
	}
	vector<ll> dp(n + 10, INF);
	dp[0] = 0;
	rep(i, n) {
		ll h1 = l[i];
		if (i + 1 < l.size()) chmin(dp[i + 1], dp[i] + abs(h1 - l[i + 1]));
		if (i + 2 < l.size()) chmin(dp[i + 2], dp[i] + abs(h1 - l[i + 2]));
	}
	cout << dp[n - 1] << endl;
	//cout << fixed << setprecision(10) << ans << endl;
	system("pause");
}

Measured memory_bytes: 4756
import math

a,b = map(int,input().split())

val1 = math.floor(a / 0.08)
val2 = math.floor(b / 0.1)
ans = []

for i in range(0, 1250):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        ans.append(i)
if ans:
    print(min(ans))
else:
    print(-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,string> P;

int main() {
    int n;
    string x;
    string music[51];
    int time[51];
    cin >> n;
    rep(i,n){
        cin >> music[i] >> time[i];
    }
    cin >> x;
    int a;
    rep(i,n){
        if (music[i] == x){
            a = i;
            break;
        }
    }
    int ans = 0;
    rep(i,a+1,n) ans += time[i];
    PRINT(ans);
}


Measured memory_bytes: 256
class Queue():
  def __init__(self):
      self.items = []

  def isEmpty(self):
      return self.items == []

  def enqueue(self, item):
      self.items.insert(0,item)

  def dequeue(self):
      return self.items.pop()

  def size(self):
      return len(self.items)
    
rs = Queue()

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

for i in range(n):
  inp = input().split()
  name = inp[0]
  time = int(inp[1])
  rs.enqueue([name, time])

all_time = 0

while rs.size() != 0: 
  task = rs.dequeue()
  temp = min(q, task[1])
  task[1] -= temp
  all_time += temp
  if task[1] == 0:
    print(task[0],all_time)
  else:
    rs.enqueue(task)


Measured memory_bytes: 13012
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

int main() {
  long long x; cin >> x;
  long long a = 100;
  for(int i=1; ; i++) {
    long long b = a / 100;
    if (a + b >= x) {
      cout << i << endl;
      return 0;
    }
    a += b;
  }

  return 0;
}

// EOF


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

using namespace std;

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

const double PI = acos(-1);



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int h, w, n;
    cin >> h >> w >> n;
    int ans = 0;
    int mul = max(h, w);
    while (ans * mul < n) {
        ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
N, H = map(int, input().split())
damages = []
for _ in range(N):
  slash, throw = map(int, input().split())
  damages.append((0, slash))
  damages.append((1, throw))
damages.sort(key=lambda x: -x[1])
cnt = 0
damage = 0
idx = 0
while True:
  if damage >= H:
    print(cnt)
    break
  else:
    if damages[idx][0] == 1:
      damage += damages[idx][1]
    else:
      rest = H-damage
      if rest%damages[idx][1] == 0:
        cnt += rest//damages[idx][1]
      else:
        cnt += rest//damages[idx][1]+1
      print(cnt)
      break
    cnt += 1
    idx += 1
  

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

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(Console.ReadLine());
        for (int n = 1; n <= N; n++)
        {
            int count = 0;
            for (int x = 1; x <= n; x++)
            {
                if ((x * x) > n)
                {
                    break;
                }
                for (int y = 1; y <= n; y++)
                {
                    if ((x * x) + (y * y) + (x * y) > n)
                    {
                        break;
                    }
                    for (int z = 1; z <= n; z++)
                    {
                        if ((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x) > n)
                        {
                            break;
                        }
                        if ((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x) == n)
                        {
                            count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


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

int main() {
  string s;cin>>s;
if(s[0]==s[1] &&s[1]==s[2])cout <<"No";
  else cout <<"Yes";
}


Measured memory_bytes: 3592
#include <cstdio>

using namespace std;

const int Max_N(15);
typedef long long int LL;
const int MOD(1000000000 + 7);

inline void update(int &a, const int &b)
{
	((a += b) >= MOD) ? (a -= MOD) : 0;
}

inline int Mult(const int &a, const int &b)
{
	return (a * 1LL) * b % MOD;
}

int N, M, F[1 << Max_N], power[Max_N * Max_N], In[Max_N][1 << Max_N];
bool G[Max_N][Max_N];

//注意到，如果我们把所有点按照其SG值分层，那么一定会分成0 ~ max{SG(u)}这么多层
//每个点一定会向前面的每一层中的点都至少连一条边，同时每个点不会向同一层中的点连边 
//考虑状压dp计数，每次枚举SG值最小的一层。转移时1和2不在同一层 

void init()
{
	scanf("%d%d", &N, &M);
	for (int i = 1, s, t;i <= M;++i)
		scanf("%d%d", &s, &t), --s, --t, G[s][t] = true;
	power[0] = 1;
	for (int i = 1;i <= M;++i)
		power[i] = Mult(power[i - 1], 2);
	for (int t = 0;t <= N - 1;++t)
		for (int S = 0;S < (1 << N);++S)
			for (int s = 0;s <= N - 1;++s)
				if (S & (1 << s))
					In[t][S] += G[t][s];
}

void dp()
{
	F[0] = 1;
	for (int S = 1;S < (1 << N);++S)
		for (int S0 = S, val;S0;S0 = ((S0 - 1) & S))
		{
			if (((S0 & (1 << 0)) != 0) && ((S0 & (1 << 1)) != 0))
				continue;
			val = F[S - S0];
			for (int i = 0;i <= N - 1;++i)
				if ((S - S0) & (1 << i))
					val = Mult(val, ((power[In[i][S0]] - 1) % MOD + MOD) % MOD);
			for (int i = 0;i <= N - 1;++i)
				if (S0 & (1 << i))
					val = Mult(val, power[In[i][S - S0]]);
			update(F[S], val);
		}
	printf("%d", F[(1 << N) - 1]);
}

int main()
{
	init();
	dp();
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
    int r;
    int ans;
    cin >> r;
    cout << 3 * r *r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k;
    cin >> n >> k;
    long long int ans=0;
    long long int m=1000000007;
    for(long long int i=k;i<=n;i++)
    {
        ans+= (((n*(n+1))/2) -(((n-i)*(n-i+1))/2)-((i*(i-1))/2)+1);
        ans %=m;
 
    }
    ans+=1;
    cout << ans<<"\n";
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using namespace boost::adaptors;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> xs(N, 0);
    for (auto &&i: boost::irange(0LL, N)){
        ll x;
        cin >> x;
        xs.at(i) = x;
    }
    ll cost{0};
    for (auto &&i: boost::irange(0LL, N-1)){
        cost += min(B, A * (xs.at(i+1) - xs.at(i)));
    }
    cout << cost;
    return 0;
}

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

using namespace std;


int main(void){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	string s;
	cin >> s ;
	int d=0,ab=0;
	for(int i=0;i<n;i++){
		if(s[i]=='c')cout<< "No" << endl;
		else if(s[i]=='a'){
			if(d+ab<a+b){
				d++;
				cout<<"Yes"<<endl;
			}else{
				cout<<"No"<<endl;
			}
		}else{
			if(d+ab<a+b && ab<b){
				ab++;
				cout<<"Yes"<<endl;
			}else cout<<"No"<<endl;
		}
	}
	return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    bool f = true;
    for(int i = 0; i < n; i++){
        if(i % 2 == 1 && s[i] == 'R') f = false;
        if(i % 2 == 0 && s[i] == 'L') f = false;
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int dp[10][10];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	int n;
 	cin >> n;
 	ll ans = 0;
 	for(int i=1; i<=n; i++)
 	{
 		int x = i;
 		int l, r = x%10;
		while(x)
		{
			l = x%10;
			x /= 10;
		}
		dp[l][r]++;
 	}
 	for(int i=1; i<=9; i++)
 		for(int j=1; j<=9; j++)
 			ans += 1ll*dp[i][j]*dp[j][i];;
 	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;++i)
int main(){
    int n; cin >> n;
    map<int,int> mp;
    ll res = 0;
    rep(i,n){
        int a; cin >> a;
        res+=a;
        mp[a]++;
    }
    int q; cin >> q;
    rep(i,q){
        int b,c; cin >> b >> c;
        res += (c-b)*mp[b];
        cout << res << endl;
        mp[c] += mp[b];
        mp[b] = 0;
    }
}

Measured memory_bytes: 7948
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

int64 n, k;
int64 a[2010];
int64 dp[2010][2010];
int64 mod = 1000000007;

int main(){
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> k;
    rep(i, n) cin >> a[i];

    
    rep(j, 2001) dp[0][j] = 0;
    rep(j, 2001) rep(i, n) {
        dp[i+1][j] = dp[i][j] + (a[i] >= j ? 1 : 0);
    }

    debug(dp[0][1]); debug(dp[1][1]);

    int64 ans = 0;
    rep(i, n) {
        ans += (((((k - 1) * k / 2) % mod) * dp[n][a[i] + 1])%mod) + ((k * dp[i][a[i] + 1]) % mod);
        ans %= mod;
        debug(ans);
    }

    cout << ans << '\n';


    return 0;
}



Measured memory_bytes: 31744
from scipy.sparse import*;f=lambda*z:map(int,raw_input().split());N,M,R=f();r=f();a,b,c=zip(*map(f,[0]*M));a=csgraph.dijkstra(csr_matrix((c,(a,b)),[N+1]*2),0,r);print int(min(sum(a[e[i]][r[e[i+1]]]for i in range(R-1))for e in __import__('itertools').permutations(range(R))))

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

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

    int n,m;
    cin >> n >> m;
    vector<vector<int>> jobs(m);
    rep(i,n) {
        int a,b;
        cin >> a >> b;
        if(a > m) continue;
        jobs[m-a].push_back(b);
    }
    priority_queue<int> q;
    ll ans = 0;
    for(int i = m - 1; i >= 0 ; i--){
        for(int b : jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 5632
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == "__main__":
    n = int(input())
    lst = collections.Counter(prime_factorize(n))

    #primes = lst.keys()
    counts = lst.values()

    ans = 0
    for c in counts:
        num = c
        cnt = 1
        while True:
            num -= cnt
            if num < 0:
                break
            ans += 1
            cnt += 1
    
    print(ans)

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

double run(int n) {
    int x;
    int v[n];
    double sum = 0;
    double avg;
    for (int i = 0; i < n; i++) {
        cin >> x;
        v[i] = x;
        sum += x;
    }
    avg = sum / n;
    sum = 0;
    for (int i = 0; i < n; i++) {
        sum += pow(v[i] - avg, 2.0) / n;
    }
    return sqrt(sum);
}

int main() {
    int n;
    int x;
    while (true) {
        cin >> n;
        if (n == 0) { break; }
        cout << fixed << setprecision(8) << run(n) << endl;
    }
}


Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> V;
const long long MOD=1000000007LL;
const long long INFL=1LL << 60;
const int INF=1<<29;


int main() {
    ll W,H,x,y;
    cin >>W>>H>>x>>y;
    if(W%2==0&&H%2==0&&W/2==x&&H/2==y)
    cout <<W*H/2.0<<' '<<1<<endl;
    else
    cout<< W*H/2.0<<' '<<0<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define l(i,a,b) for(ll i=a;i<b;i++)
#define PI 3.14159265358979323846
using namespace std;
int main(){
	ll n,d,sum;
	cin>>n>>d;
	ll a[n],b[n],cont=0;
	l(i,0,n) cin>>a[i]>>b[i];
	l(i,0,n){
		sum = a[i]*a[i] + b[i]*b[i];
		if(sum<=d*d) cont++;
	}
	cout<<cont<<"\n";
}

Measured memory_bytes: 6712
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	cout << A + B + C - max(A, max(B, C)) + max(A, max(B, C)) * pow(2, K) << endl;
}

Measured memory_bytes: 4156
import fractions
N, X = map(int,input().split())
xlst = list(map(int,input().split()))

lst = []
for n in xlst:
    difference = abs(X - n)
    lst.append(difference)

ans = lst[0]
for i in range(1,N):
    ans = fractions.gcd(ans, lst[i])
print(ans)

Measured memory_bytes: 16280
import java.util.Arrays;
import java.util.Scanner;

class C {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        final int[][] abc = new int[N][3];
        for (int i = 0; i < N; i++)
            for (int j = 0; j < 3; j++)
                abc[i][j] = sc.nextInt();
        final int[][] dp = new int[N][];
        Arrays.setAll(dp, i -> i > 0 ? new int[3] : abc[0]);
        for (int i = 1; i < N; i++)
            for (int j = 0; j < 3; j++)
                for (int k = 0; k < 3; k++)
                    if (j != k)
                        dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + abc[i][j]);
        System.out.println(Math.max(dp[N - 1][0], Math.max(dp[N - 1][1], dp[N - 1][2])));
    }
}
public class Main {
    public static void main(String... args) {
        C.main();
    }
}


Measured memory_bytes: 101876
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int n, a, ans = 0;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a;
		ans += a - 1;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	int ans = 1;
	for (int i = 1; i <= n; i++) {
		if (ans < k)
			ans <<= 1;
		else 
			ans += k;
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> s(m);
    vector<char> c(m);
    rep(i,m) cin >> s[i] >> c[i];

    bool flag = true;
    string x, s_c;

    rep(i,1000){
        flag = true;
        x = to_string(i);
        if(x.length() != n){
            flag = false;
        }
        rep(j,m){
            if(x[s[j]-1] != c[j]){
                flag = false;
            }
        }
        if(flag == true){
            cout << i << endl;
            break;
        }
    }
    
    if(flag == false) cout << -1 << endl;

    return 0;
}

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

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

    vector<string> S(N);
    vector<int> P(N);
    for(int i=0;i<N;i++){
        cin >> S[i] >> P[i];
    }
    vector<tuple<string,int,int>> SP(N);
    for(int i=0;i<N;i++){
        SP[i] = make_tuple(S[i],100-P[i],i+1);
    }

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

    for(int i=0;i<N;i++){
        int& j = get<2>(SP[i]);
        cout << j << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
#define maxn 1000000

int  isprime(int n)
{
  
  bool prime[maxn];
  int p = 0;
  memset(prime,true,sizeof(prime));
  prime[0] = prime[1] = false;
  for(int i=2;i<=n;i++)
  {
    if(prime[i])
    {
      for(int j=2*i;j<=n;j+=i) prime[j] = false;
      p++;
    }
  }

  return p;
}

int main()
{

    int n;
    while(cin>>n)
    {
      cout<<isprime(n)<<endl;
    }
    return 0;
}

Measured memory_bytes: 2144
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(1<=a<=100 && 1<=b<=100 && 1<=c<=100){
    if(a==b && b==c){
        cout<<1<<endl;
    }
    else if(a!=b && b!=c && a!=c){
        cout<<3<<endl;
    }
     else
     {
         cout<<2<<endl;
     }
}
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n, i, j, tempb, tempc, check;
	int a[10];

	scanf("%d", &n);

	for(i = 0;i < n;i++){
		check = 1;
		tempb = 0;
		tempc = 0;
		for(j = 0;j < 10;j++){
			scanf("%d", &a[j]);
		}

		for(j = 0;j < 10;j++){
			if(tempb >= tempc){
				if(j == 0 || tempb < a[j]){
					tempb = a[j];
				} else if(tempc < a[j]){
					tempc = a[j];
				} else {
					check = 0;
					break;
				}
			} else if(tempc > tempb){
				if(j == 0 || tempc < a[j]){
					tempc = a[j];
				} else if(tempb < a[j]){
					tempb = a[j];
				} else {
					check = 0;
					break;
				}
			}
		}

		if(check == 1){
			printf("YES\n");
		} else if(check == 0){
			printf("NO\n");
		}

	}

	return 0;
}

Measured memory_bytes: 576
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int n;
    cin >> n;
    int a[n];
    cin >> a[0];
    int mx = a[0];
    int mn = a[0];
    for (int i = 1; i < n; i++) {
        cin >> a[i];
        mx = max(mx, a[i]);
        mn = min(mn, a[i]);
    }

    bool ans = true;

    if (mx - mn >= 2) {
        ans = false;
    } else if (mx - mn == 1) {
        int mxc=0, mnc=0;
        for (int i = 0; i < n; i++) {
            if (a[i] == mx) mxc++;
            if (a[i] == mn) mnc++;
        }

        if (mxc == 1) ans = false;
        if (mnc >= mx) ans = false;
        if (mx - mnc > mxc/2) ans = false;
    } else {
        if (mx == n - 1) {
            ans = true;
        } else if (mx * 2 <= n) {
            ans = true;
        } else {
            ans = false;
        }
    }

    if (ans) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 640