akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define MAX_N 1000

using namespace std;

int v[101];

    int n;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
        cin >> v[i];

    long long rez = (long long)(1e18);
    long long cr = 0;
    for(int i = 1; i <= 100; i ++)
    {
        cr = 0;
        for(int j = 1; j <= n; j ++)
        {
            cr += (i - v[j]) * (i - v[j]);
        }

        rez = min(rez, cr);
    }

    cout << rez << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring> 
#include<algorithm>
using namespace std;
int main()
{
	long long int n,a,b;
	cin>>n>>a>>b;
	long long int s=a+b;
	long long int ans;
	if(n%s==0)
	cout<<a*(n/s);
	else
	{
	
	ans=n-(n/s*s);
	cout<<a*(n/s)+min(ans,a);
}
}

Measured memory_bytes: 256
#include <stdio.h>
//#define scanf scanf_s

int main()
{
	int n, i, x, qTmp, tmp, qSum = 0;;
	scanf("%d", &n);

	if (n == 1)
	{
		printf("1");
		return 0;
	}
	
	for (i = 1; i <= n; i++)
	{
		tmp = 0;
		x = i;
		while (1)
		{
			if (x % 2 == 0)
			{
				tmp++;
			}
			x /= 2;
			if (x <= 1)
				break;
		}
		if (tmp > qSum) {
			qSum = tmp;
			qTmp = i;
		}
	}

	printf("%d", qTmp);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int sum(long long n)
{
  if(n) return sum(n/10) + n%10;
  return 0;
}
bool cmp(pair<long long, int> a, pair<long long, int> b)
{
  return a.first*b.second < a.second*b.first;
}
int main()
{
  int K; scanf("%d", &K);
  vector<pair<long long, int> > V;
  long long pow10 = 1;
  for(int i=0; i<=12; ++i)
  {
    for(int j=1; j<=999; ++j)
    {
      long long targ = j*pow10 + (pow10-1);
      V.emplace_back(targ, sum(targ));
    }
    pow10 *= 10;
  }
  sort(V.rbegin(), V.rend());
  V.resize(unique(V.begin(), V.end())-V.begin());
  //for(auto x: V) printf("%lld %d\n", x.first, x.second);
  vector<long long> ans;
  pair<long long, int> mv = make_pair(999999999999999LL, 1);
  for(auto x: V)
  {
    if(!cmp(mv, x))
    {
      ans.push_back(x.first);
      mv = x;
    }
  }
  reverse(ans.begin(), ans.end());
  ans.resize(K);
  for(auto x: ans) printf("%lld\n", x);
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
struct data
{
	int z, y, xh;
	bool operator < ( const data& x) const
	{
		if (y < x.y)
			return 1;
		else
			return 0;
	}
} s[501001];
int c[500011];
int a[500101];
int h[500101];

map<int, int> Map;
int n;
int lowbit(int i)
{
	return i & (-i);
}
void add(int i, int x)
{
	while (i <= n)
	{
		c[i] += x;
		i += lowbit(i);
	}
}
int sum(int x)
{
	int ans = 0;
	while (x > 0)
	{
		ans += c[x];
		x -= lowbit(x);
	}
	return ans;
}
int main()
{
	ios::sync_with_stdio(0);
	int m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		cin >> a[i];

	for (int i = 1; i <= m; ++i)
	{
		cin >> s[i].z >> s[i].y;
		s[i].xh = i;
	}

	sort(s + 1, s + 1 + m);
	int last = 0;
	for (int i = 1; i <= m; ++i)
	{
		++last;
		for (int j = last; j <= s[i].y; ++j)
		{
			if (Map[a[j]])
			{
				add(Map[a[j]], -1);
				Map[a[j]] = j;
				add(Map[a[j]], 1);
			}
			else
			{
				Map[a[j]] = j;
				add(j, 1);
			}
		}
		h[s[i].xh] = sum(s[i].y) - sum(s[i].z - 1);
		last = s[i].y;
	}
	for (int i = 1; i <= m; ++i)
		cout << h[i] << endl;
}

Measured memory_bytes: 38908
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, C;
  cin >> N >> C;
  vector<vector<int>> vec(N,vector<int>(3));
  for(int i=0; i<N; i++){
    for(int j=0; j<3; j++){
      cin >> vec.at(i).at(j);
    }
  }
  sort(vec.begin(),vec.end());
  pair<int,int> P;
  vector<pair<int,int>> R(0);
  for(int i=0; i<N; i++){
    int a = vec.at(i).at(0);
    int b = vec.at(i).at(1);
    int c = vec.at(i).at(2);
    bool flag = false;
    int end = 1000000000;
    int tv = -1;
    for(int j=0; j<R.size(); j++){
      if(end > R.at(j).first){
        if(a > R.at(j).first || (a == R.at(j).first && c == R.at(j).second)){
          end = R.at(j).first;
          tv = j;
          flag = true;
        }
      }
    }
    if(!flag){
      P = make_pair(b,c);
      R.push_back(P);
    }
    else{
      P = make_pair(b,c);
      R.at(tv) = P;
    }
  }
  cout << R.size() << endl;
}

Measured memory_bytes: 5760
def Euklides(m, n):
    while m % n != 0:
            tempVal = n
            n = m % n
            m = tempVal
            Euklides(m, n)
    return n
    
n, m = list(map(int, input().split()))
if m > n:
    print(Euklides(m, n))
else:
    print(Euklides(n, m))


Measured memory_bytes: 5596
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        Array.Sort(a);
        Console.WriteLine(10 * a[2] + a[1] + a[0]); 
    }
}


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

