akhauriyash/Code-Regression huggingface dataset:
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
	  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
	   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
		   # #  # # #                   # #      ###### #    # #    # #      #####
	  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
	   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LL i = 0; i < (n); i++)
#define FOR(in) for(LL i=1; i <= (n); i++)
#define pb push_back
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 
 
LL concate(LL a, LL b)
{
	ostringstream os;
	os <<a <<b;
	istringstream is(os.str());
	LL c;
	is>> c;
	return c;
}
 
 
LL check(char vowel)
{
	return vowel=='a' || vowel=='e' || vowel=='i' || vowel=='o' || vowel=='u';
}
LL mod = 1e9+7;
 
 
int main()
{
	//LL q,t;
	//cin>>t;
	//while(t--)
	//{
	   LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
		LL aa[1000];
		LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
		LL ma=0, mi=100000000;
		LL mid=0, temp=0, stop=0, start=0;
		double pi= 3.141592653589793;
		double d1=0.0, d2, d3, d4;
		VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
		VS vs, vs1, vs2, vs3, vs4;
		VP vp, vp1,vp2;
		char ch, ch1, ch2[1001];
		string str, str1, str2, str3, str4, str5;
		pair<LL, LL> pa;
		list<LL> li, li1;
		map<LL, LL> mp, mp1;
		set<LL> st;
		map<LL ,LL> :: iterator imll;
		VLL :: iterator ivll;
		set<LL> :: iterator isll;
		VP :: iterator ivp;
 

		cin>>n;
		for(i=0; i<n; i++)cin>>a, v.pb(a), co+=a;
		srt(v);
		if(co%10==0)
		{
			for(i=0; i<n; i++)
			{
				if(v[i]%10!=0)
				{
					x=v[i];
					break;
				}
			}
			co -= x;
			if(co%10==0)cout<<0<<endl;
			else cout<<co<<endl;
		}
		else cout<<co<<endl;
		
		
	//}
	exit()
 
 
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 998244353;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int t, n;
pii a[maxn];
int sta[maxn], top;
vector<int> E[maxn];
ll dfs(int x)
{
	ll ret = 1;
	for(auto v : E[x])
		ret = ret * dfs(v) % mod;
	ret = (ret + 1) % mod;
	return ret;
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
	sort(a + 1, a + n + 1);
	for(int i = n; i; --i)
	{
		while(top > 0 && a[i].first + a[i].second - 1 >= a[sta[top]].first)
		{
			E[i].push_back(sta[top]);
			--top;
		}
		sta[++top] = i;
	}
	ll ans = 1;
	for(int i = 1; i <= top; ++i)
		ans = ans * dfs(sta[i]) % mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 22912
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean isNext(){return sc.hasNext();}
        static String[] mySplit(String str){return str.split("");}
        public static void main(String[] args){
          long N = getLong();
          long M = getLong();
  if(N == 2 || M == 2){
     myout(0);
  }else if(N == 1 || M == 1){
     if(N == M){
        myout(1);
     }else if(N == 1){
     	myout(M - 2);
     }else{
        myout(N - 2);
     }
  }else{
    myout((N-2)*(M-2));
  }
        }
        //便利メソッド追加枠ここから

        //便利メソッド追加枠ここまで
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) 1e9
#define tt ll testcase; cin>>testcase; while(testcase--)
 
int main(){
	fast;
	ll n;
	cin >> n;
	double p[n+1];
	p[0] = 0;
	for(ll i = 1; i <= n; i++){
		cin >> p[i];
	}
	vector<vector<double>>dp(n+1, vector<double>(n+1, 0));
	dp[0][0]=1.0;
	for(ll i = 1; i<= n; i++){
		dp[i][0] = 1 - p[i];
		for(ll j = 0; j <= i; j++){
			dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1 - p[i]); 
		}
	}
	// for(ll i =0; i<=n; i++){
	// 	for(ll j=0; j<=n; j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	double ans = 0;
	for(ll i=0; i<=n; i++){
		if(i > n - i){
			ans += dp[n][i];
		}
	}
	printf("%.10lf", ans);
	//cout<<ans;
}	

