akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

#define LL long long
#define reg register
#define rep(a,b,c) for(reg int a=(b),a##_end_=(c); a<=a##_end_; ++a )
#define ret(a,b,c) for(reg int a=(b),a##_end_=(c); a<a##_end_; ++a )
#define drep(a,b,c) for(reg int a=(b),a##_end_=(c); a>=a##_end_; --a )
#define debug(x) cerr<<#x<<" = "<<x<<endl;

template<class T>inline bool Max(T &a,T b) {
	return a<b?a=b,1:0;
}
template<class T>inline bool Min(T &a,T b) {
	return a>b?a=b,1:0;
}

inline int Read(void) {
	int res=0,flag=1;
	char c;
	while(c=getchar(),c<48||c>57)if(c=='-')flag=0;
	do res=(res<<1)+(res<<3)+(c^48);
	while(c=getchar(),c>=48&&c<=57);
	return flag?res:-res;
}

const int N=2e5+5,M=1e6+5,mod=1e9+7;
const int dx[4]= {1,-1,0,0},dy[4]= {0,0,1,-1};

struct node{
	int x,y;
}A[N];

bool cmp(node a,node b){
	return a.y<b.y;
}

int main(void) {
	int n=Read(),w=0;
	rep(i,1,n)A[i].x=Read(),A[i].y=Read();
	sort(A+1,A+n+1,cmp);
	rep(i,1,n){
		w+=A[i].x;
		if(w>A[i].y)return !puts("No");
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 1792
import heapq


def dijkstra(n, s, edge):
    d = [(float('inf'), i, -1) for i in range(n + 1)]
    d[s] = (0, s, 0)
    q = [(0, s, 0)]
    
    while q:
        dist, curr, prev = heapq.heappop(q)
        if d[curr][0] < dist:
            continue
            
        for e in edge[curr]:
            if d[e][0] > dist + 1:
                d[e] = (dist + 1, e, curr)
                heapq.heappush(q, d[e])
    
    return d


def submit():
    n, m = [int(e) for e in input().split()]
    edge = {i: [] for i in range(1, n + 1)}
    for _ in range(m):
        a, b = [int(e) for e in input().split()]
        edge[a].append(b)
        edge[b].append(a)

    # 直前のノードを覚えるdijkstra
    d = dijkstra(n, 1, edge)
    
    print("Yes")
    for i in range(2, n + 1):
        print(d[i][-1])


if __name__ == "__main__":
    submit()

Measured memory_bytes: 53608
#include<iostream>
using namespace std;
int main(void)
{
        int A, B;

        cin >> A >> B;

        if(A==1)A=14;
        if(B==1)B=14;
                
        if(A>B){
                 cout << "Alice"<<endl;
        }else if(B>A){
                cout << "Bob"<<endl;
        }else{
                cout << "Draw"<<endl;
        }
        
        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>



int main(){
	unsigned int X,A,B;
	
	
	scanf("%d",&X);
	scanf("%d",&A);
	scanf("%d",&B);	
	
	if (1<=A & A<=1000){
	}else{
		return 0;
	}
	if (1<=B & B<=1000){
	}else{
		return 0;
	}
	if (A+B<=X & X<=10000){
	}else{
		return 0;
	}
	X = X - A;
	X = X % B;
	
	printf("%d",X);
	
		
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cstring>
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~i))
#define rf(i,a,b) for(register int i=(a);i>=(b);i=~(-i))
int n,m,K,maxbit,ans=2e9;
const int N=25,B=1050010,mod=1e9+7; 
int dp[2][N][B],lim[N][N],nex[B][N],ban[B][N];
int cmin(int x,int y){return x<y?x:y;}
int ADD(int x,int y){return (x+=y)>=mod?x-mod:x;}
void init()
{
	int x;
	f(S,0,maxbit)
	{
		x=-1;
		rf(i,n-1,0)
		{
			if(S&(1<<i))x=i;
			nex[S][i]=x;
		}
	}
}
int main()
{
	int now=0,pre,x,y,z;
	scanf("%d%d%d",&n,&m,&K),--n,maxbit=(1<<n)-1;
	f(i,1,m)
	 f(j,0,n-1)
	  lim[i][j]=-1;
	f(i,1,K)
	{
		scanf("%d%d%d",&x,&y,&z);	
		lim[x][y-1]=z;
	}
	dp[0][n][0]=1;
	init();
	f(i,1,m)
	{
		pre=now,now^=1;
		f(S,0,maxbit)dp[now][0][S]=dp[pre][n][S];
		f(j,0,n)
		 f(S,0,maxbit)
		  dp[pre][j][S]=0;
		f(j,0,n-1)
	     f(S,0,maxbit)if(dp[now][j][S])
		 {
			x=(S&(1<<j))?1:0;
			f(k,0,1)
			{
				if((lim[i][j]^-1)&&(lim[i][j]^k))continue;
				if((!k)&&x)continue;
				if(k==x)dp[now][j+1][S]=ADD(dp[now][j+1][S],dp[now][j][S]);
				else
				{
					y=nex[S][j];
					if(y!=-1)dp[now][j+1][(S|(1<<j))^(1<<y)]=ADD(dp[now][j+1][(S|1<<j)^(1<<y)],dp[now][j][S]);
					else dp[now][j+1][S|1<<j]=ADD(dp[now][j+1][S|1<<j],dp[now][j][S]);
				}
			}
		 }
	}f(S,0,maxbit)ans=ADD(ans,dp[now][n][S]);
	std::cerr<<clock()*1.0/CLOCKS_PER_SEC<<std::endl;
	return printf("%d\n",ADD(ADD(ans,mod),14)),0;
}

Measured memory_bytes: 217472
n=int(input())

nums=list(map(int,input().split()))
#print(nums)
cnt=0

while True:
    cnt2=0
    for i in range(n):
        if nums[i]%2==0:
            cnt2+=1
            nums[i]=nums[i]/2

    if cnt2==n:
        cnt+=1

    else:
        break
print(cnt)


Measured memory_bytes: 2940
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);

        int d;
        StringBuilder sb = new StringBuilder("");

        while (sc.hasNextInt()) {
            d = sc.nextInt();
            sb.append(100 * (600 - d) * (1200 - d));
            sb.append('\n');
        }

        System.out.print(sb);
    }
}

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