int main(){
  int n,m;
  cin>>n>>m;
  if(n==m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 3616
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(arr[int(input())-1])



Measured memory_bytes: 2940
import sys

sys.setrecursionlimit(1000000)


def main():
    s = input()

    op_cnt = 3
    for i in range(2 ** op_cnt):
        op = ["-"] * op_cnt  # あらかじめ ["-", "-", "-"] というリストを作っておく
        for j in range(op_cnt):
            if (i >> j) & 1:
                op[op_cnt - 1 - j] = "+"  # フラグが立っていた箇所を "+" で上書き
        frml = ""
        for j in range(3):
            frml += s[j]
            frml += op[j]
        frml += s[3]

        if eval(frml) == 7:
            print(frml + "=7")
            return


main()


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <iomanip>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[4] = {-1, 0, 1, 0};
ll dy[4] = {0, 1, 0, -1};

int main(void){
    ll a, b, c, n;
    cin >> a >> b >> c >> n;
    ll ans = 0;
    for(ll i = 0; i <= n/a; i++){
        for(ll j = 0; j <= n/b; j++){
            if((n-a*i-b*j)%c==0 && n-a*i-b*j>=0) {
                //cout << i << " " << j << " " << n-a*i-b*j << endl;
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

c = 0
for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')

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

#define MAX 1001

int result[MAX][MAX];
char X[MAX], Y[MAX];

int hantei(void );

int main(){
    int q;
    int C[MAX];
    int i=0, j, a[MAX];
    

    scanf("%d", &q);
    
    while(q--){

	scanf("%s", X);
	scanf("%s", Y);
	
	a[i] = hantei();

	i++;
	//q--;
    }

    j=i;
    
    while(i--) printf("%d\n", a[j-i-1]);

    return 0;
}

int hantei(void ){
  int i, j;
  int X_length, Y_length;

    X_length = strlen(X);
    Y_length = strlen(Y);
    
    for(i=0; i<X_length; i++){
	for(j=0; j<Y_length; j++){
	    if(X[i] == Y[j]) result[i+1][j+1] = result[i][j]+1;
	    else{
	      if(result[i+1][j] > result[i][j+1])
		result[i+1][j+1] = result[i+1][j];
	      else result[i+1][j+1] = result[i][j+1];
	    }
	}
    }
    
    return result[X_length][Y_length];
}



Measured memory_bytes: 5676
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define MOD 998244353
//#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int n;
char s[300010];
int main(){
	scanf("%d%s",&n,s);
	ll ans=1;
	int c1=0,c2=0;
	int pair=0,alone=0;
	//pairはc1とc2の組の個数、aloneはpairになってないc1の個数
	rep(i,0,3*n){
		if(pair==0){
			if(alone==0){
				//0種類
				alone++;
				c1=s[i];
			}else{
				//1種類
				if(s[i]==c1){
					alone++;
				}else{
					ans=ans*alone--%MOD;
					pair++;
					c2=s[i];
				}
			}
		}else{
			//2種類
			if(s[i]==c1){
				alone++;
			}else if(s[i]==c2){
				if(alone==0){
					int t=c1;c1=c2;c2=t;
					alone++;
				}else{
					ans=ans*alone--%MOD;
					pair++;
				}
			}else{
				ans=ans*pair--%MOD;
			}
		}
	}
	rep(i,1,n+1)ans=ans*i%MOD;
	printf("%lld",ans);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll i,ans=0,x,y,n,d;
  cin >> n >> d;
  for(i=0;i<n;i++){
    cin >> x >> y;
    if(x*x+y*y<=d*d){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3592
import static java.util.Comparator.comparing;

import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver(System.in, out);
        solver.solve();
        out.close();
    }
}
class Solver {
	Scanner sc;
	PrintWriter out;
    public Solver(InputStream in, PrintWriter out) {
    	sc = new Scanner(in);
    	this.out = out;
    }
    // ==========================================================
    public void solve() {
    	int H = ni();
    	int A = ni();
    	out.println((H+A-1)/A);
    }
    // ------------------------------------------
    // 入力
    // ------------------------------------------
    public int ni() {
    	return sc.nextInt();
    }
    public long nl() {
    	return sc.nextLong();
    }
    public String ns() {
    	return sc.next();
    }
    public char[] nc() {
    	return sc.next().toCharArray();
    }
    public int[] ndi(int N) {
    	int[] ans = new int[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ni();
		}
    	return ans;
    }
    public long[] ndl(int N) {
    	long[] ans = new long[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = nl();
		}
    	return ans;
    }
    public String[] nds(int N) {
    	String[] ans = new String[N];
    	for (int i = 0; i < N; i++) {
			ans[i] = ns();
		}
    	return ans;
    }
    public char[][] ndc(int N) {
    	char[][] ans = new char[N][];
    	for (int i = 0; i < N; i++) {
			ans[i] = nc();
		}
    	return ans;
    }
    public int[][] nddi(int N, int S) {
    	int[][] ans = new int[N][S];
    	for (int i = 0; i < N; i++) {
			for (int j = 0; j < S; j++) {
				ans[i][j] = ni();
			}
		}
    	return ans;
    }
}


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

int main(void){
  int n,m,l,r,max = 100000,min = 0;
  scanf("%d%d",&n,&m);
  for(int i = 0;i < m;i++){
    scanf("%d%d",&l,&r);
    if(min < l){
      min = l;
    }
    if(max > r){
      max = r;
    }
  }
  if(max - min >= 0){
    cout << max - min + 1;
  }else{
    cout << 0;
  }
  return 0;
}


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

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
ll a = 0, b = 0, c = 0, n = 0, m = 0, k = 0, sum = 0, MASK = 0;
ll A[500000] = {}, B[500000] = {}, X[1500][13], rui[500000] = {}, dp[1 << 12] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
str S, T;
bool check = true, check2 = false;

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

int main() {
	//Code Line
	priority_queue <int> qu;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		qu.push(A[i]);
	}
	for (int i = 0; i < m; i++) {
		a = qu.top() / 2;
		qu.pop();
		qu.push(a);
	}
	for (int i = 0; i < n; i++) {
		b += qu.top();
		qu.pop();
	}
	cout << b << endl;
	return 0;
}


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

using namespace std;

typedef long long li;

int main() {
    li a, b;
    cin >> a >> b;
    vector<vector<li>> ds(a, vector<li>(b));
    for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            cin >> ds[i][j];
        }
    }

    const li size = 102;
    vector<vector<li>> offset(size, vector<li>(size, -1114));
    for (int a_ = 0; a_ < a; ++a_) {
        int xc = a_ + 1;
        for (int b_ = 0; b_ < b; ++b_) {
            int yc = b_ + 1;
            int dist = ds[a_][b_];

            for (int xuse = 0; xuse < size; ++xuse) {
                for (int yuse = 0; yuse < size; ++yuse) {
                    offset[xuse][yuse] = max<li>(offset[xuse][yuse], dist - xc * xuse - yc * yuse);
                }
            }

        }
    }

    vector<vector<li>> exists(a, vector<li>(b));
    for (int xuse = 0; xuse < size; ++xuse) {
        for (int yuse = 0; yuse < size; ++yuse) {
            if (offset[xuse][yuse] < 0) {
                continue;
            }
            for (int a_ = 0; a_ < a; ++a_) {
                int xc = a_ + 1;
                for (int b_ = 0; b_ < b; ++b_) {
                    int yc = b_ + 1;
                    if (offset[xuse][yuse] + xc * xuse + yc * yuse == ds[a_][b_]) {
                        exists[a_][b_] = 1;
                    }
                }
            }
        }
    }

    for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            if (not exists[i][j]) {
                cout << "Impossible" << endl;
                return 0;
            }
        }
    }

    int edge_count = 220;
    for (int xuse = 0; xuse < size; ++xuse) {
        for (int yuse = 0; yuse < size; ++yuse) {
            if (offset[xuse][yuse] < 0) {
                continue;
            }
            edge_count += 1;
        }
    }

    cout << "Possible" << endl;
    cout << 221 << " " << edge_count << endl;
    for (int i = 0; i < 110; ++i) {
        cout << i + 1 << " " << i + 2 << " X" << endl;
        cout << i + 111 << " " << i + 112 << " Y" << endl;
    }
    for (int xuse = 0; xuse < size; ++xuse) {
        for (int yuse = 0; yuse < size; ++yuse) {
            if (offset[xuse][yuse] < 0) {
                continue;
            }
            cout << xuse + 1 << " " << 221 - yuse << " " << offset[xuse][yuse] << endl;
        }
    }

    cout << "1 221" << endl;
    return 0;
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
vector<ll> V;
vector<ll> C;

void input() {
  ll temp;
  IN(N);
  REP(i, N) {
    IN(temp);
    V.push_back(temp);
  }
  REP(i, N) {
    IN(temp);
    C.push_back(temp);
  }
}

void solve() {
  REP(i, N) {
    if(V[i] - C[i] > 0) {
      ret+= V[i]-C[i];
    };
  }
  PRINT(ret);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	string s, t;
	cin >> s >> t;
	int ret = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) {
			ret++;
		}
	}
	cout << ret << endl;
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

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

int main() {
    ll K;
    cin >> K;
    ll ans = 0;
    rep(i, 1, K+1)rep(j, 1, K+1){
        ll tmp = gcd(i, j);
        rep(k, 1, K+1){
            ans += gcd(tmp, k);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3192
#include "bits/stdc++.h"
using namespace std;
using ll = long long;


int main() {
    ll n, t;
    cin >> n >> t;

    ll res = 0, last = 0;
    while (n--) {
        res += t;
        ll x;
        cin >> x;
        if(x < last) res -= (last - x);
        last = x + t;
    }
    cout << res << endl;
}

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

int main(void)
{
	long long a, b, c, x;

	std::cin >> a >> b >> c >> x;

	std::vector<int> v(20001);

	v[x] = 1;

	for (int i = 1; i <= a; i++) {
		if (x - (500 * i) >= 0) {
			v[x - (500 * i)] = 1;
		}
	}

	std::vector<int> temp = v;
	for (int i = 0 ; i <= x; i++) {
		if (v[i] > 0) {
			for (int j = 1; j <= b; j++) {
				if (i - (j * 100) >= 0) {
					temp[i - (j * 100)] += temp[i];
				}
			}
		}
	}

	v = temp;

	for (int i = 0 ; i <= x; i++) {
		if (v[i] > 0) {
			for (int j =1; j <= c; j++) {
				if (i - (j * 50) >= 0) {
					temp[i - (j * 50)] += temp[i];
				}
			}
		}
	}

	v = temp;
	std::cout << v[0] << std::endl;

	return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

class UnionFindTree
{
private:
    int n;
    int groupNum;       // グループの数
    vector<int> parent; // 親ノード
    vector<int> rank;   // 木の高さの上限
    vector<int> num;    // グループの要素数
    int find(int i){
        if(parent[i] == i)
            return i;
        else
            return parent[i] = find(parent[i]);
    }
public:
    UnionFindTree(int n){ // コンストラクタ
        this->n = n;
        parent.resize(n);
        for(int i=0; i<n; ++i)
            parent[i] = i;
        rank.assign(n, 0);
        num.assign(n, 1);
        groupNum = n;
    }
    void unite(int a, int b){ // aとbのグループを併合
        if((a = find(a)) != (b = find(b))){
            if(rank[a] < rank[b]){
                parent[a] = b;
                num[b] += num[a];
            }
            else{
                parent[b] = a;
                if(rank[a] == rank[b])
                    ++ rank[a];
                num[a] += num[b];
            }
            -- groupNum;
        }
    }
    bool same(int a, int b){ // aとbのグループが同じかを調べる
        return find(a) == find(b);
    }
    int getNum(){ // グループの数を返す
        return groupNum;
    }
    int getNum(int a){ // aのグループの要素数を返す
        return num[find(a)];
    }
};

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

    int ans = 0;
    for(int i=0; i<m; ++i){
        UnionFindTree uft(n);
        for(int j=0; j<m; ++j){
            if(i != j)
                uft.unite(a[j], b[j]);
        }
        if(uft.getNum() == 2)
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(1000000)

def steps(n):
    if memo[n] != -1:
        return memo[n]
    
    one = memo[n-1] if memo[n-1] != -1 else steps(n-1)    
    two = memo[n-2] if memo[n-2] != -1 else steps(n-2)

    memo[n] = one + two
    return memo[n]

n, m = map(int, input().split())
broken = [int(input()) for i in range(m)]
memo = [-1 for i in range(n+1)]
memo[0] = 1
memo[1] = 1
for b in broken:
    memo[b] = 0

print(steps(n) % (10**9+7))

Measured memory_bytes: 535480
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

int n,m;
vector<vector<pii> > g;
bool hako[111111];
int kyori[111111];

bool dfs(int x,int d){
  if(kyori[x]==-1) kyori[x]=d;
  else if(kyori[x]!=d) return false;
  else return true;
  
  for(int i=0;i<g[x].size();i++){
    if(!dfs(g[x][i].first,d+g[x][i].second)) return false;
  }
  return true;
}

int main(void){
  cin>>n>>m;
  int l,r,d;
  g.resize(n+1,vector<pii>());
  memset(kyori,-1,sizeof kyori);
  
  for(int i=0;i<m;i++){
    cin>>l>>r>>d;
    g[l].pb(pii(r,d));
    hako[r]=true;
  }

  bool f=true;
  for(int i=1;i<=n;i++){
    if(hako[i]) continue;
    if(!dfs(i,0)){
      f=false;
      break;
    }
  }
  for(int i=1;i<=n;i++){
    if(kyori[i]==-1) f=false;
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int main(){
  int N;
  cin >> N;
  vector<int> before(N + 1,1e9);
  vector<int> next = before;
  before[0] = 0;
  int now = 6;
  while(now <= N){
    for(int c = 0;c < 6;c++){
      next.assign(N + 1,1e9);
      for(int i = 0;i <= N;i++){
        next[i] = before[i];
        if(i - now >= 0){
          next[i] = min(next[i],before[i - now] + 1);
        }
      }
      swap(next,before);
    }
    now*=6;
  }
  now = 9;
  while(now <= N){
    for(int c = 0;c < 9;c++){
      next.assign(N + 1,1e9);
      for(int i = 0;i <= N;i++){
        next[i] = before[i];
        if(i - now >= 0){
          next[i] = min(next[i],before[i - now] + 1);
        }
      }
      swap(next,before);
    }
    now*=9;
  }
  int ans = before[N];
  for(int i = 0;i <= N;i++){
    ans = min(ans , before[i] + N - i);
  }
  cout << ans << endl;

}


Measured memory_bytes: 1024
(defn main-abc124-B []
  (let [N (read)
        xs (doall (take N (repeatedly read)))]
    (loop [m (first xs)
           count 0
           [x & xs] xs]
      (cond (not x) (println count)
            :else (recur (max m x) (if (<= m x) (inc count) count) xs)))))
(main-abc124-B)

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

#define REP(i,n) REPN(i,0,n)
#define REPN(i,m,n) for(int i=m; i<(n); i++)

#define MAX 2000001
#define VMAX 10000

int main() {
    int n, i, j;
    cin >> n;

    int A[n+1], B[n+1], C[VMAX+1];
    REP(i, VMAX+1) {
        C[i] = 0;
    }

    REP(i, n) {
        cin >> A[i+1];
        C[A[i+1]]++;
    }

    REPN(i, 1, VMAX+1) {
        C[i] = C[i] + C[i-1];
    }

    REPN(j, 1, n+1) {
        B[C[A[j]]] = A[j];
        C[A[j]]--;
    }

    REPN(i, 1, n+1) {
        if (i > 1) {
            cout << " ";
        }
        cout << B[i];
    }
    cout << '\n';
}


Measured memory_bytes: 18756
import java.io.*
import java.util.*

fun solve(N: Long, p: LongArray){
    println(p.sum() - p.max()!!/2L)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toLong()
    val p = LongArray(N.toInt())
    for (i in 0 until N.toInt()) {
        p[i] = sc.next().toLong()
    }
    solve(N, p)
}



Measured memory_bytes: 32288
#include <cmath>
#include <queue>
#include <cstdio>
#include <iomanip>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 200010
#define ll long long
using namespace std;
inline int read() 
{ 
    int x=0,f=1;char ch=getchar(); 
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} 
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} 
    return x*f; 
}
struct zgz
{
	int next,to;
}edge[N<<1];
int cnt=1,head[N];
void add(int from,int to)
{
	edge[cnt].to=to;
	edge[cnt].next=head[from];
	head[from]=cnt++;
}
int d1[N],dn[N];
void dfs1(int x,int fa)
{
	for(int i=head[x];i;i=edge[i].next)
	{
		int to=edge[i].to;
		if(to==fa)continue;
		d1[to]=d1[x]+1;
		dfs1(to,x);
	}
}
void dfsn(int x,int fa)
{
	for(int i=head[x];i;i=edge[i].next)
	{
		int to=edge[i].to;
		if(to==fa)continue;
		dn[to]=dn[x]+1;
		dfsn(to,x);
	}
}
int n;
int main()
{
	n=read();
	for(int i=1;i<n;i++)
	{
		int u=read(),v=read();
		add(u,v),add(v,u);
	}
	dfs1(1,0),dfsn(n,0);
	int cnt1=0,cntn=0;
	for(int i=1;i<=n;i++)
	{
		if(d1[i]<=dn[i])cnt1++;
		else cntn++;
	}
	if(cnt1>cntn)puts("Fennec");
	else puts("Snuke");
}

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

using namespace std;

typedef long long ll;
const int MAXN = 101;
int n, cnt;
ll x, sum;
ll num[MAXN];


int main() {

	cin >> n >> x;

	for (int i = 1; i <=n; i++) {
		cin >> num[i];
	}

	
	for (int i = 0; i <= n; i++) {
		sum += num[i];
		if (x < sum) break;
		cnt++;
	}

	cout << cnt << "\n";
	return 0;
}

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

int main(){
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    string ans="Yes";
    if(abs(c-a)>d){
      if(abs(b-a)>d||abs(c-b)>d)ans="No";
    }
    cout<<ans<<endl;
  }


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

#define all(x) (x).begin(),(x).end()
#define ll long long
#define ld long double
#define pb push_back
#define FR first
#define SC second
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vl >
#define vb vector<bool>
#define vbb vector< vb >
#define vpl vector<pll>
#define vpll vector< vpl >

void solve()
{
    string s, t;
    cin>>s>>t;
    
    ll n = s.size(), m = t.size();
    ll mn = m;
    for(ll i = 0; i < n; i++)
    {
        ll j, count = 0;
        for(j = 0; j < m; j++)
        {
            if(i + j >= n)
                break;
            if(s[i + j] != t[j])
                count++;
        }
        if(j == m)
            mn = min(count, mn);
    }
    cout<<mn;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll t = 1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;

int ceildiv(int a, int b){
    int tmp = 0;
    if(a % b != 0) tmp = 1;
    return a/b+tmp;
}

int main(){
    int N, D, A; cin >> N >> D >> A;
    vector<pair<int, int>> P(N);
    for(int i = 0; i < N; i++){
        int x, h; cin >> x >> h;
        P[i] = make_pair(x, h);
    }
    sort(P.begin(), P.end());
    for(int i = 0; i < N; i++) P[i].second = ceildiv(P[i].second, A);//体力を必要攻撃回数にしておく
    
    ll ans = 0;
    vector<long long> S(N+1, 0);
    vector<int> X(N); for(int i = 0; i < N; i++) X[i] = P[i].first;
    //for(int i = 0; i < N; i++) cout << P[i].second << " "; cout << endl;

    for (int i = 0; i < N; ++i) {
        if (S[i] < P[i].second) {
            // モンスター i を倒すのに必要な回数
            long long need = P[i].second - S[i];
        
            // X[i] を左端とした爆発が届く範囲を求める
            long long right = P[i].first + D * 2;
            int id = upper_bound(X.begin(), X.end(), right) - X.begin();
            
            // imos しながら爆発させる
            S[i] += need;
            S[id] -= need;
            ans += need;
        }

        // imos の累積和をとる操作
        S[i+1] += S[i];
        //for(int i = 0; i < N+1; i++) cout << S[i] << " "; cout << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4096
#include<stdio.h>
int main(){
  int N,M,A[100],i,j,k,goukei=0,counter=0;
  float a;
  scanf("%d %d",&N,&M);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
    goukei+=A[i];
  }
 

  a=goukei/(4.0*M);
 
  

  for(i=0;i<N;i++){
    if(a<=A[i]){
      counter++;
    }
  }

  if(counter>=M){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }
  return 0;
}
    

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int T, A;
  cin >> T >> A;
  vector<int> H(N);
  for(int i = 0; i < N; i++) cin >> H[i];
  int mi = 1 << 29, j;
  for(int i = 0; i < N; i++) {
  	if (mi > abs(1000 * A - (1000 * T - H[i] * 6)) ) {
      mi = abs(1000 * A - (1000 * T - H[i] * 6));
      j = i;
    }
  }
  cout << j + 1 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		while (true) {
			int H = scan.nextInt();
			int W = scan.nextInt();

			if ((H == 0) && (W == 0)) {
				break;
			} else {

				for (int i = 0; i < H; i++) {
					for (int j = 0; j < W; j++) {

						System.out.print("#");

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

	}

}

Measured memory_bytes: 34968
#include<bits/stdc++.h>
#define rep(i,a,n) for(int _tmp=n,i=a;i<=_tmp;++i)
#define dep(i,a,n) for(int _tmp=n,i=a;i>=_tmp;--i)
#define re(i,a,n) for(int _tmp=n,i=a;i<_tmp;++i)
#define fec(i,a) for(__typeof a.begin() i=a.begin();i!=a.end();++i)
#define For(i,v,u) for(int i=H[u],v=to[i];i;i=nxt[i],v=to[i])
#define si(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define inf 1e18
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
template<class T> inline void read(T&x){char c;bool fu=0;for(c=getchar();c<=32;c=getchar());if(c=='-')fu=1,c=getchar();for(x=0;c>32;c=getchar())x=x*10+c-'0';if(fu)x*=-1;}
template<class T> inline void read(T&x,T&y){read(x);read(y);}
template<class T> inline void read(T&x,T&y,T&z) {read(x,y);read(z);}
template<class T> inline void MAX(T&x,T y){if(x<y)x=y;}
template<class T> inline void MIN(T&x,T y){if(x>y)x=y;}
typedef long long ll;
typedef pair<int,int> pii;
const int N=111111;
//head
int a,b,c,x,y;
int ans;
int main() {
	read(a,b,c);
	c=c*2;
	read(x,y);
	if (a+b<=c){
		ans=a*x+b*y;
	}else{
		int xx=min(x,y);
		x-=xx;y-=xx;
		ans=c*xx;
		if(x){
			ans+=x*min(c,a);
		}else if(y){
			ans+=y*min(c,b);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int i,j,k;
  int l;
  int f=0;
  int n[100];
  int key;

  //データ長さ入力
  while(1){
    //printf("prease data length\n");
    scanf("%d",&l);
    if((0<l)&&(l<101)){
      break;
    }
    //printf("prease 0<length<101\n");
  }

  //printf("prease inport number\n");
  for(i=0; i<l; i++){
    scanf("%d",&n[i]);
    if((1000<=n[i])||n[i]<=0){
      //printf("prease more low number\n");
      continue;
    }
  }

  for(i=0; i<l; i++){
    printf("%d",n[i]);
    if(i!=l-1)printf(" ");
  }
  printf("\n");

  for(i=1; i<l; i++){
    key = n[i];
    for(j=i-1; j>=0&&n[j]>key; j--){
      n[j+1]=n[j];

    }
    n[j+1]=key;


    for(k=0; k<l; k++){
      printf("%d",n[k]);
      if(k!=l-1)printf(" ");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2084
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int max = 0;
        for(int i = 0; i < n; i++){
            x[i] = scan.nextInt();
            if(max < x[i]) max = x[i];
        }
        int out = Integer.MAX_VALUE;
        int sum = 0;
        for(int i = 1; i <= max; i++){
            for(int j = 0; j < n; j++){
                sum += (int)Math.pow(x[j] - i, 2);
            }
            if(out > sum) out = sum;
            sum = 0;
        }
        System.out.println(out);
    }
}

Measured memory_bytes: 27176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef vector<ll> vi;
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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 main(){
  ll n, d;
  cin >> n >> d;
  Graph x(n, vector<ll>(d));
  rep(i,n){
    rep(j,d){
      cin >> x[i][j];
    }
  }
  ll count = 0;
  for(ll i=0;i<n-1;i++){
    for (ll j = i + 1; j < n;j++){
      double sum = 0;
      rep(k, d){
        sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      }
      double y = sqrt(sum);
      while(y>=1){
        y -= 1;
      }
      if(y==0){
        count++;
      }
    }
  }
  print(count);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,d,e[10000],f;
	char c;
	c = '+';
	d = 0;
	
	while(c != '?'){
		scanf("%d %c %d",&a,&c,&b);
		if(c == '+'){
			e[d] = a+b;
			++d;
		}
		else if(c == '-'){
			e[d] = a-b;
			++d;
		}
		else if(c == '*'){
			e[d] = a*b;
			++d;
		}
		else if(c == '/'){
			if(a != 0 || b != 0){
				e[d] = a/b;
				++d;
			}
		}
	}
	
	for(f = 0; f < d;++f){
		printf("%d\n",e[f]);
	}
	
	return(0);
}

Measured memory_bytes: 2620
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s, t;
  cin >> s >> t;
  string ans = t + s;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

int A[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++)  cin >> A[i];
	int sum = 0;
	for (int i = 0; i <= N; i++) {
		sum += abs(A[i] - A[i + 1]);
	}
	for (int i = 0; i < N; i++) {
		int ans = sum;
		ans -= abs(A[i] - A[i + 1]) + abs(A[i + 1] - A[i + 2]);
		ans += abs(A[i] - A[i + 2]);
		cout << ans << endl;
	}
	
}

Measured memory_bytes: 4028
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>

using ll = long long;
typedef unsigned long long ull;
typedef std::pair<ll, ll>P;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const ll mod = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 8000000000000000000LL;
bool fl = true;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
std::string abc = "abcdefghijklmnopqrstuvwxyz";
struct edge { ll to, cost; };
struct edge1 { ll from, to, cost; };
double pai = 3.141592653589793;
std::vector<P>v[100010];
edge1 es[2100];
ll d[1100];
int n, m;

bool bellman(int s) {
	for (int i = 1;i <= n;i++)d[i] = INF2;
	d[s] = 0;
	for (int j = 0;j < n;j++) {
		for (int i = 0;i < m;i++) {
			edge1 e = es[i];
			if (d[e.to] > d[e.from] + e.cost) {
				d[e.to] = d[e.from] + e.cost;
				if (j == n - 1 && e.to == n)return true;
			}
		}
	}
	return false;
}

int main() {
	std::cin >> n >> m;
	for (int i = 0;i < m;i++) {
		ll a, b, c;
		std::cin >> a >> b >> c;
		es[i] = edge1{ a,b,-c };
	}
	if (bellman(1))std::cout << "inf" << std::endl;
	else std::cout << -d[n] << std::endl;
	
}

Measured memory_bytes: 2688
n,m = list(map(int,input().split()))
a = []
b = []
dic = {}
count = 0
data = [0] * n
for i in range(n):
    x,y = list(map(int,input().split()))
    data[i] = [x,y]
data = sorted(data,key = lambda x : x[0])
for i in range(n):
    if m > data[i][1]:
        count += data[i][0] * data[i][1]
        m -= data[i][1]
    else:
        count += data[i][0] * m
        break
print(count)

"""
for i in range(n):
    x,y = list(map(int,input().split()))
    dic[x] = y
dic = sorted(dic.items())



for key in dic:
    if m - dic[key] > 0:
        count += key * dic[key]
        m = m - dic[key]
    else:
        count += m * key
        break
print(count)
"""
            

"""

for i in range(n):
    x,y = list(map(int,input().split()))
    a.append(x)
    b.append(y)
count = 0


while m > 0:
    mi = min(a)
    d = a.index(mi)
    if m > b[d]  : # Bi本買う
        m -= b[d]
        count += b[d] * mi
    else:
        count += m * mi
        break
    del a[d]
    del b[d]
print(count)



"""


Measured memory_bytes: 22496
# RubyのFloatの精度は環境依存、一般にはせいぜい15桁
BTC_YEN_RATE = 380000.0
JPY = 'JPY'
BTC = 'BTC'
N = gets.chomp.to_i
gifts = Array.new(N) do
  x, u = gets.chomp.split
  case u
  when JPY
    x.to_i
  when BTC
    x.to_f * BTC_YEN_RATE
  end
end
puts gifts.inject(&:+)

Measured memory_bytes: 1788
#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(int i=0;i<n;++i)
#define REPR(i,n) for(int 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(int 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 SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#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(){

  llong x, y;
  scanf("%lld %lld", &x, &y);

  if(abs(x - y) <= 1){
    printf("Brown\n");
  }else{
    printf("Alice\n");
  }
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    map<int, int> mp;
    int n, m, x;
    while(cin >> n) {
        for(int i = 0; i < n; ++i) {
            cin >> x;
            mp[x]++;
        }
        bool flag = true;
        cin >> m;
        while(m--) {
             cin >> x;
             if(!flag) continue;
             if(!mp[x]) flag = false;
             else mp[x]--;
        }
        cout << (flag ? "YES" : "NO") << endl;
    }
}


Measured memory_bytes: 9600
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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 main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S,T;
    cin >> S >> T;
    int cnt = 0;
    for(int i=0; i<S.size(); i++){
        if(S[i] != T[i]) cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
    int left = A + B;
    int right = C + D;
    if (left > right) {
        puts("Left");
    } else if(left < right) {
        puts("Right");
    } else {
        puts("Balanced");
    }
}


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

int main(){
  int n;
  char s[1000];
  scanf("%d",&n);
  scanf("%s",s);
  int count=0;
  for(int i=0;i<n/2;i++){
    if(s[i]!=s[n/2+i]){
      count++;
    }
  }
  if(n%2!=0) count++;
 if(count!=0) printf("No");
  else printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 17)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod(ll n){return n%=MOD1;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

/*nが素数かどうか判定*/
ll judge_prime(ll n){
    if(n==2) return 1;
    if(n==1 || n%2==0) return 0;
    ll a=sqrt(n); if(a%2==0) a--;
    repp(i,3,a+1,2){if(n%i==0) return 0;}
    return 1;
}

int main(void){
    // char ;
    ll q,prime[100000]={};
    scanf("%lld",&q);
    ll l[q],r[q],sum[100000]={};
    rep(i,0,q){
        scanf("%lld%lld",&l[i],&r[i]);
    }
    rep(i,3,100000){
        if(judge_prime(i) && judge_prime((i+1)/2)) prime[i]=1;
    }
    sum[0]=0;
    rep(i,1,100000){
        sum[i]=sum[i-1]+prime[i];
    }
    rep(i,0,q){
        printf("%lld\n",sum[r[i]]-sum[l[i]-1]);
    }
    // printf("%lld\n");
    return 0;
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int main(){
    int n,m;cin>>n>>m;
    int c[55]={0};
    rep(i,m){
        int a,b;cin>>a>>b;
        c[a]++;c[b]++;
    }
    rep1(i,n){
        co(c[i]);
    }
    
}

Measured memory_bytes: 256
Ai_j = []
for i in range(3):
    Ai_j.append(list(map(int,input().split())))
N = int(input())
number_list = []
for i in range(N):
    number_list.append(int(input()))
'''
print(Ai_j)
print(N)
print(number_list)
'''

for x in number_list:
    for i in range(3):
        for j in range(3):
           if  Ai_j[i][j] == x:
               Ai_j[i][j] = '○'
#print(Ai_j)

count = 0

if Ai_j[0][0] == Ai_j[0][2] == Ai_j[0][1] == '○': count+=1
if Ai_j[1][0] == Ai_j[1][2] == Ai_j[1][1] == '○': count+=1
if Ai_j[2][0] == Ai_j[2][2] == Ai_j[2][1] == '○': count+=1
if Ai_j[0][0] == Ai_j[1][0] == Ai_j[2][0] == '○': count+=1
if Ai_j[0][1] == Ai_j[1][1] == Ai_j[2][1] == '○': count+=1
if Ai_j[0][2] == Ai_j[1][2] == Ai_j[2][2] == '○': count+=1
if Ai_j[0][0] == Ai_j[1][1] == Ai_j[2][2] == '○': count+=1
if Ai_j[0][2] == Ai_j[1][1] == Ai_j[2][0] == '○': count+=1

if count == 0:
    print("No")
else:
    print("Yes")

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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    cout << a[n-1] - a[0] << endl;
    return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;


void array_show(int *a,int n){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?' ':'\n'));
}
void array_show(LL *a,int n){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?' ':'\n'));
}

vector<int> win[100005];
priority_queue<int> q1;
int s[100005];

int check(int a){
	int b,c;
	if(s[a]!=-1)return s[a];
	if(win[a].size()==0){
		s[a]=0;
		return 0;
	}
	for(int i=0;i<win[a].size();i++){
		check(win[a][i]);
	}
	for(int i=0;i<win[a].size();i++){
		q1.push(check(win[a][i]));
	}
	b=0;
	for(int i=0;i<win[a].size();i++){
		c=i+q1.top()+1,q1.pop();
		b=max(b,c);
	}
	s[a]=b;
	return b;
}

int main(){
	int n;
	int i,j,k;
	int a,b,c;
	memset(s,-1,sizeof(s));
	cin>>n;
	for(i=1;i<n;i++){
		cin>>a;
		win[a-1].push_back(i);
	}
	cout<<check(0)<<endl;
	return 0;
}


Measured memory_bytes: 12288