akhauriyash/Code-Regression huggingface dataset:
//
// Created by 10940 on 2020/7/25.
//

#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int Count = 0;
    while (b <= a) {
        b *= 2;
        Count++;
    }
    while (c <= b) {
        c *= 2;
        Count++;
    }
    //cout << Count << " " << k << endl;
    if (Count <= k) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main (void) {
    int i;
    int n;
    scanf("%d", &n);
    int l[n], max = 0, sum = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &l[i]);
        if ( l[i] > max ) {
            max = l[i];
        }
        sum += l[i];
    }

    if ( max < sum - max )
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,st,en) for(i=st;i<=en;i++)
#define repv(i,en,st) for(i=en;i>=st;i--)
#define fout cout<<fixed<<setprecision(7)
#define bi(n) __builtin_popcount(n)
#define bil(n) __builtin_popcountll(n)


typedef long long ll;
typedef pair<int,int> pii;
const int N = 200010;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
    ll res =1;
    while(exp){if(exp&1ll)res=(res*b)%mod;
    b =(b*b)%mod;exp/=2ll;
    }
    return res;
}
int n;
ll A[N],h[N],bit[N];
void upd(int idx,ll val)
{
    for(int i=idx;i<=n;i+=(i&-i))
        bit[i]=max(bit[i],val);
}
ll query(int idx)
{
    ll res =0;
    for(int i=idx;i;i-=(i&-i))
    res = max(res,bit[i]);
    return res;
}


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t=1,i,j,m;
    cin>>n;
    rep(i,1,n)cin>>h[i];
    rep(i,1,n)cin>>A[i];
    ll mx = 0;
    rep(i,1,n)
    {
        ll cur = query(h[i]);
        ll ans = cur+A[i];
        mx = max(mx,ans);
        upd(h[i],ans);
    }
    cout<<mx<<"\n";


    
    return 0;
}


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

const int maxn = 2009;
int sum0[maxn][maxn], sum1[maxn][maxn];
int n, K, x, y, m, ans; char ch;

int getSum(int sum[maxn][maxn], int x1, int y1, int x2, int y2) {
	return sum[x1][y1] - sum[x2][y1] - sum[x1][y2] + sum[x2][y2];
}