int main(void) {
  int K;
  cin >> K;
  queue<long long> que;
  for (int i = 1; i < 10; i++) {
    que.push(i);
  }
  for (int i = 0; i < K - 1; i++) {
    long long num = que.front();
    que.pop();
    if (num % 10 != 0) {
      que.push(10 * num + num % 10 - 1);
    }
    que.push(10 * num + (num % 10));
    if (num % 10 != 9) {
      que.push(10 * num + num % 10 + 1);
    }
  }
  cout << que.front() << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<vector<int>> dp(n + 1, vector<int>(3, 0));
	vector<int> a(n), b(n), c(n);
	for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
	for (int i = 1; i <= n; ++i) {
		dp[i][0] = max(dp[i - 1][1] + a[i - 1], dp[i - 1][2] + a[i - 1]);
		dp[i][1] = max(dp[i - 1][0] + b[i - 1], dp[i - 1][2] + b[i - 1]);
		dp[i][2] = max(dp[i - 1][0] + c[i - 1], dp[i - 1][1] + c[i - 1]);
	}
	cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

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

inline void Yes(){
    cout << "Yes" << "\n";
}
inline void No(){
    cout << "No" << "\n";
}
typedef pair<int,int> P;

int main(){
    ll h;
    cin >> h;
    ll ans = 1;
    ll ninorui = 2;
    while(1){
        if (h < ninorui){
            cout << ans << "\n";
            return 0;
        }
        ans = ans*2 +1;
        ninorui *= 2;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int b[n+1],sum=0;
    b[0]=111111110;
    b[n]=111111110;
    for(int i=1;i<n;i++){
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        if(b[i]<=b[i+1]){
            sum += b[i];
        }else if(b[i]>b[i+1]){
            sum += b[i+1];
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int x;
    cin>>x;
    x/=200;
    x=10-x;
    cout<<x<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}   

Measured memory_bytes: 3804
#ifdef OJ_MISC_OFFLINE

#include "prolog.h"

#else
#define LOG
#define PRINT
#define LCERR
#include <iostream>
auto optimize_cpp_stdio = []() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ);
    return 0;
}();
#endif

#include <algorithm>
#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

namespace {

using namespace std;

int solve() {
    // handle IO here
    int N;
    cin >> N;
    vector<int> sides(N);
    for (int i = 0; i < N; ++i) {
        cin >> sides[i];
    }

    int sum_sides = accumulate(sides.begin(), sides.end(), 0);
    int max_side = *max_element(sides.begin(), sides.end());
    cout << (max_side < sum_sides - max_side ? "Yes\n" : "No\n");

    return 0;
}

} // anonymous namespace

#ifdef OJ_MISC_OFFLINE

#include "epilog.h"

#else

int main() {
    return solve();
}

#endif


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args) {
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int[] mountain=new int[n];
        for(int i=0;i<n;i++){
            mountain[i]=scn.nextInt();
        }
        int total=0;
        int max=0;
        for(int i=0;i<n;i++){
            if(mountain[i]>=max){
                total++;
                max=mountain[i];
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 23252
#include<stdio.h>
#include<string.h>
int n;
char s[20][20];
int len[20];
int dfs(int d,int k,int e){
    int res=0;
    if(e)res=1;
    for(int i=d;i<n&&k<len[i];i++){
        if(s[i][k]=='.')continue;
        int a=s[i][k]-'0';
        if(s[i][k]=='+')a=dfs(i+1,k+1,0);
        if(s[i][k]=='*')a=dfs(i+1,k+1,1);
        if(e)res*=a;
        else res+=a;
    }
    return res;
}int main(void){
    while(1){
        scanf("%d",&n);
        if(n==0) break;
        for(int i=0;i<n;i++){
            scanf("%s",s[i]);
            len[i]=strlen(s[i]);
            //printf("%d\n",len[i]);
        }
        if(n==1) printf("%d\n",s[0][0]-'0');
        else{
            printf("%d\n",dfs(0,0,0));
        }
    }
}



Measured memory_bytes: 2048
// In the name of Allah the Lord of the Worlds.

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

typedef long long ll;

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

    ll n;
    cin >> n;
    n--;
    cout << n*(n+1LL)/2LL << endl;

    return 0;
}


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

#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

const long long int mod = 1000000007;

int main() {

    long long int n;
    cin >> n;

    vector< long long int > v;

    for ( long long int i = 0; i < n; i++ ) {
        long long int in;
        cin >> in;
        v.push_back( in );
    }

    long long int inv[114514] = {};
    inv[1] = 1;
    for ( long long int i = 2; i <= n; i++ ) {
		inv[i] = mod - ( mod / i ) * inv[ mod % i ] % mod;
	}

    long long int p[114514] = {};
    p[1] = 1;
    for ( long long int i = 2; i <= n; i++ ) {
        p[i] = p[i-1] * i;
        p[i] %= mod;
        inv[i] *= inv[i-1];
        inv[i] %= mod;
    }

    long long int a[114514] = {};
    a[1] = 1;
    for ( long long int i = 2; i <= n; i++ ) {
        a[i] = a[i-1] * i + p[i-1];
        a[i] %= mod;
    }

    long long int ans = 0;
    for ( long long int i = 0; i < n - 1; i++ ) {
        long long int x = ( v[i+1] - v[i] );
        x %= mod;
        x *= a[i+1];
        x %= mod;
        x *= p[n-1];
        x %= mod;
        x *= inv[i+1];
        x %= mod;
//        cout << " " << x << endl;
        ans += x;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 3828
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int gcd(int a, int b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, d;
	cin >> n >> d;
	int x[n][d];
	rep(i, n){
		rep(j, d) cin >> x[i][j];
	}
	int ans = 0;
	rep(i, n) repn(j, i + 1, n){
		int cur = 0;
		rep(k, d){
			cur += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
		}
		int e = sqrt(cur);
		if(e * e == cur) ans++;
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;

const ll INF = 2e18;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;

int N, M;
vector<int> G[MAXN];
queue<int> q;
bool vis[MAXN];
int ans[MAXN];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> N >> M;
	for(int i=1; i<=M; i++) {
		int a, b; cin >> a >> b;
		G[a].push_back(b); G[b].push_back(a);
	}
	q.push(1); vis[1] = 1;
	while(!q.empty()) {
		int cur = q.front(); q.pop();
		for(int i : G[cur]) if(!vis[i]) {
			vis[i] = 1; ans[i] = cur;
			q.push(i);
		}
	}
	cout << "Yes\n";
	for(int i=2; i<=N; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 10568
class node:
    def __init__(self):
        self.p = -1
        self.l = -1
        self.r = -1

def preParse(u):
    if u == -1:
        return
    print(" " + str(u), end = '')
    preParse(T[u].l)
    preParse(T[u].r)

def inParse(u):
    if u == -1:
        return
    inParse(T[u].l)
    print(" " + str(u), end = '')
    inParse(T[u].r)

def postParse(u):
    if u == -1:
        return
    postParse(T[u].l)
    postParse(T[u].r)
    print(" " + str(u), end = '')

root = -1
def insert(T, z):
    global root
    parent = -1
    u = root
    while u != -1:
        parent = u
        if z < u:
            u = T[u].l
        else:
            u = T[u].r
    T[z].p = parent
    if parent == -1:
        root = z
    elif z < parent:
        T[parent].l = z
    else:
        T[parent].r = z

def find(T, k):
    u = root
    while u != -1 and k != u:
        if k < u:
            u = T[u].l
        else:
            u = T[u].r
    return "no" if u == -1 else "yes"

n = int(input())
cmdList = [input() for _ in range(n)]
T = {int(cmd[7:]): node() for cmd in cmdList if cmd[0] == "i"}

for cmd in cmdList:
    if cmd[0] == "p":
        inParse(root)
        print("")
        preParse(root)
        print("")
    elif cmd[0] == "f":
        print(find(T, int(cmd[5:])))
    else:
        insert(T, int(cmd[7:]))


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

int count_game_num(bool *is_player_join, int join_num, int k) {
  if (k >= join_num - 1) {
    return 0;
  }
  int count
    = count_game_num(is_player_join, join_num, 2 * k + 1)
    + count_game_num(is_player_join, join_num, 2 * k + 2);
  if (!is_player_join[2 * k + 1] && !is_player_join[2 * k + 2]) {
    is_player_join[k] = false;
  }
  // cout << " k => " << k << endl;
  // cout << " right => " << is_player_join[2 * k + 1] << ", left => " << is_player_join[2 * k + 2] << endl;
  return is_player_join[2 * k + 1] && is_player_join[2 * k + 2] ? ++count : count;
}

int main() {
  int abstention_num, join_num;
  cin >> join_num >> abstention_num;
  bool is_player_join[join_num * 2];
  fill(is_player_join, is_player_join + join_num * 2, true);

  for (int i = 0; i < abstention_num; i++) {
    int abstention_player;
    cin >> abstention_player;
    is_player_join[abstention_player + join_num - 1] = false;
  }

  cout << count_game_num(is_player_join, join_num, 0) << endl;
}

Measured memory_bytes: 3092
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

class UnionFind:
	def __init__(self, n):
		self.par = [i for i in range(n + 1)]
		self.rank = [0] * (n + 1)
		self.size = [1] * (n + 1)

	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]

	def same_check(self, x, y):
		return self.find(x) == self.find(y)

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if self.rank[x] < self.rank[y]:
			if self.same_check(x, y) != True:
				self.size[y] += self.size[x]
				self.size[x] = 0
			self.par[x] = y
		else:
			if self.same_check(x, y) != True:
				self.size[x] += self.size[y]
				self.size[y] = 0
			self.par[y] = x
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1

	def siz(self, x):
		x = self.find(x)
		return self.size[x]

#処理内容
def main():
	N, M, K = getlist()

	Dnode = defaultdict(int)
	UF = UnionFind(N)
	for i in range(M):
		A, B = getlist()
		A -= 1; B -= 1
		Dnode[A] += 1
		Dnode[B] += 1
		UF.union(A, B)

	for i in range(N):
		UF.par[i] = UF.find(i)

	Dblock = defaultdict(int)
	for i in range(K):
		C, D = getlist()
		C -= 1; D -= 1
		if UF.same_check(C, D):
			Dblock[C] += 1
			Dblock[D] += 1

	ans = [0] * N
	for i in range(N):
		ans[i] = UF.siz(i) - 1 - Dblock[i] - Dnode[i]

	print(" ".join(list(map(str, ans))))


if __name__ == '__main__':
	main()

Measured memory_bytes: 123352
from collections import deque

H, W = map(int, input().split())
C = [input() for _ in range(H)]

# print(C)


def bfs(C, visited_list, que):
    _max_move_num = 0
    while len(que) > 0:
        h, w, d = que.popleft()
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h = h + j
            new_w = w + k
            if (new_h >= H or new_w >= W or new_w < 0 or new_h < 0):
                continue
            if (C[new_h][new_w] != '#' and visited_list[new_h][new_w] == 0):
                new_d = d + 1
                # print('探索', new_h, new_w, new_d)
                if (_max_move_num < new_d):
                    _max_move_num = new_d
                visited_list[new_h][new_w] = 1
                que.append((new_h, new_w, new_d))

    # print(_max_move_num)
    return(_max_move_num)


max_move_num = 0
for h in range(H):
    for w in range(W):
        if (C[h][w] == '.'):
            start_h, start_w = h, w
            # print(start_h, start_w)
            que = deque([(start_h, start_w, 0)])
            visited_list = [[0]*W for _ in range(H)]
            visited_list[start_h][start_w] = 1
            max_move_num_ = bfs(C, visited_list, que)
            # print('=================')
            if(max_move_num_ > max_move_num):
                max_move_num = max_move_num_

print(max_move_num)


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const ll MOD=1e9+7;

int main(){
    double a, b, x;
    cin >> a >> b >> x;
    double l=0, r=M_PI/2;
    while(r-l > 1e-8){
        double mid=l+(r-l)/2;
        double v;
        if(b-a*tan(mid) >= 0){
            v=(a*b-a*a*tan(mid)/2)*a;
        }
        else{
            v=b*b/tan(mid)/2*a;
        }
        if(v <= x) r=mid;
        else l=mid;
    }
    cout << fixed << setprecision(7);
    cout << r*180/M_PI << endl;
    return 0;
}

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

int N;

int main() {
    //cout<<"接水问题\n";
    cin>>N;
    switch(N%10){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout<<"hon";
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout<<"pon";
            break;
        case 3:
            cout<<"bon";
            break;
    }
 
    
    return 0;
}


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

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
using namespace std;
int mod = 1'000'000'000 + 7;

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

char S[3][110];

char solve(vi v = {0, 0, 0}, int t = 0) {
    char c = S[t][v[t]];
    if (c == '\0')return t + 'A';
    v[t]++;
    return solve(v, c - 'a');
}

int main() {
    COME_LET_THE_GAMES_BEGIN();
    cin >> S[0] >> S[1] >> S[2];
    cout << solve() << endl;
}

Measured memory_bytes: 256
n=int(input())
S=list(map(int,input().split()))
q=int(input())
T=list(map(int,input().split()))

cnt=0

for j in range(q):
    for i in range(n):
        v=S[i]
        w=T[j]
        if v==w:
            cnt=cnt+1
            break
print(cnt)
        



Measured memory_bytes: 6548
#include <iostream>
using namespace std;
int main(void){
    bool flgO=true,flgE=true;
    char o[51],e[51];
    cin>>o;
    cin>>e;
    
    for(int i=0;i<50;i++){
        if(flgO && o[i]!='\0'){
            cout<<o[i]<<flush;
        }else{
           flgO=false; 
        }
        
        if(flgE && e[i]!='\0'){
            cout<<e[i]<<flush;
        }else{
            flgE=false;
        }
        
        if(!flgO && !flgE)break;
    }
    return 0;
}


Measured memory_bytes: 256
a,b,c,x,y = map(int, input().split())

if a+b <= c*2:
  print(a*x+b*y)
else:
  if x == y: print(c*x*2)
  elif x > y: 
    if a <= c*2: print(c*y*2+a*(x-y))
    else: print(c*x*2)
  elif x < y: 
    if b <= c*2: print(c*x*2+b*(y-x))
    else: print(c*y*2)

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

using namespace std;

#define INF 1000000007
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define maxn 100005

signed main()
{
    int N;
    cin >> N;
    cout << N * N * N << endl;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ULL = unsigned long long;

void solve() {
	int AZ = 1000000001;

	int n, m; cin >> n >> m;
	int L; cin >> L;
	queue<pair<int, int>> st;
	int l[300][300]; rep(i, n)rep(j, n)l[i][j] = AZ;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		int c; cin >> c;
		if (c <= L) l[a][b] = l[b][a] = c;
		st.push({ a,b });
		st.push({ b,a });
	}
	rep(i, n) l[i][i] = 0;
	while (!st.empty()) {
		auto p = st.front(); st.pop();
		int d = l[p.first][p.second];
		rep(i, n) {
			int dd = l[p.second][i] + d;
			if (dd > L) continue;
			if (l[p.first][i] <= dd) continue;
			l[p.first][i] = dd;
			st.push({ p.first, i });
		}
	}

	int dp[300][300];
	rep(i, n)rep(j, n) {
		if (l[i][j] <= L) {
			st.push({ i,j });
			dp[i][j] = 0;
		}
		else dp[i][j] = AZ;
	}
	rep(i, n) dp[i][i] = 0;
	while (!st.empty()) {
		auto p = st.front(); st.pop();
		int d = dp[p.first][p.second];
		rep(i, n) {
			if (dp[p.second][i] != 0) continue;
			if (dp[p.first][i] <= d + 1) continue;
			dp[p.first][i] = d + 1;
			st.push({ p.first, i });
		}
	}

	int q; cin >> q;
	vector<int> ans;
	rep(i, q) {
		int s, t; cin >> s >> t; s--; t--;
		if (dp[s][t] == AZ)
			ans.push_back(-1);
		else
			ans.push_back(dp[s][t]);
	}
	rep(i, ans.size()) { cout << ans[i] << endl; }
}

int main() {

	solve();

	return 0;
}


Measured memory_bytes: 6784
# 優先度付き待ち行列で解く
import heapq
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A = sorted(A, reverse=True)
B = sorted(B, reverse=True)
C = sorted(C, reverse=True)
A.append(-10**20)
B.append(-10**20)
C.append(-10**20)
Q = []
heapq.heapify(Q)
heapq.heappush(Q, (-(A[0]+B[0]+C[0]), 0, 0, 0))  # ケーキの美味しさ, Aのindex, Bのindex, Cのindex
count = 0
fin = {}
while count < K:
    delicious, a, b, c = heapq.heappop(Q)
    if (a, b, c) not in fin:
        fin[(a, b, c)] = True
        print(-delicious)
        heapq.heappush(Q, (-(A[a+1]+B[b]+C[c]), a+1, b, c))
        heapq.heappush(Q, (-(A[a]+B[b+1]+C[c]), a, b+1, c))
        heapq.heappush(Q, (-(A[a]+B[b]+C[c+1]), a, b, c+1))
        count += 1


Measured memory_bytes: 4340
from collections import deque

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

graph = [[] for _ in range(n+1)] # 初期化
for i in range(m):
  a,b = map(int, input().split())
  graph[a].append(b)
  graph[b].append(a)
# print(graph)


dist = [None] * (n+1)
dist[0] = 0
dist[1] = 0

d = deque()
d.append(1)

while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] is None: 
            dist[i] = v
            d.append(i)

ans = dist[2:]

if all(d == None for d in dist):
  print('No')
  exit()

print('Yes')
for a in ans:
  print(a)


Measured memory_bytes: 34860
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	int N;
	int h[120]={};
	int flag=0,ans=0;
	int fzero,lzero;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>h[i];
		if(h[i]!=0){
			flag=1;//ぜんぶぜろじゃない
		}
	}
	if(flag==0){
		cout<<"0"<<endl;
		return 0;
	}
	flag=0;
	while(flag==0){
		int kukan=1;
		for(fzero=0;fzero<N;fzero++){
			if(h[fzero]!=0){
				break;
			}
		}
		for(lzero=N-1;lzero>=0;lzero--){
			if(h[lzero]!=0){
				break;
			}
		}
		for(int i=fzero;i<=lzero;i++){
			if(h[i]==0){
				if(h[i+1]!=0){
					kukan++;
				}
			}
		}
		for(int i=0;i<N;i++){
			if(h[i]!=0){
				h[i]--;
			}
		}
		ans+=kukan;

		

		

		//全部ゼロ？
		flag=1;
		for(int i=0;i<N;i++){
			if(h[i]!=0){
				flag=0;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();

    if(k % 2 == 0) {
      System.out.println((k/2)*(k/2));
    } else {
      System.out.println((k/2)*(k/2+1));
    }
  }

}


Measured memory_bytes: 21844
import sys
A=int(sys.stdin.readline(2))
D=int(sys.stdin.readline(2))
if A>=1 and A<=12:
	if D>=1 and D<=12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif D>=1 and D<=12:
	print("YYMM")
else:
	print("NA")

Measured memory_bytes: 3060
N = int(input())
Weight = list(input().split())
Weight = [int(Weight[i]) for i in range(N)]
dif_min = float('inf')

for i in range(N):
    S1 = sum(Weight[:i+1])
    S2 = sum(Weight[i+1:])
    dif_min = min(dif_min, abs(S2 - S1))

print(dif_min)

Measured memory_bytes: 3064
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

typedef struct
{
  char name[11];
  int i;
  int rate;
} hoge;

int upll__(const void *a, const void *b) { return strcmp(((hoge *)a)->name, ((hoge *)b)->name); }

int main()
{
  int n, p;
  char s[11];
  scanf("%d", &n);
  hoge fuga[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%s%d", s, &p);
    fuga[i].i = i;
    strcpy(fuga[i].name, s);
    fuga[i].rate = p;
  }
  qsort(fuga, n, sizeof(hoge), upll__);
  int cnt = 1;
  while (cnt)
  {
    cnt = 0;
    for (int i = 0; i < n - 1; i++)
    {
      if (!strcmp(fuga[i].name, fuga[i + 1].name))
      {
        hoge tmp = fuga[i];
        if (fuga[i].rate < fuga[i + 1].rate)
        {
          fuga[i] = fuga[i + 1];
          fuga[i + 1] = tmp;
          cnt++;
        }
      }
    }
  }
  for (int i = 0; i < n; i++)
    printf("%d\n", (fuga[i].i) + 1);
  return 0;
}


Measured memory_bytes: 128
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1] * (n + 1)
        self.rnk = [0] * (n + 1)

    def Find_Root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]

    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1


import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline

n, m = map(int, input().split())
u = UnionFind(n)
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    u.Unite(a, b)
print(len(set(u.Find_Root(i) for i in range(n))))


Measured memory_bytes: 89940
n = int(input())
a = list(map(int,input().split()))
b = max(a)
c = min(a)
ans = 99999999999999999999999999999999999999999999999999999
for i in range(c,b+1):
    count = 0
    for j in range(n):
        count += (i-a[j])**2
    ans = min(ans,count)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  double_t N; cin >> N;
  auto ans = 2*N * 3.14159265359;
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 3808
// finish date: 2018/01/10
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long

bool isExist(char c, string str) {
    rep(i, str.length()) {
        if (c == str[i]) return true;
    }
    return false;
}

int fact(int n) {
    int ans = 1;
    FOR(i, 1, n + 1) {
        ans *= i;
    }
    return ans;
}

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    cout << "A" << b[0] << "C" << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

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

	int n;
	cin >> n;
	if(n < 1000){
		cout << "ABC" << endl;
	}else{
		cout << "ABD" << endl;
	}
}


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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

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

const int N = 33;

bool s[N][N], v[N][N];

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

	for(int n; cin >> n && n; ) {
		memset(s, 0, sizeof s);
		for(int i = 0; i < n; i ++) {
			int x, y; cin >> x >> y;
			s[x][y] = 1;
		}
		int m; cin >> m;
		memset(v, 0, sizeof v);
		int x = 10, y = 10;
		while(m --) {
			char c; int t; cin >> c >> t;
			int d = (c == 'N') ? 0 : (c == 'E') ? 1 : (c == 'S') ? 2 : 3;
			while(t --) {
				x += dx[d]; y += dy[d];
				v[x][y] = 1;
			}
		}

		bool f = 1;
		for(int i = 0; i <= 20; i ++)
			for(int j = 0; j <= 20; j ++)
				if(s[i][j] && !v[i][j]) f = 0;

		cout << (f ? "Yes" : "No") << '\n';
	}

	return 0;
}

Measured memory_bytes: 3120
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        int c5 = 0;
        int c7 = 0;
        
        if(a==5) {
        	c5++;
        }else {
        	c7++;
        }
        
        if(b==5) {
        	c5++;
        }else {
        	c7++;
        }
        
        if(c==5) {
        	c5++;
        }else {
        	c7++;
        }
        
        if(c5==2 && c7==1) {
        	System.out.println("YES");
        }else {
        	System.out.println("NO");
        }
	}
}

