akhauriyash/Code-Regression huggingface dataset:
//In The Name Of God
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<double, double> dd;
typedef pair<dd, double> ddd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<dd> vdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ii> vii;
typedef vector<vii> vvii;

#define forn(i, n) for (int i = 0; i < n; i++)
#define forr(i, n) for (int i = n; i >= 0; i--)
#define forne(i, x, n) for (int i = x; i < n; i++)
#define forre(i, x, n) for (int i = n; i >= x; i--)
#define all(a) (a).begin(), (a).end()
#define inf 1000000000
#define eps 1e-9
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(0);
    string str; cin >> str;
    forn(i, str.size()) {
        if (str[i] == 'A') str[i] = 'T';
        else if (str[i] == 'T') str[i] = 'A';
        else if (str[i] == 'C') str[i] = 'G';
        else if (str[i] == 'G') str[i] = 'C';
    }
    cout << str << endl;

    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val A = Array(3) { listOfInt() }
    val N = nextInt()
    val B = Array(N) { nextInt() }
    val F = Array(3) { BooleanArray(3) }
    B.forEach { b ->
        repeat(3) { i ->
            repeat(3) { j ->
                if (A[i][j] == b) F[i][j] = true
            }
        }
    }
    var ans = false
    for (i in 0 until 3) {
        ans = ans or (F[i][0] and F[i][1] and F[i][2])
    }
    for (j in 0 until 3) {
        ans = ans or (F[0][j] and F[1][j] and F[2][j])
    }
    ans = ans or (F[0][0] and F[1][1] and F[2][2])
    ans = ans or (F[0][2] and F[1][1] and F[2][0])
    println(if (ans) "Yes" else "No")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)


Measured memory_bytes: 37868
#include <stdio.h>
#define MAX_N 100

int main(void) {
  int N, K;
  scanf("%d %d", &N, &K);
  int MaxK = (N-2) * (N-1) / 2;
  if(MaxK < K) {
    printf("-1\n");
    return 0;
  }

  // Make Graph
  char D[MAX_N][MAX_N];
  D[0][0] = 0;
  for(int i = 1; i < N; i++) {
    D[0][i] = 1;
    for(int j = i; j < N; j++) {
      D[i][j] = (i == j) ? 0 : 2;
    }
  }

  int M = N-1;
  int nowK = MaxK;
  for(int i = 0; (i < N-1) && (K < nowK); i++) {
    for(int j = i+1; (j < N) && (K < nowK); j++) {
      //printf("i=%d j=%d, M=%d nowK=%d\n", i, j, M, nowK);
      if(D[i][j] == 2) {
	M++;
	nowK--;
	D[i][j] = 1;
      }
    }
  }
  printf("%d\n", M);
  for(int i = 0; i < N-1; i++) {
    for(int j = i+1; j < N; j++) {
      if(D[i][j] == 1) {
	printf("%d %d\n", i+1, j+1);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define INF 1000000
void warshall_floyd(void);
int min(int,int);
int graph[101][101],n,c,d;

int main(void){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=(i==j?0:INF);

    for(i=0;i<k;i++){

      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	printf((graph[a][b]>=INF)?"-1\n":"%d\n",graph[a][b]);
      }
    }
  }
  return 0;
}

void warshall_floyd(void){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return (x<y)?x:y;
}

Measured memory_bytes: 456
#include <iostream>

using namespace std;

int main(){
    string N;
    //3桁の正の数Nを定義
    cin >> N;
    //Nの順で
    if(N[0] == N[2]){ //配列は0から数えるので1番目の0と3番目の2
        cout << "Yes" << endl;
        //100桁の位の数と1のくらいの数が一致すればYesと出力
    } else {
        cout << "No" << endl;
        //それ以外はNoと出力
    }
}

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000001;
using namespace std;
typedef long long ll;

string s;

int main(){
  std::cin >> s;
  int tmp = MAX;
  int res;
  rep(i,0,s.size()-2){
    int x = 100*(s[i]-'0')+10*(s[i+1]-'0')+(s[i+2]-'0');
    if(abs(753-x) < tmp){
      tmp = abs(x-753);
      res = x;
    }
  }
  std::cout <<tmp << '\n';
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
xyh = []
for i in range(N):
    x, y, h = LI()
    xyh.append([x, y, h])


"""

C_x C_y H

XYの高度はmax(H - abs(X - C_x) - abs(Y - C_y), 0)
"""
xyh = sorted(xyh, key=lambda xyh: xyh[2], reverse=True)

# print(xyh)
ans = (0,0,0)
for c_x in range(101):
    for c_y in range(101):
        H = 0
        flag = True
        for i, (x, y, h) in enumerate(xyh):
            if i == 0:
                H = h + abs(x - c_x) + abs(y - c_y)
            if h != max(H - abs(x - c_x) - abs(y - c_y), 0):
            # if H != max(h + abs(x - c_x) + abs(y - c_y), 0):
                flag = False
        if flag:
            ans = (c_x, c_y, H)
    
X, Y, H = ans
print(X, Y, H)



Measured memory_bytes: 10864
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and (c-a-b)>0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 64956
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a), i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	set<ll> A;
	ll N;
	cin >> N;
	REP(i, N){
		ll a;
		cin >> a;
		A.insert(a);
	}
	if(N==SIZE(A)){
		cout << "YES";
	}else{
		cout << "NO";
	}
	cout << endl;
}


Measured memory_bytes: 9600
#include<stdio.h>
#include<string.h>

int main(void)
{
	int n,i,j,k,l;
	int ts,hs;
	char tcard[100],hcard[100];

	scanf("%d",&n);
	ts = 0;
	hs = 0;
	for(i = 0;i < n;i++){
		scanf("%s %s",tcard, hcard);
		if(strcmp(tcard,hcard) == 0){
			ts++;
			hs++;
		}
		else if(strcmp(tcard,hcard) > 0){
			ts += 3;
		}else{
			hs += 3;
		}
	}
	printf("%d %d\n",ts,hs);
	return 0;
}

Measured memory_bytes: 604
import java.util.Scanner;

public class Main {
	public static void main(String[] args){



		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		String s = sc.next();
		String[] ss = s.split("");
		boolean ans = false;
		if(n%2!=0) {
			
		}else {
			for(int i=0;i<n/2;i++) {
				if(ss[i].equals(ss[i+n/2])) {
					ans = true;
				}else {
					ans = false;
					break;
				}
			}
		}
		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
		
		
		
	}

	

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 21332
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream in = System.in;
        OutputStream out = System.out;
        FastScanner fs = new FastScanner(in);
        PrintWriter pw = new PrintWriter(out);
        String S = fs.next();
        String[] tmp = S.split("/", 0);
        Integer[] array = new Integer[3];
        for(int i = 0; i < 3; i++) {
            array[i] = Integer.parseInt(tmp[i]);
        }
        boolean flag = false;
        if(array[0] < 2019) {
            flag = true;
        } else if(array[0] == 2019) {
            if(array[1] <= 4) {
                flag = true;
            }
        }
        if(flag) System.out.println("Heisei");
        else System.out.println("TBD");
        pw.close();
    }
}

