akhauriyash/Code-Regression huggingface dataset:
program siax
  implicit none
  integer :: N,l,i

  real(8) :: c,d,e
  character(len=15) :: S
  read(*,*) S
  l=0
  do i=1,len_trim(S)
     if(S(i:i).eq.'o') then
        l=l+1
     endif
  enddo
  if((15-len_trim(S)+l).lt.8) then
     write(*,'(a)') 'NO'
  else
     write(*,'(a)') 'YES'
  endif
!  write(*,'(i0)') l                                                                                                                                     
end program siax



Measured memory_bytes: 768
using System;

class Program
{
	static void Main()
	{
		var hw = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var h = hw[0];
		var w = hw[1];

		var s = new bool[w, h];
		for (var y = 0; y < h;  ++y) {
			var line = Console.ReadLine();
			for (var x = 0; x < w; ++x) {
				s[x, y] = line[x] == '#';
			}
		}

		var vectors = new[] {
			new { X = -1, Y = -1 },
			new { X = 0, Y = -1 },
			new { X = 1, Y = -1 },
			new { X = -1, Y = 0 },
			new { X = 1, Y = 0 },
			new { X = -1, Y = 1 },
			new { X = 0, Y = 1 },
			new { X = 1, Y = 1 },
		};

		for (var y = 0; y < h; ++y) {
			for (var x = 0; x < w; ++x) {
				if (s[x, y] == false) {
					var count = 0;
					foreach (var vector in vectors) {
						var targetX = x + vector.X;
						var targetY = y + vector.Y;
						if (targetX >= 0 && targetX < w && targetY >= 0 && targetY < h) {
							if (s[targetX, targetY]) {
								++count;
							}
						}
					}

					Console.Write(count);
				} else {
					Console.Write("#");
				}
			}

			Console.WriteLine(string.Empty);
		}
	}
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sz 100100
int a[sz];
int b[sz];
int c[sz];
int dpa[sz];
int dpb[sz];
int dpc[sz];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i] >> b[i] >> c[i];
	for (int i = 1; i <= n; i++)
	{
		dpa[i] = max(dpb[i - 1], dpc[i - 1]) + a[i - 1];
		dpb[i] = max(dpa[i - 1], dpc[i - 1]) + b[i - 1];
		dpc[i] = max(dpa[i - 1], dpb[i - 1]) + c[i - 1];
	}
	cout << max(dpa[n], max(dpb[n], dpc[n]));
	return 0;
}

Measured memory_bytes: 5912
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define int long long
//#define double long double
#define moder 1000000007
#define P std::pair<int,int>
using namespace std;

double n,s[1010];
signed main(){
	while(true){
		cin>>n;
		if(!n)break;
		double sum=0;
		rep(i,n){
			cin>>s[i];
			sum+=s[i];
		}
		sum/=n;
		double cnt=0;
		rep(i,n){
			cnt+=pow(s[i]-sum,2);
		}
		cnt/=n;
		printf("%.12lf\n",sqrt(cnt));
	}
	return 0;
}


Measured memory_bytes: 3220
#include <stdio.h>
#include <math.h>
#include <string.h>
#define N 20
int main(void){
	double n,m,l,ans;
	char str[N];

	for( ; ; ){
		fgets(str,sizeof(str),stdin);	
		sscanf(str,"%lf",&n);
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%lf",&m);
		if(n==0 && m==0)
			break;
		l=sqrt((n/2)*(n/2)+m*m);
		ans=n*n+l*n*2;
		printf("%f\n",ans);			
	}
	return 0;
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define For(i,n) for(int i=0;i<n;i++)
#define Fre(i,a,b) for(int i = a; i < b; i++)
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pfn(n) printf("%d\n", n)
#define pfs(n) printf("%d ", n)
#define ff first
#define ss second
#define mem(a,b) memset(a,b,sizeof(a))
#define READ freopen("in.txt", "r", stdin)
#define WRITE freopen("out.txt", "w", stdout)
#define sz size()
#define number_of_digit(n) __builtin_ffs(n);
#define ll long long
#define T int
#define ld long double
inline void print(T n)
{
	if (n == 0)
	{
		putchar('0');
		putchar('\n');
	}
	else if (n == -1)
	{
		putchar('-');
		putchar('1');
		putchar('\n');
	}
	else
	{
		char buf[11];
		buf[10] = '\n';
		int i = 9;
		while (n)
		{
			buf[i--] = n % 10 + '0';
			n /= 10;
		}
		while (buf[i] != '\n')
			putchar(buf[++i]);
	}
}
int read()
{
       int cc = getc(stdin);
       for (;cc < '0' || cc > '9';)  cc = getc(stdin);
       int ret = 0;
       for (;cc >= '0' && cc <= '9';)
       {
          ret = ret * 10 + cc - '0';
          cc = getc(stdin);
       }
      return ret;
}
ll power(ll num,ll g)
{
	if(g==0)return 1;

	if(g%2==1)return (num*power((num*num)%mod,g/2))%mod;
	return power((num*num)%mod,g/2);
}
vector<int> vec[100005];
int a[100005];
int dfs(int index)
{
	if(a[index]>=0)return a[index];
	//a[index]=0;
	For(i,vec[index].size())
	{
		if(a[vec[index][i]]==-1)a[vec[index][i]]=dfs(vec[index][i]);
		a[index]=max(a[index],a[vec[index][i]]);
	}
	return ++a[index];
}
int main()
{
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
  	cout.tie(NULL);

  	int n,m;
  	cin>>n>>m;
  	For(i,m)
  	{
  		int x,y;
  		cin>>x>>y;
  		vec[x].pb(y);
  	}
  	int maximum=0;
  	For(i,n)a[i+1]=-1;
  	For(i,n)
  	{
  		a[i+1]=dfs(i+1);
  		maximum=max(maximum,a[i+1]);
  	}
  	cout<<maximum<<endl;
	return 0;
}

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

const int N = 100005;

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

int a[N],b[N];

int main()
{
	int n = read(), L = read(), T = read();
	int s = 1;
	for (int i = 1; i <= n; i++)
	{
		int x = read(), w = read();
		if (w == 1)
		{
			a[i] = (x + T) % L;
			if (T >= L - x)
				(s -= (T - L + x) / L + 1) %= n;
		}
		else
		{
			a[i] = ((x - T) % L + L) % L;
			if (T >= x + 1)
				(s += (T - x - 1) / L + 1) %= n;
		}
	}
	s = (s % n + n - 1) % n + 1;
	std::sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; i++)
		b[(s + i - 2) % n + 1] = a[i];
	for (int i = 1; i <= n; i++)
		printf("%d\n",b[i]);
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m; 
	scanf("%d%d",&n,&m);
	if((n+m)%2==0)printf("%d\n",(n+m)/2);
	else if((n+m)%2!=0)printf("IMPOSSIBLE\n");
	return 0;
}