Measured memory_bytes: 70784
while True:
	a, op, b = input().split()
	a = int(a)
	b = int(b)
	if op == "+":
		print(a + b)
	elif op == "-":
		print(a - b)
	elif op == "*":
		print(a * b)
	elif op == "/":
		print(a // b)
	elif op == "?":
		break

Measured memory_bytes: 7624
import sys
sys.setrecursionlimit(1000000)

N,M = [int(x) for x in input().split()]
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
#%%
flag = False
for i in range(N-M):
    for j in range(N-M):
        flagx = True
        for x in range(M):
            if(A[i+x][j:j+M]!=B[x]):
                flagx = False
        if(flagx):
            flag = flag|flagx
            break

if(flag or (N==1 and M==1)):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;


int main() {
	int H, W,N=0;
	cin >> H >> W;

	int **a = new int*[H];
	int **b = new int*[H];

	for (int i = 0; i < H; i++) {
		a[i] = new int[W];
		b[i] = new int[W];

		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
			b[i][j] = a[i][j];
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = W - 1; j >= 1; j--) {
			if (a[i][j] % 2 == 1) {
				N++;
				a[i][j]--;
				a[i][j - 1]++;
			}
		}
	}
	for (int i = H - 1; i >= 1; i--) {
		if (a[i][0] % 2 == 1) {
			N++;
			a[i][0]--;
			a[i - 1][0]++;
		}
	}

	cout << N << endl;

	for (int i = 0; i < H; i++) {
		for (int j = W - 1; j >= 1; j--) {
			if (b[i][j] % 2 == 1) {
				cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j << endl;
				b[i][j]--;
				b[i][j - 1]++;
			}
		}
	}
	for (int i = H - 1; i >= 1; i--) {
		if (b[i][0] % 2 == 1) {
			cout << i + 1 << " " << 1 << " " << i << " " << 1 << endl;
			b[i][0]--;
			b[i - 1][0]++;
		}
	}

	for (int i = 0; i < H; i++) {
		delete[] b[i];
		delete[] a[i];
	}
	delete[] b;
	delete[] a;
	return 0;
}

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

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

#define rep(i, n) for (int i = 1; i <= (n); ++i)
#define rag(con) std::begin(con), std::end(con)

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

int main()
{
    int h, w;

    std::cin >> h >> w;

    int sx, sy, gx, gy;

    std::cin >> sx >> sy;
    std::cin >> gx >> gy;

    constexpr int INF = 1e9;

    std::vector<std::vector<int>> d(h + 1, std::vector<int>(w + 1, INF));

    std::vector<std::vector<int>> dat(h + 1, std::vector<int>(w + 1, 0));

    rep(i, h)
    {
        rep(j, w)
        {
            char ch;
            std::cin >> ch;
            if (ch == '.')
                dat[i][j] = 1;
        }
    }

    using T = std::tuple<int, int, int>;

    std::priority_queue<T, std::vector<T>, std::greater<T>> que;

    que.emplace(0, sx, sy);
    d[sx][sy] = 0;

    while (!que.empty())
    {

        int x, y, cnt;
        std::tie(cnt, x, y) = que.top();
        //std::cerr << x << ' ' << y << ' ' << cnt << std::endl;
        que.pop();

        if (d[x][y] < cnt)
            continue;

        if (x == gx && y == gy)
        {
            std::cout << cnt << std::endl;
            return 0;
        }

        for (int i = 0; i < 4; ++i)
        {
            int nx = x + ex[i], ny = y + ey[i];
            if (nx <= 0 || nx > h || ny <= 0 || ny > w || !dat[nx][ny])
                continue;
            if (d[nx][ny] > d[x][y])
            {
                d[nx][ny] = d[x][y];
                que.emplace(d[nx][ny], nx, ny);
            }
        }

        for (int i = 0; i < 5; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                int nx = x + dx[i], ny = y + dy[j];
                if (x == nx && y == ny)
                    continue;
                //std::cerr << dx[i] << ' ' << ny << std::endl;

                if (nx <= 0 || nx > h || ny <= 0 || ny > w || !dat[nx][ny])
                    continue;
                if (d[nx][ny] > d[x][y] + 1)
                {
                    d[nx][ny] = d[x][y] + 1;
                    que.emplace(d[nx][ny], nx, ny);
                }
            }
        }
    }

    std::cout << -1 << std::endl;

    return 0;
}

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