class FastScanner {

    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
 
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
 
    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }
    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                    throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }
 
    public long nextLong() {
        return Long.parseLong(next());
    }
 
    public int nextInt() {
        return Integer.parseInt(next());
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
 
    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: 20308
#include<bits/stdc++.h>
using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n;cin>>n;
  ll p;
  for(i=0;i<n;i++){
    cin>>p;
    if(p%2==1){
      judge=false;
      break;
    }
  }
  ans(judge,"second","first");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1ll<<60
#define int long long
using namespace std;
bool isday(int d,int m){
  if(d<100 && d>=10){
    if((((d/10) * (d%10))==m) && d/10>=2 && d%10>=2){
      return true;
    }
  }
  return false;
}
signed main(){
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int m,d,c=0;
  cin>>m>>d;
  for(int i=10; i<=d; i++){
    for(int j=1; j<=m; j++){
      if(isday(i,j)){
        c++;
      }
    }
  }
  cout<<c<<endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
from operator import mul
from functools import reduce
mod=10**9+7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for i in range(1,k+1):
  if n-k+1<i:
    print(0)
  else:
    print(cmb(n-k+1,i)*cmb(k-1,i-1)%mod)

Measured memory_bytes: 3944
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String[] line = scanner.nextLine().split(" ", n);
        int min = 1001;
        int max = -1;
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(line[i]);
            if (a > max) {
                max = a;
            }
            if (a < min) {
                min = a;
            }
        }
        System.out.println(max - min);
    }
}


Measured memory_bytes: 21588
#include <stdio.h>
#include <algorithm>
#include <iostream>

