akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/perl

$line = 0;
while (<>) {
    chomp;
    if ($line == 0) {
        ($n, $l) = split /\s/, $_;
    } else {
        chomp;
        push @l, $_;
    }
    $line++;
}

foreach (sort {$a cmp $b} @l) {
    print "$_";
}
print "\n";


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        long[] array = new long[N+1];
        long[] brray = new long[N];

        for (int i=0; i<N+1; i++) {
            array[i] = scanner.nextLong();
        }
        for (int i=0; i<N; i++) {
            brray[i] = scanner.nextLong();
        }

        int aIndex = 0;
        int bIndex = 0;
        long count = 0;
        while (aIndex < N+1 && bIndex < N) {
            if (array[aIndex] <= 0) {
                aIndex++;
                continue;
            }
            if (brray[bIndex] <= 0) {
                bIndex++;
                continue;
            }

            if (aIndex - bIndex > 1) {
                bIndex++;
                continue;
            }

            if (bIndex > aIndex) {
                aIndex++;
                continue;
            }

            if (array[aIndex] > brray[bIndex]) {
                long tmpCount = brray[bIndex];
                array[aIndex] -= tmpCount;
                brray[bIndex] -= tmpCount;
                count += tmpCount;
            } else {
                long tmpCount = array[aIndex];
                array[aIndex] -= tmpCount;
                brray[bIndex] -= tmpCount;
                count += tmpCount;
            }
        }
        System.out.println(count);
    }
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef vector<int> V;

int n;
V t[100000];
int d[100000];
int p[17][100000];

void dfs(int x){
	for(int i: t[x]){
		d[i] = d[x] + 1;
		p[0][i] = x;
		dfs(i);
	}
}
void init(){
	p[0][0] = -1;
	dfs(0);
	for(int i = 1; i < 17; ++i){
		rep(j, n){
			int v = p[i - 1][j];
			p[i][j] = v != -1 ? p[i - 1][v] : -1;
		}
	}
}

int up(int v, int x){
	rep(i, 17){
		if(x >> i & 1){
			v = p[i][v];
		}
	}
	return v;
}
int lca(int u, int v){
	if(d[u] > d[v]){
		swap(u, v);
	}
	v = up(v, d[v] - d[u]);
	if(u == v){
		return u;
	}
	for(int i = 17 - 1; i >= 0; --i){
		if(p[i][u] != p[i][v]){
			u = p[i][u];
			v = p[i][v];
		}
	}
	return p[0][u];
}

int main(){
	cin >> n;
	rep(i, n){
		int k;
		cin >> k;
		rep(j, k){
			int c;
			cin >> c;
			t[i].push_back(c);
		}
	}

	init();

	int q;
	cin >> q;
	rep(i, q){
		int u, v;
		cin >> u >> v;
		cout << lca(u, v) << endl;
	}
	return 0;
}

Measured memory_bytes: 20200
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		boolean b = true;
		for(int i=1; i<=9; i++) {
			if(n % i == 0 && n / i <= 9) {
				System.out.println("Yes");
				b = false;
				break;
			}
		}
		if(b) System.out.println("No");

	}

}

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