int main() {
	scanf("%d%d", &n, &K); m = K * 2;
	for (int i=1; i<=n; i++) {
		scanf("%d%d %c", &x, &y, &ch);
		if (ch == 'B') sum0[x%m+1][y%m+1]++;
		else sum1[x%m+1][y%m+1]++;
	}
	for (int i=1; i<=m; i++)
		for (int j=1; j<=m; j++) {
			sum0[i][j] += sum0[i-1][j] + sum0[i][j-1] - sum0[i-1][j-1];
			sum1[i][j] += sum1[i-1][j] + sum1[i][j-1] - sum1[i-1][j-1];
		}
	for (int i=K; i<=m; i++)
		for (int j=K; j<=m; j++) {
			ans = max(ans, getSum(sum0, i, j, i-K, j-K) + getSum(sum0, i-K, j-K, 0, 0) + getSum(sum0, m, m, i, j)
						 + getSum(sum0, i-K, m, 0, j) + getSum(sum0, m, j-K, i, 0) + getSum(sum1, i, m, i-K, j)
						 + getSum(sum1, m, j, i, j-K) + getSum(sum1, i, j-K, i-K, 0) + getSum(sum1, i-K, j, 0, j-K));
			ans = max(ans, getSum(sum1, i, j, i-K, j-K) + getSum(sum1, i-K, j-K, 0, 0) + getSum(sum1, m, m, i, j)
						 + getSum(sum1, i-K, m, 0, j) + getSum(sum1, m, j-K, i, 0) + getSum(sum0, i, m, i-K, j)
						 + getSum(sum0, m, j, i, j-K) + getSum(sum0, i, j-K, i-K, 0) + getSum(sum0, i-K, j, 0, j-K));
		}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 31744
import java.lang.*;
import java.io.*;
import java.util.*;


public class Main {
	
	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {
	
	public void solve(InputReader in, PrintWriter out) {
		String sa = in.next();
		String sb = in.next();
		boolean fa = sa.charAt(0)=='H';
		boolean fb = sb.charAt(0)=='H';
		boolean f = (fa && fb) || (!fa && !fb);
		
		if (f)
			out.println("H");
		else
			out.println("D");
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;
	
	
	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}
	
	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 22996
N = int(input())
x, y, h = [], [], []
for i in range(N):
    s, t, u = map(int, input().split())
    x.append(s)
    y.append(t)
    h.append(u)

# h>0となるものは必ず存在するので
# そのときの答えの(cx, cy, H)の候補としてprobに(10000個)格納する
# 最大でN*100*100=10^6
prob = []
for i in range(N):
    if h[i] > 0:
        for cx in range(101):
            for cy in range(101):
                H = h[i] + abs(x[i] - cx) + abs(y[i] - cy)
                prob.append([cx, cy, H])
        break

# 答えの候補probの中から全ての条件を満たすものを探す
# 最大でN*10000=10^6
for i in range(N):
    minus = []
    for j in range(len(prob)):
        cx = prob[j][0]
        cy = prob[j][1]
        H = prob[j][2]
        if h[i] == max(H - abs(x[i] - cx) - abs(y[i] - cy), 0):
            continue
        else:
            minus.append([cx, cy, H])
    if len(minus) == 0:
        continue
    else:
        for k in range(len(minus)):
            prob.remove(minus[k])

ans = ' '.join(list(map(str, list(list(prob)[0]))))
print(ans)



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

int main() 
{
	int n;
	cin >> n;
	int a[n];
	cin >> a[0];
	int ans = a[0];
	for(int i=1;i<n;i++)
		cin >> a[i],ans=__gcd(ans,a[i]);
	cout << ans;
}

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

#define    ll    long long int

int toInt(char ch)
{
    return (ch - '0');
}

int main( )
{
    string s;
    int i, j, l, x, ans = 11111;
    cin >> s;
    l = (int) s.size();
    for (i = 0; i + 2 < l; i++) {
        x = toInt(s[i]) * 100 + toInt(s[i + 1]) * 10 + toInt(s[i + 2]);
        ans = min(ans, abs(x - 753));
    }
    cout << ans << '\n';
    return 0;
}




Measured memory_bytes: 256
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c; cin >> c;
    cout << (char)(c + 1) << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>

int main()
{
	int n, x;
	std::cin >> n >> x;
	std::vector<int> a(n);
	for (auto &e : a) std::cin >> e;
	
	if (std::accumulate(a.begin(), a.end(), 0ll) == x) {
		std::cout << n << std::endl;
		return 0;
	}
	std::sort(a.begin(), a.end());
	int i;
	for (i = 0; i < n; i++) {
		x -= a[i];
		if (x < 0) break;
	}
	if (i == n) i--;
	
	std::cout << i << std::endl;
	
	return 0;
}


Measured memory_bytes: 3192
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")



#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include <ext/rope>
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define Find order_of_key
// #define at find_by_order
#define x first
#define y second
#define ll long long
#define lll __int128
#define ull unsigned long long
#define ulll unsigned __int128
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define gu getchar_unlocked()
#define pu putchar_unlocked()
#define all(x) x.begin(),x.end()
#define endl '\n'

int a[110];
int b[110];

int main()
{
	int n;
	cin>>n;
	bool f=0;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		if(i-2>=0){
			if(a[i]==b[i] && a[i-1]==b[i-1] && a[i-2]==b[i-2]){
				f=1;
			}
		}
	}
	if(f)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%d",&x);
int main(){
    vector<string> s(3);
    cin >> s[0] >> s[1] >> s[2];
    reverse(s[0].begin(), s[0].end());
    reverse(s[1].begin(), s[1].end());
    reverse(s[2].begin(), s[2].end());
    int ans, tmp, turn = 0;
    while(1){
        tmp = turn;
        if (s[tmp].size() == 0){
            ans = tmp;
            break;
        }
        if (s[turn].back() == 'a') turn = 0;
        else if (s[turn].back() == 'b') turn = 1;
        else turn = 2;
        s[tmp].pop_back();
    }
    if (ans == 0) cout << 'A' << endl;
    else if(ans == 1) cout << 'B' << endl;
    else cout << 'C' << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.trim().split('\n');
  K = input[0].split(' ')[1];
  Ni = input[1].split(' ');
  if (K >= Ni.length) {
    console.log('0');
    return;
  }
  console.log(Ni.sort((a,b) => b-a).map(Number).reduce((a,v,i) => i < K ? a : a + v, 0));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 35744
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)
	m := getNextInt(scanner)

	g := make([][]int, n)
	for i := 0; i < n; i++ {
		g[i] = make([]int, 0)
	}
	for i := 0; i < m; i++ {
		s := getNextInt(scanner) - 1
		t := getNextInt(scanner) - 1
		g[s] = append(g[s], t)
	}

	ysp48 := make([]float64, n)
	rng58 := make([]float64, n)
	rng58[0] = 1
	for i := 0; i < n-1; i++ {
		for _, to := range g[i] {
			rng58[to] += rng58[i] / float64(len(g[i]))
		}
	}

	for i := n - 2; i >= 0; i-- {
		for _, to := range g[i] {
			ysp48[i] += ysp48[to] + 1
		}
		ysp48[i] /= float64(len(g[i]))
	}
	horobiyo := 0.0

	for i := 0; i < n-1; i++ {
		l := len(g[i])
		if l < 2 {
			continue
		}
		for _, to := range g[i] {
			if horobiyo < rng58[i]*(ysp48[i]-(ysp48[i]*float64(l)-(ysp48[to]+1))/float64(l-1)) {
				horobiyo = rng58[i] * (ysp48[i] - (ysp48[i]*float64(l)-(ysp48[to]+1))/float64(l-1))
			}
		}
	}

	fmt.Fprintln(writer, ysp48[0]-horobiyo)
	writer.Flush()
}


Measured memory_bytes: 4736
def cal
	a = [1.0]
	0.upto(8) {|i| a[i+1] = (i % 2 == 0 ? a[i] * 2 : a[i] / 3) }
	a.inject {|x,y| x+y }
end
while gets
	puts $_.to_f*cal
end

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

int main()
{
    int n;
    cin >> n;
    vector<int> res(n);
    for(int i=0; i<n; i++)
    	cin >> res[i];
    float ans=0;
    for(int i=0; i<n; i++){
    	float temp = 1/(float)res[i];
    	ans += temp;
    }
    ans = 1/ans;
    cout << ans;
    return 0;
}

Measured memory_bytes: 384
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;

int main(){
	int n , X ; 
	cin >> n >> X ; 
	vector<int> v(n) ; 
	for(int &x : v){
		cin >> x ; 
	}
	sort(v.begin(),v.end()) ; 
	vector<int> diff ; 
	diff.push_back(abs(X-v[0])) ; 
	for(int i=1;i<n;i++){
		diff.push_back(v[i]-v[i-1]) ; 
	}
	int g = diff[0] ; 
	for(int i=1;i<n;i++){
		g = __gcd(g,diff[i]) ; 
	}
	cout << g << endl;
	return 0 ; 
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cout << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;

int n;
VI A;
deque<int> seq()
{
	deque<int> ans;
	ans.push_back(A[0]);
	bool lft = n % 2 == 0 ? true : false;
	for(int i = 1; i < n; ++i) {
		if(lft) ans.push_front(A[i]);
		else ans.push_back(A[i]);
		lft ^= 1;
	}
	return ans;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n;

	A = VI(n);
	REP(i, 0, n) cin >> A[i];

	for(auto i : seq())
		cout << i << " ";
	cout << endl;

	return 0;
}

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

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

  int res=0;
  for (int num=0; num<1000; num++) {
    int oxx=num/100;
    int xox=(num-oxx*100)/10;
    int xxo=num-oxx*100-xox*10;
    bool frag1=false;
    bool frag2=false;
    bool frag3=false;
    rep(i, n) {
      int k=(int)(S[i]-'0');
      if (oxx==k&&!frag1) {
        frag1=true;
        continue;
      }
      if (frag1&&xox==k&&!frag2) {
        frag2=true;
        continue;
      }
      if (frag2&&xxo==k&&!frag3) {
        frag3=true;
        continue;
      }
    }
    if (frag1&&frag2&&frag3) res++;
  }
  cout<<res<<endl;
}


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

int main() {
    int N;
    cin >> N;
    double a=0;
    vector<double> A(N);
    for(int i=0;i<N;i++){
        cin >> A.at(i);
        a+=1/A.at(i);
    }
    cout << 1/a << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    if (n % 2) {
        for (int i = n - 1; i >= 0; i -= 2) cout << a[i] << " ";
        for (int i = 1; i < n; i += 2) {
            cout << a[i];
            if (i == n - 2) {
                cout << endl;
            } else {
                cout << " ";
            }
        }
    } else {
        for (int i = n - 1; i >= 0; i -= 2) cout << a[i] << " ";
        for (int i = 0; i < n; i += 2) {
            cout << a[i];
            if (i == n - 2) {
                cout << endl;
            } else {
                cout << " ";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4040
n = input()
cards = list(map(int, input().split()))
sorted_cards = sorted(cards, reverse=True)
alice, bob = [], []
for index, card in enumerate(sorted_cards):
    if index % 2 == 0:
        alice.append(card)
    else:
        bob.append(card)
print(sum(alice) - sum(bob))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//const ll MOD=(ll)1e9+7;
const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

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 (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

void solve(int ca){
    int N; cin>>N;
    vector<vector<char>> c(N,vector<char>(N));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            cin>>c[i][j];
        }
    }
    int ans=0ll;
    for (int d = 0; d < N; ++d) {
        bool ok=true;
        for (int i = 0; i < N; ++i) {
            for (int j = i+1; j < N; ++j) {
                if(c[(i-d+N)%N][j]!=c[(j-d+N)%N][i]){
                    ok= false;
                }
            }
        }
        if(ok) ++ans;
    }
    cout<<(ll)ans*N<<endl;
}

//#define MULTI
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(1);
#endif
    return 0;
}


Measured memory_bytes: 384
import collections


MAX_N = 110
MAX_V = 100100

Item = collections.namedtuple("Item", ("weight", "value"))


def main():
    N, W = [int(i) for i in input().split()]
    items = [Item(int(i), int(j)) for (i, j) in [input().split() for _ in range(N)]]
    dp = [[float('inf')] * MAX_V for _ in range(MAX_N)]

    dp[0][0] = 0

    for i in range(N):
        item = items[i]
        for sum_v in range(MAX_V):
            # i番目の品物を選ぶ
            if sum_v - item.value >= 0:
                dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - item.value] + item.weight)
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])

    ans = 0
    for sum_v in range(MAX_V):
        if dp[N][sum_v] <= W:
            ans = sum_v

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 312648
#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 maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	cin >> s;
	const int dx[] = { 0,1,0,-1 };
	const int dy[] = { 1,0,-1,0 };
	auto cal_max = [&](int a, int b) {
		queue<P> que;
		que.emplace(a, b);
		vector<vector<int>> dist(h, vector<int>(w, -1));
		dist[a][b] = 0;
		while (que.size()) {
			P p = que.front(); que.pop();
			rep(i, 4) {
				int na = p.first + dx[i], nb = p.second + dy[i];
				if (na < 0 || nb < 0 || na >= h || nb >= w) continue;
				if (s[na][nb] == '#') continue;
				if (dist[na][nb] != -1) continue;
				dist[na][nb] = dist[p.first][p.second] + 1;
				que.emplace(na, nb);
			}
		}
		int ret = 0;
		rep(i, h)rep(j, w) if (s[i][j] != '#') maxs(ret, dist[i][j]);
		return ret;
	};
	int ans = 0;
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			if (s[i][j] != '#') maxs(ans, cal_max(i, j));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <utility>
#include <climits>
 