using namespace std;

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

  long long unsigned int res1 = 0, res2 = 0;
  res1 = n/ k;

  if (k % 2 != 1) {
    res2 = (n + k / 2) / k;
  }

  cout << res1 * res1 * res1 + res2 * res2 * res2 << 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);
		ArrayDeque<Integer> ansA = new ArrayDeque<Integer>();
		ArrayDeque<Integer> ansB = new ArrayDeque<Integer>();

		while(sc.hasNext()){
			int m = sc.nextInt();
			int n = sc.nextInt();
			if(n>m){
				int l = m;
				m=n;
				n=l;
			}
			int a = m;
			int b = n;			
			while(n!=0){
				int l = n;
				n = m%n;
				m = l;
			}
			ansA.push(m);
			ansB.push((a/m)*b);
		}
		int num = ansA.size();
		for(int i=0;i<num;i++){
			System.out.println(ansA.pollLast() + " " + ansB.pollLast());
		}
	}
}

Measured memory_bytes: 17232
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

int main() {
    const double PI=3.141592653589;

    int a, b, x; cin >> a >> b >> x;

    double total = a * a * b;
    double diff = total - x;
    double ans = 0;
    if (diff < x) {
        double ans_rad = atan((2.0 * diff) / (a * a * a));
        ans = (ans_rad * 180) / PI;
    } else {
        double rad = atan( (2.0 * x) / (a * b * b));
        double deg = (rad * 180) / PI;
        ans = 90 - deg;
    }
    printf("%.8f\n", ans);
    return 0;
}


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

vector<vector<int> > edges;
vector<bool> vis;
vector<int> indeg;
vector<int> dist;
void dfs(int start){
	
	vis[start] = true;
	for(auto i : edges[start]){
		dist[i] = max(dist[i],dist[start] + 1);
		indeg[i]--;
		if(indeg[i]==0) dfs(i);
	}
	
	
}


int main(){
	int n,m;
	cin>>n>>m;
	edges.resize(n+1);
	vis.resize(n+1,false);
	indeg.resize(n+1,0);
	dist.resize(n+1,0);
	int aa,bb;
	for(int i=0;i<m;i++){
		cin>>aa>>bb;
		edges[aa].push_back(bb);
		indeg[bb]++;
	}
	
	for(int i=1;i<=n;i++){
		if(vis[i]==false && indeg[i]<1){
			dfs(i);
		}
	}
		
	int ans = 0;
	for(int i=1;i<=n;i++){
		ans = max(ans,dist[i]);
	}
	cout<<ans;
	
	
	return 0;
	
}


Measured memory_bytes: 9600
N = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if a[i] != a[j] and a[j] != a[k] and a[i] != a[k] and i<j and j<k:
                if a[i]<(a[j]+a[k]) and a[j]<(a[i]+a[k]) and a[k]<(a[i]+a[j]):
                    s += 1
print(s)

Measured memory_bytes: 9108
#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>

using namespace std;
#define endl "\n"
#define FILEIO freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define LL long long 
#define mod 1000000007LL
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pp pop_back
//#define p push
#define I insert
#define bg begin()
#define ed end()
#define sz size()
#define all(v) v.begin(),v.end()
typedef vector<LL> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef map<LL ,LL > mii;
//typedef priority_queue<int> pq;
typedef queue<int>que;
typedef stack<int>stk;
#define Inf 100000005LL
#define f first
#define s second





vi vect_2pow;
void pow_of_2(){
    vect_2pow.assign(32,0);
      for(int i=0;i<=32;i++){
           LL y = 1<<i;
           vect_2pow[i]=y;
      }
}
bool Ispalindrome(string str){
        LL len = str.size();
		bool flag;
		for(int i=0;i<len/2;i++){
				if(str[i]==str[len-i-1])
				     {
						 flag=0;
						 continue;
					 }
					 else 
					    {
							flag=1;
							break;
						}
			}
		if (flag==1)
		  return false;
		else return true;  
		
}
vector<LL> prime_check;
mii get_high_prime;
int high_prime_factor(){
	//cout<<"ecd";
	LL max_prime=0;
	for(int i=2;i<100000;i++)
	{
		LL n=i;
		
		while(n%2==0)
		{
			max_prime=2;
			n>>=1;
		}
		for(int j=3;j<=sqrt(n);j++)
		{
			while(n%j==0){
				max_prime=j;
				n/=j;
			}
		}
		if(n>2)
		  max_prime=n;
		  
		//prime_check.pb(max_prime);
		get_high_prime[i]=max_prime;
	}
	
			
}
vi vect[2000001];
LL ans=0;
bool flag=0;
mii check;
vi store;
void dfs(LL k,LL par){
    
	for(auto x:vect[k])
	  {
		  check[x]++;
		  if(check[x]==2){
		       store[x]=ans;
		  }
		  if(x==par){
			  flag=1;
		  }
		  if(flag==0)
		       dfs(x,par);
	  }

	  ans++;

}
void dfs1(LL k)
{
	for(auto x:vect[k])
	    check[x]=0;
}
int main(){

  
	  double n;
	  cin>>n;
	  cout<< 2 * 3.14*n;

   
}