Measured memory_bytes: 256
import itertools

n = int(input())
ps = tuple(map(int, input().split()))
qs = tuple(map(int, input().split()))

l = [i for i in range(1, n+1)]

pl = [v for v in itertools.permutations(l)]

a = pl.index(ps)
b = pl.index(qs)

print(abs(a-b))


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

int main()
{
    size_t N, K;
    cin >> N >> K;

    vector<int> A(N);
    for (int &a : A)
    {
        cin >> a;
        a--;
    }
    vector<int> visit(N, -1);
    size_t next = 0;
    for (size_t i = 0; i < K; i++)
    {
        if (visit[next] != -1)
        {
            long long period = i - visit[next];
            long long diff = K - i - 1;
            i += (diff / period) * period;
        }
        visit[next] = i;
        next = A[next];
    }
    cout << next + 1 << endl;
}

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

using namespace std;

int main() {

    int m, n;
    int num[18];
    string unit[18] = {
        "", "Man", "Oku", "Cho", "Kei", "Gai", "Jo", "Jou", "Ko",
        "Kan", "Sei", "Sai", "Gok", "Ggs", "Asg", "Nyt", "Fks", "Mts"
    };

    while(cin >> m >> n, n || m) {

        fill(num, num + 18, 0);
        num[0] = 1;

        for(int i = 0; i < n; ++i) {
            for(int j = 0; j < 18; ++j) {
                num[j] *= m;
            }
            int carry = 0;
            for(int j = 0; j < 18; ++j) {
                num[j] += carry;
                carry = num[j] / 10000;
                num[j] %= 10000;
            }
        }

        for(int i = 17; i >= 0; --i) {
            if(num[i]) {
                cout << num[i] << unit[i];
            }
        }
        cout << endl;

    }

}

Measured memory_bytes: 3184
import sys
import math
import collections
from collections import deque
#k = int(input())
h, w = map(int, sys.stdin.readline().split())
#s = input()
#x = sys.stdin.readline().split()
if h != 1 and w != 1:
    print(math.ceil(h*w/2))
else:
    print(1)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
typedef  long long ll ;
typedef unsigned  long long ull ;
using namespace std ;
const int N = 1e5 + 100 ;