int main(){
	double ans=0;
	
	int n;
	cin >> n;
	ans = double(n/2 + n%2) / n;

	printf("%lf", ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }

int n,q,r,x,y;
ll dist[100010];
vector<ll> et[100010],ec[100010];

void dfs(int v, int p=-1, ll d=0){//現在の頂点v,vの親,現在の距離d
  dist[v]=d;
  for(int i=0; i<sz(et[v]); i++){
    if(et[v][i]==p) continue;
    dfs(et[v][i],v,d+ec[v][i]);
  }
}

int main(int argc, char const *argv[]) {
  cin >> n;
  rep(i,n-1){
    int a,b,c;
    cin >> a >> b >> c;
    a--,b--;
    et[a].pb(b);
    et[b].pb(a);
    ec[a].pb(c);
    ec[b].pb(c);
  }

  cin >> q >> r;
  r--;
  dfs(r);

  rep(i,q){
    cin >> x >> y;
    x--,y--;
    cout << dist[x] + dist[y] << endl;
  }

  return 0;
}


Measured memory_bytes: 21376
#include<bits/stdc++.h>
using namespace std;
bool dp[101][100001];
int main(){
  int n,k;
  cin>>n>>k;
  int a[n+1];
  for(int i=1;i<=n;i++)
  cin>>a[i];
  memset(dp,0,sizeof dp);
  for(int i=1;i<=n;i++){
      for(int j=1;j<=k;j++){
          if(j<a[i])
          dp[i][j]=dp[i-1][j];
          else { for(int k=1;k<=i;k++)
              dp[i][j]=max(!dp[i][j-a[k]],dp[i][j]);
          }
      }
  }
  if(dp[n][k])
  cout<<"First";
  else cout<<"Second";
  return 0;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

// https://ei1333.hateblo.jp/entry/2017/04/10/224413

vll G[100100];
ll dist[100100];

void dfs1(ll v, ll p){
  for(auto &nv: G[v]){
    if(nv==p) continue;
    dfs1(nv,v);
    chmax(dist[v],dist[nv]+1);
  }
}

ll ans[100100];
void dfs2(ll v, ll parent, ll p){
  vpll child;
  child.emplace_back(0,-1);
  for(auto &nv: G[v]){
    if(nv==p) child.emplace_back(parent+1, nv);
    else child.emplace_back(dist[nv]+1, nv);
  }
  sort(child.rbegin(),child.rend());
  ans[v]=child[0].first;
  for(auto &nv: G[v]){
    if(nv==p) continue;
    dfs2(nv, child[child[0].second==nv].first, v);
  }
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  rep(i,n-1){
    ll a,b; cin>>a>>b; a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  dfs1(0,-1);
  dfs2(0,0,-1);
  rep(i,n){
    // ある頂点からスタートしてその頂点に戻ってくるためのコストはどの頂点であっても必ず (n-1)*2 となる(行って戻ってくることを考えるとどの辺も2回ずつ通るため)
    // この往復距離から、その頂点からの最遠距離を引いたものが全ての頂点を回るための最短距離となる
    cout<<(n-1)*2-ans[i]<<endl;
  }
  
}


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

int main(void){
    double x1,y1,x2,y2,sd;
    scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
    sd=(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
    printf("%lf\n",sqrt(sd));
    return 0;
}

Measured memory_bytes: 652
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define sortt(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/******* Variable ***********************************/
const int maxn = 1e6 * 50;
const double inf = 0x3f3f3f3f3f;
/******* Function ***********************************/
void out(const vector<int> A) {
  rep(i, 0, A.size()) {
    cout << A[i] << ((i != A.size() - 1) ? " " : "\n");
  }
}

/******* Main ****************************************/
int main() {
  int i = 1, x;
  while (cin >> x && x != 0) {
    cout << "Case"
         << " " << i++ << ": " << x << endl;
  }
  return 0;
}


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int64_t update_h(char c, int64_t h) { return h * 29 + c; }

int64_t calc_h(const string_view& s) {
    int64_t h = 0;

    for (auto i : irange(0uL, s.size())) {
        h = update_h(s[i], h);
    }

    return h;
}

int main() {
    int64_t n;
    cin >> n;

    vector<string> s(n);
    for (auto&& ss : s) {
        cin >> ss;
        reverse(ss.begin(), ss.end());

        for (auto&& c : ss) {
            c -= 'a';
        }
    }

    sort(s.begin(), s.end(),
         [](const string& l, const string& r) { return l.size() < r.size(); });

    int64_t ans = 0;
    unordered_map<int64_t, vector<pair<string_view, array<int64_t, 26>>>> m;
    for (const auto& ss : s) {
        if (ss.size() >= 2) {
            array<int64_t, 26> v{};
            for (auto c : ss) {
                ++v[c];
            }

            int64_t h = 0;
            for (auto i : irange(0uL, ss.size() - 1)) {
                for (const auto& [sv, ar] : m[h]) {
                    if (sv != string_view(ss).substr(0, i)) {
                        continue;
                    }

                    for (auto c : irange(0L, 26L)) {
                        if (v[c] > 0) {
                            ans += ar[c];
                        }
                    }
                }

                --v[ss[i]];
                h = update_h(ss[i], h);
            }
        }

        bool updated = false;
        string_view r = string_view(ss).substr(0, ss.size() - 1);
        auto h = calc_h(r);
        for (auto&& kv : m[h]) {
            if (kv.first == r) {
                ++kv.second[ss.back()];
                updated = true;
                break;
            }
        }
        if (!updated) {
            m[h].emplace_back(r, array<int64_t, 26>{});
            ++m[h].back().second[ss.back()];
        }
    }

    cout << ans << endl;
}

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

int main(){ 
  string s; 
  cin >> s;
  int n = s.size();
  int l = n, r = -1;
  for (int i = 0; i < n; i++){
    if (s[i] == 'A') l = min(l, i);
    if (s[i] == 'Z') r = max(r, i);
  }
  cout << r-l+1 << endl;
  
  return 0;
}
  

Measured memory_bytes: 640
n =gets.to_i
retsu = gets.split("")
a = []
hidari =0
migi = retsu.count(".")
a.push(migi)
n.times{|t|
if retsu[t] == "#" then
  hidari +=1
else
  migi -=1
end
  a.push(hidari + migi)
  }

print a.min

Measured memory_bytes: 20220
import bisect
from collections import deque
n = int(input())
a = [0 for i in range(n)]
for i in range(n):
    a[i] = int(input())
count = deque()
count.append(a[0])
for i in range(1, n):
    
    index = bisect.bisect_left(count, a[i])
    
    if index == 0:
        count.appendleft(a[i])
    else:
        count[index - 1] = a[i]
    #print("{}  {}".format(count, index))
print(len(count))



Measured memory_bytes: 48800
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    int y;
    cin >> n >> y;
    imfor(i, n + 1) {
        imfor(j, n + 1) {
            int k = n - i - j;
            if (k < 0) {
                continue;
            }
            if (i * 10000 + j * 5000 + k * 1000 == y) {
                cout << i << " " << j << " " << k << endl;;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

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

using ll = long long;
using ull = unsigned long long;
#define countof(a) (sizeof(a)/sizeof((a)[0]))
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define bzero(p, n) memset(p, 0, n)
#define all(a) begin(a),end(a)
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 

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

    ll X, Y; cin >> X >> Y;

    ll n = 1;
    while ((X *= 2) <= Y)
        n++;

    cout << n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/













int A, B, K;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> K;

    vector<int> v;
    rrep(i, 100, 1) if (A % i == 0 and B % i == 0) v.push_back(i);
    cout << v[K - 1] << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {
    public static int n;
    public static int s;
    public static int c;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            n = sc.nextInt();
            s = sc.nextInt();
            if (n == 0 && s == 0) {
                break;
            }
            c = 0;
            dfs(0, s, s);
            //dfs2(n, s, 0);
            System.out.println(c);

        }
    }

    static void dfs(int k, int rest, int x) {
        if (k == n && rest == 0) {

               c++;

        }
        if (rest >= 0) {
            for (int i = Math.min(x, 9); i >= 0; i--) {
                dfs(k + 1, rest - i, i - 1);
            }
        }
    }

    static void dfs2(int k, int rest, int x) {
        if (k == 0) {
            if (rest == 0) {
                c++;
            }
        }
        if (rest >= 0) {
            for (int i = x; i <= 9; i++) {
                dfs2(k - 1, rest - i, i + 1);
            }
        }
    }
}


Measured memory_bytes: 26488
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

a,b,c=mp()
if a+b+c>=22:
    print("bust")
else:
    print("win")

Measured memory_bytes: 77404
#include <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define rv(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define SZ(x) (int)(x.size())
#define pb(x) push_back(x)
#define P pair<int,int>
using namespace std;
const int M = 210000;
const ll inf = 9e18;
int n,m,k;
int a[M]={0};
const int mod = 1e9+7;
int f[M];
int fd(int x) { return x==f[x] ? x : f[x]=fd(f[x]);}
void merge(int u,int v) {
    int fu = fd(u), fv = fd(v);
    f[fu] = fv;
}
void solve() {
    cin >> n >> m;
    fo(i,1,n) f[i] = i;
    int u,v;
    fo(i,1,m) {
        cin >> u >> v;
        merge(u, v);
    }
    fo(i,1,n) {
        fd(i);
        a[f[i]]++;
    }
    int ans=1;
    fo(i,1,n) ans=max(ans,a[i]);
    cout << ans << endl;
}
int main()
{ 
    int t;
    //cin >> t;
    t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 10432
main :: IO ()
main = do
  [s,t] <- words <$> getLine
  [a,b] <- map read . words <$> getLine :: IO [Int]
  u <- getLine

  putStrLn $ if u == s then show (a - 1) ++ " " ++ show b else show a ++ " " ++ show (b - 1)


Measured memory_bytes: 508
#include <bits/stdc++.h>
//#include <iostream>
//#include <string>
//#include <sstream>
//#include <vector>
//#include <algorithm>
//#include <map>
//#include <set>
//#include <math.h>
//#include <unordered_map>
//#include <queue>
//#include <stack>
//#include <iomanip>

using namespace std;

#define PI 3.141592653589793238462643383279502884
#define Max 100005
#define ll long long
#define mod 1000000007
#define EPS 1E-9



int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

    char a,b;
    cin >> a >> b;
    if(a=='H')
        cout << b << endl;
    else
    {
        if(b=='H')
            cout << 'D' << endl;
        else
            cout << 'H' << endl;
    }



	return 0;
}


Measured memory_bytes: 256
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ n ] = readMany(1).map(it => parseInt(it))
    const a = []
    for (let i = 0; i < n; i += 1) {
        a.push(parseInt(readMany(1)[0]) - 1)
    }

    let button = 0

    for (let i = 0; i <= n; i += 1) {
        if (button == 1) return console.log(i)
        button = a[button]
    }
    console.log('-1')
})()


Measured memory_bytes: 27560
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define forn(i,n) for(ll i=0;i<(n);i++)
#define maxx ((ll)1e6+5)
#define pb push_back
#define mp make_pair
using namespace std;
int main()
{
 	ll x;
 	cin>>x;
 //	int a[6]={5,9,12,13,15,15};
 	if((x/100)*5>=x%100)
 	cout<<"1";
 	else
 	cout<<"0";
 	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <memory.h>
#include <algorithm>
using namespace std;

typedef long long ll;
ll bulb[300010];
ll bkt[300010];

ll operate(int n) {
	memset(bkt, 0, sizeof bkt);
	for (int i = 0; i < n; ++i) {
		ll op1 = i - bulb[i];
		ll op2 = i + bulb[i];
		if (op1 < 0) op1 = 0;
		++bkt[op1];
		if (op2 >= n) op2 = n - 1;
		--bkt[op2 + 1];
	}
	bulb[0] = bkt[0];
	for (int i = 1; i < n; ++i)
		bulb[i] = bulb[i - 1] + bkt[i];
	return *min_element(bulb, bulb + n);
}

int main() {
	int n, k, i;
	scanf("%d%d", &n, &k);
	for (i = 0; i < n; ++i)
		scanf("%lld", bulb + i);
	for (i = 0; i < k; ++i)
		if (operate(n) >= n)
			break;
	for (int i = 0; i < n; ++i)
		printf("%lld%c", bulb[i], " \n"[i == n - 1]);
	return 0;
}



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

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * c, b * d, ((a <= 0 && b >= 0) || (c <= 0 && d >= 0) ? 0 : LONG_LONG_MIN), a * d, b * c}) << '\n';
  return 0;
}

Measured memory_bytes: 3644
<?php
  list($a, $b, $h, $m) = explode(' ', trim(fgets(STDIN)));

  // 角度を求める
  $angle = abs((30 * $h + 1 / 2 * $m) - 6 * $m);
  if ($angle > 180) {
    $angle = 360 - $angle;
  }

  $ans = sqrt(pow($a, 2) + pow($b, 2) - 2 * $a * $b * cos($angle * pi() / 180));
  printf("%.20f",$ans);

Measured memory_bytes: 16724
#include<stdio.h>

int main() {
	int a, b;
	
	scanf("%d %d", &a, &b);
	int add = a + b;
	int sub = a - b;
	int mul = a * b;
	
	int r = add > sub ? add > mul ? add : mul : sub > mul ? sub : mul;
	printf("%d\n", r);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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

const int INF = 1001001001;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    map<int, ll> cnt; // a[i]の出現回数

    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll total = 0;
    map<int, ll> ss;
    for (auto e: cnt) {
        ss[e.first] = e.second * (e.second - 1) / 2; // a[i]の選び方
        total += ss[e.first]; // 選び方の総数
    }

    rep(i, n) {
        ll pp = max(ss[a[i]], 0ll);
        ll res = max((cnt[a[i]] - 1) * (cnt[a[i]] - 2) / 2, 0ll);
        cout << (total - pp + res) << endl;
    }
}


Measured memory_bytes: 19968
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,top;
int a[5050][250],st[5050],l[5050],r[5050];
long long len[5050],sum[5050][5050];
long long ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=2;i<=n;i++)
	scanf("%d",&len[i]),len[i]+=len[i-1];
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		scanf("%d",&a[i][j]);
		a[i][0]=0x3f3f3f3f;
	}
	
	for(int i=1;i<=m;i++)
	{
		top=0;
		for(int j=1;j<=n;j++)
		{
			while(top&&a[j][i]>a[st[top]][i]) r[st[top]]=j-1,top--;
			l[j]=st[top]+1;
			st[++top]=j;
		}
		while(top) r[st[top]]=n,top--;
		for(int j=1;j<=n;j++)
		{
			int x=l[j],y=r[j],d=a[j][i];
			sum[x][j]+=d;sum[x][y+1]-=d;
			sum[j+1][j]-=d;sum[j+1][y+1]+=d;
		}
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			sum[i][j]+=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];
	for(int i=1;i<=n;i++)
	for(int j=i;j<=n;j++)
	ans=max(ans,sum[i][j]-len[j]+len[i]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 204416
#include <stdio.h>
int main() {
  int ans,a,n;
  n=0,
  a=0;
  ans=0;
  scanf("%d",&n);
  for(a=0;a<n;a+1000)
  {
   a=a+1000;
  }
  
  ans=a-n;
  printf("%d",ans);
  return 0;
}



Measured memory_bytes: 1700
#include<cstdio>
int main() {
	int c[3][3], i, j;
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			scanf("%d", &c[i][j]);
		}
	}
	for (i = 0; i < 3; i++) {
		for (j = 1; j < 3; j++) {
			c[i][j] -= c[i][0];
		}
	}
	for (i = 1; i < 3; i++) {
		for (j = 1; j < 3; j++) {
			c[i][j] -= c[0][j];
		}
	}
	if (c[1][1] == 0 && c[1][2] == 0 && c[2][1] == 0 && c[2][2] == 0)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