Measured memory_bytes: 50704
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	S := sc.nextStr()
	l := 0
	r := N/2 + 1
	for (r - l) > 1 {
		mid := (r + l) / 2
		if f(mid, S) {
			l = mid
		} else {
			r = mid
		}
	}

	fmt.Fprintln(wtr, l)
}

func f(m int, S string) bool {
	res := false
	for i := 0; i <= len(S)-2*m; i++ {
		str := S[i : i+m]
		for j := i + m; j <= len(S)-m; j++ {
			if str == S[j:j+m] {
				res = true
				break
			}
		}
	}
	return res
}


Measured memory_bytes: 640
#define _''
struct T{int a,b;}A[_];long P[_],M=1e9+7,F[_],I[_]={1},X;i,j,k,t;c(a,b)struct T*a,*b;{t=a->a-b->a?:a->b-b->b;}p(a,b){return b?p(a%M*a%M,b/2)*(b%2?a:1L)%M:1;}f(a,b){return F[a+b]*I[a]%M*I[b]%M;}main(s){for(;++X<_;)I[X]=p(s=F[X]=X*s%M,M-2);for(k=A;~scanf("%d",k);k+=4)i++-1||gets(P);for(qsort(A,i/=2,8,c);j<i;P[j++]=X)for(X=f(s=A[k=j].a-=1,t=A[j].b-=1);k--;)X=t<A[k].b?X:(X-f(s-A[k].a,t-A[k].b)*P[k]%M+M)%M;printf("%d",X);}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    int n, t;
    cin >> n >> t;
    int sum = t, s = 0, e = t;
    rep(i, n) {
        int tt;
        cin >> tt;
        if (tt <= e) sum += tt - s;
        else sum += t;
        s = tt, e = tt + t;
    }
    cout << sum << endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
const int INF=2e9+10;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert
#define era erase
typedef vector<int> vi;
typedef queue<int> qi;
typedef greater<int> gi;
typedef priority_queue<int> pqi;
typedef priority_queue<int,vi,gi> pqgi;

int read() {
	int xx=0,ww=1;
	char ch=getchar();
	while(ch>'9'||ch<'0') {
		if(ch=='-') ww=-ww;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') {
		xx=10*xx+ch-48;
		ch=getchar();
	}
	return xx*ww;
}

int n;
int a,b;

int main() {
	n=read();
	for(int i=1;i<=n;i++){
		a=read();
		if(a&1==1) b=1;
	}
	if(b==1) puts("first");
	else puts("second");
	return 0;
}

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

int main(void) {
    int N;cin>>N;
    vector<int> cur;
    for (int i = 0; i < N; i++) {
        int A;cin>>A;
        cur.push_back(A);
    }
    
    while (cur.size() > 1) {
        sort(cur.begin(), cur.end());
        vector<int> tmp_cur;
        tmp_cur.push_back(cur.at(0));
        for (int i = 1; i < cur.size(); i++) {
            int tmp = cur.at(i) % cur.at(0);
            if (tmp > 0) tmp_cur.push_back(tmp);
        }
        cur = tmp_cur;
    }
    cout << cur.at(0) << endl;
    return 0;
}

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

