akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

ll lcm(ll a, ll b)
{
   return a / gcd(a, b) * b;
}

int main()
{
  string s;
  cin >> s;
  ll n = s.size();
  ll cnt = 0, ans = 0;

  for(ll i = 0; i<n; i++){
    if(s[i] == 'W'){
      ans+=(i - cnt);
      cnt++;
    }
  }

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

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

double ans, n, k;

int main(){
	cin >> n >> k;
	for(int i=1, temp; i<=n; i++){
		temp = i;
		double prob = 1;
		while(temp < k){
			temp *= 2;
			prob *= 0.5;
		}
		ans += prob;
	}

	cout << setprecision(10) << ans * (1/n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e3;
ll n, a[N], s[2];
bool z[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> a[i];
  {
    int i = max_element(a, a+n)-a;
    if(a[i] <= 0){
      cout << a[i] << endl;
      cout << n-1 << endl;
      FORR(j, n-1, i+1) cout << j+1 << endl;
      FOR(j, 0, i) cout << 1 << endl;
      return 0;
    }
  }
  {
    FOR(i, 0, n) s[i&1] += max(0ll, a[i]);
    int i = s[0]<s[1], c = 0;
    for(int j=i; j<n; j+=2)if(a[j]>0){
      z[j] = true;
      c++;
    }
    cout << s[i] << endl;
  }
  V<int> ans;
  int i = n-1;
  while(!z[i]){
    ans.pb(i);
    i--;
  }
  while(i>2){
    if(z[i-2]){
      ans.pb(i-1);
    }else{
      ans.pb(i-2);
    }
    i -= 2;
  }
  if(i==1) ans.pb(0);
  if(i==2){
    if(z[0]){
      ans.pb(1);
    }else{
      ans.pb(0);
      ans.pb(0);
    }
  }
  cout << sz(ans) << endl;
  for(int b:ans) cout << b+1 << endl;
}

Measured memory_bytes: 256
import kotlin.math.sqrt

fun main() {
    val n = readLine()!!.toInt()
    val count = Array(n + 1) { 0 }
    for (x in 1..sqrt(n.toFloat()).toInt()) {
        for (y in 1..sqrt(n.toFloat()).toInt()) {
            for (z in 1..sqrt(n.toFloat()).toInt()) {
                val value = x * x + y * y + z * z + x * y + y * z + z * x
                if (value < n + 1) {
                    count[value] += 1
                }
            }
        }
    }
    count.drop(1).forEach { println(it) }
}

Measured memory_bytes: 40776
#include<functional>
#include<algorithm>
#include<iterator>
#include<cstring>
#include<cstdio>
using namespace std;
void GG()
{
	puts("IMPOSSIBLE");
	exit(0);
}
int da[111111],db[111111],pa[111111],pb[111111];
int n;
struct R{int v,z;}e[1111111];
int K[222222],cur[222222],ce=1;
void ins(int a,int b){e[++ce]=(R){b,K[a]};K[a]=ce;}
int viz[1111111],res[111111];
const int s=0;
int d;
void dfs(int u)
{
	++d;
	for(int&i=cur[u];i;i=e[i].z)if(!viz[i])
	{
		viz[i]=1;
		viz[i^1]=-1;
		dfs(e[i].v);
	}
}
void euler()
{
	memcpy(cur,K,sizeof(cur));
	dfs(s);
	puts("POSSIBLE");
	for(int u=1;u<=n;++u)
	{
		int a=0;
		for(int i=K[u];i;i=e[i].z)
		{
			if(e[i].v==pa[u])
				res[u]+=viz[i],
				res[pa[u]]-=viz[i];
		}
	}
	for(int i=1;i<=n;++i)printf("%d ",res[i]);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&pa[i]);
		if(pa[i]==-1)pa[i]=s;
		ins(pa[i],i),ins(i,pa[i]);
		++da[pa[i]];
	}
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&pb[i]);
		if(pb[i]==-1)pb[i]=s;
		ins(pb[i]+n+1,i+n+1),ins(i+n+1,pb[i]+n+1);
		++db[pb[i]];
	}
	ins(s,s+n+1);
	ins(s+n+1,s);
	for(int i=1;i<=n;++i)
	{
		if((da[i]&1)!=(db[i]&1))
			GG();
		#define gmin(a,b) ((a)<(b)?(a):(b))
		int z=gmin(da[i],db[i])+1;
		for(int j=1;j<=z;++j)ins(i,i+n+1),ins(i+n+1,i);
	}
	euler();
	return 0;
}