import kotlin.math.abs
import kotlin.math.sqrt

fun main(args: Array<String>) {
    val n = readLong()

    var len = Long.MAX_VALUE
    var ans = 0L
    for (i in 1..sqrt(n.toDouble()).toLong()) {
        if (n % i == 0L && abs(i - n / i) < len) {
            len = abs(i - n / i)
            ans = i
        }
    }
    println(ans - 1 + n / ans - 1)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 34664
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		long A = Long.parseLong(tokens[0]);
		long V = Long.parseLong(tokens[1]);
		tokens = in.readLine().split(" ");
		long B = Long.parseLong(tokens[0]);
		long W = Long.parseLong(tokens[1]);
		long T = Long.parseLong(in.readLine());

		if (A < B) {
			long a = A + T * V;
			long b = B + T * W;
			if (a >= b) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} else {
			long a = A - T * V;
			long b = B - T * W;
			if (a <= b) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}

	}

	void calc() {
	}

	void showResult() {
	}
}

Measured memory_bytes: 32664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace D
{
    public class Program

    {

        static long[] burgerCnt;
        static long[] pattyCnt;

        public static void Main(string[] args)
        {
            long[] line = ReadLongAr();
            long n = line[0];
            long x = line[1];

            burgerCnt = new long[n + 1];
            pattyCnt = new long[n + 1];

            for (int i = 0 ; i <= n ; i++)
            {
                if (i == 0)
                {
                    burgerCnt[i] = 1;
                    pattyCnt[i] = 1;
                }
                else
                {
                    burgerCnt[i] = burgerCnt[i - 1] * 2 + 3;
                    pattyCnt[i] = pattyCnt[i - 1] * 2 + 1;
                }
            }

            long res = CountPatty(n, x);
            Console.WriteLine(res.ToString());

        }

        private static long CountPatty(long n, long x)
        {
            if (n == 0) return 1;
            if (x == 1) return 0;
            if (1 < x && x <= 1 + burgerCnt[n - 1]) return CountPatty(n - 1, x - 1);
            if (1 + burgerCnt[n - 1] < x && x <= 1 + burgerCnt[n - 1] + 1) return pattyCnt[n - 1] + 1;
            if (1 + burgerCnt[n - 1] + 1 < x && x <= burgerCnt[n] - 1) return pattyCnt[n - 1] + 1 + CountPatty(n - 1, x - (1 + burgerCnt[n - 1] + 1));
            if (x == burgerCnt[n]) return pattyCnt[n];
            return 0;
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}


Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
using namespace std; 
int main()
{
	double n, d1, x, ans = 0; 
	scanf("%lf%lf%lf", &n, &d1, &x); 
	while (n)
	{
		ans += d1 + (n - 0.5) * x; 
		d1 = ((n + 1) * d1 + 2.5 * x) / n; 
		x *= 2.0 / n + 1; 
		n--; 
	}
	printf("%.12lf\n", ans); 
	return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};

int n, m;
int v[3] = {-1, -1, -1};

int32_t main(){
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    v.pb(INF);
    SORT(v);

    int cnt=1, ans=0;
    FOR(i, 1, n+1){
        if(v[i]==v[i-1]){
            cnt++;
        }
        else{
            if(cnt>v[i-1]){
                ans+=(cnt-v[i-1]);
            }
            else if(cnt<v[i-1]){
                ans+=cnt;
            }

            cnt=1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.Scanner;

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

        // 文字列切り出し
        char c[] = new char[s.length()];
        for(int i = 0; i < s.length(); i++) {
            c[i] = s.charAt(i);
            if('7' == c[i]) {
                System.out.println("Yes");
                return;
            }
        }
        
        System.out.println("No");
    }
}


Measured memory_bytes: 35520
#include <stdio.h>
int main(void){
    int x,y,z;
    while(1){
        scanf("%d %d",&x,&y);
        if(x == 0 && y == 0){
            break;
        }
        if(x > y){
            z = x;
            x = y;
            y = z;
            printf("%d %d\n",x,y);
        }
        else {
            printf("%d %d\n",x,y);
        }
    }
    return 0;
}


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

int main() {
    string s; cin >> s;
    int order_cnt; cin >> order_cnt;
    
    for (int i = 0; i < order_cnt; ++i) {
        string order; cin >> order;
        int a, b; cin >> a >> b;
        string rep_str;
        if (order == "replace") cin >> rep_str;
        
        if (order == "print") cout << s.substr(a, b - a + 1) << endl;
        else if (order == "reverse") reverse(s.begin() + a, s.begin() + b + 1);
        else if (order == "replace") s.replace(a, b - a + 1, rep_str);
    }
    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>




int ans=0;

int a[500001];

int n;




void merge(int left,int mid,int right)

{

 int i,j,k;




 int n1=mid-left;

 int n2=right-mid;

 

 int l[n1+1],r[n2+1];




 for(i=0;i<n1;i++){

  l[i]=a[left+i];

 }

 for(i=0;i<n2;i++){

  r[i]=a[mid+i];

 }




 l[n1]=1000000001;

 r[n2]=1000000001;

 i=0;

 j=0;




 for(k=left;k<right;k++){

  ans++;

  if(l[i]<=r[j])

   a[k]=l[i++];

  else

   a[k]=r[j++];

 }

}




void mergeSort(int left,int right)

{

 int mid;




 if(left+1<right){

  mid=(left+right)/2;

  mergeSort(left,mid);

  mergeSort(mid,right);

  merge(left,mid,right);

 }

}




int main(void)

{

 int i;




 scanf("%d",&n);

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

  scanf("%d",&a[i]);

 }

 

 mergeSort(0, n);




 for(i=0;i<n-1;i++){

  printf("%d ",a[i]);

 }

 printf("%d\n",a[n-1]);

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




 return 0;

}

Measured memory_bytes: 6564
def main
  n, range = gets.chomp.split(' ').map(&:to_i)
  l = gets.chomp.split(' ').map(&:to_i)
  d = 0
  
  (n+1).times do |i|
    next if i == 0
    
    d_i = d + l[i-1]
    return i if d_i > range
    d = d_i
  end
end


puts main

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;

    int f;
    if(a > 0) f = 1;
    else if(a <= 0 && b >= 0) f = 2;
    else if(b < 0){
        int n = b - a + 1;
        if(n%2 == 0) f = 1;
        else f = 3;
    }

    if(f == 1) cout << "Positive" << "\n";
    else if(f == 2) cout << "Zero" << "\n";
    else if(f == 3) cout << "Negative" << "\n";
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if (a != 1 && b != 1) cout << 1 << endl;
  else if (a != 2 && b != 2) cout << 2 << endl;
  else if (a != 3 && b != 3) cout << 3 << endl;
  
  return 0;
}

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <utility>
#include <map>
int needleX[4] = { -1,0,1,0 };
int needleY[4] = { 0,1,0,-1 };

int main(void) {
    int h,w;
    std::cin >> h>> w;
    char a[52][52];
    
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            std::cin >> a[i][j];
        }
    }
    bool make=true;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(a[i][j]=='#'&&a[i-1][j]!='#'&&a[i+1][j]!='#'&&a[i][j-1]!='#'&&a[i][j+1]!='#'){
                make=false;
            }
        }
    }
    if(make){
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
from collections import Counter, defaultdict, deque
s = input()
#n,a,b = map(int,input().split())
# al = list(map(int,input().split()))

b = 0
ans = 0
for i in range(len(s)):
    if s[i] == 'B':
        b += 1
    elif s[i] == 'W':
        ans += b
    else:
        b = 0
print(ans)

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

#define io ios::sync_with_stdio(false)
#define pb push_back
#define pqueue priority_queue
#define fi first
#define se second
#define ls rt<<1
#define rs rt<<1|1
#define sz(x) (int)(x).size()
#define dbg(x) cout<<#x<<" --- "<<x<<endl
#define mst(x,a) memset(x,a,sizeof(x))
#define fin(a) freopen(a,"r",stdin)
#define fout(a) freopen(a,"w",stdout)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b); }
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r; }
const int inf=0x7fffffff;
int n;
ll c;

