akhauriyash/Code-Regression huggingface dataset:
package main

import (
    "fmt"
)

var a []int

func main() {
  var N int
  var In int
  var max int
  var maxnum int
  var Alice,Bob int

  Alice = 0
  Bob   = 0
  
  fmt.Scan(&N)

  a = make([]int,N)

  for i := 0; i < N; i++ {
    fmt.Scan(&In)
    a[i] = In
  }

  //for i := 0; i < N; i++ {
  //  fmt.Printf("a[%d]=%d\n",i,a[i])
  //}

  for i:= 0; i < N; i++{
    max    = 0
    maxnum = 0
    for j:= 0; j < N; j++ {
      if a[j] > max {
        max = a[j]
        maxnum = j 
      }
    }

    if i%2 == 0 {
      Alice += max
      a[maxnum] = 0
    } else {
      Bob += max
      a[maxnum] = 0
    }
  }

  //fmt.Printf("Alice:%d\n",Alice)
  //fmt.Printf("Bob  :%d\n",Bob)
  //fmt.Printf("Alice - Bob  :%d\n",Alice-Bob)
  fmt.Println(Alice-Bob)

}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, w;
  cin >> n >> w;

  string s[50];
  REP(i,n){
    cin >> s[i];
  }

  int ans = INF;
  FOR(i,1,n-1){
    FOR(j,i+1,n){
      
      int sum = 0;
      //W
      FOR(k,0,i){
        REP(l,w){
          if(s[k][l] != 'W') sum++;
        }
      }

      //B
      FOR(k,i,j){
        REP(l,w){
          if(s[k][l] != 'B') sum++;
        }
      }

      FOR(k,j,n){
        REP(l,w){
          if(s[k][l] != 'R') sum++;
        }
      }
      ans = min(ans, sum);
    }
  }

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




Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define MOD 1000000007
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
using namespace std;
typedef vector<int> vi;
typedef list<int> li;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename P> P dectobin(P a){if(a==0)return 0; else return(a%2 + 10*dectobin(a/2));}
template<typename Y> Y bintodec(Y a){int ans=0,b=1,t=a; while (t){int ld=t%10; t/=10;ans+=ld* b;b=b*2;} return ans; }
template<typename H> H modExp(H x, H n){ int r=1; while(n>0){if(n%2==1){r=(r*x)%MOD;}x=(x*x)%MOD;n/=2;}return r;}
template<typename T> T isPowerOfTwo(T x){return x && (!(x & (x - 1)));}	
template<typename T> T lcm(T a,T b) {return a*b/gcd(a,b);}
//template<typename T> T extendedEuclid(T A,T B){if(B==0){d=A; x=1;y=0;}else{ extendedEuclid(B,A%B);int temp=x; x=y; y=temp-(A
//B)*y;}}
int32_t main(){
	boost;osit;
	int a,b,c;
	cin>>a>>b>>c;
	int p=min({a+b,b+c,c+a});
	cout<<p;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18

int main(){
    int N; cin >> N;
    vector<string> S(N);
    rep(i,N)cin >> S[i];
    long long ans = 0;
    vector<long long> T(5);
    rep(i,N){
        if(S[i][0] == 'M') T[0]++;
        if(S[i][0] == 'A') T[1]++;
        if(S[i][0] == 'R') T[2]++;
        if(S[i][0] == 'C') T[3]++;
        if(S[i][0] == 'H') T[4]++;
    }
    rep(i,3){
        repr(j,i+1,4){
            repr(k,j+1,5){
                ans += T[i] * T[j] * T[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll X, A, B, C, D;

int main(void) {
  cin >> X;
  A = X / 1000 % 10;
  B = X / 100 % 10;
  C = X / 10 % 10;
  D = X / 1 % 10;

  if(A + B + C + D == 7) { cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl; return 0; }
  if(A + B + C - D == 7) { cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl; return 0; }
  if(A + B - C + D == 7) { cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl; return 0; }
  if(A + B - C - D == 7) { cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl; return 0; }
  if(A - B + C + D == 7) { cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl; return 0; }
  if(A - B + C - D == 7) { cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl; return 0; }
  if(A - B - C + D == 7) { cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl; return 0; }
  if(A - B - C - D == 7) { cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl; return 0; }
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import groupby
    s = input()
    ans = 0
    prev = 0

    for k, g in groupby(s):
        l = len(list(g))
        if k == "<":
            ans += l * (l + 1) // 2
            prev = l
        else:
            ans += l * (l + 1) // 2
            ans -= min(l, prev)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 106832
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <cassert>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <complex>
using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

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

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 *1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 1000100;

vector<LL> Q;

VI g[MAX];
LL D[MAX];

LL RES[MAX];

LL ADD[MAX];
LL MUL[MAX];

int n;

LL get(int x)
{
	if (D[x] != -1) return D[x];
	LL res = 0;
	if (x >= n) res++;
	FOR (i, 0, SZ(g[x]))
	{
		int to = g[x][i];
		res += get(to);
	}

	return D[x] = res;
}

void go(int x)
{
	FOR (i, 0, SZ(g[x]))
	{
		int to = g[x][i];
		D[to] += D[x];
		go(to);
	}
}

struct Fen
{
	LL A[MAX];
	int n;

	void add(int x, LL val)
	{
		for (; x < MAX; x = x | (x + 1))
		{
			A[x] += val;
		}
	}

	LL get(int x)
	{
		LL res = 0;
		for (; x >= 0; x = (x & (x + 1)) - 1)
		{
			res += A[x];
		}
		return res;
	}
} F;

int main()
{
	//freopen("in.txt","r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int q;
	scanf("%d%d", &n, &q);

	int m = n;

	Q.PB(n);
	FOR (i, 0, q)
	{
		LL x;
		scanf("%lld", &x);

		while(SZ(Q) && Q.back() >= x) Q.pop_back();
		Q.PB(x);
	}

	n = Q[0];

	vector<LL> A;
	VI v;
	A.PB(n);
	v.PB(n);

	/*FOR (i, 0, SZ(Q))
	{
		cout<<Q[i]<<' ';
	}
	cout<<endl;*/

	int V = n + 1;


	FOR (i, 1, SZ(Q))
	{
		while(Q[i] != A.back())
		{

			LL tot = Q[i];
			LL sz = A.back();

			tot -= sz;

			LL len = min(tot, sz);

		//	cout<<"!! "<<len<<endl;

			while(true)
			{
				if (len == 0) break;
				int pos = upper_bound(ALL(A), len) - A.begin() - 1;

			/*	cout<<"--"<<endl;
				FOR (i, 0, SZ(A))
				{
					cout<<A[i]<<' ';
				}
				cout<<endl;
				cout<<len<<' '<<pos<<' '<<endl;
*/
				if (pos == -1)
				{
					//if (len == 0) throw -1;
					//g[len].PB(V);
					g[V].PB(len);
					break;
				}

				//g[v[pos]].PB(V);
				g[V].PB(v[pos]);
				len %= A[pos];
			}

			len = min(tot, sz);
			A.PB(len + A.back());
			v.PB(V);
			V++;
		}
	}

/*	FOR (i, 0, 20)
	{
		cout<<i<<": ";
		FOR (j, 0, SZ(g[i]))
		{
			cout<<g[i][j]<<' ';
		}
		cout<<endl;
	}
	cout<<endl;
*/

	//FILL(D, -1);

	/*FOR (i, 0, 64)
	{
		cout<<i<<' '<<get(i)<<endl;
	}*/

	F.add(0, 1);

	RFOR(i, V, n)
	{
		LL cnt = F.get(i);
		FOR (j, 0, SZ(g[i]))
		{
			int to = g[i][j];
			F.add(0, cnt);
			F.add(to+1, -cnt);
		}
	}

	LL sum = 0;
	RFOR(i, n + 1, 1)
	{
		sum = F.get(i);
		RES[i] = sum;

	}

	FOR (i, 1, m + 1)
	{
		printf("%lld\n", RES[i]);
	}


}


Measured memory_bytes: 45300
N,Y = gets.chomp.split(' ').map(&:to_i)
xm,ym,zm = [-1,-1,-1]
catch(:break_loop) do
0.upto(N) do |x|
  0.upto(N-x) do |y|
     z = N - x - y
     if 10000*x + 5000*y + 1000*z == Y
       xm,ym,zm = [x,y,z]
       throw :break_loop
     end
  end
end
end
puts "#{xm} #{ym} #{zm}"

      
  

Measured memory_bytes: 1788
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 998244353

N = INT()
D = LIST()

cnt_D = Counter(D)
if D[0] != 0 or cnt_D[0] >= 2:
	print(0)
	exit()

ans = 1

for i in range(1, max(D)+1):
	ans *= pow(cnt_D[i-1], cnt_D[i], mod)
	ans %= mod
print(ans)


Measured memory_bytes: 20412
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

const MOD: usize = 1e9 as usize + 7;

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      k: usize,
    }
    let mut acm = vec![0; n+2];
    for i in 0..n+1 {
        acm[i+1] = acm[i] + i;
    }
    let mut ans = 0;
    for i in k..n+2 {
        let l = acm[i];
        let r = acm[n+1] - acm[n+1-i];
        // debug!(i, l, r);
        ans += r-l+1;
        ans %= MOD;
    }
    puts!("{}\n", ans);
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define xx first
#define yy second
#define ll long long
#define int ll
using namespace std;

struct _in {
	const _in operator , (int &a) const {
		a = 0; char k = getchar (); int f = 1;
		while (k > '9' || k < '0') { if (k == '-') f = -1; k = getchar (); }
		while (k >= '0' && k <= '9') { a = a * 10 + k - '0'; k = getchar (); }
		a *= f;
		return*this;
	}
}in;

//const int N = ;
/*const int mod = ;
inline int add (int u, int v) { return u + v >= mod ? u + v - mod : u + v; }
inline int sub (int u, int v) { return u - v < 0 ? u - v + mod : u - v; }
inline int mul (int u, int v) { return 1LL * u * v % mod; }
inline int qpow (int base, int v) {
	int tot = 1;
	while (v) {
		if (v & 1) tot = mul (tot, base);
		base = mul (base, base);
		v >>= 1;
	}
	return tot;
}*/

const int N = 500000 + 5;
ll info[N], info2[N];
int cnt[70], n;
ll bs[70];
inline void insert (ll k) {
	for (int i = 61LL; i >= 1LL; --i) {
		if (k & (1LL << (i - 1LL))) {
			if (bs[i]) {
				k ^= bs[i];
			}
			else {
				bs[i] = k;
				return ;
			}
		}
	}
}

signed main () {
	in, n;
	for (int i = 1LL; i <= n; ++i) {
		scanf ("%lld", &info[i]);
		ll k = info[i];
		int cur = 1LL;
		while (k) {
			cnt[cur] += k & 1LL;
			k >>= 1LL;
			++cur;
		}
	}
	int maxs = 61LL;
	while (maxs >= 1 && cnt[maxs] == 0LL || cnt[maxs] % 2LL == 1LL) maxs--;
	if (!maxs) {
		ll ans = 0LL;
		for (int i = 1LL; i <= 61LL; ++i) {
			if (cnt[i] % 2LL == 1LL && cnt[i]) {
				ans += 1LL << (i - 1LL);
			}
		}
		printf ("%lld\n", ans);
		return 0;
	}
	for (int i = maxs; i >= 1LL; --i) {
		if (cnt[i] == 0LL || cnt[i] % 2LL == 1LL) continue;
		for (int k = 1LL; k <= n; ++k) {
			if (info[k] & (1LL << (i - 1LL)))
				info2[k] += 1LL << (i - 1LL);
		}
	}
	for (int i = 1LL; i <= n; ++i) {
		insert (info2[i]);
	}
	ll ans = 0LL;
	for (int i = 61LL; i >= 1LL; --i) {
		if ((ans ^ bs[i]) > ans)
			ans ^= bs[i];
	}
	ans <<= 1LL;
	for (int i = 1LL; i <= 61LL; ++i) {
		if (cnt[i] % 2LL == 1LL && cnt[i]) {
			ans += 1LL << (i - 1LL);
		}
	}
	printf ("%lld\n", ans);
	return 0;
}
































Measured memory_bytes: 5120
#include <stdio.h>

#define MAX 36

typedef struct{
  char m;
  int v;
}Card;

int main(){
  int n,i,j,a,f,min;
  Card x[MAX], y[MAX],t;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%c%c%d",&x[i].m, &x[i].m, &x[i].v);
    y[i] = x[i];
  }

  //BubbleSort
  for(i = 0 ; i < n ; i++)
    for(j = n-1 ; j >= i+1 ; j--)
      if(x[j].v < x[j-1].v){
        t = x[j];
        x[j] = x[j-1];
        x[j-1] = t;
      }

  //SelectionSort
  for(i = 0 ; i < n ; i++){
    min = i;
    for(j = i ; j < n ;j++)
      if(y[j].v < y[min].v)
        min = j;
    t = y[i];
    y[i] = y[min];
    y[min] = t;
  }

for(i=0;i<n-1;i++){
    printf("%c%d ",x[i].m, x[i].v);
  }
  printf("%c%d\n",x[n-1].m, x[n-1].v);
  printf("Stable\n");

  for( i = 0 ; i < n-1 ; i++){
    printf("%c%d ",y[i].m, y[i].v);
  }
  printf("%c%d\n",y[n-1].m, y[n-1].v);

  a=1;

  for(i=0;i<n;i++)
    if(x[i].m!=y[i].m)
      a=0;

  if(a==1)
    printf("Stable\n");
  else
    printf("Not stable\n");

  return 0;
}

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

int main()
{
ll a , b ;
cin >> a >> b ;
rep(i,10000){
  if(i*8/100==a&&i*10/100==b){
cout << i << endl;
return 0;
  }
}
cout << -1 << endl;
return 0;
}

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

using namespace std;

int main(){

  int N;

  cin >> N;

  int h[N];
  int dp[N]; //guarda o menor custo para chegar na pedra i

  for(int i=0;i<N;i++)
    cin >> h[i];

  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]); 

  for(int i=2;i<N;i++){
     dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
   }

  cout << dp[N-1] << endl;

  return 0;
}

Measured memory_bytes: 1024
while True:
    N,X=map(int,input().split())
    if N == 0 and X == 0:
        break
    ans = 0
    for a in range(1,N+1):
        for b in range(1,N+1):
            if b<=a:
                continue
            c = X-(a+b)
            if c>b and c<=N:
                ans +=1
    print("%d"%(ans))


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
	long long i,j,k,n;
	string s;
	cin>>s;
	n=0;
	for (i=0;i<s.length();i+=2)
	{
		if (s[i]!='h' || s[i+1]!='i')
		{
			n=1;
		}
	}
	if (n==1)
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.append(0)

cnt = 0

cnt += min(a[0], b[0])
b[0] -= min(a[0], b[0])

for i in range(1, n + 1):
  k = min(a[i], b[i-1])
  a[i] -= k
  cnt += k

  k = min(a[i], b[i])
  b[i] -= k
  cnt += k

print(cnt)

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


int main (void) {
  int a, b;
  std::cin >> a >> b;
  if ( (a*b)%2 == 0 ) std::cout << "Even" << std::endl;
  else std::cout << "Odd" << std::endl;

  return 0;
}


Measured memory_bytes: 256
using System;

namespace Csharp_Test
{
    class Program
    {
        static void Main(string[] args)
        {  
            string[] temp= Console.ReadLine().Split(' ');
            int A = int.Parse(temp[0]);
            int B = int.Parse(temp[1]);

            Console.WriteLine((A > 8 || B > 8) ? ":(" : "Yay!");
        }
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		sc.close();
		int t = 1800 * M + 100 * N;
		int ans = (int)Math.pow(2, M) * t;
		System.out.println(ans);
	}
}

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


void solve(std::vector<std::string> c){
    for(ll i=0; i< 3; i++){
        cout << c[i][i];
    }
    cout << endl;
}

int main(){
    std::vector<std::string> c(3);
    for(int i = 0 ; i < 3 ; i++){
        std::cin >> c[i];
    }
    solve(std::move(c));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N,x=0;
	cin >> N;
	vector <int> V(N),C(N);
	rep(i, N)
		cin >> V[i];
	rep(i, N)
		cin >> C[i];
	rep(i, N)
		if (V[i] - C[i] > 0)
			x += V[i] - C[i];
	cout << x;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> primes;
bool isPrime(long long x){
	for(long long i = 2; i * i <= x; i++) if(x % i == 0) return false;
	return true;
}
void init(){
	for(int i = 2; i <= 3000; i++) if(isPrime(i)) primes.push_back(i);
}
int main(){
	init();
	int n;
	cin >> n;
	map<long long, long long> rev, occ;
	for(int i = 0; i < n; i++){
		long long x; cin >> x;
		long long Norm = 1, Pair = 1;
		for(int v : primes){
			int cnt = 0;
			while(x % v == 0) x /= v, cnt++;
			cnt %= 3;
			if(!cnt) continue;
			if(cnt == 1){
				Norm *= v;
				Pair *= v;
				Pair *= v;
			} else {
				Norm *= v;
				Norm *= v;
				Pair *= v;
			}
		}
		if(x > 1){
			long long sq = sqrtl(x);
			while(sq * sq <= x) sq++;
			while(sq * sq > x) sq--;
			if(sq * sq == x){
				Norm *= x;
				Pair *= sq;
			} else {
				Norm *= x;
				Pair *= x;
				Pair *= x;
			}
		}
		rev[Norm] = Pair;
		rev[Pair] = Norm;
		occ[Norm]++;
		occ[Pair];
	}
	int ans = 0;
	for(auto it : occ) if(it.first != 1) ans += max(it.second, occ[rev[it.first]]);
	ans /= 2;
	if(occ[1]) ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 27392
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S_arr = _in[0]  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    N = len(S_arr)-1
    cnt = 0
    for bit in range(1<<N):
        # bit = 0: '', 1: '+'
        tmp = []
        pointa = 0
        for i in range(N):
            if bit&(1<<i):
                tmp.append(int(S_arr[pointa:i+1]))
                pointa = i+1
        else:
            tmp.append(int(S_arr[pointa:]))
        cnt += sum(tmp)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


Measured memory_bytes: 41196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
ll a[200005],b[200005];
P p[200005];
ll MOD=1000000007;
ll c[200005];
ll j;
ll k=1;
ll l;
ll L=1;
ll ans;
ll gcd(ll x,ll y){
    if(y==0){
        return x;
    }
    return gcd(y,x%y);
}
ll g;
ll mod_pow(ll x,ll n,ll M){
    if(n==0) return 1;
    ll res=mod_pow(x*x%M,n/2,M);
    if(n&1) res=res*x%M;
    return res;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        g=gcd(a[i],b[i]);
        if(g!=0){
            a[i]=a[i]/g;
            b[i]=b[i]/g;
        }
        if(b[i]<0){
            a[i]=a[i]*(-1);
            b[i]=b[i]*(-1);
        }
        p[i].first=a[i]; p[i].second=b[i];
    }
    sort(p,p+n);
    for(int i=0;i<n;i++){
        if(p[i].first==0&&p[i].second==0){
            ans++;
        }else if(p[i].first>0){
        ll X=upper_bound(p,p+n,make_pair (p[i].second*(-1),p[i].first))-lower_bound(p,p+n,make_pair (p[i].second*(-1),p[i].first));
        if(X==0){
            k=k*2%MOD;
        }else{
            if(p[i].first==p[i+1].first&&p[i].second==p[i+1].second){
                c[j]++;
            }else{
                c[j]++;
                j++;
                c[j]=X;
                j++;
            }
        }
        }else{
            ll X=upper_bound(p,p+n,make_pair (p[i].second,p[i].first*(-1)))-lower_bound(p,p+n,make_pair (p[i].second,p[i].first*(-1)));
            if(X==0){
                k=k*2%MOD;
            }
        }
    }
    for(int i=0;i<j;i++){
        //cout<<c[i]<<endl;
        l=(l+mod_pow(2,c[i],MOD))%MOD;
        if(i%2==1){
            l--;
            if(l<0){
                l=l+MOD;
            }
            L=L*l%MOD;
            l=0;
        }
    }
    //cout<<k<<" "<<L<<endl;
    ans+=L*k%MOD;
    if(ans-1<0) ans+=MOD;
    cout<<ans-1<<endl;
    
}



Measured memory_bytes: 9816
#include <stdio.h>
#include <ctype.h>

//#define DEBUG

int main (void){


	char strW[11];						//10????????\????????????W???????´???????
	char strE[12] = "END_OF_TEXT";		//??????????????¨
	char strP[1001] ;					//???????????????????????¨????????????

	int ans = 0 ;						//??????????????°
	int cnt = 0 ;						//W????????°??????????????????????????°
	int end = 1 ;						//????????????????????°

	int i = 0 ;							//???????????°

	/*W???????????????*/
	scanf("%s",strW);
	/*?????????W?????¨????°????????????????*/
	for( i = 0 ; strW[i] != '\0' ; i++){
		if(isupper(strW[i])){
			strW[i] = tolower(strW[i]);	//??§?????????????°????????????????
		}
	}


#ifdef DEBUG
		printf("?????????W???%s\n",strW);
#endif

	while(end){

		scanf("%s", strP);				//?????????????????????


#ifdef DEBUG
		printf("?????????P???%s\n",strP);
#endif

		/*strE??¨strP?????????????????????????????????????????????*/

		for( i = 0 ; (strE[i] != '\0') && (ans == 0) ; i++){
					if( strE[i] != strP[i] ){
						ans = 1 ;
						}
				}
			if (strP[i] != '\0'){
				ans = 1 ;
			}
				if (ans == 0){				//?????´????????????????????°
				end = 0;
			}
		ans = 0 ;						//??????????????°????????????



		/*????????????????????£??????????????????P?????¨????°????????????????*/
		for( i = 0 ; strP[i] != '\0' ; i++){
			if(isupper(strP[i])){
				strP[i] = tolower(strP[i]);	//??§?????????????°????????????????
			}
		}

#ifdef DEBUG
		printf("?????????P???%s\n",strP);
#endif

		/*strW??¨strP?????????*/
		for( i = 0 ; (strW[i] != '\0') && (ans == 0) ; i++){
					if( strW[i] != strP[i] ){
						ans = 1 ;
						}
				}
			if (strP[i] != '\0'){
				ans = 1 ;
			}

			if (ans == 0){				//?????´????????????????????¢??????
				cnt++;
			}


		ans = 0;						//??????????????°????????????

	}

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

Measured memory_bytes: 544
n = gets.to_i
$graph = []
$seen = Array.new(n, false)
$ans = Array.new(n).map{Array.new(2, 0)}
$time = 1

n.times do |i|
  tmp = []
  gets.split().map(&:to_i).each_with_index do |value, index|
    next if index == 0 || index == 1
    tmp << value
  end
  $graph << tmp
end

def dfs(s)
  $seen[s] = true
  $ans[s][0] = $time
  $time += 1 
  $graph[s].each do |node|
    next if $seen[node-1]
    dfs(node-1)
  end
  $ans[s][1] = $time
  $time += 1
end

$seen.each_with_index do |value, index|
  next if value
  dfs(index)
end

$ans.each_with_index do |array, index|
  puts "#{index+1} #{array[0]} #{array[1]}"
end




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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
        
    N=I()
    n=int(N**0.5)+1
    ans=0
    
    def make_divisors(n):
        divisors = []
        for i in range(1, int(n**0.5)+1):
            if n % i == 0:
                divisors.append(i)
                if i != n // i:
                    divisors.append(n//i)

        # divisors.sort()
        return divisors
    
    div=make_divisors(N)
    if len(div)==2:
        ans+=1
    else:
        ans=0
        for d in div:
            div2=make_divisors(d)
            if N==0:
                break
            if len(div2)==2:
                p=div2[-1]
                p2=p
                while N%p2==0:
                    N=N//p2
                    p2*=p
                    ans+=1

        
            
    
    
            
    print(ans)

main()


Measured memory_bytes: 69060
import java.util.*;
import java.io.*;

public class Main {	
	private static void solve(){
		//Implement solution here.
		int N = ni();
		long K = nl();
		int[] A = na(N);
		//Find loop size
		long[] steps = new long[N];
		
		int pos = 1;
		long step = 1L;
		boolean loop = false;
		while(step < K) {
		//while(true) {
			//System.out.println(step + " " + steps[pos - 1]);
			if(steps[pos - 1] == 0) {
				steps[pos - 1] = step;
				pos = A[pos - 1];
				step++;
			} else {
				loop = true;
				step--;
				break;
			}			
		}
		long loopstart = steps[pos - 1];
//		Arrays.stream(steps).forEach(v -> System.out.print(v + " "));
//		System.out.println();
//		System.out.println(step);
//		System.out.println(loopstart);
		
		if(loop) {
			K -= loopstart - 1;
			int stepmod = (int)(K % (step - loopstart + 1));
			for(int i = 0; i < stepmod; i++) {
				pos = A[pos - 1];
			}
		} else {
			pos = 1;
			for(int i = 0; i < K; i++) {
				pos = A[pos - 1];
			}
		}
		System.out.println(pos);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 47660
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 05/01/20 00:21:14
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,m; cin>>n>>m;
  vector<int> graph[n];
  set<int> vs;
  deque<int> path;
  {
    int a,b; cin>>a>>b; a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
    vs.insert({a,b});
    path.push_back(a);
    path.push_back(b);
  }
  for (int i = 1; i < m; i++) {
    int a,b; cin>>a>>b; a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  while (true) {
    auto check = [&](int s) {
      for (auto t:graph[s]) {
        if (vs.count(t) == 0)
          return false;
      }
      return true;
    };
    auto cs = check(path.front());
    auto ct = check(path.back());
    if (cs and ct) {
      break;
    } else {
      if (!cs) {
        auto s = path.front();
        for (int & t : graph[s]) {
          if (vs.count(t) == 0) {
            path.push_front(t);
            vs.insert(t);
            break;
          }
        }
      }
      if (!ct) {
        auto s = path.back();
        for (int & t : graph[s]) {
          if (vs.count(t) == 0) {
            path.push_back(t);
            vs.insert(t);
            break;
          }
        }
      }
    }
  }
  cout << path.size() << endl;
  for (auto s:path)
    cout<<s+1<<" ";
  cout<<endl;

  return 0;
}


Measured memory_bytes: 11392
#include<stdio.h>

#define NOT_FOUND 0

int linearSearch(int A[],int n,int key){
  int i=0;
  A[n] = key;
  while(A[i]!=key){
    i++;
  if(i==n){
    return NOT_FOUND;
  }
}
  return 1;
}
  int main(){
    int i,n,A[10000+1],q,key,s=0;

    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
      scanf("%d",&key);
      if(linearSearch(A,n,key)){
        s++;
      }
    }printf("%d\n",s);

    return 0;
  }



Measured memory_bytes: 2108
/**
 * @author torith
 * @date 2019-01-12
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int N; cin >> N;
    int A, B; cin >> A >> B;
    vector<int> P;
    for (int i = 0; i < N; ++i) {
        int t; cin >> t;
        P.push_back(t);
    }

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

    int first=0, second=0, third=0;
    for(auto &p : P){
        if(p <= A) first++;
        else if(A < p && p <= B) second++;
        else if(B < p) third++;
    }

    int ans = min(first, min(second, third));
    cout << ans << "\n";


    return 0;
}



Measured memory_bytes: 256
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N, X = MI()
    L = LI()
    L = [abs(i-X) for i in L]
    ans = L[0]
    for i in L:
        ans = math.gcd(ans, i)
    print(ans)
    
    
if __name__ == "__main__":
    main()

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> x(N);
  vector<ll> y(N);
  vector<ll> h(N);
  ll ansx, ansy, ansh;
  ll temph;
  REP(i, N) cin >> x[i] >> y[i] >> h[i];
  for(ll cx = 0; cx <= 100; cx++) {
    for(ll cy = 0; cy <= 100; cy++) {
      bool ok = false;
      set<ll> I;
      vector<ll> I0;
      for(ll i = 0; i < N; i++) {
        if(h[i] > 0) {
          I.insert(h[i] + abs(x[i] - cx) + abs(y[i] - cy));
        } else {
          I0.push_back(abs(x[i] - cx) + abs(y[i] - cy));
        }
      }
      if(I.size() == 1) {
        ok = true;
        for(auto i : I) {
          temph = i;
          for(auto j : I0) {
            if(temph > j) {
              ok = false;
            }
          }
        }
      }
      if(ok) {
        ansx = cx;
        ansy = cy;
        ansh = temph;
      }
    }
  }
  cout << ansx << " " << ansy << " " << ansh << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#define rep(i, n) for (int i=0; i<(n); i++)
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int p(int s1, int s2, int dp){
    if(s1 == 0 && s2 == 0) return 0;
    if(s1 == 1 && s2 == 1) return 0;
    if(s1 == 1 && s2 == 0) return 1;
    if(dp > 0) return 0;
    else return 1; 
}

int main(){
    int H, W; cin >> H >> W;
    string tmp;
    int s[H+2][W+2], dp[H+2][W+2];
    rep(i, H+2){
        rep(j, W+2) dp[i][j] = 300;
    }
    /*
    rep(i, H+2){
        dp[i][0] = 300;
        dp[i][W+1] = 300;
    }
    rep(i, W+2){
        dp[0][i] = 300;
        dp[H+1][i] = 300;
    }
    */
    for(int i=1; i<H+1; i++){
        cin >> tmp;
        for(int j=0; j<W; j++){
            if(tmp[j] == '#') s[i][j+1] = 0;
            else s[i][j+1] = 1;
        }
    }
    int a, b;
    dp[1][1] = 0;
    for(int i=1; i<H+1; i++){
        for(int j=1; j<W+1; j++){
            if(i == 1 && j == 1) continue;
            a = dp[i][j-1] + p(s[i][j-1], s[i][j], dp[i][j-1]);
            b = dp[i-1][j] + p(s[i-1][j], s[i][j], dp[i-1][j]);
            chmin(dp[i][j], a);
            chmin(dp[i][j], b);
        }
    }
    /*
    for(int i=1; i<H+1; i++){
        for(int j=1; j<W+1; j++) cout << s[i][j] << " ";
        cout << endl;
    }
    cout << endl;
    for(int i=1; i<H+1; i++){
        for(int j=1; j<W+1; j++) cout << dp[i][j] << " ";
        cout << endl;
    }
    */

    if(dp[H][W] == 0 && s[H][W] == 0) dp[H][W]++;
    cout << dp[H][W] << endl;
}

Measured memory_bytes: 384
n = gets.strip.to_i

a = [[0, 0, 0]]

enable = true
n.times do |i|
  a << gets.strip.split.map(&:to_i)
  j = i + 1
  # t: time
  t = a[j][0] - a[i][0]
  d = (a[j][1] - a[i][1]).abs + (a[j][2] - a[i][2]).abs
  # 移動距離が時間をオーバしている... 無理
  if t < d
    enable = false
  # 時間が距離をオーバしている場合
  elsif t > d
    # 残り時間が偶数であれば、折り返しで着地可能
    unless (t - d).even?
      enable = false
    end
  end
end

puts enable ? 'Yes' : 'No'


Measured memory_bytes: 9468
#include <cstdio>

long long dp[308][308];
long long dp2[308][308];
long long MOD=1000000007;
long long add(long long x,long long y) {
	x+=y;
	return x%MOD;
}
long long prod(long long x,long long y) {
	x*=y;
	return x%MOD;
}
int main() {
	int N,M;
	scanf("%d%d",&N,&M);
	dp[N-1][0]=1;
	for(int round=0;round<M;round++) {
		for(int i=0;i<=N;i++) {
			for(int j=0;j<=N;j++) dp2[i][j]=0;
		}
		for(int i=0;i<=N;i++) {
			for(int j=0;j<=i;j++) {
				dp2[i-j][0]=add(dp2[i-j][0],prod(dp[i][j],N-i));
				dp2[i][j]=add(dp2[i][j],prod(dp[i][j],j));
				if(i>j) dp2[i][j+1]=add(dp2[i][j+1],prod(dp[i][j],i-j));
			}
		}
		for(int i=0;i<=N;i++) {
			for(int j=0;j<=N;j++) dp[i][j]=dp2[i][j];
		}
	}
	printf("%lld\n",dp[0][0]);
	return 0;
}


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

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

    int* a = malloc(sizeof(int)*n);

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

    int temp = 0;
    for (int i = 0; i < (n - 1); i++) {
    for (int j = (n - 1); j > i; j--) {
      if (a[j-1] > a[j]) {
        temp = a[j-1];
        a[j-1] = a[j];
        a[j] = temp;
      }
    }
     }

    float b = (float)a[0];
    for (int i = 0; i < n-1; i++) {
        b = ((float)a[i+1] + b)/2;
    }
    printf("%f", b);
    return 0;
}

Measured memory_bytes: 128
// ref. https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: usize,
        b: usize,
    }

    let result = if a >= b*2{
        a - b*2
    }else{
        0
    };
    println!("{}", result)
}


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

  
int main(){
 VI a(3);
  cin >> a.at(0) >>a.at(1) >>a.at(2);
 sort(a.begin(),a.end());
  cout << a.at(2)-a.at(0) <<endl;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d; scanf("%d%d%d%d" , &a , &b , &c , & d );
	
	int s = max(a,c);
	int e = min(b,d);
	
	(e-s>0)?printf("%d", e-s ):printf("0");
	return 0 ;	
}

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


int main() {
    int n;
    cin>>n;
    vector<long long>v;
    long long a;
    long long z=0;
    for(int i=0;i<n;i++){
        cin>>a;
        v.push_back(a);
        if(i>=1 && v.at(i)<v.at(i-1)){
            z+=v.at(i-1)-v.at(i);
            v.at(i) = v.at(i-1);
            
        }
    }
    cout<<z<<endl;
        
    
    
    
   
    
    
    
    return 0;
}



Measured memory_bytes: 5236
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
#define MOD (ll)(1e9+7)
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;

signed main(){
    ll n;
    cin >> n;
    ll ans = 0;
    ll v[n],c[n];
    rep(i,0,n){
        cin >> v[i];
    }
    rep(i,0,n){
        cin >> c[i];
        if(v[i] - c[i] >= 0) ans += v[i] - c[i];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char a[1001];
	int sum = 0;
	int i;
	int num[1001];
	
	
	while(1)
	{
		scanf("%s",a);
		if(a[0] == '0') break;
		
		for(i = 0; i < 1000; i++)
		{
			if(a[i] == '\0') break;
			num[i] = a[i] - '0';
			sum += num[i];
		}
		
		printf("%d\n",sum);
		sum = 0;
	}
	
	return 0;
}

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint h, n;
    cin >> h >> n;
    vector<lint> v(n);
    lint at=0;
    REP(i, n) { cin >> v[i];
        at += v[i];
    }

    lint ans=0;
    if(at>=h){

        cout << "Yes" << "\n";
    }else{
        cout << "No"
             << "\n";
    }

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    vector<int>a(2*n);
    rep(i,2*n)cin >> a[i];
    sort(a.begin(),a.end());
    int ans=0;
    rep(i,n){
        ans += a[2*i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var a = Array.ConvertAll(line.Trim().Split(','), int.Parse);
            Array.Sort(a); a.Reverse();
            Console.WriteLine(getHand(a));
        }
    }
    public static string getHand(int[] a)
    {
        if (isFour(a)) return "four card";
        if (isFull(a)) return "full house";
        if (isStrai(a)) return "straight";
        if (isThree(a)) return "three card";
        switch (get210(a))
        {
            case 2:
                return "two pair";
            case 1:
                return "one pair";
            default:
                return "null";
        }
    }
    public static bool isFour(int[] a)
    {
        return (a[0] == a[3] | a[1] == a[4]);
    }
    public static bool isFull(int[] a)
    {
        return ((a[0] == a[2] && a[3] == a[4]) | (a[0] == a[1] && a[2] == a[4]));
    }
    public static bool isStrai(int[] a)
    {
        if (a[0] == 1 && a[1] == 10 && a[2] == 11 && a[3] == 12 && a[4] == 13) return true;
        for (int i = 1; i < 5; i++)
            if (a[i] - a[i - 1] != 1) return false;
        return true;
    }
    public static bool isThree(int[] a)
    {
        return (a[0] == a[2] | a[1] == a[3] | a[2] == a[4]);
    }
    public static int get210(int[] a)
    {
        var b = a.ToList();
        var c = b.Distinct().ToList();
        return 5 - c.Count();
    }
}

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

#define ll long long int
#define ld long double
#define endl '\n'

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //cout.tie(NULL); 

    #ifndef ONLINE_JUDGE 
        freopen("__input.txt", "r", stdin); 
        freopen("__output.txt", "w", stdout); 
    #endif 

    ll n, d;
    cin >> n >> d;

    ll awnser = 0;
    ld x = 0, y = 0;
    for(ll i=0; i<n; i++) {
        cin >> x >> y;

        x = pow(x, 2);
        y = pow(y, 2);
        long double a = sqrt(x + y);
        if(a <= d) awnser++;
    }

    cout << awnser;

    return 0;
}

Measured memory_bytes: 3868
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

alias Point = Tuple!(long, "x", long, "y");

Point[50] PS;

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];

    foreach (i; 0..N) {
        auto xy = readln.split.to!(long[]);
        PS[i] = Point(xy[0], xy[1]);
    }

    auto ps = PS[0..N];

    auto min_size = long.max;
    foreach (a; ps) {
        foreach (b; ps) {
            foreach (c; ps) {
                foreach (d; ps) {
                    auto max_x = max(a.x, b.x, c.x, d.x);
                    auto min_x = min(a.x, b.x, c.x, d.x);
                    auto max_y = max(a.y, b.y, c.y, d.y);
                    auto min_y = min(a.y, b.y, c.y, d.y);

                    int cnt;
                    foreach (p; ps) if (min_x <= p.x && p.x <= max_x && min_y <= p.y && p.y <= max_y) ++cnt;
                    if (cnt >= K) min_size = min(min_size, (max_x - min_x) * (max_y - min_y));
                }
            }
        }
    }
    writeln(min_size);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <deque>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define BRK(x) { (x); break; }
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mt make_tuple
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;



llint N, M;


llint solve(){
	if(2*N >= M) return M/2;
	return N+(M-2*N)/4;
}


signed main(){
	cin >> N >> M;

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, a[114];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = n - 1; i > 0; i--) {
		cout << a[i] << " ";
	}
	cout << a[0] << endl;
}


Measured memory_bytes: 3104
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int N;
int ans = 0;
int main()
{
	while (true){
		cin >> N;
		if (N == 0)break;
		if (N % 1111 == 0)printf("NA\n");
		else{
			ans = 0;
			while (N != 6174){
				int A[4];
				A[0] = N / 1000;
				A[1] = (N / 100) % 10;
				A[2] = (N / 10) % 10;
				A[3] = N % 10;
				sort(A, A + 4);
				reverse(A, A + 4);
				N = 999 * (A[0] - A[3]) + 90 * (A[1] - A[2]);
				ans++;
				
			}
			
			printf("%d\n", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 1164