int main(void){
  int N,A;
  cin >> N >> A;
  
  if((N%500) == 0){
    cout << "Yes" << endl;
  }else if((N%500) <= A){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import heapq as hq
from collections import defaultdict
n, m, s, t = map(int,input().split())
s -= 1
t -= 1
edges = defaultdict(list)
for _ in range(m):
    u, v, a, b = map(int,input().split())
    edges[u-1].append((v-1, a, b))
    edges[v-1].append((u-1, a, b))
INF = float("inf")
d = [INF]*n
d[s] = 0
q = [(0,s)]
while q:
    dist, i = hq.heappop(q)
    if d[i] < dist:
        continue
    for j, a, b in edges[i]:
        if d[j] > d[i]+a:
            d[j] = d[i]+a
            hq.heappush(q, (d[j], j))
ttoi = [INF]*n
ttoi[t] = 0
q = [(0,t)]
while q:
    dist, i = hq.heappop(q)
    if ttoi[i] < dist:
        continue
    for j, a, b in edges[i]:
        if ttoi[j] > ttoi[i]+b:
            ttoi[j] = ttoi[i]+b
            hq.heappush(q, (ttoi[j], j))
tmp = INF
ans = [None]*n
for i in range(n-1,-1,-1):
    if d[i]+ttoi[i] < tmp:
        tmp = d[i]+ttoi[i]
    ans[i] = 10**15-tmp
print(*ans, sep="\n")

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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  string s;
  cin >> s;
  map<char, int> mp;
  for (char c : s) {
    mp[c]++;
  }
  bool allExists = true;
  for (char i = 'a'; i <= 'z'; i++) {
    if (mp[i] == 0) {
      cout << i << endl;
      allExists = false;
      break;
    }
  }
  if (allExists) {
    cout << "None" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string S;
int main(){
	cin >> S;
	int ok = 0;
	int n = S.length();
	for(int i = 0,j = (n - 1) / 2 - 1;i < j;i++,j--){
		if(S[i] != S[j]) ok = 1;
	}
	for(int i = (n + 3) / 2 - 1,j = n - 1;i < j;i++,j--)
		if(S[i] != S[j]) ok = 1;
	for(int i = 0,j = n - 1;i < j;i++,j--)
		if(S[i] != S[j]) ok = 1;
	if(ok) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

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


int main(){
  int n,m,x,y; cin>>n>>m>>x>>y;
  bool check=false;
  vector<int> vec1(n); vector<int> vec2(m);
  
    for(int i=0;i<n;i++){
    cin>>vec1.at(i);
    }
 
    for(int i=0;i<m;i++){
    cin>>vec2.at(i);
    }
 
   for(int i=x+1;i<=y;i++){
        bool check2=true;
        for(int j=0;j<n;j++){
          if(vec1.at(j)>=i)check2=false;
         }
        for(int j=0;j<m;j++){
          if(vec2.at(j)<i)check2=false;
         }
      if(check2){check=true; break;}
  
    }//大for

   if(check)cout<<"No War"<<endl;
   else cout<<"War"<<endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

int a[MAXN], b[MAXN];
int n, m, v, p;

bool calc(int ind) {
	/*REP(i, 0, n) {
		b[i] = a[i];
	}
	b[ind] += m;*/
	if (ind >= n - p) {
		//printf("%d true\n", ind);
		return true;
	}
	//printf("-> %d %d %d\n", a[ind], m, a[n - p]);
	if (a[ind] + m < a[n - p]) {
		//printf("%d false\n", ind);
		return false;
	}
	ll sum = m;
	REP(i, 0, n) {
		if (i != ind) {
			if (a[i] > a[ind] + m || i >= n - p + 1) {
				sum += m;
			} else {
				sum += min(m, a[ind] + m - a[i]);
			}
		}
	}
	//printf("%d %lld\n", ind, sum);
	if (sum >= (ll)m * (ll)v) {
		return true;
	}
	return false;
	
	/*int cnt = 1, pos;
	for(pos = 0; cnt < v && a[pos] <= a[ind]; pos++) {
		if (pos != ind) {
			b[pos] += m;
			cnt++;
		}
	}
	int r = n - 1;
	for(; b[r] > b[ind] && cnt < v; r--) {
		b[r] += m;
		cnt++;
	}
	if (r < n - p + 1) {
		return false;
	}
	for(; cnt < v && r >= n - p + 1; r--) {
		b[r] += m;
		cnt++;
	}
	ll sum = 0;
	REPN(i, pos, r) {
		sum += b[m] - a[i];
	}*/
}

void solve(){
	scanf("%d%d%d%d", &n, &m, &v, &p);
	REP(i, 0, n) {
		scanf("%d", &a[i]);
	}
	sort(a, a + n);
	if (calc(0)) {
		printf("%d\n", n);
		return;
	}
	int l = 0, r = n - 1;
	for(; l + 1 < r; ) {
		int mid = (l + r) / 2;
		if (calc(mid)) {
			r = mid;
		} else {
			l = mid;
		}
		//printf("%d %d\n", l, r);
	}
	printf("%d\n", n - l - 1);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main() 
{
  int N, K;
  cin >> N >> K;
  int h[N];
  for (int i = 0; i < N; i++){
    cin >> h[i];
  }

  int count = 0;
  for (int i = 0; i < N; i++){
    if (h[i] >= K){
      count++;
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 640
s = int(input())
def f(n):
  if n%2 == 0:
    return n//2
  else:
    return 3*n+1

x = {}
i = 1
x[s] = i
while True:
  i += 1
  k = f(s)
  if k in x:
    print(i)
    break
  x[k] = i
  s = k

Measured memory_bytes: 2940
<?php
$bingoCard[0] = explode(' ', trim(fgets(STDIN)));
$bingoCard[1] = explode(' ', trim(fgets(STDIN)));
$bingoCard[2] = explode(' ', trim(fgets(STDIN)));

$N = (int)trim(fgets(STDIN));
$selected = [];
for ($i = 0; $i < $N; $i++) {
    $selected[] = trim(fgets(STDIN));
}

$bingoLine = [
    $bingoCard[0],
    $bingoCard[1],
    $bingoCard[2],
    array_map(function($ary) { return $ary[0]; }, $bingoCard),
    array_map(function($ary) { return $ary[1]; }, $bingoCard),
    array_map(function($ary) { return $ary[2]; }, $bingoCard),
    [$bingoCard[0][0], $bingoCard[1][1], $bingoCard[2][2]],
    [$bingoCard[0][2], $bingoCard[1][1], $bingoCard[2][0]],
];

$result = [];
foreach ($bingoLine as $line) {
    if (count(array_intersect($line, $selected)) >= 3) {
        $result = $line;
        break;
    }
}
echo count($result) ? 'Yes' : 'No';

Measured memory_bytes: 3700
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		for(int i = 1 ; i <= 10000000 ; i++) {
			x -= i;
			if(x <= 0) {
				System.out.println(i);
				return;
			}
		}
	}
}


Measured memory_bytes: 23892
X, Y, N = map(int, input().split())
canvas = [[1 for _ in range(X)]for _ in range(Y)]

for i in range(N):
    x,y,a = map(int,input().split())
    if a == 1:
        for j in range(Y):
            for k in range(x):
                canvas[j][k] = 0
    if a == 2:
        for j in range(Y):
            for k in range(x,X):
                canvas[j][k] = 0
    if a == 3:
        for j in range(X):
            for k in range(y):
                canvas[k][j] = 0
    if a == 4:
        for j in range(X):
            for k in range(y,Y):
                canvas[k][j] = 0
print(sum([sum(i) for i in canvas]))


Measured memory_bytes: 3188
from collections import defaultdict


def inpl():
    return list(map(int, input().split()))


N = int(input())
d = defaultdict(list)
ans_dic = {}
for i in range(N):
    s, p = input().split()
    p = int(p)
    d[s].append(p)
    ans_dic[(s, p)] = i + 1

key = []
for k in d.keys():
    key.append(k)
    d[k].sort(reverse=True)

key.sort()
for k in key:
    for i in d[k]:
        print(ans_dic[(k, i)])


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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;

ll i, j, k;

int main(){
    scanf("%lld", &N);
    ll ans = 0;
    rep(i,1,N+1){
        ll n = N / i;
        ans += (n + 1) * n / 2 * i;
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(){
  int a,b;
  cin>>a>>b;
  double x;
  int y;
  cin >>x>>y;
  x=(a+b)/2.0;
  y=(a+b)/2;
  if(x-y>0){
    cout<<y+1<<endl;
  }
  if(x-y==0){
    cout<<y<<endl;
  }
}
  


Measured memory_bytes: 256
import sys

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


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


def main():
    H, N = map(int, input().split())
    A = []
    B = []
    for _ in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)

    dp = [float("inf")] * (H + 1)
    dp[0] = 0

    for h in range(0, H):
        for a, b in zip(A, B):
            tmp = dp[h] + b
            if h + a >= H and tmp < dp[H]:
                dp[H] = tmp
            elif h + a < H and tmp < dp[h + a]:
                dp[h + a] = tmp

    print(dp[-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 42076
#define _USE_MATH_DEFINES //M_PI, M_E
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;

bool primes[int(1e7)];
void sieve()
{
	memset(primes,1,sizeof(primes));
	primes[0] = primes[1] = 0;
	for(int i = 2; i<=sqrt(1e7) ; i++)
		if(primes[i])
		{
			for(int j = i*i; j<int(1e7) ;j+=i)
				primes[j] = 0;
		}
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	sieve();
	ll n;
	cin>>n;
	int ans = 0;
	for(ll i = 2; i<=sqrt(n); i++)
	{
		if(n%i==0 && primes[i])
		{
			int cnt = 0;
			while(n%i==0)
			{
				cnt++;
				n/= i;
			}
			for(ll j = 1; j<int(1e7); j++)
					if(cnt>=j) {
						cnt -= j;
						ans++;
					}
					else break;
		}
	}
	if(n>1) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 13460
#include<bits/stdc++.h>
using namespace std;
#define INF = 2e9
#define LINF = 1e18
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << "=" << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO")
#define Yes(n) cout << ((n) ? "Yes" : "No")

int main(){

    int n,m,l;
    cin >> n >> m >> l;

    int a[100][100], b[100][100];

    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }

    rep(j, m){
        rep(k, l){
            cin >> b[j][k];
        }
    }

    rep(i, n){
        rep(j, l){
            long long out = 0;
            rep(k, m){
                out += a[i][k]*b[k][j];
            }
            if(j != 0)cout << " ";
            cout << out;
        }
        cout << endl;
    }

}


Measured memory_bytes: 3152
using System;
using System.IO;

class Solve
{
    static void Main(string[] args) {
        var N = int.Parse(Console.ReadLine());
        var L = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Array.Sort(L);
        var answer = 0;
        for (int i = 0; i < N - 2; i++) {
            for (int j = i + 1; j < N - 1; j++) {
                if (L[i] == L[j]) continue;
                for (int k = j + 1; k < N; k++) {
                    if (L[j] == L[k]) continue;
                    if (L[i] + L[j] <= L[k]) break;
                    answer++;
                }
            }
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

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

void eratosthenes(set<int> &plist,int n){
    vector<bool> is_prime(n+1,1);

    is_prime[0] = is_prime[1] = false;

    for(int i = 2;i <= n;i ++){
        if(is_prime[i]){
            plist.insert(i);
            for(int j = 2;i*j <= n;j ++){
                is_prime[i*j] = false;
            }
        }
    }
}

int main(){
    vector<int> slike(100001);
    set<int> st;
    eratosthenes(st,100000);

    slike[0] = 0;
    for(int i = 1;i < 100001;i ++){
        slike[i] = slike[i-1] + (st.find(i)!=st.end() && st.find((i+1)/2)!=st.end());
    }

    int q;
    cin >> q;
    for(int i = 0;i < q;i ++){
        int l,r;
        cin >> l >> r;
        cout << slike[r] - (l?slike[l-1]:0) << endl;
    }

    return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long Q = sc.nextInt();
		long H = sc.nextInt();
		long S = sc.nextInt();
		long D = sc.nextInt();
		long N = sc.nextInt();
		
		Q = 8*Q;
		H = 4*H;
		S = 2*S;
		
		long min = min(Q,H);
		long min1 = min(min,S);
		long min2 = min(min1,D);
		
		long sum;
		sum = N/2*min2;
		sum = sum + ((N%2==1)?(min1/2):0);
		
		System.out.println(sum);
	}
	
	public static long min(long a, long b) {
		if (a<=b)
			return a;
		else
			return b;
	}
}

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

#define PI 3.14159265358979323846264338327950L

int main(void)
{
    int a, b, h, m;
    scanf("%d%d%d%d", &a, &b, &h, &m);

    long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long double)m / 60.0);

    long double rsq = (long double)(a * a + b * b) - (long double)(2 * a * b) * cosl(rad);

    printf("%20.20Lf\n", sqrtl(rsq));

    return 0;
}

Measured memory_bytes: 4068
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;
typedef long long ll;

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
long long int mod = 1000000007;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
    //abcのbed乗を計算する
    if(bed==0){return 1;}
    else{
        ll ced = rui(abc,bed/2);
        ced *= ced;
        ced %= mod;
        if(bed%2==1){ced*=abc; ced%=mod;}
        return ced;
    }
}



ll i,j,k,ii,jj;
ll n,m,num;
ll a,b,c,e,f,g,h;
ll x[800005],y[800005],z[900005];
ll in[800005];
ll vnum = 0,sum,ans;
bool dame;
bool check[500005];


int main(){
    cin>>n;
    if(n==1){
		p("Hello World");
		return 0;
	}else{
		cin >> a >> b;
		p(a+b);
		return 0;
	}

}


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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,k,q;
    cin>>n>>k>>q;
    Vi a(q);
    REP(i,0,q){
        cin>>a[i];
        a[i]--;
    }
    map<int,int> ma;
    REP(i,0,q){
        ma[a[i]]++;
    }
    REP(i,0,n){
        if(q-ma[i]<k) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> a >> b;
  if(a==b) co("Yes");
  else co("No");
  
  
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import math
import collections
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

s=input()
letter=[]
for i in range(4):
    letter.append(s[i:i+1])
#print(letter)
i=collections.Counter(letter)
#print(i)
mul=1
for l in i:
    if i[l]==2:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")


Measured memory_bytes: 3316
#include"bits/stdc++.h"
using namespace std;

#define ll long long int
#define f(i,x,n)  for(int i=x;i<n;i++)
#define FASTIO cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define sz(a) int((a).size())
#define mod 1000000007
#define inf LLONG_MAX
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
template <typename T>
inline T gcd(T a, T b) { while (b != 0) swap(b, a %= b); return a; }

template <typename T>
inline void seethis(vector<T>vect)
{
    for(T x:vect)
        cout<<x<<" ";
    cout<<"\n";
}

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
//LCM
int lcm(int a, int b) {  return a * (b / gcd(a, b)); }

//For sort by second
bool cmp(const pair<int,int> &a)
{ return a.first<a.second; }

//Tree
/* const int MAXN = 1e5 + 5;
vector<ll> adj[MAXN];*/

//ModPower
ll modpower(ll a,ll b,ll c)
{
    ll res=1;
    while(b)
    {
        if(b&1LL)
            res=(res*a)%c;
        a=(a*a)%c;
        b>>=1;
    }
    return res;
}

int main()
{
    FASTIO;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
  int x;
   cin>>x;

   if(x)
    cout<<0<<"\n";
    else
        cout<<1<<"\n";

    
    return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

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

		int n = scan.nextInt();
		int m = scan.nextInt();
		int [][] det = new int [n][m];
		int [] b = new int [m];

		for(int i = 0; i < n ; i++){
			for(int j = 0 ; j < m ; j++){
				det[i][j] = scan.nextInt();
			}
		}

		for(int i = 0 ; i < m ; i++){
			b [i] = scan.nextInt();

		}
		
		for(int i = 0 ; i < n ; i++){
			int sum = 0 ;
			for(int j = 0 ; j < m ; j++){
			   sum += det[i][j]*b[j];
			}
			System.out.println(sum);
		}

	}
}

Measured memory_bytes: 31848
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　　￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

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

    int X, Y, Z;
    cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int A,B,C;
  	cin>>A>>B>>C;
  	if(A == B && A != C){
    	cout<<"Yes\n";
    }
  	else if(A == C && A != B){
    	cout<<"Yes\n";
    }
  	else if(B == C && B != A){
    	cout<<"Yes\n";
    }
  	else{
    	cout<<"No\n";
    }


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
ll a,b,c,d,n,f[N];
int main() {
    a=gi(),b=gi(),c=gi(),d=gi(),n=4ll*gi();
    memset(f,0x3f,sizeof(f));
    f[0]=0;
    for(int i=1;i<=9;i++) {
        f[i]=min(f[i],f[i-1]+a);
        if(i>1) f[i]=min(f[i],f[i-2]+b);
        if(i>3) f[i]=min(f[i],f[i-4]+c);
        if(i>7) f[i]=min(f[i],f[i-8]+d);
    }
    //for(int i=1;i<=n;i++) cerr<<f[i]<<" ";
    if(n<=9) return printf("%lld\n",f[n]),0;
    ll delta=f[9]-f[1];
    printf("%lld\n",f[(n-1)%8+1]+delta*((n-1)/8));
    return 0;
}


Measured memory_bytes: 8064
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

int main()
{
	string S, T;
	cin >> S >> T;

	cout << T + S << endl;
	return 0;
} 


Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
int a, b ;
int i;
int flag = 1;
int d;
  scanf("%d %d", &a, &b);
  for(i=1;i<=3;i++){
    d = a*b*i ;
    if(d%2 == 0){
      flag = 0 ;
    }
    if(d%2 == 1){
      flag = 1 ;
      break;
    }
  }
  if(flag == 0){
    printf("No") ;
  }
  if(flag == 1){
    printf("Yes") ;
  }
  return 0 ;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)
#define print(a) cout << (a) << endl; 
typedef long long ll;
const int MOD = 1000000007; 

int main() {
    int n, x, y;
    cin >> n >> x >> y;
    vector<int> dis(n+1, 0);
    rep(i, 1, n) {
        rep(j, i+1, n+1) {
            int d = min(abs(x-i)+abs(y-j)+1, j-i);
            dis[d]++;            
        }
    }
    rep(i, 1, n) {
        cout << dis[i] << endl;
    } 
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define INF 100000000

/**int matrixChainOrder(int p[], int n){                                                         
  int i, j, l, k, q, m[100][100];                                                                
  for(i = 1; i < n + 1; i++)                                                                     
    m[i][i] = 0;                                                                                 
  for(l = 2; l < n + 1; l++){                                                                    
    for(i = 1; i <= n - l + 1; i++){                                                             
      j = i + l - 1;                                                                             
      m[i][j] = INF;                                                                             
      for(k = i; k <= j - 1; k++){                                                               
        q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];                                      
        if(m[i][j] > q)                                                                          
          m[i][j] = q;                                                                           
      }                                                                                          
    }                                                                                            
  }                                                                                              
  return m[1][j];                                                                                
}                                                                                                
**/

int main(){
  int n, i, p[100], r, c, m[100][100], l, k, q, j;

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d%d", &r, &c);
    if(i == 0)
      p[i] = r;
    p[i + 1] = c;
  }

  for(i = 1; i < n + 1; i++)
    m[i][i] = 0;
  for(l = 2; l < n + 1; l++){
    for(i = 1; i <= n - l + 1; i++){
      j = i + l - 1;
      m[i][j] = INF;
      for(k = i; k <= j - 1; k++){
        q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];
        if(m[i][j] > q)
          m[i][j] = q;
      }
    }
  }

  printf("%d\n", m[1][j]);

  return 0;
}



Measured memory_bytes: 2048
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=100000+100;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline 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;
}

inline ll readll()
{
    ll x=0;int 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 n,d1,d2,col[610][610];

void solve(int d)
{
    int p=0;
    while (d%4==0)
    {
        d/=4;p++;
    }
    if (d&1)
    {
        rep(i,0,n*2-1) rep(j,0,n*2-1)
        {
            int tmp=(i>>p)+(j>>p);
            col[i][j]|=(tmp&1);
        }
    }
    else
    {
        rep(i,0,n*2-1) rep(j,0,n*2-1)
        {
            col[i][j]|=((i>>p)&1);
        }
    }
    
}

int main()
{
    n=read();d1=read();d2=read();
    solve(d1);solve(d2);
    int cnt=0;
    rep(i,0,n*2-1) rep(j,0,n*2-1)
    {
        if (!col[i][j])
        {
            printf("%d %d\n",i,j);cnt++;
            if (cnt==n*n) return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 2304
import std.stdio;
import std.conv;
import std.algorithm;

class Node {
    Edge[] edges;
    string name;
    Node toTree(bool[Node] used) {
        used[this] = true;
        Node t = new Node;
        t.name = name;
        foreach (e; edges) {
            if (used.get(e.to, false)) continue;
            t.edges ~= new Edge(t, e.to.toTree(used), e.value);
        }
        return t;
    }
    override string toString() {
        return "Node " ~ name;
    }
}

class Edge {
    Node from, to;
    int value;
    this(Node from, Node to, int value) {
        this.from = from;
        this.to = to;
        this.value = value;
    }
}

int adfs(Node v) {
    int t = 0;
    foreach (e; v.edges) {
        t += adfs(e.to);
        if (e.to.edges.length > 0) {
            t += e.value * 2;
        }
    }
    return t;
}

int bdfs(Node v) {
    int x = adfs(v);
    int t = x;
    foreach (e; v.edges) {
        if (e.to.edges.length > 0) {
            t = min(t, x + (bdfs(e.to) + e.value) - (adfs(e.to) + e.value * 2));
        }
    }
    return t;
}

void main() {
    int N; 
    while (readf("%d\n", &N), N) {
        Node[] graph = new Node[N + 1];
        foreach (int i, ref _; graph) {
            _ = new Node;
            _.name = i.to!string;
        }
        foreach (i; 0 .. N - 1) {
            int a, b, t; readf("%d %d %d\n", &a, &b, &t);
            graph[a].edges ~= new Edge(graph[a], graph[b], t);
            graph[b].edges ~= new Edge(graph[b], graph[a], t);
        }
        Node tree = graph[1].toTree((bool[Node]).init);
        bdfs(tree).writeln;
    }
}

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

using namespace std;

using ll = long long;

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

class ten
{
    public:
    int High;
    set<int> next;
};

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

    ten Ten[N];
    for(int i=0;i<N;i++)
    {
        cin >> Ten[i].High;
    }
    for(int i=0;i<M;i++)
    {
        int a,b;
        cin >> a >> b;
        Ten[a-1].next.insert(Ten[b-1].High);
        Ten[b-1].next.insert(Ten[a-1].High);
    }

    vector<bool> Highest(N,true);
    for(int i=0;i<N;i++)
    {
        for(auto x : Ten[i].next)
        {
            if(Ten[i].High <= x)
            {
                Highest[i] = false;
            }
        }
    }


    int total = 0;
    for(auto x : Highest)
    {
        if(x) total++;
    }

    cout << total << endl;

    return 0;
}

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

using namespace std;

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

    string s;
    cin >> s;

    bool found['z' - 'a' + 1] = {false};

    for (char &c : s) {
        int i = c - 'a';

        if (found[i]) {
            cout << "no" << endl;
            return 0;
        }

        found[i] = true;
    }

    cout << "yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
#define v_inputrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する

int main(){
    int N, Y;
    cin >> N >> Y;
    int x = -1, y =-1, z = -1;
    for(int i = 0;10000*i <= Y; i++){
        for(int j = 0;5000*j+10000*i <= Y;j++){
            if(10000*i+5000*j+1000*(N-i-j)==Y && N-i-j >= 0){
                x = i;y = j;z = N-i-j;
                if(x != -1){break;}
            }
           if(x != -1){break;}
        }
        if(x != -1){break;}
    }

    cout << x <<" "<<y<<" "<<z;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main(){ 
    int n; cin >> n;
    vector<ll> A(n); rep(i, n) cin >> A[i];
    int res = INF;
    rept(num, 1, 101){
        int sum = 0;
        rep(i, n){
            int d = (A[i] - num) * (A[i] - num);
            sum += d;
        }
        chmin(res, sum);
    }
    cout << res << ln;
}



Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <algorithm>

typedef long long ll;
int main()
{
	ll n, m; scanf("%lld%lld", &n, &m);
	if (2 * n >= m) printf("%lld\n", m >> 1);
	else printf("%lld\n", n + (m - 2 * n) / 4);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
main()
{
    int n;
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin>>n;
    cout<<a[n-1]<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

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

const int MAX_N = 101;
const int MAX_M = 101;
int N, M;
double table[MAX_N][MAX_N];
double dp[MAX_M][MAX_N]; 

void solve() {
	rep(i,M) rep(j,N) dp[i][j] = 0.0;

	rep(i,N) dp[0][i] = 1.0;
	repa(i,1,M-1) {
		rep(j,N) {
			double maxval = 0.0;
			rep(k,N) {
				double s = dp[i-1][k] * table[k][j];
				maxval = max(s, maxval);
			}
			dp[i][j] = maxval;
		}
	}

	double maxval = 0.0;
	rep(i,N) {
		maxval = max(maxval, dp[M-1][i]);
	}
	printf("%.2f\n", maxval);
}

int main() {
	while(scanf("%d%d",&N,&M), N|M) {
		rep(i,N) {
			rep(j,N) {
				scanf("%lf", &table[i][j]);
			}
		}
		solve();
	}
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#define lli long long int
#define ll long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
  int a, b, N;
  string S;
  int ans = 0;
  cin >> N >> a >> S;
  if(S[a-1] == 'A'){
    S[a-1] = 'a';
  }
  else if(S[a-1] == 'B'){
    S[a-1] = 'b';
  }
  else{
    S[a-1] = 'c';
  }
  cout << S;
  return 0;
}


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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if ((b-a)/2 < c){
    for (int i=a; i<=b; i++){
      cout << i << endl;
    }
  } else {
    for (int i=a; i<a+c; i++){
      cout << i << endl;
    }
    for (int i=b-c+1; i<=b; i++){
      cout << i << endl;
    }
  }

}

Measured memory_bytes: 256
<?php
  function gcd($a, $b){return ($b? gcd($b, $a%$b) : $a);}
  function lcm($a, $b){return $a/gcd($a,$b)*$b;}

  fscanf(STDIN, "%d", $n);
  $ans = 1;
  for ($i=0; $i<$n; $i++) {
    fscanf(STDIN, "%d", $t);
    $ans = lcm($ans, $t);
  }

  echo $ans;
?>

Measured memory_bytes: 4604
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(), m = scan.nextInt(), l = scan.nextInt();
        long[][] A = new long[n][m];
        long[][] B = new long[m][l];
        long[][] C = new long[n][l];
        int i, j, k;
        for(i = 0; i < n; i++){
            for(j = 0; j < m; j++){
                A[i][j] = scan.nextInt();
            }
        }
        for(j = 0; j < m; j++){
            for(k = 0; k < l; k++){
                B[j][k] = scan.nextInt();
            }
        }

        for(i = 0; i < n; i++){
            for(k = 0; k < l; k++){
                C[i][k] = 0;
                for(j = 0; j < m; j++){ C[i][k] += A[i][j] * B[j][k]; }
            }
        }
        for(i = 0; i < n; i++){
            for(k = 0; k < l - 1; k++){
                System.out.print(C[i][k] + " ");
            }
            System.out.println(C[i][l - 1]);
        }
    }
}


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

#define mod 1000000007
using namespace std;

long long dp[302][302][302],l,r,x,ans = 0;
bool a[302][302][302];

int main(){
	int i,j,k,n,m;
	cin >> n >> m;
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			for(k=0;k<=n;k++){
				a[i][j][k] = true;
			}
		}
	}
	for(i=0;i<m;i++){
		cin >> l >> r >> x;
		for(j=0;j<r;j++){
			for(k=0;k<r;k++){
				if((j!=0 && j==k) || j<k){
					a[r][j][k] = false;
				}else if(x==1){
					if(j>=l || k>=l){
						a[r][j][k] = false;
					}
				}else if(x==2){
					if(!((j>=l)^(k>=l))){
						a[r][j][k] = false;
					}
				}else if(x==3){
					if(j<l || k<l){
						a[r][j][k] = false;
					}
				}
			}
		}
	}
	
	dp[0][0][0] = 1;
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			for(k=0;k<=n;k++){
				if(!a[i][j][k]){
					dp[i][j][k] = 0;
				}
				if((i>j && j>k) || (j==0 && k==0)){
					dp[i+1][j][k] += dp[i][j][k];
					dp[i+1][j][k] = dp[i+1][j][k]%mod;
					dp[i+1][i][k] += dp[i][j][k];
					dp[i+1][i][k] = dp[i+1][i][k]%mod;
					dp[i+1][i][j] += dp[i][j][k];
					dp[i+1][i][j] = dp[i+1][i][j]%mod;
				}
			}
		}
	}
	
	for(i=0;i<=n;i++){
		for(j=0;j<=n;j++){
			ans += dp[n][i][j];
			ans = ans%mod;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 242304
N = int(input())
ABC = ["a", "b", "c", "d", "e", "f","g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" ]
count = []
i = 1
keta = 0
while True:
    if N< 26*(26**i-1)/25:
        keta = i
        break
    else:
        i+=1
n = keta-1
bann = N-26*(26**n-1)/25
#print(keta, bann)
if bann ==0:
    ans2 = []
    for i in range(keta-1):
        ans2.append("z")
    print("".join(ans2))
    
    
else:
    
    bann-=1
    ans1 = []
    while True:
        a = bann//26
        b = bann % 26
        ans1.append(b)
        #print(a)
        if a<26:
            if a!=0:
                ans1.append(a)
            break

        bann=a
    #print(ans1)
    while len(ans1)<keta:
        ans1.append(0)
    ans2 = []
    #print(ans1)
    for i in reversed(ans1):
        ans2.append(ABC[int(i)])
    print("".join(ans2))

Measured memory_bytes: 62180
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    if(S[0]!='A'){
        cout << "WA" << endl;
        return 0;
    }
    else{
        int flag=0;
        int flag2=0;
        for(int i=1;i<S.length();i++){
            if(i>=2 && i<S.length()-1 && S[i]=='C')flag++;
            else if((int)(S[i]-'a')<0 || (int)(S[i]-'a')>26)flag2++;
        }
        if(flag!=1 || flag2>0)cout << "WA" << endl;
        else cout << "AC" << endl;
    }
}

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

int main( int argc, char *argv[] )
{
int A;
int B;

	// A B を取得
	cin >> A;
	if( A < 0 || A > 23 ) return 0;

	cin >> B;
	if( B < 0 || B > 23 ) return 0;

	// 出力
	cout << ( A + B ) % 24 << endl;

	return 0;
}






Measured memory_bytes: 256