#include <cstdio>
  
using namespace std;

#define REP(var, count) for(int var=0; var<count; var++)

int data[52];
vector<pair<int, int> > list;

void saiki(int a, int b) {
	if ( a == b ) {
		return;
	}
	if ( data[b] > 0 ) {
		saiki(a, b-1);
		if ( data[b-1] > data[b] ) {
			list.push_back( make_pair(b-1, b) );
			data[b] += data[b-1];
		}
	} else if ( data[b] == 0 ) {
		saiki(a, b-1);
		if ( data[b-1] > data[b] ) {
			list.push_back( make_pair(b-1, b) );
			list.push_back( make_pair(b-1, b) );
			data[b] += data[b-1] * 2;
		}
	} else if ( data[a] < 0 ) {
		saiki(a+1, b);
		if ( data[a] > data[a+1] ) {
			list.push_back( make_pair(a+1, a) );
			data[a] += data[a+1];
		}
	} else if ( data[a] == 0 ) {
		saiki(a+1, b);
		if ( data[a] > data[a+1] ) {
			list.push_back( make_pair(a+1, a) );
			list.push_back( make_pair(a+1, a) );
			data[a] += data[a+1] * 2;
		}
	} else { //data[a]>0, data[b]<0
		if ( abs(data[a]) > abs(data[b]) ) {
			list.push_back( make_pair(a, b) );
			data[b] += data[a];
			saiki(a, b);
		} else {
			list.push_back( make_pair(b, a) );
			data[a] += data[b];
			saiki(a, b);
		}
	}
}