Measured memory_bytes: 35836
n,k=map(int,input().split())
R,S,P=map(int,input().split())
get=[P,R,S]
t=list(input())
info=[]
for i in range(1,k+1): #グル＾プ分け
    a=[]
    num=i-1
    count=0
    while num<=(n-1):
        if t[num]=="r":
            b=0
        elif t[num]=="s":
            b=1
        else:
            b=2
        a.append(b)
        count+=1
        num+=k
    a.insert(0,count)
    info.append(a)
#print(info)
score=0
for i in range(k):
    if info[i][0]==1: #一個なら勝てばいい
        score+=get[info[i][1]]
        continue
    rensa=1
    now=info[i][1]
    for j in range(2,info[i][0]+1):
        if now==info[i][j]:
            rensa+=1
        else:
            if rensa%2==0: #偶数なら半分勝てる
                score+=((rensa//2)*get[now])
            else:
                score+=((rensa//2+1)*get[now])
            now=info[i][j]
            rensa=1
    if rensa==1:
        score+=get[now]
    else:
        if rensa%2==0: #偶数なら半分勝てる
                score+=((rensa//2)*get[now])
        else:
            score+=((rensa//2+1)*get[now])
print(score)

Measured memory_bytes: 14124
#include <bits/stdc++.h>
#define MP make_pair
using namespace std;
typedef long long LL;
const LL N = 100010;
inline LL read()
{
  char ch=getchar(); LL p=0; LL f=1;
  while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();}
  while(ch>='0' && ch<='9'){p=p*10+(ch-'0'); ch=getchar();}
  return p*f;
}

string ss[N];
map<string,bool>mp; LL co[N];

int main()
{

  LL n=read();
  for(LL i=1;i<=n;i++) cin>>ss[i];
  mp.clear();
  for(LL i=1;i<=n;i++)
  {
    if(mp[ss[i]] == 0) mp[ss[i]]=1;
    else continue;
    if(ss[i][0] == 'M') co[0]++;
    if(ss[i][0] == 'A') co[1]++;
    if(ss[i][0] == 'R') co[2]++;
    if(ss[i][0] == 'C') co[3]++;
    if(ss[i][0] == 'H') co[4]++;
  }
  LL ans=0;
  for(LL i=0;i<=4;i++) for(LL j=i+1;j<=4;j++) for(LL k=j+1;k<=4;k++)
  {
    ans+=co[i] * co[j] * co[k];
  }
  return printf("%lld\n",ans),0;
}

Measured memory_bytes: 17152
s=input()
k=int(input())
a=set(s)
if len(a)==1:print(k*len(s)//2)
else:
  V=[]
  unit=0
  for i in s:
    if len(V)==0 or V[-1][0]!=i:
      V.append([i,1])
    else:
      V[-1][1] += 1
  for i in V:
    unit+=i[1]//2
  ans=unit*k
  if s[0]==s[-1]:
    ans=ans-(V[0][1]//2+V[-1][1]//2-(V[0][1]+V[-1][1])//2)*(k-1)
  print(ans)


Measured memory_bytes: 38256
import scala.io.StdIn._

object Main extends App {

  def binarySearch(key: Int, a: Array[Int]): Boolean = {
    var left = 0
    var right = a.size
    while (left < right) {
      val mid = (left + right) / 2
      val x = a(mid)
      if (x == key) {
        return true
      } else if (x > key) {
        right = mid
      } else {
        left = mid + 1
      }
    }
    return false
  }

  readLine
  val S = readLine.split(" ").map(s => s.toInt)
  readLine
  val T = readLine.split(" ").map(s => s.toInt)
  println(T.map(key => binarySearch(key, S)).filter(_ == true).size)
}


Measured memory_bytes: 75880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int D;
int s[367][27];
int c[27];
int last[27];

int main()
{
    cin >> D;
    for (int i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }
    for (int i = 1; i <= D; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
            last[j] = 0;
        }
    }
    vector<int> t;
    ll score, maxi, maxj, tmp;
    int best_i;

    for (int day = 1; day <= D; day++)
    {
        maxi = LLONG_MIN;
        best_i = -1;
        //dayまでのコスト計算
        for (int item = 1; item <= 26; item++)
        {
            score = s[day][item];
            for (int k = 1; k <= 26; k++)
            {
                score -= c[k] * (day - (k == item ? day : last[k]));
            }
            //dayからD日までのコスト計算
            maxj = LLONG_MIN;
            for (int j = day; j <= D; j++)
            {

                tmp = score;
                for (int k = 1; k <= 26; k++)
                {
                    tmp -= c[k] * (j - (k == item ? j : last[k]));
                }
                if (tmp > maxj)
                {
                    maxj = tmp;
                }
            }
            score = maxj;
            if (score > maxi)
            {
                maxi = score;
                best_i = item;
            }
        }
        t.push_back(best_i);
        last[best_i] = day;
    }

    for (int i = 0; i < t.size(); i++)
    {
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3616
import math

AB = list(map(int,input().strip().split()))
A = AB[0]
B = AB[1]


def solve_odd(a):
    return math.floor((a + 1) / 2) % 2


def solve(a):
    if a % 2 == 1:
        return solve_odd(a)
    else:
        return solve_odd(a + 1) ^ (a + 1)


print(solve(B) ^ solve(A - 1))

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

int64_t isprime(int64_t x){
  int64_t Ans=1;
  int64_t y=sqrt(x);
  for(int64_t i=2; i<=y; i++){
    if(x%i==0){
      Ans=0;
      break;
    }
  }
  if(x==1){
    Ans=0;
  }
  return Ans;
}

int main(){
  int64_t N;
  cin >> N;
  int64_t M=sqrt(N);
  vector<int64_t> P;
  for(int64_t i=1; i<=M; i++){
   if(N%i==0){
     if(isprime(i)==1){
       P.push_back(i);
     }
     if(isprime(N/i)==1){
       P.push_back(N/i);
     }
   }
  }
  sort(P.begin(), P.end());
  int64_t L=P.size();
  vector<int64_t> T(L);
  for(int64_t i=0; i<L; i++){
    int64_t R=N;
    while(R%P.at(i)==0){
      R/=P.at(i);
      T.at(i)++;
    }
  }
  int64_t An=0;
  for(int64_t i=0; i<L; i++){
    int64_t w=1;
    while(T.at(i)>=w){
      T.at(i)-=w;
      w++;
      An++;
    }
  }
  cout << An << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll Q, H, S, D, N, ans=0, less, even, count;
  std::cin >> Q >> H >> S >> D;
  std::cin >> N;
  less = min(4*Q, min(2*H, S));
  even = min(less*2, D);
  count = N/2;
  ans = count*even + (N%2)*less;
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007ll
#define INF 1000000000
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// まずは全探索，次にDP
// 偶奇，逆から，ソート，出現回数，DP
// 存在判定：構成方法，入力の特徴
// 例外を十分に含む一般化．想像力の限界
// 場合分け
int main() {
cin.tie(0);
ios::sync_with_stdio(false);

int64_t N, P, p; cin >> N >> P;
p = P;

// P の素因数分解で N 個以上ある素因数の積
VI cntp(1000010, 0);
int64_t i = 2;
while (i * i <= P) {
    if (p % i == 0){
        ++cntp[i];
        p /= i;
    }
    else ++i;
}

int64_t GCD = pow(p, 1/N);
rep(i, 2, 1000010){
    GCD *= pow(i, cntp[i] / N);
}
cout << GCD << "\n";
}

// 境界，出力文字列 チェック



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

int main(){
    int N; cin >> N;
    string W[110];
    for(int i=0; i<N; i++){
        cin >> W[i];
    }

    bool flag=true;

    for(int i=1; i<N; i++){
        if( W[i-1].at(W[i-1].size()-1) != W[i].at(0) ) flag = false;
    }
    set<string> s;
    for(int i=0; i<N; i++){
        if(s.count(W[i])==1) {flag = false; break;}
        s.insert(W[i]);
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main () {
    int N;
    int ans = 0;
    cin >> N;
    int a[10010] = {};
    for (int i=0; i < N; i++) cin >> a[i];

    for (int i=0; i < N; i++) {
        while (!(a[i]&1)) {
            ans++;
            a[i] >>= 1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
///                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
///             __.'              ~.   .~              `.__
///           .'//                  \./                  \\`.
///         .'//                     |                     \\`.
///       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
///     .'//.-"                 `-.  |  .-'                 "-.\\`.
///   .'//______.============-..   \ | /   ..-============.______\\`.
/// .'______________________________\|/______________________________`.
#include<iostream>
#include<time.h>
#include<cstdio>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<cstring>
#include<map>
#include<algorithm>
#include<string>
#include<set>
#include<sstream>
#include<iomanip>
#define INF 0x3f3f3f3f
using namespace std;
const int mod = 10007;
typedef long long ll;
const int N = 4000010;
int n, m;
double a;
int main()
{
    cin >> n >> a;
    int num = 0;
    for(int i = 1;i <= n;i ++)
    {
        double x, y;
        scanf("%lf%lf", &x,&y);
        if(sqrt(x * x + y * y) <= a) num ++;
    }
    cout << num << endl;
    return 0;
}


Measured memory_bytes: 3904
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, k;
    cin >> n >> k;
    vector<ll> cnt(n);
    REP(i, k) {
        ll d;
        cin >> d;
        REP(j, d) {
            ll a;
            cin >> a;
            a--;
            cnt[a]++;
        }
    }

    ll ret = 0;
    REP(i, n) if(cnt[i]==0) ret++;
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3588
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
    }

    let mut dp = vec![0usize; n+1];

    for i in 1..=n {
        let mut j = i;
        while j <= n {
            dp[j] += 1;
            j += i;
        }
    }

    let mut ans: usize = 0;
    for i in 1..=n {
        ans += i * dp[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 80160
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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 (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

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

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

    int N, D;
    cin >> N >> D;

    if (N%(1+2*D) == 0) cout << N/(1+2*D) << endl;
    else cout << N/(1+2*D)+1 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;


public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
 
        int[] A = new int[N+1];		//?????????index?????? 1~N+1?????????
        for(int i=0; i<N; i++)		
            A[1+i] = sc.nextInt();	
 
 	for(int i=1; i<N+1; i++){	
	    int parent = i/2;
	    int left = 2*i;
	    int right = 2*i +1;

	    String id,k,pk,lk,rk;
	    id = "node "+i+": ";
	    k  = "key = "+ A[i] + ", ";
	    pk = ( (i!=1)? "parent key = " + A[parent] + ", " : "" );
	    lk = ( (left<=N)?  "left key = "+A[left] + ", " : "");
            rk = ( (right<=N)? "right key = "+A[right] + ", " : "");
            
            System.out.print(id + k + pk + lk + rk + "\n");
	}
    }
}

Measured memory_bytes: 27432