int main(){
  int n;
  cin>>n;
  int t[n],x[n],y[n];
  for(int i=0;i<n;i++){
    cin>>t[i]>>x[i]>>y[i];
  }
  int xx=0, yy=0, tt=0;
  for(int i=0;i<n;i++){
    for(int j=tt;j<=t[i];j++){
      if (x[i]!=xx){
        if (x[i]>xx){
          xx++;
        }else{
          xx--;
        }
        continue;
      }else if (y[i]!=yy){
        if (y[i]>yy){
          yy++;
        }else{
          yy--;
        }
        continue;
      }else{
        if ((t[i]-j)%2==0){
          break;
        }else{
          cout<<"No"<<endl;
          return 0;
        }
      }
    }
    if (x[i] != xx || y[i] != yy){
      cout<<"No"<<endl; return 0;
    }
    tt=t[i];
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
using namespace std;

    const ll N = 1e2 + 7;
    const ll mod = 1e9 + 7;
    const ll inf = 1e9;



void solve(){
    ll a , b , c , k;
    cin >> a >> b >> c >> k;
    ll sum = 0;
    sum += min(k , a);
    k -= sum;
    if(k >= b){
        k -= b;
    }
    else{
        k = 0;
    }
    cout << sum - k;

}

int main(){

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);

    int tt = 1;
    //cin >> tt;
    while(tt --){
            solve();
    }
}

/**

**/


Measured memory_bytes: 3652
#include<stdio.h>
 
int main(void) {
	int N, i;
	long long a[200000] = { 0 };
	long long total = 0;
 
	scanf("%d", &N);
 
	for (i = 0; i < N; i++) {
		scanf("%lld", &a[i]);
	}
 
	for (i = 0; i < N-1; i++) {
		if (a[i] > a[i + 1]) {
			total += (a[i] - a[i + 1]);
			a[i + 1] = a[i];
		}
	}
	printf("%lld", total);
	return 0;
}

Measured memory_bytes: 3288
#include <iostream>
#include <cstdio>
using namespace std;
int a[105];
int main()
{
	int n,d,x;
	cin>>n>>d>>x;
	for(int i=1;i<=n;i++)
	  cin>>a[i];
	for(int i=1;i<=n;i++)
	  {
	  	int m=1,t=0;
	  	do
	  	{
	  		x++;
	  		t=(a[i]*m+1);
	  		m++;
	  	}while(t<=d);
	  }
	  cout<<x<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final char[] input = sc.next().toCharArray();
		
		LinkedList<Character> list = new LinkedList<Character>();
		for(final char ch : input){
			list.addLast(ch);
		}
		
		int answer = 0;
		while(!list.isEmpty()){
			boolean all_same = true;

			char prev = 0;
			for(final char ch : list){
				if(prev ==0){
					prev = ch; 
				}else if(prev != ch){
					all_same = false;
					break;
				}
			}
			
			if(all_same){
				break;
			}else{
				final char top = list.poll();
				
				while(list.peek() == top){ list.poll(); }
			}
			answer += 1;
		}
		
		System.out.println(answer);
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 17024
s = input()
n = len(s)
count10 = 0
count01 = 0
if s[0] == '1':
    for i in range(1, n):
        if i%2 != 0:
            if s[i] == '1':
                count10 += 1
        else:
            if s[i] == '0':
                count10 += 1
if s[0] == '0':
    for i in range(1, n):
        if i%2 != 0:
            if s[i] == '0':
                count01 += 1
        else:
            if s[i] == '1':
                count01 += 1
print(max(count01, count10))

Measured memory_bytes: 3188
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum = 0

for i in range(N):
    if A[i] <= B[i]:
        sum += A[i]
        B[i] -= A[i]
        if A[i+1] <= B[i]:
            sum += A[i+1]
            A[i+1] = 0
        else:
            sum += B[i]
            A[i+1] -= B[i]
    else:
        sum += B[i]

print(sum)

Measured memory_bytes: 82020
# include <bits/stdc++.h>
using namespace std;
int main () {
  int n;
  cin >> n;
  vector<int> list(n);
  for(int i=0; i<n; i++) {
    cin >> list.at(i);
  }
  sort(list.begin(),list.end());
  list.back() = list.back()/2;
  int ans=0;
  for(int i=0; i<n; i++) {
    ans += list.at(i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;



int main() {
    ios_base::sync_with_stdio(false); 

    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w));
    rep(i,h) {
        rep(j,w) cin >> s[i][j];
    } 
    bool flag=1;
    vector<int> di={0,-1,0,1},dj={1,0,-1,0};
    rep(i,h) {
        rep(j,w) {
            if (s[i][j]=='#') {
                int cnt=0;
                rep(k,4) {
                    int ni=i+di[k],nj=j+dj[k];
                    if (ni>=0 && ni<h && nj>=0 && nj<w) {
                        if (s[ni][nj]=='#') ++cnt;
                    }
                }
                if (cnt==0) flag=0;
            }
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
///Astalavista Code........~CodeSlayer007
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl
#define SPD_emergency ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
int M = 1e18;
const int N = 1e6 + 10;
const int IM = 1e15 + 37;
const int PI = 3.14159265;
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " "; cout << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << ' ' ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
inline void PP(int n) { cout << n << " ";}
inline void PP(int n, int m) { cout << n << " " << m << endl;}
inline void PP(int n, int m, int q) {  cout << n << " " << m << " " << q << endl;}
inline void PP(int n, int m, int q, int u) {  cout << n << " " << m << " " << q << " " << u << endl;}
inline void op() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
// <-------------------------------------------------------------------------------------------------------------------------------------------------------------------------> Ignore This--> setprecision memset substr pop_back  insert tuple first second push_back string continue make_pair break deque stack queue sort reverse accumulate  count lower_bound upper_bound next_permutation copy_n __builtin_popcount make_tuple
// <========================================================================================================================================================================

int a, b;
signed  main() {
    SPD_emergency
   
    int i, j, x, y, u, l;
    // int t; cin >> t; while (t--)
    {   i = j = x = y = u = l = 0;

        int x;
        double d;
        cin >> x >> d;
        d = d * x;
        x = floor(d);
        PT(x);



        /**/

    }


    return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define dump(a) cout << (a) << endl;
typedef long long Int;
Int mod = 1e9+7;
Int MOD = 998244353;

int main() {
    Int n;
    cin >> n;
    bool x = false;
    for (Int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a%2 == 1) x = true;
    }
    dump(x ? "first" : "second");
    return 0;  
}

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

int main(){
  string o,e;
  cin >> o;
  cin >> e;
  string ans;
  for(int i=0;i<o.size();++i){
    if(i==0){
      ans=o[i];
      ans+=e[i];
    }else{
      ans+=o[i];
      if(e.size()<=i){
        continue;
      }else{
        ans+=e[i];
      }
    }

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


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
int h[maxn];
int sum[maxn];
void run_case()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> h[i];
    }
    int ans = 0;
    for (int i = n - 1; i >= 1; i--)
    {
        if (h[i] >= h[i + 1])
        {
            sum[i] = sum[i + 1] + 1;
            ans = max(ans, sum[i]);
        }
        else
        {
            sum[i] = 0;
        }
        //DBG(sum[i]);
    }
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, k;
    cin >> n >> k;
    double ans = 0;
    REP(i,1,n+1){
        if(i >= k){
            ans += n-k+1.0;
            break;
        }else{
            ll x = ceil(log2((k+i-1)/i));
            ans += pow(0.5,x);
        }
    }
    ans /= (double)n;
    printf("%.10f\n",ans);
    return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define mins(x, y) x = min(x, y)
#define maxs(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;
const int mod = 1000000007;
//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

ll pow2(ll a, ll b) {
    if(b == 0) {
        return 1;
    }
    ll res = a;
    for (ll i = 1; i < b; i++) {
        res *= a;
    }
    return res;
}

int main() {
    ll d, n;
    cin >> d >> n;
    ll ans = pow2(100, d) * n ;

    if(n < 100) {
        cout << ans << endl;
        return 0;
    }
     cout << ans + pow2(100, d) << endl;

}




Measured memory_bytes: 256
using System;

namespace ABC126B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());

            int left = N / 100;
            int right = N % 100;

            if(1 <= left && left <= 12)
            {
                if(1 <= right && right <= 12)
                {
                    Console.WriteLine("AMBIGUOUS");
                }
                else
                {
                    Console.WriteLine("MMYY");
                }
            }
            else
            {
                if(1 <= right && right <= 12)
                {
                    Console.WriteLine("YYMM");
                }
                else
                {
                    Console.WriteLine("NA");
                }
            }
        }
    }
}


Measured memory_bytes: 13140
from collections import deque
S = deque(input())
Q = int(input())

reverse = False
for _ in range(Q):
    query = input().split()
    if query[0] == "1":
        reverse = not reverse
    else:
        tail = bool(int(query[1]) - 1) ^ reverse
        c = query[2]
        if tail:
            S.append(c)
        else:
            S.appendleft(c)

print("".join(reversed(S)) if reverse else "".join(S))


Measured memory_bytes: 74712
# D - Wizard in Maze
import sys
from collections import deque
from typing import List, Tuple


class WarpableMaze:
    __slots__ = ["height", "width", "road", "wall", "unsearched", "dist"]

    def __init__(
        self,
        height: int,
        width: int,
        grid: List[bytes],
        road: str = ".",
        wall: str = "#",
    ) -> None:
        self.height = height + 4
        self.width = width + 4
        self.road = road
        self.wall = wall
        self.unsearched = 1 << 30
        self.dist = self._convert_grid_to_dist(grid)

    def _flatten_dxy(self, x: int, y: int) -> int:
        return self.width * x + y

    def _flatten_coordinate(self, h: int, w: int) -> int:
        return self._flatten_dxy(h + 2, w + 2)

    def _convert_grid_to_dist(self, grid: List[bytes]) -> List[int]:
        dist = [-1] * self.height * self.width
        i = self.width * 2 + 1
        for row in grid:
            for c in row.decode():
                i += 1
                if c == self.road:
                    dist[i] = self.unsearched
            i += 4
        return dist

    def bfs(self, start_2d: Tuple[int, int], goal_2d: Tuple[int, int]) -> int:
        start = self._flatten_coordinate(*start_2d)
        goal = self._flatten_coordinate(*goal_2d)

        w = self.width
        walk_to_warp = {
            -w: (-2 * w - 2, -2 * w - 1, -2 * w, -2 * w + 1, -w - 1),
            w: (w + 1, 2 * w - 1, 2 * w, 2 * w + 1, 2 * w + 2),
            -1: (-w - 2, -2, w - 2, w - 1, 2 * w - 2),
            1: (-w + 1, -2 * w + 2, -w + 2, 2, w + 2),
        }

        dist = self.dist[:]
        dist[start] = 0
        queue = deque([start])
        while queue:
            x = queue.popleft()
            cur_dist = dist[x]
            if x == goal:
                break

            for walk, warp in walk_to_warp.items():
                nx = x + walk
                if dist[nx] > cur_dist:
                    dist[nx] = cur_dist
                    queue.appendleft(nx)
                    continue
                if dist[nx] >= 0:
                    continue

                for dx in warp:
                    nx = x + dx
                    if dist[nx] > cur_dist + 1:
                        dist[nx] = cur_dist + 1
                        queue.append(nx)

        return dist[goal] if dist[goal] != self.unsearched else -1

    def debug(self):
        print("<DEBUG>", file=sys.stderr)
        for row in zip(*[iter(self.dist)] * self.width):
            print(*row, file=sys.stderr)


def main():
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline

    H, W = map(int, readline().split())
    CH, CW = map(int, readline().split())
    DH, DW = map(int, readline().split())
    (*S,) = read().split()

    maze = WarpableMaze(H, W, S)
    start, goal = (CH - 1, CW - 1), (DH - 1, DW - 1)
    print(maze.bfs(start, goal))
    # maze.debug()


if __name__ == "__main__":
    main()


Measured memory_bytes: 96708
// A.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[]) {
	string a, b;
	cin >> a >> b;
	reverse(b.begin(), b.end());
	cout << (a == b ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  vector<int> cnt(N, 1);
  vector<bool> ok(N, false);
  ok[0] = true;
  for (int i = 0; i < M; i++){
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    if (ok[x]){
      ok[y] = true;
      if (cnt[x] == 1){
        ok[x] = false;
      }
    }
    cnt[x]--;
    cnt[y]++;
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    if (ok[i]){
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main (){
  int N, a, b, c, d;
  cin >> N;
  a = N / 1000;
  b = (N % 1000) / 100;
  c = (N % 100) / 10;
  d = N % 10;
  if (((a == b) && (b == c)) || (b == c) && (c == d)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func power(a, b int64) int64 {
	if b == 0 {
		return int64(1)
	}
	ret := power(a, b/2)
	ret *= ret
	if b%2 == 1 {
		ret *= a
	}
	return ret
}

func main() {
	var n int64
	fmt.Scan(&n)

	var sqn int
	for sqn = 1; int64(sqn)*int64(sqn) < n; sqn++ {
	}

	isnotPrime := make([]bool, sqn+1)
	ans := 0

OUTER:
	for i := 2; i <= sqn; i++ {
		if isnotPrime[i] {
			continue OUTER
		}
		for j := 2; i*j <= sqn; j++ {
			isnotPrime[i*j] = true
		}
		for j := 1; ; j++ {
			if n%power(int64(i), int64(j)) == 0 {
				ans++
				n /= power(int64(i), int64(j))
			} else {
				break
			}
		}
	}
	if n != 1 && n > int64(sqn) {
		fmt.Println(ans + 1)
		return
	}
	fmt.Println(ans)
	return
}


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

#define MOD 1000000007

int main(){
    int n;
    long long int ans = 0, sum = 0;
    vector<long long int> v, c;

    cin >> n;

    for (int i = 0; i < n; i++){
        v.push_back(0);
        // c.push_back(0);
        cin >> v[i];
        // sum += v[i];
    }

    // c[n-1] = 0;

    for (int i = 0; i < n; i++)
    {
        // c[i] = c[i+1] + v[i+1];
        // // ans = (ans%MOD + (v[i]%MOD * c[i]%MOD)%MOD)%MOD;
        // ans += v[i]*c[i];;
        // ans %= MOD;

        ans += sum*v[i];
        sum += v[i];
        ans %= MOD;
        sum %= MOD;
    }

    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 5184
#include <stdio.h>

int main(){
  int N,A,B;
  int min,max;
  scanf("%d %d %d",&N,&A,&B);
  
  if(A<B) max=A;
  else max=B;
  
  min=A+B-N;
  if(min<0) min=0;
  
  printf("%d %d\n",max,min);
  return 0;
}

Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
using namespace std;
int isPrime(int x){
  int i;
  if(x < 2)return 0;
  else if(x==2)return 1;
  if(x%2 == 0)return 0;
  for(i=3 ; i*i <= x ; i+=2){
    if(x%i == 0)return 0;
  }
  return 1;
}
int main(){
  
  int N,P;
  
  while(1){
    
    cin >>N>>P;
    if(N==-1 && P==-1)break;

    int cnt=0;
    int prime[P];
    for(int i=N+1 ; cnt < P ; i++){
      if(isPrime(i)){
	prime[cnt]=i;
	cnt++;
      }
    }
    int sum[P*P];
    int cnt2=0;
    for(int i=0 ; i < P ; i++){
      for(int j=i ; j < P ; j++){
	sum[cnt2]=prime[i]+prime[j];
	cnt2++;
      }
    }
    sort(sum,sum+cnt2);

    cout <<sum[P-1]<<endl;
      
  }
  
  return 0;
}

Measured memory_bytes: 1216
n = gets.to_i
a = gets.split.map(&:to_i).take(n)
b = gets.split.map(&:to_i).take(n)
c = gets.split.map(&:to_i).take(n - 1)

result = 0
prev = -999

a.each do |i|
  # b列の料理を食べる
  current = i - 1
  result += b[current]

  # 直前に1つ前の料理を食べていたら直前のc列の満足度を得られる
  if prev + 1 == current
    result += c[prev]
  end

  # 直前に食べた料理の添字を記憶しておく
  prev = current
end

puts result

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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back




int main() {
    int n;
    while(cin>>n){
        if(n==0)break;
       
        vector<pair<int,string> > in;
        rep(i,n){
            string s;
            cin>>s;
            int sum=0;
            rep(i,4){
                int a,b;
                cin>>a>>b;
                sum+=a*60+b;
            }
            in.pb(pair<int,string>(sum,s));
        }
        sort(all(in));
        cout<<in[0].second<<endl;
        cout<<in[1].second<<endl;
        cout<<in[(int)in.size()-2].second<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 1532
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a;
        while(true){
            int sum1=0;
            double sum2=0;
            a=sc.nextInt();
            if(a==0) break;
            int array1[]=new int[a];
            double array2[]=new double[a];
            for(int i=0;i<a;i++) array1[i]=sc.nextInt();
            for(int i=0;i<a;i++) sum1+=array1[i];
            for(int i=0;i<a;i++) array2[i]=Math.pow((double)array1[i]-((double)sum1/a),2);
            for(int i=0;i<a;i++) sum2+=array2[i];
            System.out.println(String.format("%.8f",Math.sqrt(sum2/a)));
        }
        sc.close();
    }
}


Measured memory_bytes: 31848
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];
        for(int i = 0; i < N; i++){
            a[i] = sc.nextInt();
        }
        SelectionSort(a);
    }
    

    static void SelectionSort(int[] a){
    int count = 0;
    for (int i = 0; i <  a.length - 1; i++) {
        int mini = i; 
        //最小値探す
        for (int j = i + 1; j < a.length; j++) {
            if (a[mini] > a[j]) {     
                //miniに最小値の場所入れて置く
                mini = j;
            }
        }    
        //最小値の場所が入れ替わっているとき
        if(mini != i){
            int e = a[mini];
            a[mini] = a[i];
            a[i] = e;
            count++;
        }
        

          
            
        
    }
    System.out.println(Arrays.toString(a) .replaceAll("[\\[\\],]", ""));
    // replaceAll() 、「文字列を正規表現で置換」対象の文字列.replaceAll("[正規表現]", "置換する文字列")
    // \ 　→　\\\  ,　*  →  \\*　, {} →  \\{\\} , [], → \\[\\],
        System.out.println(count);
}
    
}




Measured memory_bytes: 26492