int main(void) {
	int N;
	cin >> N;
	
	
	REP(i, N) {
		cin >> data[i+1];
	}
	
	saiki(1, N);
	cout << list.size() << endl;
	for( auto x : list ) {
		cout << x.first << " " << x.second << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,q,i,x,s,t;
	cin>>n>>q;
    list<int>a[19000];
    while(q){
    	q--;
    	cin>>i;
    	switch(i){
    		case 0:{
    			cin>>t>>x;
    			a[t].push_back(x);
				break;
			}
			case 1:{
				cin>>t;
				int b=0;
				 for (list<int>::iterator it=a[t].begin();it!=a[t].end();it++){
				 if(b!=0)cout<<" ";
				 b++;
                 cout<<*it;}
                 cout<<endl;
				break;
			}
			case 2:{
				cin>>s>>t;
				list<int>::iterator it=a[t].end();
				a[t].splice (it, a[s]);
				break;
			}
		}
	}

}



Measured memory_bytes: 19012
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

public class Main {
	public static void main(String[] argv) {
		Graph g = new Graph();
		g.loadAdjMatrix();
		int[] dist = g.Dijkstra(0);
		for(int i = 0; i < g.getTotalVertex(); i ++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}

class Graph {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		int u, v;
		for(i = 0; i < totalVertex; i ++) {
			u = in.nextInt();
			int degree = in.nextInt();
			for(j = 0; j < degree; j ++) {
				v = in.nextInt(); 
				adjMatrix[u][v] = 1;
				adjWeight[u][v] = in.nextInt();
			}	
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	//implement the following	
	public int[] Dijkstra(int s) {
		int[] dist = new int[totalVertex];
		for (int i = 0; i< totalVertex; i++) {
			if (i == s) {
				dist[i] = 0;
			}else {
				dist[i] = Integer.MAX_VALUE;
			}
		}
		
		for (int count = 0; count < totalVertex - 1; count++) {
			int u = getUnsettledNearest(dist);
			ifSettled[u] = true;
			for (int v = 0; v < totalVertex; v++) {
				if(!ifSettled[v] && adjMatrix[u][v] != 0 && dist[u] != Integer.MAX_VALUE && dist[u] + adjWeight[u][v] < dist[v]) {
					dist[v] = dist[u] + adjWeight[u][v];
				}
			}
		}
		
		return dist;
	}
}



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

int main() {
    double N;
    cin >> N;
    vector<vector<double>> p(N, vector<double>(2));
    for(int i = 0; i < N; i++){
        for(int j = 0; j < 2; j++){
            cin >> p.at(i).at(j);
        }
    }
    sort(p.begin(), p.end());
    double dis = 0;
    int div = 0;
    do{
        for(int i = 1; i < N; i++){
            double x = pow(p.at(i).at(0) - p.at(i-1).at(0),2);
            double y = pow(p.at(i).at(1) - p.at(i-1).at(1),2);
            dis += pow(x + y, 0.5);
        }
        div++;
    }while(next_permutation(p.begin(), p.end()));
    double ans = dis / div;
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 4216
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<string,ll> P;
int ar[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
  queue<P> que;
  int n;
  cin>>n;
  que.push(P("a",1));
  for(int i=2;i<=n;i++){
    queue<P> nque;
    while(!que.empty()){
      string s=que.front().first;
      ll num=que.front().second;
      que.pop();
      for(int c=0;c<num;c++){
        nque.push(P(s+(char)(c+'a'),num));
      }
      nque.push(P(s+(char)(num+'a'),num+1));
    }
    while(!nque.empty()){
      que.push(nque.front());
      nque.pop();
    }
  }
  while(!que.empty()){
    cout<<que.front().first<<endl;
    que.pop();
  }
}


Measured memory_bytes: 8960
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL<<60;

typedef pair<ll,ll> Pair;

int main(){

ll X,N;
ll ansabs = 101;
ll ans = 101;

cin >> X >> N;

vector<ll> p(N);

for(ll i = 0;i < N;++i) cin >> p[i];

/*
for(ll i = 100;i >= -100;--i){

    bool exists = std::find(std::begin(p), std::end(p), i) != std::end(p);

    if(exists) continue;
    else{

        ll temp;
        temp = abs(X + (i*(-1)));        

        if(ansabs >= temp){
            ansabs = temp;
            ans = i;
        }
    }
}
*/

bool flg = false;
ll  j = 0;

while(!flg){

    ll pre = X - j;
    ll post = X + j;

    bool existsPre = std::find(std::begin(p), std::end(p), pre) != std::end(p);
    bool existsPost = std::find(std::begin(p), std::end(p), post) != std::end(p);

    if(!existsPre){

        cout << pre << endl;
        flg = true;

    }
    else if(!existsPost){

        cout << post << endl;
        flg = true;
    }

    ++j;

}

return 0;

}   


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main(){

    int n,t=0;
  	cin >> n;
    int c[n-1];
    int s[n-1];
    int f[n-1];

    for(int i=0;i<n-1;i++){
        cin >> c[i];
        cin >> s[i];
        cin >> f[i];
    }

    for(int l=0;l<n-1;l++){
        t = s[l]+c[l];
        for(int i=l+1;i<=n-2;i++){
            if(s[i] >= t){
                t = s[i] + c[i];
            }else if(t%f[i] == 0){
            	t = ( (t/f[i]) * f[i] ) + c[i];
            }else{
                t = ( ((t/f[i])+1) * f[i] ) + c[i];
            }
        }
        cout << t << endl ;
    }

    cout << "0";
    return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
P=list(map(float,input().split()))
DP=[[0]*(n+1) for _ in range(n+1)]
for i in range(n+1):
    DP[i][0]=1
for i in range(1,n+1):
    for j in range(1,i+1):
        DP[i][j]=DP[i-1][j-1]*P[i-1]+DP[i-1][j]*(1-P[i-1])
print(DP[n][n//2+1])

Measured memory_bytes: 264584
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    h = list(map(int, input().rstrip('\n').split()))
    ls = [0] * n
    for i in range(1, n):
        t = 10 ** 10
        for j in range(i-1, max(i-k-1, -1), -1):
            t = min(t, ls[j] + abs(h[i] - h[j]))
        if ls[i] == 0:
            ls[i] = t
        else:
            ls[i] = min(ls[i], t)
    print(ls[-1])


if __name__ == '__main__':
    slove()


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

int main(){
  int N,K;
  cin >> N >> K;
  vector<char> D(K);
  for(int i=0;i<K;i++) cin >> D[i];

  for(int n=N;n<=99999;n++){
    string check = to_string(n);
    bool irohaOK = true;
    for(int c=0;c<check.length();c++){
      if(!irohaOK) break;
      for(int d=0;d<K;d++){
        if(check[c] == D[d]){
          irohaOK = false;
          break;
        }
      }
    }
    if(irohaOK){
      cout << n << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define REP2D(i,j,h,w) for(long long i=0;i<h;i++) for(long long j=0;j<w;j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=h;i++) for(long long j=1;j<=w;j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) (a.begin()),(a.end())
#define RANGE(a) (a),(a+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<a<<endl;
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 100005
#define MOD 1000000007
//---------------------

ll n,k;
vector<int> G[MAXN];
ll ret=1;

ll modmult(ll a , ll b ){
  return ( (a%MOD) * (b%MOD)  ) %MOD;
  }

void solve(ll lastId,ll curId,ll depth){
  	
	if(ret==0) {ret=0;return;}
	ll temp=depth==0 ? k:1;
	ll id=k-min(depth+1,ll(2));
	REP(i,G[curId].size()){
		if(G[curId][i] == lastId) continue;
		solve( curId , G[curId][i] , depth+1);
		temp = modmult(temp,max(id--,ll(0)));
	}
	ret = modmult(ret,temp);
	//cout<<ret<<endl;
}

int main(){
  	cin>>n>>k;
  	REP(i,n-1) {int a,b;cin>>a>>b;G[a].PB(b);G[b].PB(a);}
  	solve(-1,1,0);
	cout << ret <<endl;
	return 0;
}

Measured memory_bytes: 12800
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int r,c,h;
	while(cin>>r>>c>>h,r) 
	{
		int n; cin>>n;
		for(int i = 0; i < n; ++i)
		{
			int rr; cin>>rr; rr*=2;
			if(sqrt(rr*rr)<=sqrt(r*r+c*c)&&sqrt(rr*rr)<=sqrt(c*c+h*h)&&sqrt(rr*rr)<=sqrt(h*h+r*r)) cout<<"NA"<<endl;
			else cout<<"OK"<<endl;
		}
	}
  return 0;
}

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

long long N;

int main(){
	cin >> N;
	long long mini = 10e15;
	for(long long i = 0; i < 5; i++){
		long long tmp;
		cin >> tmp;
		mini = min(mini, tmp);
	}

	if(N%mini == 0){
		cout << 5 + (N/mini - 1) << endl;
	} else {
		cout << 5 + (N/mini) << endl;
	}
}

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

typedef long long ll;
using namespace std;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int maxv = max({a, b, c});
    for (int i = 0; i < k; ++i) maxv *= 2;

    int ans = a + b + c + maxv - max({a, b, c});
    cout << ans;
    return 0;
}


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

int main()
{
	int n = 0 , m = 0 , l = 0 , boxa[256][256] = {} , boxb[256][256] = {} ;
	long long boxc[256][256] = {} ;
	cin >> n >> m >> l ;
	for ( int i = 0 ; i < n ; i++ )
	{
		for ( int j = 0 ; j < m ; j++ )
		{
			cin >> boxa[i][j] ;
		}
	}
	for ( int k = 0 ; k < m ; k++ )
	{
		for ( int h = 0 ; h < l ; h++ )
		{
			cin >> boxb[k][h] ;
		}
	}
	for ( int i2 = 0 ; i2 < n ; i2++ )
	{
		for ( int j2 = 0 ; j2 < l ; j2++ )
		{
			for ( int k2 = 0 ; k2 < m ; k2++ )
			{
				boxc[i2][j2] += boxa[i2][k2] * boxb[k2][j2] ;
			}
		}
	}
	for ( int i5 = 0 ; i5 < n ; i5++ )
	{
		for ( int i7 = 0 ; i7 < l ; i7++ )
		{
			cout << boxc[i5][i7] ;
			if ( i7+1 != l ) cout << " " ;
		}
		cout << endl ;
	}
	return 0;
}



Measured memory_bytes: 4100
#include<iostream>
#define MOD 1000000007;
using namespace std;
int main(){
    long n,ans=0LL,x;
    cin>>n;
    long a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<60;i++){
        long c=0L;
        for(int j=0;j<n;j++)if((a[j]&(1L<<i))!=0LL)c++;
        long tmp=c*(n-c),w=i;
        tmp%=MOD;
        while(w--)tmp=tmp*2%MOD;
        ans+=tmp;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 2560
s = input()
t = input()

ans = len(t)
for i in range(len(s)-len(t)+1):
  count = 0
  r = int(i)
  for j in t:
    if s[r] != j:
      count += 1
    r += 1
  
  if ans > count:
    ans = count

print(ans)

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

int main() {
    int n;
    cin >> n;
    map<int,int> m;
    rep(i,n) {
        int a;
        cin >> a;
        m.insert({a,1});
    }
    if(m.size() == n) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 9600
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
	int a[3];
	while(cin>>a[0]>>a[1]){
		if(!a[0] && !a[1])break;
		else sort(a,a+2);
		cout<< a[0] << " "<<a[1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1176
function Main (input) {
  input = input.split("\n").map(inp => inp.split(""));
  var S = input[0];
  var T = input[1];
  var ans = "";
  var i = 0;
  while (true) {
    if (typeof S[i] == "undefined" && typeof T[i] == "undefined") {
      break;
    }
    else {
      ans += S[i];
      if (typeof T[i] != "undefined") {
        ans += T[i];
      }
    }
    i++
  }
  console.log(ans);
}

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

Measured memory_bytes: 7372
use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let v:Vec<i32> = procon_read();
	let k = v[0];
	let x:Vec<i32> = procon_read();
	let mut sum = 0;
	for i in x {
		sum += min(i*2, 2*(k - i));
	}
	println!("{}", sum);
}

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

using namespace std;

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long elapsed = 1900 * m + 100 * (n - m);
  long long kali = 1;
  for (int i = 0; i < m; i++) kali *= 2;
  cout << elapsed * kali << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    long long n,m,res,r,a,b,d,i;
    while(scanf("%lld %lld",&n,&m) != EOF)
    {
    	if(n>m)
	    {
	        a=m;
	        b=n;
	    }
	    else
	    {
	        a=n;
	        b=m;
	    }
        while(a!=0)
        {
            res=b%a;
            b=a;
            a=res;
        }
        printf("%lld\n",b);
    }

    return 0;
}

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

using ll = long long;
#define ld long double
#define ull unsigned long long int

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  // (i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define ret return

typedef pair<int, int>    pii;
typedef vector<int>       vi;
typedef vector<vi>        vii;
typedef vector<long long> vl;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) { cin >> a[i]; }

    // 処理
    int  cnt = 0;
    bool flg = true;
    while (flg == true) {
        rep(j, n) {
            if (a[j] % 2 == 0) {
                a[j] /= 2;
            } else {
                flg = false;
            }
        }
        if (flg == true) cnt++;
    }

    // 出力
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int x;
  cin >> x;
  for (int i = 1; ; i++) {
    if ((x * i) % 360 == 0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3596
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int n; cin >> n;
	multiset<int> s;
	for (int i = 1; i <= n; ++i) {
		int a; cin >> a;
		s.insert(a);
	}
	vector<pii> moves;
	while (s.size() > 1) {
		auto i1 = *(s.begin());
		auto i2 = *(s.rbegin());
		s.erase(s.find(i1));
		s.erase(s.find(i2));
		if (i1 > 0) {
			moves.pb({i1, i2});
			s.insert(i1 - i2);
		} else if (i2 < 0) {
			moves.pb({i2, i1});
			s.insert(i2 - i1);
		} else {
			if (!s.empty() and *s.rbegin() >= 0) {
				moves.pb({i1, i2});
				s.insert(i1 - i2);
			} else {
				moves.pb({i2, i1});
				s.insert(i2 - i1);
			}
		}
	}
	cout << *s.begin() << '\n';
	for (auto &p : moves) {
		cout << p.first << ' ' << p.second << '\n';
	}
}

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

Int A = 26;
Int D = 365;
Int c[26];
Int s[365][26];
Int last[26];

int main() {
    Int d;
    cin >> d;
    for (Int i = 0; i < (Int)A; i++) {
        cin >> c[i];
    }
    for (Int i = 0; i < (Int)D; i++) {
        for (Int j = 0; j < (Int)A; j++) {
            cin >> s[i][j];
        }
    }
    Int cur = 0;
    for (Int i = 0; i < (Int)D; i++) {
        Int ma = -INF;
        Int ma_type = -1;
        for (Int j = 0; j < (Int)A; j++) {
            Int diff = s[i][j];
            for (Int k = 0; k < (Int)A; k++) {
                if (j == k) continue;
                diff -= c[k] * (i + 1 - last[k]);
            }
            if (diff > ma) {
                ma = diff;
                ma_type = j;
            }
        }
        cur += ma;
        last[ma_type] = i + 1;
        print(ma_type + 1);
    }
    return 0;
}

Measured memory_bytes: 3744
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  cin>>n;
  vector<pll> ps(n);
  rep(i,n) cin>>ps[i].X>>ps[i].Y;
  for(pll &p:ps) if(p.X>p.Y) swap(p.X,p.Y);
  
  multiset<ll> a,b;
  for(pll p:ps) a.insert(p.X), b.insert(p.Y);
  sort(all(ps),[](const pll &p,const pll &q){return p.X+p.Y<q.X+q.Y;});
  ll re=(*b.rbegin()-*b.begin())*(*a.rbegin()-*a.begin());
  for(pll p:ps){
    a.erase(a.find(p.X));
    b.erase(b.find(p.Y));
    a.insert(p.Y);
    b.insert(p.X);
    MN(re,(*b.rbegin()-*b.begin())*(*a.rbegin()-*a.begin()));
  }
  
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 24192
package main

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

func main() {
	scan_init()
	n := scanInt()
	x := make([]int, n)
	y := make([]int, n)
	// sumX := make([]int, n)
	for i:= 0; i<n; i++ {
		p := scanInt()
		x[i] = p
		y[i] = p
	}
	// fmt.Println("aa", n/2)
	sort.Ints(y)
	merginLeft := y[(n/2)-1]
	merginRight := y[(n/2)]
	// fmt.Println(merginLeft, merginRight)
	for i:= 0; i<n; i++ {
		if x[i]<= merginLeft {
			fmt.Println(merginRight)
		} else {
			fmt.Println(merginLeft)
		}
	}
}

var sc = bufio.NewScanner(os.Stdin)

func scan_init() {
	sc.Split(bufio.ScanWords)
}
func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func scan() string {
	sc.Scan()
	return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 200000)

func readLine() string {
	buf := make([]byte, 0, 200000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}
func readLineToNumber() int {
	S := readLine()
	number, _ := strconv.Atoi(S)
	return number
}
func readLineToSlice() []string {
	S := readLine()
	list := strings.Split(S, "")
	return list
}
func readLineToNumberSlice(memo map[string]int) []int {
	// err時は-1を代入
	S := readLine()
	intList := make([]int, len(S))
	for i := 0; i < len(S); i++ {
		if val, ok := memo[string(S[i])]; ok {
			intList[i] = val
		} else {
			intList[i] = -1
		}
	}
	return intList
}

Measured memory_bytes: 9564