akhauriyash/Code-Regression huggingface dataset:
import math
n=int(input())
a = []
b = []
ans = 0
def z(p,q,r,s):
    return ((p-r)**2+(q-s)**2)**0.5
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
for i in range(n):
    for j in range(i+1,n):
        ans += 2*z(a[i],b[i],a[j],b[j])
ans /= n
print(ans)

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

using namespace std;

int main()
{
    string s; cin>>s;
    int res=0;
    for(int i=1;i<s.length();i++)
    {
        if(s[i]!=s[i-1]) res++;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	a := nextInt()
	b := nextInt()

	if (a+b)%2 == 1 {
		fmt.Println("IMPOSSIBLE")
	} else {
		fmt.Println((a + b) / 2)
	}
}
func abs(a int) int {
	return int(math.Abs(float64(a)))
}

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


Measured memory_bytes: 1776
#include <stdio.h>

int n,k;
int p[200000];

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

    int max=0;
    int maxindex=0;
    int now=0;
    for(int i=0;i<k;i++) now+=p[i];
    max=now;
    for(int i=0;i<n-k;i++)
    {
        
        now-=p[i];
        now+=p[i+k];
        if(max<now)
        {
            max=now;
            maxindex=i+1;
        }
    }
    double ans=0;
    for(int i=maxindex;i<maxindex+k;i++)
    {
        double tmp=0;
        for(int j=1;j<=p[i];j++)
        {
            tmp+=j;
        }
        ans+=tmp/p[i];
    }
    printf("%lf\n",ans);
}