Measured memory_bytes: 20864
#include <stdio.h>
int main()
{
  long long int i, j;
  long long int a,b=0,k=0;
  scanf("%lld",&a);
  for (int i = 1; i <= a; i++) {
    if (i%2==1) {
      b++;
    }
  }
  printf("%.10f\n",(float)b/a);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(void) {
	int N; cin >> N;
	int X; cin >> X;
	int T; cin >> T;
	int Ans = 0;
	if (N % X != 0) {
		Ans = T * ((N / X) + 1);
	}
	else {
		Ans = T * (N / X);
	}
	cout << Ans << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	vector<ll> h(n);
	for(int i = 0; i < n; ++i){ cin >> h[i]; }
	sort(h.begin(), h.end(), greater<ll>());
	ll answer = 1;
	for(int i = 0; i < n; ++i){
		ll lost = i / 4;
		answer += max(0ll, h[i] - lost);
	}
	cout << answer << endl;
	return 0;
}

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

int main(void) {

  char s[1001],t[1001];
  scanf("%s%s", s,t);
  long s_length = strlen(s),t_length = strlen(t);
  long count,min = t_length;
  for (long i = 0; i <= s_length-t_length; i++) {
    count = 0;
    for (long j = 0; j < t_length; j++) {
      if (s[i+j] != t[j]) {
        count++;
      }
    }
    if (count < min) {
      min = count;
    }
  }
  printf("%ld\n", min);

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<ll> a(n+1);
    ll ans = 0;
    for(int i = 0;i <= n;i ++){
        cin >> a[i];
    }
    for(int i = 0;i < n;i ++){
        ll b;
        cin >> b;
        ans += min(b,a[i]);
        b -= a[i];
        ans += max(0ll,min(b,a[i+1]));
        if(b>0) a[i+1] -= b;
        if(a[i+1]<0) a[i+1] = 0;
    }
    cout << ans << endl;
    return 0;
}

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<double> vcD;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	lli n;
	cin >> n;
	
	vcD prob(n);
	for (auto &x : prob) cin >> x;
	
	double dp[n + 1];
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;
	
	for (int i = 0; i < n; ++i) {
		for (int j = n; j >= 0; --j) {
			if (j >= 1) {
				dp[j] = dp[j] * prob[i] + dp[j - 1] * (1 - prob[i]);
			}
			else {
				dp[j] = dp[j] * prob[i];
			}
		}
	}
	
	double ans = 0;
	for (int i = 0; i <= n/2; ++i) {
		ans += dp[i];
	}
	
	cout << setprecision(10) << ans << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}




Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        int t1 = 0;
        int x1 = 0;
        int y1 = 0;
        int t2 = 0;
        int x2 = 0;
        int y2 = 0;
        double dt = 0;

        for (int i = 0; i < N; i++) {
            t1 = Integer.parseInt(sc.next());
            x1 = Integer.parseInt(sc.next());
            y1 = Integer.parseInt(sc.next());

            dt = Math.abs(x2 - x1) + Math.abs(y2 - y1);
            if ( dt > t1 || ((t2-t1) - dt) % 2 != 0) {
                System.out.println("No");
                System.exit(0);
            }

            x2 = x1;
            y2 = y1;
            t2 = t1;
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 60860
#include<bits/stdc++.h>
using namespace std;
 
typedef long long   ll;
typedef long double ld;
const int N  = 2e5+10;
const ll mod = 1e9+7;
const ll inf = 1e18;
 
#define fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb              push_back
#define mp              make_pair
#define ub              upper_bound                 // first element >  val(itr)
#define lb              lower_bound                 // first element >= val(itr) 
#define all(x)          (x).begin(),(x).end()
#define reset(a,x)      memset(a,x,sizeof(a))       // x can be 0 or -1
#define leadzero(a)     __builtin_clz(a)            // count leading zeroes
#define trailzero(a)    __builtin_ctz(a)            // count trailing zeroes
#define bitcount(a)     __builtin_popcount(a)       // count set bits
#define test            int t; cin>>t; while(t--)
#define forn(i,a,e)     for(ll i = a; i < e; i++)
#define pii             pair<int,int>
#define pll             pair<ll,ll>
#define sp              <<" "<<
 
 
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;    }
ll powm(ll base,ll exp){ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
ll add(ll a,ll b)  { return (a%mod+b%mod)%mod;        }
ll sub(ll a, ll b) { return (a%mod+mod-b%mod)%mod;    }
ll mult(ll a,ll b) { return ((a%mod)*(b%mod))%mod;    }

int main()
{
    fast
    ll a,b,t;
    cin>>a>>b>>t;
    
    ll cnt=0; 
    for(ll i=a;i<=t;i+=a)
     cnt+=b;

    cout<<cnt;

    return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int t[10],a[10],b[10],m,n,now;
int dfs(int x)
{
    now = x;
    if(now==10)
    {
        return 1;
    }
    if(t[now]>a[m-1])
    {
        a[m]=t[now];
        m++;
        now++;
        dfs(now);
    }
    if(now==10)
    {
        return 1;
    }
    if(t[now]>b[n-1])
    {
        b[n]=t[now];
        n++;
        now++;
        dfs(now);
    }
    if(now==10)
    {
        return 1;
    }
    return 0;

}
int main()
{
    int times,i,j,p=0;
    scanf("%d",&times);
    for(i=0;i<=times-1;i++)
    {
        m=1;n=1;
        a[10]={0};
        b[10]={0};
        for(p=0;p<=9;p++)
            cin>>t[p];

        if(dfs(0))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3212
use std::io;
use std::io::{BufRead, Write};

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let inputs: Vec<usize> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    buf.clear();
    input.read_line(&mut buf).unwrap();
    let k: usize = buf.trim_right().parse().unwrap();
    let max = inputs.iter().max().unwrap();
    writeln!(output, "{}", inputs.iter().sum::<usize>() + (max << k) - max).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "5 3 11
1
",
            "30\n",
        );
    }

    #[test]
    fn case2() {
        test(
            "3 3 4
2
", "22\n",
        );
    }
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

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

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		(1<<29)
#define MINF		-2000000007
#define MAX 		205

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

//
int main(){
	string N;
	ll K;
	cin >> N >> K;

	int one = 0;
	while(N[one++]=='1') ;
	one--;

	if(one >= K)puts("1");
	else cout << (N[one]-'0') << endl;

	return 0;
}




Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

let end = false;
reader.on("line", (line) => {
  if (end) return;
  const [as, op, bs] = line.split(" ");
  if (op === "?") {
      end = true;
      return;
  }
  const a = Number(as);
  const b = Number(bs);

  let n;
  switch (op) {
    case "+":
      n = a + b;
      break;
    case "-":
      n = a - b;
      break;
    case "*":
      n = a * b;
      break;
    case "/":
      n = Math.floor(a / b);
      break;
  }

  console.log(n);
});



Measured memory_bytes: 16552
import sys
input = sys.stdin.readline
N,K,Q = map(int,input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())
    
judge = [K-Q] * N
for j in A:
    judge[j-1] += 1

for k in judge:
    if k > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 10416
#include <bits/stdc++.h>
using namespace std;
#define MX 8000000
bool p[MX];
bool solve(){
	int m,n;
	cin >> m >> n;
	if(m==0&&n==0)return false;
	for(int i=0;i<MX;i++)p[i] = false;
	int cnt = 0;
	for(int i=m;;i++){
		if(!p[i]&&cnt<=n){
			if(cnt==n){
				printf("%d\n",i);
				return true;
			}
			cnt++;
			for(int j=i;j<=MX;j+=i){
				p[j]=true;
			}
		}
	}
	return true;
}
int main(){
	while(solve()){}
	return 0;
}



Measured memory_bytes: 10936
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,m;
    cin >> n >> m;
    vector<int> k(m);
    vector<int> s[m];
    vector<int> p(m);
    int ans = 0;
    rep(i,m){
        cin >> k[i];
        rep(j,k[i]){
            int t;
            cin >> t;
            t--;
            s[i].push_back(t);
        }
    }
    rep(i,m) cin >> p[i];
    rep(i,1<<n){
        vector<bool> sw(n,false);
        vector<int> lb(m);
        rep(j,n){
            if(i>>j & 1) sw[j]=true;
        }
        cout << endl;
        rep(j,m){
            rep(ij,k[j]){
                if(sw[s[j][ij]]) lb[j]++; 
            }
        }
        bool check = true;
        rep(j,m){
            if(lb[j]%2 != p[j]) check = false;
        }
        if(check) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(j, m) for (int j = 0; j < (int)(m); j++)
#define rep2(i, l, n) for (int i = l; i < (int)(n); i++)


int main() {
    string S;
    cin >> S;
    rep2(i,'a','z' + 1) {
        int flag = 0;
        rep(j,S.size()) {
            if (S[j] == i) {
                flag++;
            }
        }
        if (flag == 0) {
            char c = i;
            cout << c << endl;
            break;
        }
        if (i == 'z') {
            cout << "None" << endl;
        }
    }

}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
int main(){
  string a,b;
  int sum=0;
  cin>>a>>b;a+=b;
  r(i,a.size())sum=sum*10+(a[i]-'0');
  for(int i=0;i<10000;i++){
    if(i*i==sum){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

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

vector<int> G[10000];

void dfs(vector<int> &point,priority_queue<int> &pq,int p){
    static bool visited[10000] = {};
    visited[p] = true;
    point[p] = pq.top();
    pq.pop();

    for(int i = 0;i < G[p].size();i ++){
        int to = G[p][i];
        if(visited[to]) continue;
        else dfs(point,pq,to);
    }
    return ;
}

int main(){
    int n;
    ll score = 0;
    vector<int> point(n);
    priority_queue<int> pq;
    cin >> n;
    for(int i = 0;i < n-1;i ++){
        int a,b;
        cin >> a >> b;
        a --,b --;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for(int i = 0;i < n;i ++){
        ll C;
        cin >> C;
        pq.push(C);
        score += C;
    }
    score -= pq.top();
    
    dfs(point,pq,0);

    cout << score << endl;
    for(int i = 0;i < n;i ++){
        cout << point[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
 
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))
 
typedef long long ll;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n,a,b;
  cin>>n>>a>>b;
  
  ll ans = n/(a+b) * a;
  ll rem = n%(a+b);
  
  ans+=min(a,rem);
  cout<<ans;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;



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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

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

#define int long long



void solve(){

	int n;
	cin>>n;

	int dp[n][3];

	memset(dp , 0 , sizeof dp);

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

		int a , b , c;
		cin>>a>>b>>c;

		if(!i){

			dp[i][0] = a;
			dp[i][1] = b;
			dp[i][2] = c;
		}
		else {

			dp[i][0] = max(dp[i-1][1] , dp[i-1][2]) + a;

			dp[i][1] = max(dp[i-1][0] , dp[i-1][2]) + b;

			dp[i][2] = max(dp[i-1][0] , dp[i-1][1]) + c;
		}
	}

	cout<<*max_element(dp[n-1] , dp[n-1] + 3)<<endl;

}
signed main(){

    fast;
    int t = 1;
    //cin>>t;
    while(t--)
        solve();
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,b) for(ll i=0;i<b;i++)
#define RFOR(i,a,b) for(ll i=b-1;i>=a;i--)
#define rsort(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(),(v).end()
using namespace std;
ll mod=1000000007;

set<ll> se;
signed main(){
    ll n,m,s,ans=0;
    cin>>n;
    rep(i,n) {
        cin>>s;
        se.insert(s);
    }
    cin>>m;
    rep(i,m){
        cin>>s;
        if(se.find(s)!=se.end())ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 7772
#include <bits/stdc++.h>
#include <set>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou(bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<vector<int>> children;
  vector<int> hukasa;
  vector<int> kazu;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    kazu = vector<int>(n,1);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
      kazu.at(rx) += kazu.at(ry);
    }
    else{
      par.at(rx) = ry;
      kazu.at(ry) += kazu.at(rx);
    }
  }
  void newkazu(){
    int n = kazu.size();
    for(int i=0;i<n;i++){
      kazu.at(i) = kazu.at(root(i));
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
void hukasa(vector<vector<int>> s,vector<vector<int>> table,int &ans,pii frm,int n,int m){
  int x,y;
  tie(x,y) = frm;
  set<pii> se;
  if(x-1 >= 0)se.insert(pii(x-1,y));
  if(x+1 < n)se.insert(pii(x+1,y));
  if(y-1 >= 0)se.insert(pii(x,y-1));
  if(y+1 < m)se.insert(pii(x,y+1));
  for(auto t:se){
    int tx,ty;
    tie(tx,ty) = t;
    if(s.at(tx).at(ty) && table.at(tx).at(ty) == -1){
      table.at(tx).at(ty) = table.at(x).at(y) + 1;
      ans = max(ans,table.at(tx).at(ty));
      hukasa(s,table,ans,t,n,m);
      table.at(tx).at(ty) = -1;
    }
  }
}
void daiku(int frm,vector<vector<pii>> g,vector<int> &cost,int n){
  priority_queue<pii,vector<pii>,greater<pii>> q;
  q.push(pii(cost.at(frm),frm));
  vector<bool> kakutei(n,false);
  while(!q.empty()){
    pii now = q.top();
    q.pop();
    int n1,n2;
    tie(n1,n2) = now;
    if(kakutei.at(n2))continue;
    kakutei.at(n2) = true;
    for(auto t:g.at(n2)){
      int tx,ty;
      tie(tx,ty) = t;
      if(cost.at(tx) > n1 + ty){
        cost.at(tx) = n1 + ty;
        q.push(pii(cost.at(tx),tx));
      }
    }
  }
}
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin >> a.at(i);
  int all = a.at(0);
  for(int i=1;i<n;i++){
    all ^= a.at(i);
  }
  for(int i=0;i<n;i++)cout << (all ^ a.at(i)) << ' ';
}

Measured memory_bytes: 4032
{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Data.List
import Data.Bits
import Debug.Trace
import Data.Maybe
import qualified Data.ByteString.Char8 as C

main :: IO ()
main = do
  [n] <- readInts
  inputs <- readNIntegers n
  putStrLn $ solve n inputs

solve n inputs = validateJobs $ sortJobs inputs

sortJobs inputs = sortOn (!! 1) $ sortOn (!! 0) inputs

validateJobs = validateJobsSub 0
  where
    validateJobsSub t (x:xs) = if nt > (x !! 1)
      then "No"
      else validateJobsSub nt xs
      where
        nt = t + (x !! 0)
    validateJobsSub _ [] = "Yes"

-- 以下ライブラリ

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

readNInts :: Int -> IO [[Int]]
readNInts = flip replicateM readInts

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . C.readInteger) . C.words <$> C.getLine

readNIntegers :: Int -> IO [[Integer]]
readNIntegers = flip replicateM readIntegers

getNLns :: Int -> IO [String]
getNLns = flip replicateM getLine

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

int s_to_bin(string S){
    int ans = 0;
    for (auto &&y : S) {
        ans *= 2;
        ans |= y == '1';
    } // end y
    return ans;
}

int count_bit(int b){
    int cnt = 0;
    while(b > 0){
        cnt += b & 1;
        b /= 2;
    }
    return cnt;
}

bool check(int n, const vector<bitset<500>>& x){
    bitset<500> mat = 0;
    int i = 0;
    while(n > 0){
        if(n & 1){
            mat ^= x[i];
        }
        i++;
        n /=2;
    }
    return mat == 0;
}

void solve_n(int n, int m, vector<bitset<500>> b){
    int maxim = 0;
    for (int i = 0; i < (1 << n); ++i) {
        if(check(i, b)){
            maxim = max(maxim, count_bit(i));
        }
    } // end i
    cout << maxim << endl;
}


void solve_m(int n, int m, vector<int> b){
    vector<int> dp(1<<m, 0);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        vector<int> dp2 = dp;
        if(dp[b[i]] == 0) dp2[b[i]] = 1;
        for (int j = 0; j < dp.size(); ++j) {
            if(dp[j] > 0)
            dp2[j^b[i]] = max(dp[j^b[i]], dp[j] + 1);
        } // end j
        dp = dp2;
    } // end i
    cout << dp[0] << endl;
}


int main() {
    while(cin){
        int n, m;
        cin >> n >> m;
        if(n == 0 and m == 0) return 0;
        vector<string> b;
        for (int i = 0; i < n; ++i) {
            string s;
            cin >> s;
            b.push_back(s);
        } // end i

        if(n < m) {
            vector<bitset<500>> b2;
            for (auto &&i : b) {
                b2.push_back(bitset<500>(i));
            } // end i
            solve_n(n, m, b2);
        }
        else {
            vector<int> b2;
            for (auto &&i : b) {
                b2.push_back(s_to_bin(i));
            } // end i
            solve_m(n, m, b2);
        }

    }


    return 0;
}


Measured memory_bytes: 35808
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
        ll n;
    cin >> n;
    ll now = 26;
    ll cnt = 1;
    string ans;
    while(true){
        if(n - now <= 0){
            n--;
            while(n > 0){
                ans.push_back('a' + (n % 26));
                n /= 26;
            }
            while(ans.size() < cnt) ans.push_back('a');
            reverse(all(ans));
            cout << ans << endl;
            return 0;
        }
        n -= now;
        now *= 26;
        cnt++;

    }
}


Measured memory_bytes: 3592
s = list(input())

start = 0

found = False

if len(s) == 2:
  if s[0] == s[1]:
    end = 1
    found = True
else:
  for i in range(len(s)-2):
    if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:
      end = i + 2
      found = True
      break
    else:
      start += 1

if not found:
  start = -2
  end = -2

print(start+1, end+1)

Measured memory_bytes: 3956
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9+7;

int H,W,D;
int Q;
int A;
int L,R;
int dp[310*310];
map<int, pair<int,int>> m;
int main() {
    cin>>H>>W>>D;
    REP(i,0,H){
        REP(j,0,W){
            cin>>A;
            m[A]={i, j};
        }
    }

    REP(i,1,D+1){
        for(int j=i+D;j<=H*W;j+=D){
            dp[j]=abs(m[j].F - m[j-D].F) + abs(m[j].S - m[j-D].S) + dp[j-D];
            //cout<<j<<" "<<dp[j]<<endl;
        }
    }
    cin>>Q;
    REP(i,0,Q){
        cin>>L>>R;
        p(dp[R]-dp[L]);
    }
    return 0;
}

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

int n, k;
bool marked[11];

bool check(int n) {
  string s = to_string(n);
  for (auto it : s){
    if (marked[it - '0'])
      return false;
  }
  return true;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);    
     
    cin >> n >> k;
    for (int i = 0; i < k; i++){
      int x;
      cin >> x;
      marked[x] = true;
    }
    int i = n;
    for (; ;i++){
      if (check(i)){
        cout << i << endl;
        return 0;
      }
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var ans = 0;
            if ((input[0] + input[1]) % 2 == 0)
            {
                ans = (input[0] + input[1]) / 2;
            }else
            {
                ans = (input[0] + input[1]) / 2 + 1;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11348
/*input
5 2
1 1 2 2 5
*/
#include <bits/stdc++.h>

using namespace std;

const int MAX = 200005;

int N, K;
int arr[MAX];

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

	sort(arr, arr+MAX);
	int ans = N; int ct = 0;
	for(int i = 0; i < K; i++){
		ct += arr[MAX-i-1];
	}

	cout << ans-ct << endl;

	return 0;
}

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	ll n;
	std::cin >> n;
	ll ans = n;
	for (ll i = 1; i < sqrt(n) + 10; i++) {
		if (n % i == 0) {
			ans = min(ans, max((ll)log10(n/i)+1 ,(ll)log10(i)+1));
		}
	}

	std::cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N, M; cin >> N >> M;
    map<int,int> MA;
    rep(i,N) {
        int a; cin >> a;
        MA[a]++;
    }
    while (M > 0) {
        auto x = MA.rbegin();
        int a = x->first, b = x->second;
        if (M >= b) {
            MA.erase(a);
            MA[a >> 1] += b;
            M -= b;
        } else {
            MA[a] -= M;
            MA[a >> 1] += M;
            M = 0;
            break;
        }
    }
    ll res = 0;
    for (auto [k,v] : MA) {
        res += (ll)k * v;
    }
    cout << res << endl;
}

Measured memory_bytes: 8264
#include<iostream>
#define _USE_MATH_DEFINES
#include <math.h>
#include<iomanip>
using namespace std;
int A, B, H, M;
 
long double kakudo(long double a, long double b)
{
	if (a - b >= -180 && a - b <= 180) return a - b;
	else if (a - b > 180) return b + 360 - a;
	else if (a - b < -180) return a + 360 - b;
}
 
int main()
{	
	cin >> A >> B >> H >> M;
	long double jisin, funsin;
	jisin = (60 *(long double) H +(long double) M) / 2;
	funsin = 6 * M;
	long double c = kakudo(jisin,funsin);
	long double ans = (long double)(A * A + B *B) - (long double)(2*A * B) * cosl(M_PI*c/180);
	
	cout << setprecision(12)<<pow(ans,0.5) << endl;
}
//floatやdouble程度だと誤差に耐え切れない

Measured memory_bytes: 4112
#include<stdio.h>
#include<math.h>

main() {
	long int n,ans=0,ans1=0;
	scanf("%ld",&n);
	for(int i=2;i<=n;i++) {
		if(i%2!=0) {
			for(int j=1;j<=i;j++) {
				if(i%j==0) ans1++;
			}
			if(ans1==8) ans++;
			ans1=0;
		}
	}
	printf("%ld",ans);
}


Measured memory_bytes: 128
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int a=ir.nextInt();
 int b=ir.nextInt();
 out.println(gcd(a,b));
}

public static int gcd(int a,int b){
 if(b==0) return a;
 else return gcd(b,a%b);
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

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

 public BigInteger nextBigInteger(){return new BigInteger(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

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

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 24212
#include <iostream>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::vector;
int main() {
	int n, m, l;
	// ?¢???????????????????????´???°
	cin >> n >> m >> l;

	// ??????????¢????
	vector<vector<int>> A, B;
	vector<vector<long long>> C;
	A.resize(n);
	for (int i = 0; i < A.size(); i++)
	{
		A[i].resize(m);
	}
	B.resize(m);
	for (int i = 0; i < B.size(); i++)
	{
		B[i].resize(l);
	}
	C.resize(n);
	for (int i = 0; i < C.size(); i++)
	{
		C[i].resize(l);
	}
	// A,B????????\???
	for (int i = 0; i < A.size(); i++)
	{
		for (int j = 0; j < A[0].size(); j++)
		{
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < B.size(); i++)
	{
		for (int j = 0; j < B[0].size(); j++)
		{
			cin >> B[i][j];
		}
	}

	// ?¨????
	int i;
	long long c;
	for (i = 0; i < A.size(); i++)
	{
		for (int j = 0; j < B[0].size(); j++)
		{
			c = 0;
			for (int k = 0; k < B.size(); k++)
			{
				c += A[i][k] * B[k][j];
			}
			C[i][j] = c;
		}
	}

	// ??????
	for (int i = 0; i < C.size(); i++)
	{
		for (int j = 0; j < C[0].size(); j++)
		{
			cout << C[i][j];
			if (j != C[0].size() - 1) cout << " ";
				
		}
		cout << endl;
	}	
	return 0;
}

Measured memory_bytes: 3172
#include <iostream>
#include <stdio.h>
using namespace std;

int main(void){
        char s[1210];
        char count[28]={0};
        while(scanf("%s",s,stdin)!=EOF) {
                int i=0;
                while(s[i]) {
                        if('a'<=s[i] and s[i]<='z') {
                                count[s[i]-'a']+=1;
                        }
                        else if('A'<=s[i] and s[i]<='Z') {
                                count[s[i]-'A']+=1;
                        }
                        i++;
                }
        }
        for(int i=0; i<26; i++) {
                printf("%c : %d\n",i+'a',count[i]);
        }
        return 0;

}



Measured memory_bytes: 3196
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
pair<int, int> E[100001];
int H[100001];
int n[100001], kari[100001];
int sagasu(int A) {
	if (n[A] == n[A - 1]) return 0;
	int k = n[A - 1];
	for (int i = H[A]; i; i = E[i].second) {
		kari[k++] = sagasu(E[i].first);
	}
	sort(kari + n[A - 1], kari + n[A], greater<int>());
	int ret = 0;
	for (int i = 0; i < n[A] - n[A - 1]; i++) ret = max(ret, kari[n[A - 1] + i] + i);
	return ret + 1;
}

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


	int N = getint();

	for (int i = 2; i <= N; i++) {
		int a = getint();
		n[a]++;
		E[i] = mp(i, H[a]);
		H[a] = i;
	}
	rep1(i, N) n[i] = n[i - 1] + n[i];

	printf("%d\n", sagasu(1));

	Would you please return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)

#define SORT(c) sort((c).begin(),(c).end())
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(int argc, char const *argv[]) {
  int n,v,d; std::cin >> n;
  REP0(i,n){
    std::cin >> v >> d;
    VI row(n,0);
    REP0(j,d){
      std::cin >> v;
      row[v-1]=1;
    }
    REP0(j,n){
      std::cout << row[j];
      if (j<n-1) std::cout << " ";
    }
    std::cout << '\n';
  }

  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#define rep(i,n) for (int i = 0; i< (n); i++)
using namespace std;
 
int main() {
  int N, K, count = 0;
  cin >> N >> K;
  
  while(N/K>=1){
    count ++;
    N = N/K;
  }

  
 
  cout<<count+1<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
ll a[100001][3],dp[100001][3];
int n;
ll f(int day,int type){
    if (day==n)
        return 0;
    if (dp[day][type]!=-1)
        return dp[day][type];
    int road1,road2;
    if (type==0){
        road1=1;
        road2=2;
    }
    else if (type==1){
        road1=0;
        road2=2;
    }
    else
    {
        road1=1;
        road2=0;
    }
    return dp[day][type]=max(a[day][type]+f(day+1,road1),a[day][type]+f(day+1,road2));
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin>>n;
    for (int i=0;i<n;i++)
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    memset(dp,-1,sizeof dp);
    cout<<max({f(0,0),f(0,1),f(0,2)});
    return 0;
}


Measured memory_bytes: 9600
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int d; char s[13];
int p[11] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 };
int main() {
	while (scanf("%d%s", &d, s), d) {
		long long v = 0;
		for (int i = 0; i < strlen(s); i++) v = v * d + (s[i] <= '9' ? s[i] - 48 : s[i] - 55);
		long long ret = 9191919191919191919;
		for (int i = 0; i < 11 && p[i] <= d; i++) {
			int e = 0, f = d;
			while (f % p[i] == 0) f /= p[i], e++;
			if (e) {
				long long w = v, x = 0;
				while (w) w /= p[i], x += w;
				ret = min(ret, x / e);
			}
		}
		printf("%lld\n", ret);
	}
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int sum(int a, int b) {return a+b;}
int diff(int a, int b) {return a-b;}
int prod(int a, int b) {return a*b;}
int quot(int a, int b) {return a/b;}

int main(int argc, char const *argv[]) {
    int a,b;
    char op;
    while (true) {
        cin>>a>>op>>b;
        int ans=0;
        switch (op) {
            case '+':
                ans=sum(a,b);
                break;
            
            case '-':
                ans=diff(a,b);
                break;
            
            case '*':
                ans=prod(a,b);
                break;

            case '/':
                ans=quot(a,b);
                break;
            
            case '?':
                return 0;
        }
        cout << ans << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3096