ll n , k , dp[N] , arr[N] ;
int main() {
    cin >> n >> k ;
    for ( int i = 0 ; i < n ; i ++){
        cin >> arr[i] ;
    }
    dp[0] = 0 ;
    dp[1] = abs(arr[1] - arr[0]) ;
    for ( int i = 2 ; i < n ; i ++){
        ll mn = 1e18 ;
        for ( int j = 1 ; j <= k ; j ++){
            if (i-j < 0)break;
            mn = min ( abs(arr[i-j]-arr[i])+dp[i-j],mn );
        }
        dp[i]=mn ;
    }

    cout << dp[n-1];


    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int ans=0;
		int now=0;
		for(int i=0; i<str.length(); i++) {
			boolean isATCG=false;
			if(str.substring(i,i+1).matches("[A,T,C,G]")) {
				isATCG=true;
			}
			if(!isATCG) {
				now=0;
			}else {
				now++;
				ans=Math.max(ans,now);
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21204
function Main(arg) {

  var n = arg.split("\n")[0]-0;
  var a = arg.split("\n")[1].split(" ").map(Number);

  var tmp = [];
  for (var i = 1; i < n; i++){
    tmp.push(a[i - 1] - a[i]);
  }

  var ans = 0;
  var f = false;
  var diff = 0;
  for (var i = 0; i < tmp.length; i++){
    if (!f) {
      if (tmp[i] === 0) {
        continue;
      }
      f = !f;
      diff = tmp[i];
    }
    else {
      if (diff > 0) {
        if (tmp[i] < 0) {
          ans++;
          f = !f;
        }
      }
      else if(diff < 0){
        if (tmp[i] > 0) {
          ans++;
          f = !f;
        }
      }
    }
  }
 
  console.log(++ans);
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

/* コンプリートボーナスを受け取る問題群をbit全探索する。
   コンプリートボーナスを受け取る問題群を決めたあと、残り必要なポイントを計算し、
   コンプリートボーナスを受け取らない問題に関して貪欲法を用いてできるだけ少なく問題を解く。*/
int main(void){
    int D, G;
    cin >> D >> G;
    int p[D], c[D];
    rep(i,D){
        cin >> p[i] >> c[i];
    }
    int ans = INT_MAX;
    rep(bit,1<<D){
        int point = 0;
        int solved = 0;
        rep(i,D){
            if(!(bit & 1<<i)) continue;
            point += p[i] * (i+1) * 100 + c[i];
            solved += p[i];
        }
        brep(i,D){
            if (point >= G)break;
            if (bit & 1<<i)continue;
            int add_solved = min(p[i], int(ceil((double(G - point) / ((i+1) * 100)))));
            solved += add_solved;
            point += add_solved * (i+1) * 100;
        }
        if(point >= G)ans = min(ans, solved);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
    int a;
    int b;
    int c;

    cin>>a>>b>>c;

    if(a==b){
    	cout<<c<<endl;
    }

    if(a==c){
    	cout<<b<<endl;
   }
    if(b==c){
    	cout<<a<<endl;
    }


    }


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

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

    int n, x, q;
    cin >> n;

    vector<int> v;
    for (int i = 0; i < n; i++) { cin >> x; v.pb(x); }

    cin >> q;
    sort(v.begin(), v.end());
    int ans = 0;
    while (q--) {
        cin >> x;
        ans += binary_search(v.begin(), v.end(), x) ? 1 : 0;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
  int N, M, i, j=0; cin >> N >> M;
  string a[N], b[M];
  rep(i, N) cin >> a[i];
  rep(i, M) cin >> b[i];
  while(a[j].find(b[j]) != -1){
    j++;
    if(j == M) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<62;

int main(){
    int n;
    cin>>n;
    cout << n*n*n << endl;
    return 0;
}



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

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

int main() {
  string S;
  cin >> S;
 
  rep (i, S.length()) {
    if (i % 2 == 0) {
      if (S.at(i) == 'R' || S.at(i) == 'U' ||  S.at(i) == 'D') {
        continue;
      } else {
        cout << "No" << endl;
        return 0;
      }
    } else {
      if (S.at(i) == 'L' || S.at(i) == 'U' ||  S.at(i) == 'D') {
        continue;
      } else {
        cout << "No" << endl;
        return 0;
      }
    }
  }

  cout << "Yes" << endl;
}

Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))
li = []
for i in range(N):
    if i == 1:
        cadA = A[N-1] - A[0]
    else:
        cadA = K - A[i] + A[i-1]
    if i == N-1:
        cadB = A[N-1] - A[0]
        cadB = 100000000000
    else:
        cadB = A[i] + (K - A[i+1])
        cadB = 100000000000
    li.append(min(cadA, cadB))
print(min(li))

Measured memory_bytes: 33388
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
int h,w;
int arr[25][25];
int dy[4]={0,0,1,-1};
int dx[4]={1,-1,0,0};
int solve(int a,int b){
	int ret = 0;
	bool visited[25][25]={false};
	queue<pair<pi,int> >q;
	q.push(make_pair(pi(a,b),0));
	visited[a][b] = true;
	while(!q.empty()){
		int y = q.front().first.first;
		int x = q.front().first.second;
		int d = q.front().second;
		ret = max(ret,d);
		q.pop();
		for(int i=0; i<4; i++){
			int yy = y+dy[i];
			int xx = x+dx[i];
			if(yy<1 || yy>h || xx<1 || xx>w) continue;
			if(visited[yy][xx] || arr[yy][xx]) continue;
			visited[yy][xx] = true;
			q.push(make_pair(pi(yy,xx),d+1));
		}
	}
	return ret;
}
int main(){
	cin>>h>>w;
	for(int i=1; i<=h; i++){
		string s;
		cin>>s;
		for(int j=0; s[j]; j++){
			if(s[j]=='#') arr[i][j+1] = 1;
		}
	}
	int ret = 0;
	for(int i=1; i<=h; i++){
		for(int j=1; j<=w; j++){
			if(arr[i][j]==0){
				ret = max(ret,solve(i,j));
			}
		}
	}
	cout<<ret;
}

Measured memory_bytes: 3632
a = input()

inp = a.split()

inp = [int(i) for i in inp]


point  = 0

for i in range(2):
	maxinp = 0
	maxind = 0
	for index, s in enumerate(inp):
		if maxinp < s:
			maxinp = s
			maxind = index
	
	point += maxinp
	inp[maxind] = maxinp - 1

print(point)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int MAX_X = 200000;
using ll = long long;

int main(){
  stack<char> st;
  st.push('G');
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='S'){
      st.push('1');
    }
    if(s[i]=='T'){
      char x=st.top();
      if(x=='1'){
        st.pop();
      }
      else{
        st.push('0');
      }
    }
  }
  cout<<st.size()-1<<endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s; cin >> s;
  int n = s.size();
  rep(i, n) {
    for(int j = 0; j <= n-i; ++j) {
      string t = "";
      if(i > 0) t += s.substr(0, i);
      if(i+j <= n) t += s.substr(i+j, n-(i+j));

      if(t == "keyence") {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
}

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

#define INF (1<<29)

vector<int> v;
int cnt;

int bs(int x){
  int r = v.size(), l = 0;

  while(l < r){
    int m = (r+l)/2;
    if(v[m] < x){
      l = m + 1;
    }else if(v[m] > x){
      r = m;
    }else if(v[m] == x){
      return 1;
    }
  }
  return 0;
}

int main(){
  int n, p;
  cin >> n;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(),v.end());

  cin >> p;
  for(int i = 0; i < p; i++){
    int b;
    cin >> b;
    if(bs(b)) cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1676
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  vector<int>B(N);
  for(int i=0;i<N;i++)
    B.at(i)=A.at(i);
  sort(B.begin(),B.end());
  reverse(B.begin(),B.end());
  int Max=B.at(0);
  int Max1=B.at(1);
  for(int i=0;i<N-1;i++){
  if(A.at(i)!=Max)
    cout<<Max<<" ";
    else
      cout<<Max1<<" ";
  
  }if(A.at(N-1)!=Max)
      cout<<Max<<endl;
  else
    cout<<Max1<<endl;

return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
    cin>>a>>b;
    sort(b.begin(),b.end());
    reverse(b.begin(),b.end());
    sort(a.begin(),a.end());
    if(b>a)
        puts("Yes");
    else 
        puts("No");
}

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

int main(void){
	long long  N;
	cin >> N;
	if (N == 1){
		cout << 0 << endl;
		return 0;
	}
	long long p = 2;
	long long N0 = N;
	vector<long long> e;
	while ((p*p<=N0)) {
		int tmp = 0;
		while (N%p == 0){
			tmp++;
			N /= p;
			if (N%p != 0){
				e.push_back(tmp);
			}
		}

		p++;
	}

	int Np = e.size();
	int No = 0;
	if (N > 1){
		No++;
	}
	for (int i = 0; i < Np; i++) {
		int tmp = 0;
			for (int j = 1; j <= e[i]; j++) {
				if (tmp+j > e[i]) break;
				tmp += j;
				No++;
			} 
	}
	cout << No << endl;

	return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, A;
  cin >> N >> A;
  vector<vector<long>> dp(N + 1, vector<long> (2501));
  dp.at(0).at(0) = 1;
  long a;
  for(int i = 0; i < N; i++){
    cin >> a;
    for(int j = N - 1; j >= 0; j--){
      for(int k = 0; k < 2451; k++){
        if(dp.at(j).at(k) != 0)dp.at(j + 1).at(k + a) += dp.at(j).at(k);
      }
    }
  }
  long ans = 0;
  for(int i = 1; i <= N; i++){
    if(i * A >= 2501)break;
    else ans += dp.at(i).at(i * A);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1280
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=2019
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    A=list(map(int,list(input())[::-1]))
    N=len(A)
    S=[0]*(N+1)
    for i in range(N):
        S[i+1]=(S[i]+A[i]*pow(10,i,MOD))%MOD
    l=[0]*2019
    ans=0
    for i in range(N+1):
        ans+=l[S[i]]
        l[S[i]]+=1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 90428
#include <cstdio>
#include <cstdlib>
#include <cmath>

#include <iostream>

#include <string>
#include <vector>
#include <algorithm>

typedef long long ll;

const ll mod = 1000000007;

class mint{
public:
  ll x;
  mint(ll x=0) : x(x%mod){}
  mint& operator+=(const mint rhs){
    x += rhs.x;
    while(x >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint rhs){
    x -= rhs.x;
    while(x < 0) x += mod;
    return *this;
  }
  mint & operator*=(const mint rhs){
    (x *= rhs.x) %= mod;
    return *this;
  }
  mint operator+(const mint rhs) const {
    mint res(*this);
    return res += rhs;
  }
  mint operator-(const mint rhs) const {
    mint res(*this);
    return res -= rhs;
  }
    mint operator*(const mint rhs) const {
    mint res(*this);
    return res *= rhs;
  }
};

#define rep(index,num) for(int index=0;index<num;++index)

using namespace std;

int N,M;
int S[2000],T[2000];
mint dp0[2005][2005];
mint dp1[2005][2005];

int main(){
  std::cin >> N >> M;
  rep(i,N) cin >> S[i];
  rep(i,M) cin >> T[i];
  dp0[0][0] = 1;
  rep(i,N+1){
    rep(j,M+1){
      dp0[i+1][j] += dp0[i][j];
      dp1[i][j]   += dp0[i][j];
      dp1[i][j+1] += dp1[i][j];
      if(S[i] == T[j]){
	dp0[i+1][j+1] += dp1[i][j];
      }
    }
  }
  const mint ans = dp1[N][M];
  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 63104
a = input()
b = input()

if len(a) > len(b):
    print('GREATER')
elif len(a) == len(b):
    for i in range(len(a)):
        if a[i] > b[i]:
            print('GREATER')
            exit()
        elif a[i] < b[i]:
            print('LESS')
            exit()
    print('EQUAL')
else:
    print('LESS')

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

const int Nmax=200010;
//#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//#definr REP(i,n) FOR(i,0,n)
//#define dump(x) cout << #x << "=" << (x) << endl;
//#define debug(x) cout << #x << "=" << (x) << "(L" << _LINE_ << ")" << "" << _FILE_ << endl;
//ll a[Nmax];
//int* P = new int[N];

int main() {
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	int cnt=0;
	for(;;){
      	if(a[2]==a[1] || a[2]-1==a[1]) break;
		a[1]+=2;
		cnt++;
	}
	for(;;){	
      	if(a[2]==a[0] || a[2]-1==a[0]) break;
		a[0]+=2;
		cnt++;
	}
	if(a[0]==a[1] && a[0]==a[2]) cout << cnt << endl;
	if(a[0]+1==a[2] || a[1]+1==a[2])
		if(a[0]+1==a[2] && a[1]+1==a[2]) cout << cnt+1 << endl;
		else cout << cnt+2 << endl;
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

w = input()
A = {}
for i in w:
    if i not in A:
        A[i] = 1
    else:
        A[i] += 1
for a in A.keys():
    if A[a] % 2 != 0:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

int main(){
	int n,k;
	cin >> n >> k;
	vector<ll> a(n+1);
	for(int i=1;i<=n;i++){
		cin >> a.at(i);
	}
	for(int i=k+1;i<=n;i++){
		if(a[i] > a[i-k]){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 4312
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n = s.size()-1;
  string ss;
  while(n>=0){
    if(s[n-2] == 'e' && s[n-1] == 'a' && s[n] == 'm'){
      if(n<4){
        cout << "NO" << endl;
        return 0;
      }
      else{
        for(int i = n-4;i<=n;i++){
          ss.push_back(s[i]);
        }
        if(ss=="dream"){
          n-=5;
        }
        else{
          cout << "NO" << endl;
          return 0;
        }
      }
    }else if(s[n-2] == 'm' && s[n-1] == 'e' && s[n] == 'r'){
      if(n<6){
        cout << "NO" << endl;
        return 0;
      }
      else{
        for(int i = n-6;i<=n;i++){
          ss.push_back(s[i]);
        }
        if(ss=="dreamer"){
          n-=7;
        }
        else{
          cout << "NO" << endl;
          return 0;
        }
      }
    }else if(s[n-2] == 'a' && s[n-1] == 's' && s[n] == 'e'){
      if(n<4){
        cout << "NO" << endl;
        return 0;
      }
      else{
        for(int i = n-4;i<=n;i++){
          ss.push_back(s[i]);
        }
        if(ss=="erase"){
          n-=5;
        }
        else{
          cout << "NO" << endl;
          return 0;
        }
      }
    }else if(s[n-2] == 's' && s[n-1] == 'e' && s[n] == 'r'){
      if(n<5){
        cout << "NO" << endl;
        return 0;
      }
      else{
        for(int i = n-5;i<=n;i++){
          ss.push_back(s[i]);
        }
        if(ss=="eraser"){
          n-=6;
        }
        else{
          cout << "NO" << endl;
          return 0;
        }
      }
    }
    else{
      cout << "NO" << endl;
      return 0;
    }
    ss = "";
  }
  cout << "YES" << endl;
}
        
  


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

const int MAX_N = 200000;
int n;
int a[MAX_N+1];
int b[MAX_N+1];

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn1(i,n) {
    cin >> a[i];
  }

  vi ans;
  for (int i = n; i >= 1; i--) {
    int c = 0;
    for (int j = i*2; j <= n; j+=i) c += b[j];
    if (c%2 != a[i]) {
      b[i] = 1;
      ans.push_back(i);
    }
  }

  cout << ans.size() << endl;
  for (int x : ans) cout << x << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int n; cin >> n;
    vector<int> data(n);
    rep(i,n){
        int a; cin >> a;
        data[i] = a-(i+1);
    }
    sort(data.begin(),data.end());

    ll ans = 0;
    int cen;
    if(n%2 == 0) cen = (data[(n/2)-1] + data[n/2])/2;
    else cen = data[n/2];

    rep(i,n) ans += abs(data[i] - cen);
    
    cout << ans << endl;

}



Measured memory_bytes: 4032
#include <cstdio>
     
    using namespace std;
     
    int main(){
         int a, b, c;
         scanf("%d%d%d", &a, &b, &c);
         if(a == b)
                 printf("%d", c);
         if(a == c)
                 printf("%d", b);
         if(b == c)
                 printf("%d", a);
         return 0;
    }

Measured memory_bytes: 128
#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

const int maxn = 100000 + 100;

int n,c,k;
int t[maxn];

int main() {

    scanf("%d%d%d",&n,&c,&k);

    for(int i=0; i<n; i++) {
        scanf("%d",&t[i]);
    }

    sort(t, t + n);

    int res = 1;
    int current = 1;
    int time = t[0];

    for(int i=1; i<n; i++) {
        if (time <= t[i] && t[i] <= time + k && current + 1 <= c) {
            current++;
        } else {
            res++;
            current = 1;
            time = t[i];
        }
    }

    printf("%d",res);

    return 0;
}



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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

template <class T>
struct SegmentTree{
  using F = function<T(T,T)>;
  F f;
  T inf;
  int n;
  vector<T> node;

  SegmentTree(vector<T> v,T inf,F f):inf(inf),f(f){
    n = 1; while(n < v.size()) n *= 2;
    node.resize(2*n-1,inf);
    for(int i = 0; i < v.size(); i++) node[i+n-1] = v[i];
    for(int i = n-2; i >= 0; i--) node[i] = f(node[2*i+1],node[2*i+2]);
  }

  void update(int k,T val){
    k += n-1;
    node[k] = val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  void add(int k,T val){
    k += n-1;
    node[k] += val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  T getval(int a,int b){ return getval(a,b,0,0,n); }
  T getval(int a,int b,int k,int l,int r){
    //区間[a, b)の値を返す
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return node[k];
    T vl = getval(a, b, 2*k+1, l, (l+r)/2);
    T vr = getval(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }
};

using P = pair<int,int>;

signed main(){

  int n,m,q; cin >> n >> m >> q;
  vector<P> v;
  for(int i = 0; i < m; i++){
    int l,r; cin >> l >> r;
    v.push_back({l,r});
  }
  sort(v.begin(),v.end(),[](P x,P y){
    if(x.second == y.second) return x.first < y.first;
    else return x.second < y.second;
  });

  vector<pair<P,int>> qs;
  for(int i = 0; i < q; i++){
    int p,q; cin >> p >> q;
    qs.push_back(make_pair(make_pair(p,q),i));
  }
  sort(qs.begin(),qs.end(),[](auto x,auto y){
    if(x.first.second == y.first.second) return x.first.first < y.first.first;
    else return x.first.second < y.first.second;
  });

  auto f = [](int x,int y){
    return x + y;
  };
  SegmentTree<int> seg(vector<int>(n+1,0),0,f);
  vector<int> ans(q);
  int k = 0;
  for(int i = 0; i < q; i++){
    if(k < m && v[k].second <= qs[i].first.second){
      seg.add(v[k].first,1);
      k++;
      i--;
    }
    else {
      ans[qs[i].second] = seg.getval(qs[i].first.first,qs[i].first.second+1);
    }
  }

  for(int p : ans){
    cout << p << endl;
  }

  return 0;
}


Measured memory_bytes: 10732
import java.util.Scanner;

/**
 *
 * @author HP
 */
public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n  = s.nextInt();
        int m  = s.nextInt();
        int limit = s.nextInt();

        int a[] = new int[n];
        long sumA[] = new long[n+1];
        int b[] = new int[m];
        long sumB[] = new long[m+1];

        for(int i = 1; i <= n; ++i) {
            a[i-1] =  s.nextInt();
            sumA[i] = sumA[i-1] + a[i-1];
//            System.out.println(sumA[i]);
        }

        for(int i = 1; i <= m; ++i) {
            b[i-1] =  s.nextInt();
            sumB[i] = sumB[i-1] + b[i-1];
//            System.out.println(sumB[i]);
        }

        int j = m;
        int ans = 0;
        for(int i = 0; i <= n; i++) {
            if(sumA[i] > limit)
                break;
            while(limit - sumA[i] < sumB[j])
                j--;
            ans = Math.max(ans,i+j);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64616
import itertools
import numpy as np

N, M, X = map(int, input().split())

A = []
C = []
for _ in range(N):
    temp_list = list(map(int, input().split()))
    A.append(temp_list[1:])
    C.append(temp_list[0])

A = np.array(A)
C = np.array(C)

answer = 10**9
for comb in itertools.product([0, 1], repeat= N):
    cost = 0
    A_memo = np.zeros(M, dtype=int)

    for i in range(N):
        if not comb[i]:
            continue

        A_memo += A[i]
        cost += C[i]

    if (A_memo >= X).sum() == M:
        answer = min(answer, cost)

if answer == 10**9:
    print(-1)
else:
    print(answer)

Measured memory_bytes: 27292
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter

n = int(readline())
ppp = list(map(int,readline().split()))

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length()
 
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
 
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i
 
    def lower_bound(self, x):
        """ 累積和がx以上になる最小のindexと、その直前までの累積和 """
        sum_ = 0
        pos = 0
        for i in range(self.depth, -1, -1):
            k = pos + (1 << i)
            if k <= self.size and sum_ + self.tree[k] < x:
                sum_ += self.tree[k]
                pos += 1 << i
        return pos + 1

q = sorted(enumerate(ppp,1),key=itemgetter(1),reverse=True)
bit = Bit(n+4)
bit.add(1,1)
bit.add(2,1)
bit.add(n+3,1)
bit.add(n+4,1)

ans = 0
for i, p in q:
  f = bit.sum(i+2)
  LL = max(2,bit.lower_bound(f-1))
  LR = bit.lower_bound(f)
  RL = bit.lower_bound(f+1)
  RR = min(n+3,bit.lower_bound(f+2))
  ans += p*((i+2-LR)*(RR-RL)+(LR-LL)*(RL-i-2))
  bit.add(i+2,1)
  
print(ans)

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

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

	cin >> n;

	int mx = 0;
	int rep = 0;

	int a, b;
	for (int i = 1; i <= n; i++) {
		cin >> a >> b;
		if (a == b) {
			rep += 1;
		}
		else {
			rep = 0;
		}
		mx = max(mx, rep);
	}

	if (mx >= 3) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
string make_string(T N)
{
    string ret;
    T now = N;
    while (now > 0)
    {
        T x = now % 10;
        ret += (char)('0' + x);
        now /= 10;
    }
    reverse(all(ret));
    return ret;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}

template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b; // aをbで更新
        return true;
    }
    return false;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));
const string minf = "-";
void chmax(string &s, string t)
{
    if (s == minf)
    {
        s = t;
        return;
    }
    if (s.size() < t.size())
    {
        s = t;
        return;
    }
    if (s.size() == t.size() && s < t)
    {
        s = t;
        return;
    }
    return;
}
//cost[i]:iを作るのに必要なコスト
const ll cost[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int main()
{
    cout << fixed << setprecision(30);
    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    loop(i, M) cin >> A[i];
    vector<string> dp(11000, "-"); 
    dp[0] = "";
    loop(i, 10010)
    {
        if (dp[i] == minf)
            continue;
        loop(j, M)
        {
            ll nownum = cost[A[j]];
            chmax(dp[i + nownum], dp[i] + (char)('0' + A[j]));
        }
    }
    putout(dp[N]);
    return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    vector<vector<ll>> a(n, vector<ll>(n));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }

    vector<ll> c(1 << n);
    for (int s = 0; s < (1 << n); s++) {
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (((s >> i) & 1) && ((s >> j) & 1)) c[s] += a[i][j];
            }
        }
    }

    vector<ll> dp(1 << n);
    for (int s = 0; s < (1 << n); s++) {
        for (int t = s; t > 0; --t &= s) {
            dp[s] = max(dp[s], dp[s ^ t] + c[t]);
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}


Measured memory_bytes: 1280
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

MOD = 1000000007

def smax(a,b):
    if a>b:
        return a
    else:
        return b

def smin(a,b):
    if a<b:
        return a
    else:
        return b


def main():
    N = int(readline())
    S = readline().rstrip().decode()
    rn = 0
    gn = 0
    bn = 0
    R = [0]
    G = [0]
    B = [0]

    for i in range(N):
        if S[i]=="R":
            rn+=1
        if S[i]=="G":
            gn+=1
        if S[i]=="B":
            bn+=1
        R.append(rn)
        G.append(gn)
        B.append(bn)
    ans = 0
    for i in range(N-2):
        for j in range(i+1,N-1):
            if S[i]!=S[j]:
                if "R"!=S[i] and "R"!=S[j]:
                    ans += R[N]-R[j]
                    if j+(j-i) < N:
                        if S[j+(j-i)]=="R":
                            ans-=1
                elif "G"!=S[i] and "G"!=S[j]:
                    ans += G[N]-G[j]
                    if j+(j-i) < N:
                        if S[j+(j-i)]=="G":
                            ans-=1
                elif "B"!=S[i] and "B"!=S[j]:
                    ans += B[N]-B[j]
                    if j+(j-i) < N:
                        if S[j+(j-i)]=="B":
                            ans-=1
        
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 68784
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int cnt[101] = {}, most = 0, a;
    while(cin >> a){
        most = max(most, ++cnt[a]);
    }
    for(int i = 1; i <= 100; i++){
        if(most == cnt[i]){
            cout << i << "\n";
        }
    }
}


Measured memory_bytes: 3008
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <sstream>
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[])
{
    ll a, b, c;
    std::cin >> a >> b >> c;
    ll d = a*b*c;
    if (d % 2 == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }
    ll e1, f1, g1, e2, f2, g2;
    e1 = (a/2)*b*c;
    f1 = a*(b/2)*c;
    g1 = a*b*(c/2);
    e2 = d-e1;
    f2 = d-f1;
    g2 = d-g1;
    ll ans = min({abs(e1-e2), abs(f1-f2), abs(g1-g2)});
    //printf("e1 : %d, e2 : %d\nf1 : %d, f2 : %d\ng1 : %d, g2 : %d\n", e1, e2, f1, f2, g1, g2);
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
let i_inp_list : unit -> int list = fun () ->
  let inp_split = Str.split (Str.regexp " ") (input_line stdin) in
  List.map (fun x -> int_of_string x) (inp_split)

  
let rec pairs : 'a list -> ('a * 'a) list = function
    [] -> []
  | x :: xs -> List.map (fun y -> (x, y)) xs @ (pairs xs)
  
let () =
  let _ = Scanf.sscanf (input_line stdin) "%d" (fun n -> n) in
  let l = i_inp_list () in
  let p = pairs l in
  let ans = List.fold_right(fun (a,b) s -> a * b + s) p 0 
  in
  print_int ans;
  print_newline ()


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

int main() {

  int X,Y;
  cin>>X>>Y;

  int asi = 0;

  int a = 0;

  for(int i=0;i<110;i++){

    if(X>=i){

      asi = 2*i + 4*(X-i);

      if(asi ==Y){
        a = 1;
        cout << "Yes" << endl;
        break;
      }
    }

    
  }

  if (a == 0)cout << "No" << endl;
}

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

int main()
{
	int n,m;
	int sum = 0;
	cin >> n >> m;
	for(int i = 0;i<m;i++)
	{
		int x;
		cin >> x;
		sum += x;
	}
	if(sum>n)
	{
		cout<<-1<<endl;
	}
	else
	{
		cout<<n-sum<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3636
use std::io::*;
//use std::cmp::*;


fn modulo(x: usize) -> usize {
    x % (1_000_000_000 + 7)
}

const BOUND: usize = 0;
const LESS: usize = 1;

fn solve(buf: String) -> usize {
    let l: Vec<char> = buf.trim().chars().collect();
    let n: usize = l.len();
    let mut count = vec![vec![0; 2]; n+1];
    count[0][BOUND] = 1;
    for i in 1..n+1 {
        match l[i-1] {
            '1' => {
                count[i][BOUND] = modulo(count[i-1][BOUND]*2);
                count[i][LESS] = modulo(count[i-1][BOUND] + count[i-1][LESS]*3);
            },
            '0' => {
                count[i][BOUND] = modulo(count[i-1][BOUND]);
                count[i][LESS] = modulo(count[i-1][LESS]*3);
            },
            _ => {}
        }
    }
    // println!("{:?}", count);
    modulo(count[n][BOUND] + count[n][LESS])
}


fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    println!("{}", solve(buf));
}


Measured memory_bytes: 10492
#include<iostream>
#include<string>

using namespace std;

int main(){
  string name="kogakubu10gokan";
  int N,Q;
  cin>>N>>Q;
  while(N--){
    int y;
    string n;
    cin>>y>>n;
    if(y<=Q){
      name=n;
    }
  }
  cout<<name<<endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    string former = s.substr(0, a);
    string latter = s.substr(a+1, b);
    bool ok = true;
    ok = ok && s.at(a) == '-';

    for(char c : former) {
        ok = ok && '0' <= c && c <= '9';
    }

    for(char c : latter) {
        ok = ok && '0' <= c && c <= '9';
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>

using namespace std;

struct pos {
    int x;
    int y;

    double operator-(const pos &other) {
        return sqrt(pow(x - other.x, 2) + pow(y - other.y, 2));
    }
};

int fac(int n) {
    int ret = 1;
    for (int i = 2; i <= n; i++) {
        ret *= i;
    }
    return ret;
}

int main() {
    int N, x, y;
    double sum = 0;
    cin >> N;
    int permu = fac(N);
    vector<pos> vp(N);
    for (int i = 0; i < N; i++) {
        cin >> x >> y;
        vp.at(i) = pos{x, y};
    }
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            sum += vp.at(i) - vp.at(j);
        }
    }
    double avg = sum / N * 2;
    cout << setprecision(12) << avg << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 1000000005
#define NIL -1
long long func(int n, long long x){
    if(n == 0){
        return 1;
    }if(x == 1){
        return 0;
    }if(1 < x && x < pow(2, 1+n) - 1){
        return func(n-1, x-1);
    }if(x == pow(2, 1+n) -1){
        return func(n-1, x-1) + 1;
    }if(x > pow(2, 1+n) - 1){
        return func(n-1, x-(pow(2, 1+n) -1)) + pow(2, n);
    }
}

int main(){
    int N; long long X; cin >> N >> X;
    cout << func(N, X) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    #define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define mp make_pair
    #define pb push_back
    #define fp first
    #define sp second
    typedef long long int ll;
    typedef pair<ll,ll> pp;
    #define check(x, i) ((x>>i)&1LL)
    #define set(x,i) (x|(1LL<<i))
    #define unset(x,i) (x&~(1LL<<i))
    #define INF LONG_MAX
    #define MAX_N 20
    #define MAX 4000005
    #define mod 1000000007
    #define REP(i,n) for(i=0;i<n;i++)
    #define FOR(i,a,b) for(i=a;i<=b;i++)
    #define RFOR(i,a,b) for(i=a;i>=b;i--)
    #define len(i,s) for(i=0;s[i];i++)
    #define T() ll t;cin>>t;while(t--)
    ll gcd (ll a, ll b){return (a?gcd(b%a,a):b);}
    ll pow1(ll a,ll b,ll MOD){ll ans=1;while(b!=0){if(b&1)ans=(ans*a)%MOD;a=(a*a)%MOD;b=b/2;}return ans;}
    ll modInverse(ll a,ll p){return pow1(a,p-2,p);}
 
    int main()
    {
      boost
      #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);    
        freopen("output.txt", "w", stdout);
    #endif 
      ll n,i;
      cin>>n;
      ll a[n];
      map<ll,ll> mp;
      ll s=0;
      REP(i,n)
      {
      cin>>a[i];
      mp[a[i]]++;
      s=s+a[i];

   }
   ll q;
   cin>>q;
   while(q--)
   {
    ll x,y;
    cin>>x>>y;
    if(mp[x]==0)
        cout<<s<<"\n";
    else
    {
        s=s-mp[x]*x;
        s=s+y*mp[x];
        mp[y]+=mp[x];
        mp[x]=0;
        cout<<s<<"\n";
    }

   }
}

Measured memory_bytes: 10084
import math
Num = input()
N = [input() for _ in range(Num)]
pnum_count = Num
for n in N:
    if n == 2:
        continue
    if n % 2 == 0:
        pnum_count -= 1
        continue
    i = 2
    while i <= math.sqrt(n):
        if n % i == 0:
            pnum_count -= 1
            break
        i += 1
print pnum_count

Measured memory_bytes: 6908
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	a, b, c := nextInt(), nextInt(), nextInt()
	var result string
	if (a == b && b != c) || (b == c && c != a) || (c == a && a != b) {
		result = "Yes"
	} else {
		result = "No"
	}
	fmt.Println(result)
}


Measured memory_bytes: 640
//Circumscribed Circle of a Triangle
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    double x1, y1, x2, y2, x3, y3;
    double px, py, r;
    scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
    px=((y1-y2)*(y2-y3)*(y3-y1)+(y1-y2)*(x2+x3)*(x2-x3)+(y3-y2)*(x1+x2)*(x1-x2))/(2*((y1-y2)*(x2-x3)+(y3-y2)*(x1-x2)));
    py=((x1-x2)*(x2-x3)*(x3-x1)+(x1-x2)*(y2+y3)*(y2-y3)+(x3-x2)*(y1+y2)*(y1-y2))/(2*((x1-x2)*(y2-y3)+(x3-x2)*(y1-y2)));
    r=sqrt(pow(x1-px, 2.0)+pow(y1-py, 2.0));
    printf("%.3f %.3f %.3f\n", px, py, r);
  }
  return 0;
}

Measured memory_bytes: 1248