Measured memory_bytes: 896
#include <iostream>
using namespace std;
int s,a,b,ans;
char ch;
int main(void){
    while(1){
        ans = 0;
        for(int i=0;i<5;i++){
            cin >> a >> b;
            if(a==0 && b==0 && i==0){
                return 0;
            }
            if(a+b >= ans){
                ans = a + b;
                ch = 'A' + i;
            }
        }
        cout << ch << ' ' << ans << endl;
    }
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define p (int)(1e9 + 7)

int MOD(int a){
	return (a %= p) >= 0 ? a : a + p;
}

int power(int a, int N){
	if(N == 0) return 1;
	else if(N % 2 == 0) return power(MOD(a * a), N / 2);
	else return MOD(a * power(a, N - 1));
}

int inverse(int a){
	return power(a, p - 2);
}

int fact(int N){
	static vector<int> _fact(1, 1);
	for(int i = _fact.size(); i <= N; i++){
		_fact.push_back(MOD(i * _fact[i - 1]));
	}
	return _fact[N];
}
 
int fact_inv(int N){
	static vector<int> inv(2, 1), _fact_inv(2, 1);
	for(int i = inv.size(); i <= N; i++){
		inv.push_back(MOD(-(p / i) * inv[p % i]));
		_fact_inv.push_back(MOD(inv[i] * _fact_inv[i - 1]));
	}
	return _fact_inv[N];
}
 
int combination(int N, int k){
	if(k < 0 || N < k || N < 0) return 0;
	else return MOD(fact(N) * MOD(fact_inv(N - k) * fact_inv(k)));
}

int N;
vector<vector<int>> t;
vector<int> x, n, xs, n_facts, y, ans;

void dfs(int u, int parent){
	xs[u] = 1;
	n_facts[u] = 1;
	n[u] = 1;
	for(int i = 0; i < t[u].size(); i++){
		if(t[u][i] != parent){
			dfs(t[u][i], u);
			xs[u] = MOD(xs[u] * x[t[u][i]]);
			n_facts[u] = MOD(n_facts[u] * fact(n[t[u][i]]));
			n[u] += n[t[u][i]];
		}
	}
	x[u] = MOD(MOD(fact(n[u] - 1) * inverse(n_facts[u])) * xs[u]);
}

void dfs2(int u, int parent){
	ans[u] = MOD(MOD(y[u] * xs[u]) * MOD(fact(N - 1) * inverse(MOD(n_facts[u] * fact(N - n[u])))));
	for(int i = 0; i < t[u].size(); i++){
		if(t[u][i] != parent){
			y[t[u][i]] = MOD(MOD(MOD(ans[u] * MOD(fact(n[t[u][i]]) * fact(N - 1 - n[t[u][i]]))) * inverse(MOD(x[t[u][i]] * fact(N - 1)))));
			dfs2(t[u][i], u);
		}
	}
}

signed main(){
	scanf("%lld", &N);
	t.assign(N, vector<int>(0));
	for(int i = 1; i < N; i++){
		int a, b;
		scanf("%lld%lld", &a, &b);
		a--;
		b--;
		t[a].push_back(b);
		t[b].push_back(a);
	}
	x.assign(N, 0);
	n.assign(N, 0);
	xs.assign(N, 0);
	n_facts.assign(N, 0);
	dfs(0, -1);
	ans.assign(N, 0);
	y.assign(N, 1);
	dfs2(0, -1);
	for(int i = 0; i < N; i++){
		printf("%lld\n", ans[i]);
	}
	return 0;
}

Measured memory_bytes: 25712
#include <stdio.h>

int main(){
int a,x,y,res;

scanf("%d%d",&x,&y);

if(x<y){
a = x;
x = y;
y = a;
}

res = x % y;

while(res!=0){
  x = y;
  y = res;
  res = x % y;
}

printf("%d\n",y);

return 0;

}



Measured memory_bytes: 2136
#include <stdio.h>

#define MAX 10000
#define NIL -1

struct Node {int p, l, r;};
struct Node T[MAX];
int n;

/* 先行順巡回 */
void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

/* 中間順巡回 */
void inParse(int u) {
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

/* 後方順巡回 */
void postParse(int u) {
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

/*
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1
*/



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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<pair<T, T>>& vp) {
	for (int i = 0; i < vp.size(); ++i) {
		s << "(" << vp[i].first << "," << vp[i].second << ")" << ( i+1 == vp.size() ? "" : ",\t" );
	}
	return s;
}

// 多重vector
// auto dp=make_v<int>(4,h,w) みたいに使える
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

// 多重vectorのためのfill
// fill_v(dp,0) みたいに使える
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//main code

int main(int argc, char const* argv[])
{
	VL n(3);
	cin >> n;
	RSORT(n);
	cout << 10*n[0] + n[1] + n[2] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
	int n;
	cin >> n;
	
	vector<string> s(n);
	for(int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	
	long long ans = 0;
	long long cnt[5] = {0};
	for(int i = 0; i < n; i++)
	{
		if(s[i][0] == 'M')
		{
			cnt[0]++;
		}
		else if(s[i][0] == 'A')
		{
			cnt[1]++;
		}
		else if(s[i][0] == 'R')
		{
			cnt[2]++;
		}
		else if(s[i][0] == 'C')
		{
			cnt[3]++;
		}
		else if(s[i][0] == 'H')
		{
			cnt[4]++;
		}
	}
	
	for(int i = 0; i < 3; i++)
	{
		for(int j = i + 1; j < 4; j++)
		{
			for(int k = j + 1; k < 5; k++)
			{
				ans += cnt[i] * cnt[j] * cnt[k];
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main(){
  string s; cin >> s;
  string t;
  vector<string> u{"dream","dreamer","erase","eraser"};
  reverse(s.begin(),s.end());
  rep(i,4){
     reverse(u[i].begin(),u[i].end());
  }
  while(true){
     if(s.empty()){
        print("YES");
        return 0;
     }
     if(s.substr(0,5) == u[0]){
        t += u[0];
        s.erase(0,5);
     }else if(s.substr(0,7) == u[1]){
        t += u[1];
        s.erase(0,7);
     }else if(s.substr(0,5) == u[2]){
        t += u[2];
        s.erase(0,5);
     }else if(s.substr(0,6) == u[3]){
        t += u[3];
        s.erase(0,6);
     }else{
        print("NO");
        return 0;
     }
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll mod = 1000000007;

int main()
{
  int n; cin >> n;
  int t = 1;
  int s = 1;
  while (s < n) {
    t++; s+=t;
  }
  if (s != n) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  cout << t+1 << endl;
  vector<vector<int>> ans(t+1);
  int num = 1;
  for (int i=0; i<t; i++) {
    for (int j=i+1; j<t+1; j++) {
      ans[i].push_back(num);
      ans[j].push_back(num);
      num++;
    }
  }
  for (int i=0; i<t+1; i++) {
    cout << t;
    for (int j=0; j<t; j++) {
      cout << " " << ans[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 2304
import sys

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    t = LI()
    v = LI() + [0]
    p = [0] * (N+1)

    for i in range(N):
        p[i+1] = min(p[i]+t[i],v[i],v[i+1])
        j = i
        while p[j] > p[j+1] + t[j] and j > 0:
            p[j] = p[j+1]+t[j]
            j -= 1
    ans = 0
    for i in range(N):
        s1 = v[i] - p[i]
        s2 = v[i] - p[i+1]
        ans += v[i] * t[i] - s1 * s1 / 2 - s2 * s2 / 2
        if s1 + s2 > t[i]:
            ans += (s1 + s2 - t[i]) ** 2 / 4
    print(ans)

if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
	
	string s;
	
	cin >> s;
	
	if(s[0]!=s[1] && s[1]!=s[2] && s[2]!=s[0]) cout << "Yes";
	else cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
using namespace std;
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 13882177
#define mod 13882177
#define sec setprecision
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
constexpr double eps = 1e-9;
constexpr double pi = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ld log(ld a, ld b){
	return((log(b) / log(a)));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main() {
	int x;
	cin >> x;
	int ans = 1;
	while (((ans * x) % 360 )!= 0) {
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"

using namespace std;

int dp(int curr, int accum, const vector<int>& s, vector<vector<int>>& memo) {
    if (curr == s.size()) {
        return accum % 10 == 0 ? 0 : accum;
    }
    if (memo[curr][accum] >= 0) {
        return memo[curr][accum];
    }
    int take = dp(curr + 1, accum + s[curr], s, memo);
    int skip = dp(curr + 1, accum, s, memo);
    int ret = max(take, skip);
    memo[curr][accum] = ret;
    return ret;
}

void Main() {
    int N;
    cin >> N;
    vector<int> s(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> s[i];
    }

    vector<vector<int>> memo(110, vector<int>(10010, -1));
    int ans = dp(0, 0, s, memo);
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 7720
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
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; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> &P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
bool is_one(int bit){
    while(bit%2==0){
        bit>>=1;
    }
    return bit==1;
}
//fixed<<setprecision(10)<<ans<<endl;
ll TravelingSalesmanProblem(vector<vector<P>> &edge, int N,int start=0){
    ll max_bit = 1<<N; //MAX_BIT
    vector<vector<ll>> dp(max_bit,vector<ll>(N,INF)); //dp[bit][i]:=bitのすべてをまわり、iにいるときの最短路
    dp[1][0] = 0; //始点は0

    //配るDP
    ll from,to,dist;
    for(ll bit_mask=1;bit_mask<max_bit;bit_mask++){
        REP(from,N){
            if(dp[bit_mask][from]>=INF) continue; //未実現の状態
            for(auto e: edge[from]){
                tie(to,dist) = e; //行き先、距離
                if( (1<<to) & bit_mask ) continue;
                ll next_bit = 1<<to | bit_mask;
                chmin(dp[next_bit][to], dp[bit_mask][from]+dist);
            }
        }
    }

    ll ans = INF;
    REP(from,N){
        for(auto e:edge[from]){
            tie(to,dist) = e;
            if(to==start)
                chmin(ans,dp[max_bit-1][from]+dist);    
        }
    }

    return ans;
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    
    //辺入力
    vector<vector<pair<ll,ll>>> edge(N);
    vector<P> edge_to_zero;
    REP(i,M){
        ll a,b,c;
        cin  >> a >> b >> c;
        edge[a].push_back(mp(b,c));
        if(b==0) edge_to_zero.push_back(mp(a,c));
    }

    ll ans = TravelingSalesmanProblem(edge,N);
    if(ans>=INF) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 7800
def digitsSum(num):
    cnt=0
    num=str(num)
    l=len(num)
    for i in range(l):
        cnt+=int(num[i])
    return cnt

N=input()
k=digitsSum(N)
N=int(N)
if N%k==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}
        static void myerr(Object t){System.err.println(t);}
        static String getStr(){return sc.next();}
        static int getInt(){return sc.nextInt();}
        static Long getLong(){return sc.nextLong();}
        static boolean isNext(){return sc.hasNext();}
        public static void main(String[] args){
          long Q = getLong();
          long H = getLong();
          long S = getLong();
          long D = getLong();
          long N = getLong();
          long output = 0;
          long tmpQ = Q*8;
          long tmpH = H*4;
          long tmpS = S*2;
          long tmp = Math.min(tmpQ,Math.min(tmpH,Math.min(tmpS,D)));
          output = tmp * (N / 2);
          if(N % 2 == 1){
            tmpQ = Q*4;
            tmpH = H*2;
            output += Math.min(tmpQ,Math.min(tmpH,S));
          }
          myout(output);
        }
        //便利メソッド追加枠ここから

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


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin,(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
	//作るときはParentの値を全て-1にする
	//こうするとすべてバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}
	//AとBをくっつける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついているからくっつけない
			return false;
		}
		//大きい方(A)に小さいほう(B)をくっつけたい
		//大小が逆だったらひっくり返しちゃう
		if (size(A) < size(B)) swap(A, B);
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
	bool same(int x, int y) { return(root(x) == root(y)); }
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, k;
	cin >> n >> m >> k;
	vector<int> a(m), b(m), c(k), d(k);
	UnionFind Uni(n);
	vector<vector<int>> G(n);
	vector<int> res(n);
	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		Uni.connect(a[i], b[i]);
		res[a[i]]++; res[b[i]]++;
	}
	rep(i, k) {
		cin >> c[i] >> d[i];
		c[i]--; d[i]--;
		G[c[i]].emplace_back(d[i]);
		G[d[i]].emplace_back(c[i]);
	}
	vector<int> ans(n);

	rep(i, n) {
		int ans = Uni.size(i) - 1 - res[i];
		for (auto& p : G[i])if (Uni.same(i, p)) ans--;
		cout << ans << (i == n - 1 ? "\n" : " ");
	}

	return 0;
}

Measured memory_bytes: 8704
#include <bits/stdc++.h> 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

#define PI 3.14159265359  
const long long INF = 1LL << 60;
long long MOD = 1000000007;


long long lcm (int a, int b){return  (long long) a*b /gcd(a,b);}
long long gcd(long long a, long long b) { return b ? gcd(b, a%b) : a; }
long long dp[200100];

vector<pair<long long, long long> > prime_factorize(long long N){
    vector<pair< long long , long long> > res;
    for(long long a = 2; a* a <= N; a++){
        if(N%a != 0)continue;
        long long ex = 0;
        while(N%a == 0){
            ex++;
            N /= a;
        }

        res.push_back({a,ex});
    }

    if(N!=1)res.push_back({N,1});
    return res;
    
}


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

    int a = 0;
    rep(i,4){
        if(S[i] == '+')a ++;
        else a--;
    }
    cout << a << endl;




}





Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for (int i = (a); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define FOR(it, c) \
  for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  vector<int> A, B;
  rep(i, N + 1) {
    int a;
    cin >> a;
    A.push_back(a);
  }
  rep(i, N) {
    int b;
    cin >> b;
    B.push_back(b);
  }

  ll ret = 0;
  rep(i, N) {
    int b = B[i];
    int mn = min(b, A[i]);
    ret += mn;
    A[i] -= mn;
    b -= mn;
    int mn2 = min(b, A[i + 1]);
    ret += mn2;
    A[i + 1] -= mn2;
    b -= mn2;
  }

  cout << ret << endl;

  return 0;
}

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

int main()
{
    int count = 0;
    int t=0;
    int N, X, Y;
    cin >> N >> X >> Y;
    int ans[N];


    for(int i=0; i<N; i++){
        ans[i]=0;
    }

    for(int i=1; i<=N; i++){
        for(int j=1; j<=N; j++){
            if(i<j){
                t = min(abs(j-i), abs(X-i)+1+abs(j-Y));
                t = min(t, abs(Y-i)+1+abs(j-X));
                ans[t]++;
            }
        }
    }
    
    for(int i=1; i<N; i++){
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3432
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func main() {
	sc.Split(bufio.ScanWords)

	S := next()

	fmt.Println(strings.Replace(S, "2017", "2018", 1))
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  if(n < 1200) cout << "ABC";
  else if(n < 2800) cout << "ARC";
  else cout << "AGC";
}


Measured memory_bytes: 256
#include <stdio.h>
int n, m, a[100][100], b[100];
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	for(int i = 0; i < m; i++) scanf("%d", &b[i]);
	for(int i = 0; i < n; i++) {
		int ret = 0;
		for(int j = 0; j < m; j++) ret += a[i][j] * b[j];
		printf("%d\n", ret);
	}
	return 0;
}

Measured memory_bytes: 2748
n=int(input())
a=list(map(int,input().split()))
b,c,d,e=[0,0,0,0]
for i in range(1,n):
    if(a[i]>a[i-1]):
        if(d>e):
            e=d
        d=0
    else:
        d+=1
if(d>e):
    e=d
print(e)

Measured memory_bytes: 15020
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

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

  printf("%d\n", n / 3);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

ll fac[2000007],finv[2000007],inv[2000007];
void cominit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<2000007;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(ll n,ll k){
    if(n<k)return 0;
    if(n<0 || k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cominit();
    ll k;
    cin >> k;
    string s;
    cin >> s;
    ll n = s.length();
    ll ans = 0;
    k += n;
    for(ll i=n;i<=k;i++){
    	ll num = modpow(26LL, k-i) * modpow(25LL, i-n) % mod;
    	num *= com(i-1, n-1);
    	num %= mod;
    	ans += num;
    	ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 51064
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        sc.nextLine();
        String[] s = new String[a];
        for(int i = 0;i<a;i++){
            s[i] = sc.nextLine();
        }
        for(int i = 0;i<a;i++){
            System.out.println(s[i]);
            System.out.println(s[i]);
        }
    }
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

int main(void)
{
  ll n;
  cin >> n;
  vector<string> vs(n);
  REP(i, n) {
    string s1;
    cin >> s1;
    sort(s1.begin(), s1.end());
    vs[i]=s1;
  }
  sort(vs.begin(), vs.end());
  string olds = "XXXXXXXXXX";
  ll cnt = 0;
  ll ans = 0;
  for(auto v:vs) {
    if(olds != v) {
      olds = v;
      cnt = 0;
    } else {
      cnt ++;
      ans += cnt;
    }
    //    cout << cnt << ":" << v << endl;
  }
  cout << ans << endl;
}


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

int main() {
	int N;
	int a[100001];
	int sum = 0;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < N; ++i) {
		if (i + 1 == a[a[i] - 1]) {
			++sum;
		}
	}
	cout << sum / 2 << endl;
}

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

const int maxm=2e5+10;
const int base=210;

int n,H,in[500],out[500],cnt;
bool diff[500],vis[500];
int tote,FIR[500],TO[maxm],NEXT[maxm];

void addedge(int u,int v)
{
//	printf("%d %d\n",u,v);
	u+=base; v+=base;
	out[u]++; in[v]++;

	TO[++tote]=v;
	NEXT[tote]=FIR[u];
	FIR[u]=tote;

	TO[++tote]=u;
	NEXT[tote]=FIR[v];
	FIR[v]=tote;
}

void dfs(int u)
{
	if (vis[u]) return;
	vis[u]=1;
	cnt+=diff[u];
	for (int p=FIR[u];p;p=NEXT[p])
		dfs(TO[p]);
}

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i,a,b,c,d;
	scanf("%d%d",&n,&H);
	for (i=1;i<=n;i++)
	{
		scanf("%d%d%d%d",&a,&b,&c,&d);
		addedge(c?-c:a,d?d:-b);
	}

	for (i=-200;i<=200;i++)
		if (out[base+i]!=in[base+i])
		{
			diff[base+i]=1;
//			printf("%d : %d\n",i,out[base+i]-in[base+i]);
//			printf("%d\n",(i<0)^(out[base+i]<in[base+i]));
			if ((i<0)^(out[base+i]<in[base+i]))
			{
				puts("NO");
				return 0;
			}
		}

	for (i=-200;i<=200;i++)
		if (!vis[base+i]&&FIR[base+i])
		{
			cnt=0;
			dfs(base+i);
			if (!cnt)
			{
				puts("NO");
				return 0;
			}
		}
	puts("YES");
}


Measured memory_bytes: 1792
use std::io::*;
use std::io::Write;
use std::str::FromStr;

fn main() {

    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();

    let ans = if(a*c) < b {c} else{b/a};
    
    println!("{}",ans);



}

fn is_leap_year(year: u32) -> bool {
    year % 4 == 0 && !(year %100 == 0 && year % 400 !=0)
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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

A, B = map(int, input().split())

ans = 0
tmp_left = ''
tmp_right = ''

for x in range(A, B + 1):
    tmp_left = str(x)[0] + str(x)[1]
    tmp_right = str(x)[-1] + str(x)[-2]
    if tmp_left == tmp_right:
        ans += 1

print(ans)

Measured memory_bytes: 8992
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<ll >    vecll;
typedef vector<string > vecstr;
////////////////////////////////////////////////
const int size = 100001;// 1e5+1
vector<ll> fac(size, 0); //n!(mod M)
vector<ll> ifac(size, 0); //k!^{M-2} (mod M)
vector<ll> inv(size, 0); //k!^{M-2} (mod M)
////////////////////////////////////////////////
void ifac_mod(){ 
  // ifac[i] = 1/i! (mod M)
  ifac[0] = 1;
  ifac[1] = 1;
  inv[1] = 1;
  for(int i = 2;i < size; i++){
    inv[i] = MOD - inv[MOD%i] * (MOD/i) %MOD;
    ifac[i] = ifac[i - 1] * inv[i] %MOD;
  }
}
////////////////////////////////////////////////
void fac_mod(){ 
  // fac[i] = i! (mod M)
  fac[0] = 1;
  fac[1] = 1;
  REP(i, size){
    fac[i + 1] = fac[i]*(i + 1)%MOD;
  }
}
////////////////////////////////////////////////
int main()
{
  ll n, m;
  cin >> n >> m;
  if(abs(n - m) > 1){
    cout << 0 << endl;
    return 0;
  }
  fac_mod();
  ll a = max(n,m);
  ll b = min(n,m);
  if(a == b){
    cout << 2*((fac[a]*fac[a])%MOD)%MOD << endl;
  }else{
    cout << fac[a]*fac[b]%MOD << endl;
  }
   
} 

Measured memory_bytes: 2560
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author I.E
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define fr(i,a,b) for(int i=a;i<b;++i)
#define frn(i,a,b) for(int i=a;i>b;i--)
#define rep(i,n) fr(i,0,n)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define sz(a) int((a).size())
#define srt(container, lambda) sort(container.begin(), container.end(), lambda)

typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> ii;

int int_pow(int x, int p)
{
    if (p == 0) return 1;
    if (p == 1) return x;

    int tmp = int_pow(x, p/2);
    if (p%2 == 0) return tmp * tmp;
    else return x * tmp * tmp;
}

void fill(istream& in, vi& a, int n) {
    int elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(istream& in, vl& a, int n) {
    ll elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(vi& a, int n, int val) {
    rep(i, n) {
        a.push_back(val);
    }
}

void fill(vl& a, int n, ll val) {
    rep(i, n) {
        a.push_back(val);
    }
}

int sum(vi arr) {
    int s = 0;
    for (auto& x: arr)
        s += x;
    return s;
}

int max(vi a) {
    return *max_element(a.begin(), a.end());
}

int min(vi a) {
    return *min_element(a.begin(), a.end());
}

void print(ostream& out, vi a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

void print(ostream& out, vl a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
    while (b--) ret = (ret * a);
    return ret;
}
//======================================================

#pragma GCC optimize("Ofast")
static auto speedup = [](){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();



class BMultipleOf9 {
public:
    void solve(std::istream& in, std::ostream& out) {
        string s;
        in >> s;
        ll n = s.size();
        ll somme = 0;
        for (auto& c: s) {
            somme += c - '0';
            somme %= 9;
        }
        string ret = (somme % 9 == 0) ? "Yes" : "No";
        out << ret << endl;
    }
};


int main() {
	BMultipleOf9 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3344
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

int main() {
  uint32_t K = 0, A = 0, B = 0;
  std::cin >> K >> A >> B;

  std::cout << (A % K == 0 || ((K - A % K) + A <= B) ? "OK" : "NG")
            << std::endl;

  return 0;
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if(ch=='A') return 1;
  else if(ch=='C') return 2;
  else if(ch=='G') return 3;
  else if(ch=='T') return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}

int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}

int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0)return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++)H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s", com, str);

    if(com[0]=='i'){
      insert(str);
    }else{
      if(find(str)){
        printf("yes\n");
      }else{
        printf("no\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 17064
import sys
sys.setrecursionlimit(10 ** 6)

def main():
    N = int(input())
    E = [[] for _ in range(N)]
    for i in range(N - 1):
        x, y = map(int, input().split())
        E[x - 1].append(y - 1)
        E[y - 1].append(x - 1)

    v = [False] * N
    def dp(n):
        v[n] = True
        tb = 1
        tw = 1
        for i in E[n]:
            if v[i]:
                continue
            b, w = dp(i)
            tb *= w
            tw *= w + b
        return tb, tw
    return sum(dp(0)) % (10 ** 9 + 7)


print(main())


Measured memory_bytes: 123568
import sys
input = sys.stdin.readline

N,W=map(int,input().split())
V = 1000
INF = 1e+10
wv = [list(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(N*V+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1,N+1):
    for j in range(N*V+1):
        dp[i][j] = dp[i-1][j]
        if j-wv[i-1][1] >= 0:
            dp[i][j] = min(dp[i][j], dp[i-1][j-wv[i-1][1]]+wv[i-1][0])

for i in reversed(range(N*V+1)):
    if dp[N][i] <= W:
        print(i)
        break
    


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L = A + B;
  int R = C + D;
  if ( L > R) {
    cout << "Left" << endl;
  }
  else if ( L == R ) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
ary = []
3.times do
  ary << gets.split(" ").map(&:to_i)
end

n = gets.chomp.to_i
ary_b = []
n.times do
  ary_b << gets.chomp.to_i
end

ary_bingo = ary


3.times do |i|
  ary_bingo << [ary[0][i], ary[1][i], ary[2][i]]
end

ary_bingo << [ary[0][0], ary[1][1], ary[2][2]]
ary_bingo << [ary[0][2], ary[1][1], ary[2][0]]

array_shaffle = []
ary_b.permutation(3) do |x|
  array_shaffle << x
end

ary_bingo.each do |x|
  array_shaffle.each do |y|
    if x == y
      puts "Yes"
      exit
    end
  end
end

puts "No"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int x; cin >> x;
	cout << 32 * x << endl;
	return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,K,N,x,y;
  cin>>K;
  cin>>N;
  vector<int>A;
  vector<int>D;
  for(i=0;i<N;i++)
  {
    cin>>x;
    A.push_back(x);
  }
  for(i=0;i<N-1;i++)
  {
    y=K-A[i+1]+A[i];
    D.push_back(y);
  }
  y=(A[N-1]-A[0]);
  D.push_back(y);
  sort(D.begin(),D.end());
  cout<<D[0];
  return 0;
    
}

Measured memory_bytes: 2548
/**
*    author:  yuya1234
*    created: 24.06.2020 10:10:02
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

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

    int n;
    ll y;
    bool flg = false;

    cin >> n >> y;

    FOR(i, 0, n)
    {
        FOR(j, 0, n - i)
        {
            if (i * 10000 + j * 5000 + (n - i - j) * 1000 == y)
            {
                cout << i << " " << j << " " << n - i - j << endl;
                flg = true;
                i = j = n;
            }
        }
    }

    if (!flg)
    {
        cout << "-1 -1 -1" << endl;
    }

    return 0;
}

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

int main() {
    //
    int num, buy;
    int kekka = 0;
    cin >> num >> buy;

    vector<int> vec(num);
    for (int i = 0; i < num; i++) cin >> vec.at(i);

    sort(vec.begin(), vec.end());

    for (int i = 0; i < buy; i++) { kekka += vec.at(i);
     }

    cout << kekka;
}

Measured memory_bytes: 3628
// 参考: https://atcoder.jp/contests/abc120/submissions/12440523

package main

import (
	"fmt"
	"strconv"
	"strings"
)

// stringToInt はstring型のスライスをint型のスライスにキャストする関数
func stringToInt(tSlice []string) (rSlice []int) {
	for _, str := range tSlice {
		num, _ := strconv.Atoi(str)
		rSlice = append(rSlice, num)
	}
	return
}

// containCount はint型のスライスの中に特定の要素がいくつ入っているかを返す関数
func containCount(tSlice []int, tNum int) int {
	var foundNum int = 0
	for _, num := range tSlice {
		if num == tNum {
			foundNum++
		}
	}
	return foundNum
}

// min は2つの整数を比べ小さいほうを返す関数
func min(x int, y int) (minNum int) {
	if x > y {
		minNum = y
	} else {
		minNum = x
	}
	return
}

func main() {
	var inputText string
	fmt.Scanf("%s", &inputText)
	var cubes []int = stringToInt(strings.Split(inputText, ""))

	var redCubeNum int = containCount(cubes, 0)
	var blueCubeNum int = containCount(cubes, 1)

	fmt.Println(min(redCubeNum, blueCubeNum) * 2)
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
  int n, s[128], sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    sum += s[i];
  }
  sort(s, s+n);
  int i = 0, ret = sum;
  while (ret % 10 == 0 && i < n) {
    if (s[i] % 10 != 0)
      ret -= s[i];
    i++;
  }
  cout << (ret % 10 == 0 ? 0 : ret) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
#include<string.h>
#include<sstream>
#include<limits.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;

//最大公約数
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;
}

//素数判定
bool isPrime(int x){
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(int i=3;i*i<=x;i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}

//桁ごとの足し算
int digsum(int n){
    int res=0;
    while(n>0){
        res+=n%10;
        n/=10;
    }
    return res;
}

//約数列挙
vector<int> enum_div(int n){
    vector<int> ret;
    for(int i=1;i*i<=n;++i){
        if(n%i==0){
            ret.push_back(i);
            if(i*i !=n){
                ret.push_back(n/i);
            }
        }
    }
    return ret;
}

//累乗の計算とあまり,0で累乗そのまま出力
long long modpow(long long a,long long n,long long mod){
    if(mod==0)mod=__LONG_LONG_MAX__;
    long long res=1;
    while(n>0){
        if(n & 1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int H,W,K;
vector<string> s;
int ans=0;
int main(){
    cin>>H>>W>>K;
    s.resize(H);

    for(int i=0;i<H;++i){
        cin>>s[i];
    }
    for(int i=0;i<(1<<H);++i){
        for(int j=0;j<(1<<W);++j){
            int counter=0;
            for(int k=0;k<H;++k){
                for(int l=0;l<W;++l){
                    if(i>>k&1)continue;
                    if(j>>l&1)continue;
                    if(s[k][l]=='#')counter++;
                }
            }
            if(counter==K)ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

/*************** using variables **************/

/**********************************************/

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(){
    string s;
    bool dp[505][505];

    cin >> s;

    int n = s.size();
    REP(i, n) REP(j, n) dp[i][j] = false;

    for(int len = 3; len <= n; len++){
        REP(l, n){
            int r = l + len - 1;
            if(r > n) break;

            for(int c = l+1; c < r; c++){
                if(s[l] == 'm' && s[c] == 'e' && s[r] == 'w'){
                    if(l != c-1 && !dp[l+1][c-1]) continue;
                    if(c != r-1 && !dp[c+1][r-1]) continue;
                    dp[l][r] = true;
                }
            }
        }
    }

    if(dp[0][n-1]) cout << "Cat" << endl;
    else cout << "Rabbit" << endl;
}


Measured memory_bytes: 3428
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int[][] array = new int[4][13];
        for (int i = 0; i < a; i++) {
            String b = scanner.next();
            int c = scanner.nextInt();
            if (b.equals("S"))
                array[0][c - 1] = 1;
            else if (b.equals("H"))
                array[1][c - 1] = 1;
            else if (b.equals("C"))
                array[2][c - 1] = 1;
            else
                array[3][c - 1] = 1;
        }
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 13; j++) {
                if (array[i][j] == 0)
                    if (i == 0)
                        System.out.println("S " + (j + 1));
                    else if (i == 1)
                        System.out.println("H " + (j + 1));
                    else if (i == 2)
                        System.out.println("C " + (j + 1));
                    else
                        System.out.println("D " + (j + 1));
            }
        }
    }
}
 

 

Measured memory_bytes: 26292
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  long long ans = 0;
  for(long long b = 0; b <= N/B; ++b){
    for(long long g = 0; g <= N/G; ++g){
      long long tmp = b * B + g * G;
      if((N - tmp) >= 0 && ((N - tmp)%R) == 0){
        ++ans;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct node
{
    int number;
    struct node* next;
} Node;

Node * addNode()
{
    Node *cur = (Node*)malloc(sizeof(Node));
    if(cur == NULL)
    {
        printf("malloc failed!\n");
        exit(0);
    }
    return cur;
}

int main(int argc, const char * argv[])
{
    int n = 0,a = 0;
    scanf("%d\n",&n);
    
    Node *first = addNode();
    Node *last = addNode();
    first->next = last;
    int time = 0;
    while(1)
    {
        scanf("%d",&a);
        Node *new = addNode();
        new->next = NULL;
        last->next = new;
        last->number = a;
        time = time + 1;
        last = last->next;
        if(time >= n)
        {
            break;
        }
    }
    

    int num[n];
    int x = 0;
    
    for(Node *i = first->next;i->next != NULL;i = i->next)
    {
        num[x] = i->number;
        if(x < n)
        {
            x = x + 1;
        }
    }
    
    if(n % 2 == 0)
    {
        for(int i = n - 1;i >= 0;i = i - 2)
        {
            printf("%d ",num[i]);
        }
        for(int i = 0;i < n;i = i + 2)
        {
            printf("%d ",num[i]);
        }
    }
    else if(n % 2 == 1)
    {
        for(int i = n - 1;i >= 0;i = i - 2)
        {
           printf("%d ",num[i]);
        }
        for(int i = 1;i < n;i = i + 2)
        {
            printf("%d ",num[i]);
        }
    }
    
    Node *station;
    
    for(station = first;station->next != NULL;station = station->next)
    {
        free(station);
    }
    free(station);
    
    return 0;
}


Measured memory_bytes: 9088