int main(){
	io;
	cin>>n>>c;
	int cnt=0;
	while(n--){
		ll x,y;cin>>x>>y;
		if(c*c>=x*x+y*y)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main() {
  double a, b, x;
  const long double PI = acos(-1);
  cin >> a >> b >> x;
  long double result = 0.0;
  long double S = x/a;

  if (S >= a*b/2) {
    long double h = (a*b - S) * 2 / a;
    result = atan2(h, a) / (2 * PI) * 360;
  } else {
    long double w = 2 * S / b;
    result = atan2(b, w) / (2 * PI) * 360;
  }

  cout << fixed << setprecision(10) << result << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

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

  string w[4] = {"remaerd", "resare", "maerd", "esare"};
  reverse(s.begin(), s.end());
  while (s.size()) {
    for (int i = 0; i < 4; i++) {
      if (s.substr(0, w[i].size()) == w[i]) {
        s = s.substr(w[i].size());
        break;
      }
      if (i + 1 == 4) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  

  return 0;
}

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

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main (void) {
    int N, ans, Flag;
    int Maxans = 0;
    scanf("%d", &N);
    vector<int> Person(N);
    vector<vector<int>> x(N), y(N);
    vector<int> A(N);
    int xa,ya;
    REP(int,j,0,N){
        scanf("%d", &A.at(j));
        REP(int,i,0,A.at(j)){
            scanf("%d %d", &xa, &ya);
            x[j].push_back(xa);
            y[j].push_back(ya);
        }
    }
    for ( int i = pow(2,N) - 1; i >= 0; i-- ){
        int Number = i;
        REP(int,j,0,N){ //True or Falseの全探索
            Person.at(j) = Number % 2;
            Number = Number / 2;
        }
        //cout << "i=" << i << endl;
        Flag = 1;
        REP(int, j, 0, N){ // 証言のCheck
            if ( Person.at(j) == 1 ){ // 正直者
                REP(int, k, 0, A.at(j)){
                    //cout << Person.at(x.at(j).at(k)-1) << " " << y.at(j).at(k) << endl;
                    if ( Person.at(x.at(j).at(k)-1) == y.at(j).at(k) ){
                        continue;
                    }
                    else{
                        Flag = 0;
                        break;
                    }
                }
            }
        }
        if ( Flag == 1 ){ // 矛盾してない場合
                ans = 0;
                REP(int,i,0,N){
                    //cout << "Person=" << Person.at(i) << endl;
                    ans += Person.at(i);
                }
                if ( ans > Maxans ) Maxans = ans;
        }
    } // 全探索loop

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(10)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ld dp[3000][3000];
ld p[3000];
ll n;
int main(){FAST;
  dofloat;
cin>>n;
for(ll i=1;i<=n;++i){
  cin>>p[i];
} 
dp[0][0] = 1;
for(ll i=1;i<=n;++i){
  dp[i][0] = dp[i-1][0]*(1-p[i]);
  for(ll j=1;j<=i;++j){
    dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
  }
}
ld ans = 0;
for(ll i=n/2+1;i<=n;++i){
  ans+=dp[n][i];
}
cout<<ans;
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 85480
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int c[30];

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

	map<char, char> ma, ima;
	string ans = "Yes";
	REP(i, S.length())
	{
		char s = S[i], t = T[i];
		if (ma.count(s))
		{
			if (ma[s] != t)
			{
				ans = "No";
			}
		}
		if (ima.count(t))
		{
			if (ima[t] != s)
			{
				ans = "No";
			}
		}
		ma[s] = t;
		ima[t] = s;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 776
import java.io.BufferedReader;
import java.io.InputStreamReader;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String[] args) throws Exception
    {
        //out.println("hi");
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader scan = new BufferedReader(isr);
        StringTokenizer cut = new StringTokenizer(scan.readLine());
        
        int a = Integer.parseInt(cut.nextToken());
        int b = Integer.parseInt(cut.nextToken());
        
        int[] one = new int[b];
        int[] two = new int[a + 1];
        //ArrayList<Integer> coin = new ArrayList<Integer>();
        
        cut = new StringTokenizer(scan.readLine());
        int temp;
        int count = 0;
        for (int z = 0; z < b; z++)
        {
            temp = Integer.parseInt(cut.nextToken());
            //out.println("temp is" + temp);
            
            one[count] = temp;
            //out.println("placed coin " + one[count] + " into pool..");
            count++;
            
        }
        
        boolean go = true;
        
        int answer = 99999;
        two[0] = 0;
        //out.println("Two[0] is: 0");
        for (int z = 1; z < a + 1; z++)
        {
            answer = 99999;
            //out.println("Resetting, Z is now " + z);
            for (int y = 0; y < b; y++)
            {
                //out.println("Checking coin " + one[y]);
                if (one[y] <= z && two[z-one[y]] < answer)
                {                   
                    //out.println("Value for two[" + z + "] changing to " + two[z-one[y]]);
                    answer = two[z-one[y]];
                }
                //else out.println("nothing happened");
            }
            two[z] = answer + 1;
            //out.println("Two[" + z + "] is: " + two[z]);
        }
        out.println(two[a]);
    }
}

Measured memory_bytes: 25096
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

// calculate x%m for x "properly" for all x
long long int mod(long long int x, long long int m);

// calculate inverse of x in mod m
// if there is inverse of x   : return (inverse of x)
// if there is no inverse of x: return 0
long long int mod_inverse(long long int x, long long int m);

// calculate inverse of x in mod m for PRIME m
long long int mod_inverse_Fermat(long long int x, long long int m);

// calculate x^n mod m
long long int fast_power(long long int x, long long int n, long long int m);

// extended euclid gojjohou
long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y);




long long int MOD = 1e9 + 7;

int main(){

  long long int n, k;

  scanf("%lld%lld", &n, &k);

  long long int tmp1, tmp2, tmp3, tmp4, ans;
  long long int nCk, n1Ck;
  tmp1 = tmp2 = tmp3 = 1;

  if(k == 1){
    ans = 0;
  }
  else{
    ans = 1;
  }

  for(long long int i = 1; i < n && i <= k; i++){
    tmp1 *= n+1-i;
    tmp2 *= n-i;
    tmp3 *= i;
    tmp1 = (tmp1+MOD)%MOD;
    tmp2 = (tmp2+MOD)%MOD;
    tmp3 = (tmp3+MOD)%MOD;

    nCk = tmp1 * mod_inverse(tmp3, MOD);
    nCk = (nCk+MOD)%MOD;

    n1Ck = tmp2 * mod_inverse(tmp3, MOD);
    n1Ck = (n1Ck+MOD)%MOD;

    //if(i != k-1){
      tmp4 = (nCk * n1Ck +MOD)%MOD;
      ans = (ans+tmp4+MOD)%MOD;
    //}
  }

  std::cerr << "Answer: " << std::endl;
  std::cout << ans << std::endl;

  return 0;
  
}


long long int mod(long long int x, long long int m){
  if(x>0){
    return x%m;
  }
  else if(x==0){
    return 0;
  }
  else if((-x)%m == 0){
    return 0;
  }
  else{
    return m - (-x)%m;
  }
}


long long int euclid_extended(long long int a, long long int b, long long int &x, long long int &y){
  long long int d = a;
  if(b != 0){
    d = euclid_extended(b, a%b, y, x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  
  return d;
}

long long int mod_inverse(long long int x, long long int m){
  long long int tmp, x_inv, gcd_xm;
  gcd_xm = euclid_extended(x, m, x_inv, tmp);
  // if the inverse is calculate properly
  if(gcd_xm == 1){
    return mod(x_inv, m);
  }
  else{
    //std::cerr << "Error in mod_inverse: there is no inverse of x in mod m" << std::endl;
    return 0;
  }
}

long long int mod_inverse_Fermat(long long int x, long long int m){
  return fast_power(x, m-2, m);
}

long long int fast_power(long long int x, long long int n, long long int m){
  long long int ans = 1;
  
  while(n > 0){
    if(n&1){
      ans = ans * x;
      ans = mod(ans, m);
    }
    x = x*x;
    x = mod(x, m);
    n = n>>1;
  }
  
  return ans;
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;

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

	int n;
	cin >> n;

	int a[7] = { 1, 2, 4, 8, 16, 32, 64 };

	int ma = 0;
	for (int i = 0; i < 7; i++) {
		if (a[i] <= n) {
			chmax(ma, a[i]);
		}
	}

	out(ma);

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    String N = sc.next();

    String N1 = N.substring(0,1);
    String N2 = N.substring(1,2);
    String N3 = N.substring(2,3);
    String N4 = N.substring(3,4);

    if (N1.equals(N2) && N1.equals(N3)) {
      System.out.println("Yes");
    } else if (N2.equals(N3) && N2.equals(N4)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}

Measured memory_bytes: 21972
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a[i] = ai;
    }

    sort(a.begin(), a.end(), greater<int>());
    int alice = 0;
    int bob = 0;

    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }

    cout << alice - bob << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int N;
LL a[1000000],s[1000000];

int main(void){
    cin>>N;
    REP(i,N){
        cin>>a[i];
        if(i==0)
            s[i]=a[i];
        else
            s[i]=a[i]+s[i-1];
    }
    LL ans=LLMAX;
    REP(i,N-1){
        LL d=s[i]-(s[N-1]-s[i]);
        if(d<0)
            d*=-1;
        ans=min(ans,d);
    }
    cout<<ans<<endl;
     return 0;
}

Measured memory_bytes: 5888