akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0075
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) return;

                decimal[] items = Array.ConvertAll(line.Trim().Split(','), e => decimal.Parse(e));
                if ((items[1] / items[2] / items[2]) >= 25 )Console.WriteLine(items[0]);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 18032
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) {

        try (final Scanner sc = new Scanner(System.in)) {
            final int A = sc.nextInt();
            final int B = sc.nextInt();
            final int C = sc.nextInt();
            System.out.println(Math.min(B / A, C));
        }
    }
}


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

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

  if (S.size() < 26)
    for (char c = 'a'; c <= 'z'; c++)
      if (!count(S.begin(), S.end(), c)) return cout << S + c << "\n", 0;

  if (!next_permutation(S.begin(), S.end())) return cout << -1 << "\n", 0;

  for (int i = 0; i < S.size(); i++) {
    cout << S.at(i);
    if (S.at(i) != T.at(i)) return cout << "\n", 0;
  }
}

Measured memory_bytes: 256
#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 FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int count = 1;
    int flag = 0;
    while (true)
    {
        if (count % 2 == 0)
        {
            a = a - d;
            if (a <= 0)
            {
                flag = 1;
                break;
            }
        }
        else
        {
            c = c - b;
            if (c <= 0)
            {
                flag = 2;
                break;
            }
        }
        count++;
    }

    if (flag == 2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int N, Q;
vector<vector<int>> tree(200020);
vector<ll> cost(200020);
vector<bool> visited(200020, false);

// なぜこれで解けるの？
void dfs(int v, int pv) {
  visited[v] = true;
  if(v != 0) cost[v] += cost[pv];
  for(auto nv : tree[v]) {
    // cout << v << " " << nv << endl;
    if(visited[nv] == false) {
      dfs(nv, v);
    }
  }
} 

int main() {
  cin >> N >> Q;
  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  REP(i, Q) {
    int p, x;
    cin >> p >> x;
    p--;
    cost[p] += x;
  }

  dfs(0, 0);
  REP(i, N - 1) cout << cost[i] << " ";
  cout << cost[N - 1] << endl;
}

Measured memory_bytes: 24320
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?(c=getchar()):0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
const int N=100010;
int pos[N],v[N],lst[N];
vector<int>vec[2];
inline bool pcmp(int a,int b){
	return pos[a]<pos[b];
}
int ans[N];
int main(){
	int n=ni,len=ni;
	lint t=ni;
	for(int i=1;i<=n;i++){
		pos[i]=ni;
		lst[i]=i;
		v[i]=3-(ni<<1);
		vec[v[i]>0].push_back(i);
	}
	if(vec[0].size()==0||vec[1].size()==0){
		for(int i=1;i<=n;i++){
			printf("%lld\n",((pos[i]+v[i]*t)%len+len)%len);
		}
		return 0;
	}
	sort(lst+1,lst+n+1,pcmp);
	sort(vec[1].begin(),vec[1].end(),pcmp);
	reverse(vec[1].begin(),vec[1].end());
	for(int i=0;i<(int)vec[0].size();i++){
		if(pos[vec[0][i]]<pos[vec[1][0]]){
			pos[vec[0][i]]+=len;
		}
	}
	sort(vec[0].begin(),vec[0].end(),pcmp);
	bool latter=false;
	lint finpos;
	{
		lint tmpans;
		{
			lint l=0,r=t;
			while(l<r){
				lint m=(l+r)>>1;
				lint p0=m%vec[0].size();
				lint p1=(m+1)%vec[1].size();
				lint pos0=pos[vec[0][p0]]+m/vec[0].size()*len;
				lint pos1=pos[vec[1][p1]]-(m+1)/vec[1].size()*len;
				if((t<<1)<pos0-pos1){
					r=m;
				}else{
					l=m+1;
				}
			}
			tmpans=l;
		}
		lint p0=tmpans%vec[0].size();
		lint p1=tmpans%vec[1].size();
		lint pos0=pos[vec[0][p0]]+tmpans/vec[0].size()*len;
		lint pos1=pos[vec[1][p1]]-tmpans/vec[1].size()*len;
		if((t<<1)<=pos0-pos1){
			finpos=pos1+t;
		}else{
			finpos=pos0-t;
		}
		finpos=(finpos%len+len)%len;
		if(tmpans){
			lint p11=(tmpans-1)%vec[0].size();
			lint pos11=pos[vec[0][p11]]+(tmpans-1)/vec[0].size()*len;
			if((t<<1)==pos11-pos1){
				latter=true;
			}
		}
	}
	for(int i=1;i<=n;i++){
		pos[i]=((pos[i]+(lint)v[i]*t)%len+len)%len;
	}
	sort(pos+1,pos+n+1);
	int curpos,curlst;
	for(int i=1;i<=n;i++){
		if(pos[i]==finpos){
			if(latter){
				if(pos[i%n+1]==pos[i]){
					curpos=i%n+1;
				}else{
					curpos=i;
				}
			}else{
				if(pos[i==1?n:i-1]==pos[i]){
					curpos=i==1?n:i-1;
				}else{
					curpos=i;
				}
			}
			break;
		}
	}
	for(int i=1;i<=n;i++){
		if(lst[i]==vec[1][0]){
			curlst=i;
			break;
		}
	}
	for(int i=1;i<=n;i++,curpos=curpos%n+1,curlst=curlst%n+1){
		ans[lst[curlst]]=pos[curpos];
	}
	for(int i=1;i<=n;i++){
		printf("%d\n",ans[i]);
	}
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		a[i]--;
	}
	vector<int> cnt(N, 0);
	int next = 0;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cnt[next]++;
		ans++;
		if (a[next] == 1)
			break;
		next = a[next];
		if (cnt[next] == 1) {
			ans = -1;
			break;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int ans[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
    int k;
    cin >> k;
    cout << ans[k-1] << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = int(input())
    S = input()
    L = [0] * 26

    for s in S:
        L[ord(s) - 97] += 1

    ans = 1
    for i in range(26):
        if L[i] != 0:
            ans = (ans * (L[i] + 1)) % (10 ** 9 + 7)

    print(ans - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(Math.abs(x-a)<Math.abs(x-b)){
            System.out.println("A");
        }else{
            System.out.println("B");
        }
    }

}


Measured memory_bytes: 22736
import sys
sys.setrecursionlimit(1000000)

ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000

def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			d = dfs(num - ma_map[p])
			if d == -1: continue
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

ma.sort()
print("{}".format(dfs(N)))

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;



void one_case() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto& el : a) {
        cin >> el;
    }
    sort(a.begin(), a.end());
    int A = 0, B = 0;
    for (int i = n - 1; i >= 0; --i) {
        if (i % 2 != n % 2) {
            A += a[i];
        } else {
            B += a[i];
        }
    }
    cout << A - B << "\n";

}


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


    int t = 1;
//    cin >> t;
    while (t--) {
        one_case();
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x,y,z,q;
int main()
{
	scanf("%d %d",&x,&y);
	if(x==y)
	{
		printf("0");
		return 0;
	}
	if(x==-1*y)
	{
		printf("1");
		return 0;
	}
	if(x>0 && y>0)
	{
		if(x>y)
		{
			int a=fabs(x-y);
			printf("%d",a+2);
			return 0;
		}
		int a=fabs(x-y);
		printf("%d",a);
		return 0;
	}
	if(x<0 && y<0)
	{
		if(fabs(x)>fabs(y))
		{
			int a=fabs(x-y);
			printf("%d",a);
			return 0;
		}
		else
		{
			int a=fabs(x-y);
			printf("%d",a+2);
			return 0;
		}
	}
	if(x>0 && y<0)
	{
		int a=fabs(x);
		int b=fabs(y);
		int c=fabs(a-b);
		printf("%d",c+1);
		return 0;
	}
	if(x<0 && y>0)
	{
		int a=fabs(x);
		int b=fabs(y);
		int c=fabs(a-b);
		printf("%d",c+1);
		return 0;
	}
	if(x==0 && y>0)
	{
		printf("%d",y);
		return 0;
	}
	if(x<0 && y==0)
	{
		int a=fabs(x);
		printf("%d",a);
		return 0;
	}
	if(x==0 && y<0)
	{
		int a=fabs(y);
		printf("%d",a+1);
		return 0;
	}
	if(x>0 && y==0)
	{
		printf("%d",x+1);
		return 0;
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int N, TWO, THREE, SIX;
  cin >> N >> TWO >> THREE >> SIX;
  int ans = N-TWO-THREE+SIX;
  cout << ans << endl;
}



Measured memory_bytes: 3092
/*
 * aoj/dpl_5_f/main.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
/* Mod */
#define MOD 1000000007
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
ostream & operator << (ostream & out, mint const & v) {
  out << v.x;
  return out;
}

/* nCk */
template<class T> struct BiCoef {
    vector<T> fact_, inv_, finv_;
    constexpr BiCoef() {}
    constexpr BiCoef(int n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1) {
        init(n);
    }
    constexpr void init(int n) noexcept {
        fact_.assign(n, 1), inv_.assign(n, 1), finv_.assign(n, 1);
        for(int i = 2; i < n; i++){
            fact_[i] = fact_[i-1] * i;
            inv_[i] = -inv_[MOD%i] * (MOD/i);
            finv_[i] = finv_[i-1] * inv_[i];
        }
    }
    constexpr T com(int n, int k) const noexcept {
        if (n < k || n < 0 || k < 0) return 0;
        return fact_[n] * finv_[k] * finv_[n-k];
    }
    constexpr T fact(int n) const noexcept {
        if (n < 0) return 0;
        return fact_[n];
    }
    constexpr T inv(int n) const noexcept {
        if (n < 0) return 0;
        return inv_[n];
    }
    constexpr T finv(int n) const noexcept {
        if (n < 0) return 0;
        return finv_[n];
    }
};

// n-1Ck-1
int N, K;
void solve() {
  cin >> N >> K;
  if (K>N) {
    cout << 0 << endl;
    return;
  }

  BiCoef<mint> bc;
  bc.init(1001);
  cout << bc.com(N-1, K-1) << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}



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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(),(x).end()

void chmin(int &a, int b) {
  if (a > b) a = b;
}

signed main() {
#ifdef _DEBUG
  // freopen("in", "r", stdin);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int a, b, c;
  cin >> a >> b >> c;
  int res = 2e18;
  if ((a % 2) * (b % 2) * (c % 2)) {
    chmin(res, a * b);
    chmin(res, b * c);
    chmin(res, c * a);
  }
  else res = 0;
  cout << res << '\n';
}


Measured memory_bytes: 256
ai = lambda: list(map(int, input().split()))

n,x = ai()
a = ai()

ma = [[] for _ in range(n)]
for i in range(n):
    ma[i].append(a[i])
    for j in range(1,n):
        if ma[i][-1] > a[i-j]:
            ma[i].append(a[i-j])
        else:
            ma[i].append(ma[i][-1])


def m(k):
    return sum(ma[i][k] for i in range(n))


print(min(m(k) + x*k for k in range(n)))

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    int N; cin >> N;
    int honsuu = 2*N;
    int L[honsuu]; rep(i, honsuu) cin >> L[i];
    sort(L, L+honsuu);
    int ans = 0;
    for(int i = 0; i < honsuu; i+=2) ans += L[i];
    cout << ans << endl;
    return 0;
}

void solve(){}

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

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

        final int N = sc.nextInt();
        final int D = sc.nextInt();

        System.out.println((int)Math.ceil(N / (D * 2 + 1.0)));
    }
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K;
  string S;
  cin >> K >> S;
  if(S.size() > K) {
    for(int i = 0; i < K; i++) {
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
  else {
    cout << S << endl;
  }
}

Measured memory_bytes: 3632
#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;

bool cmp(P a, P b) { return a.second < b.second; }

int a[101], b[101];
int dp[101][101][10010];

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

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	while (a > 0 && c > 0) {
		c -= b;
		if (c <= 0) {
			out("Yes");
			break;
		}
		a -= d;
		if (a <= 0) {
			out("No");
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize(3)
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=0;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;
 
#define int long long
int n,m,v,p;
int a[100010];
bool check(int pos){
	int tot=m*(n-v);
	if(pos<p)return 1;
	int sub=0;
	for(int i=p-1;i<pos;i++){
		sub+=(a[i]-a[pos]);
		if(a[i]-a[pos]>m)return 0;
	}
	if(sub<=tot)return 1;
	else return 0;
}
signed main(){
	cin>>n>>m>>v>>p;
	rep(i,n){
		cin>>a[i];
		a[i]+=m;
	}
	sort(a,a+n);
	reverse(a,a+n);
	int l=0,r=n-1,mid=0,ans=0;
	rep(i,30){
		mid=(l+r)/2;
		if(check(mid)){
			ans=mid;
			l=mid+1;
		}
		else{
			r=mid-1;
		}
	}
	cout<<ans+1;
	return 0;
}

Measured memory_bytes: 1024
b,c=gets.chomp.split(" ").map(&:to_i);

if b==1
 alice=100
else
 alice=b
end

if c==1
 bob=100
else
 bob=c
end


if alice>bob
 print("Alice")
elsif alice<bob
 print("Bob")
elsif alice=bob
 print("Draw")
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,A,B;
    cin>>N>>A>>B;
    vector<int> P(N);
    for (int i=0;i<N;i++){
        cin>>P[i];
    }
    int min=0,mid=0,max=0;
    for (int x:P) {
        if (x<=A) min++;
        else if (x<=B) mid++;
        else max++;
    }
    if (min<=mid && min<=max) {
        cout<<min<<endl;
    }
    else if (mid<=min && mid<=max){
        cout<<mid<<endl;
    }
    else if (max<=min && max<=mid){
        cout<<max<<endl;
    }
}


Measured memory_bytes: 384
def resolve():
	n = int(input())
	robots = [list(map(int, input().split())) for _ in range(n)]
	robots.sort(key=lambda x: x[0] + x[1])
	t = robots[0][0] + robots[0][1]
	a = n
	for i in range(1, n):
		if t <= robots[i][0] - robots[i][1]:
			t = robots[i][0] + robots[i][1]
		else:
			a -= 1
	print(a)
resolve()

Measured memory_bytes: 64600
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
const int MN = 1e6+5, MOD=1e9+7, LOG=33;
ll lcm (ll a, ll b) {return a*b/__gcd(a,b);}
ll multiplyMod(ll a, ll b) { return (a % MOD * b % MOD) % MOD; }
ll addMod(ll a, ll b) { return (a % MOD + b % MOD) % MOD; }
ll subMod(ll a, ll b) { return (a % MOD - b % MOD) % MOD; }
ll fpow(ll b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
int h, n;
ll sume = 0;
int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> h >> n;
    for (int i =0,z;i<n;i++) {
        cin >> z;
        sume += z;
    }
    if (sume >= h) {
        cout << "Yes" << '\n';
    }
    else {
        cout << "No" << '\n';
    }

    return 0;

}

Measured memory_bytes: 256
f,h=range,input
R,C,K=map(int,h().split())
l=lambda:[-~C*[0]for i in f(R+1)]
G=l()
for i in'_'*K:r,c,v=map(int,h().split());G[r][c]=v
F=[l()for i in f(4)]
for r in f(1,R+1):
	for x in f(3):
		for c in f(1,C+1):F[x+1][r][c]=max(F[x][r][c],max(F[x][r][c-1],(x<1)*F[3][r-1][c])+G[r][c],F[x+1][r][c-1])
print(F[3][R][C])

Measured memory_bytes: 428508
#include <stdio.h>

int main() {
  int n,m,i,j,cnt=0;
  scanf("%d",&n);
  int a[n];
  for(i=0; i<n; i++) scanf("%d",&a[i]);
  scanf("%d",&m);
  for(i=0; i<m; i++) {
    int x;
    scanf("%d",&x);
    int l=-1,r=n+1;
    while(l+1!=r) {
      int m=(l+r)/2;
      if(a[m]==x) {
	cnt++;
	break;
      }
      if(a[m]<x) l=m;
      else r=m;
    } 
  }
  printf("%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2112
takaH, takaA, aokiH, aokiA = map(int, input().split())

while True:
    aokiH -= takaA
    if aokiH <= 0: break
    takaH -= aokiA
    if takaH <= 0: break
if takaH <= 0:
    print('No')
else:
    print('Yes')
    


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

    #define ll long long
    #define ff first
    #define ss second
    #define pb push_back
    #define vll vector<ll>
    #define mll map<ll,ll>
    #define MOD 1000000007
    #define pll pair<ll,ll>
constexpr ll INF = 1999999999999999997; 
    #define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
    #define MAXN 10000005
    int spf[MAXN];
    void seive()
    {
        for(int i=1;i<MAXN;i++)
            spf[i]=i;

        for(int i=2;i<MAXN;i+=2)
            spf[i]=2;

        for(int i=3;i*i<MAXN;i++)
        {  if(spf[i]==i)
            {
           for(int j=i*i;j<MAXN;j+=i)
           {
              if(spf[j]==j)
                spf[j]=i;
           }
          }
        }
    }  

    ll prod(ll x)
    {  ll res=1;
        map<ll,ll>m;
        while(x!=1)
        {
          m[spf[x]]++;
          x=x/spf[x];
        }
        for(auto j:m)
        {
            res=res*(j.ss+1); 
        }
        return res;
    }
 

    int main() {
        fastio;
        seive();
        ll n;
        cin>>n;
        ll ans=0;
        for(ll i=1;i<=n;i++)
        {
            ans=ans+prod(i)*i;
        }
        cout<<ans<<endl;

    }

Measured memory_bytes: 42688
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a%2==1 && b%2==1)	printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int n, m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  cin >> n;
  bool ok = true;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = 0;
  while (ok) {
    for (int i = 0; i < n; ++i)
      if (a[i] % 2 != 0) ok = false;
    if (ok == false) break;
    for (int i = 0; i < n; ++i) a[i] /= 2;
    ++ans;
  }
  cout << ans;

  return 0;
}



Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////

ll bin(ll n, ll i) {
	if (i == 0) { return n % 2; }
	else { return bin(n / 2, i - 1); }
}

	
int main() {

	ll n;

	cin >> n;

	ll a[MAX];

	
	repn(i, n) cin >> a[i];

	ll ans = 0;

	ll t[20] = {};

	ll fr = 0;
	ll bc = 0;

	while (fr < n) {
		bool b = 1;

		if (bc == n) { b = 0; }

		else {
			rep(i, 20) {
				if (bin(a[bc + 1], i) == 1 && t[i] == 1) { b = 0; }
			}
		}

		if (b == 1) {
			rep(i, 20) {
				if (bin(a[bc + 1], i) == 1) { t[i] = 1; }
			}
			bc++;
		}

		else {
			rep(i, 20) {
				if (bin(a[fr+1], i) == 1) { t[i] = 0; }
			}
			ans += bc - fr;
			fr++;
		}
	}

	cout << ans;

	
	system("PAUSE");
}

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

map<pair<int,int>,int> m;
int col[100001],par[100001];
vector<int> v[100001];
bool vis[100001];
int bfs(int s)
{
    vis[s]=true;
    int count=0;
    par[s]=-1;
    queue<int> q;
    q.push(s);
    while(!q.empty())
    {
        
        int r=q.front();
        //cout<<"3t"<<r<<"\n";
        q.pop();
        int pcol;
        if(r==s)
         pcol=-1;
         else
         {
             int edgep=m[{par[r],r}];
             pcol=col[edgep];
         }
          int a=1;
          //cout<<"2t"<<pcol<<"\n";
        for(int i=0;i<v[r].size();i++)
        {
            if(!vis[v[r][i]])
            {
            if(r==s)
            {
               count=v[r].size(); 
            }
            int e=m[{r,v[r][i]}];
            //cout<<"1t"<<e<<"\n";
            par[v[r][i]]=r;
            if(a!=pcol)
            col[e]=a;
            else
            {
                a++;
                col[e]=a;
            }
             a++;
             q.push(v[r][i]);
             vis[v[r][i]]=true;
        }
        }
    }
    return count;
}

int main()
{
    for(int i=0;i<=100000;i++)
     vis[i]=false;
    int n,x,y,max=0,maxv=0;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
        m[{x,y}]=i;
        m[{y,x}]=i;
        if(v[x].size()>max)
        {
         max=v[x].size();
         maxv=x;
        }
         if(v[y].size()>max)
         {
         max=v[y].size();
         maxv=y;
         }
    }
    int co=bfs(maxv);
    cout<<co<<"\n";
    for(int i=1;i<n;i++)
     cout<<col[i]<<"\n";
     return 0;
}


Measured memory_bytes: 19456
#include<bits/stdc++.h>
#define P pair<int,int>
using namespace std;

P a[200];
int b;
int memo[200];
int saiki(int c){
	if(memo[c]!=-1)return memo[c];
	int MAX=1;
	for(int i=0;i<b;i++){
		if(a[i].first<a[c].first&&a[i].second<a[c].second){MAX=max(MAX,saiki(i)+1);}
		}
		return memo[c]=MAX;
	}
signed main(){
	int c;
	while(cin>>c,c){
		memset(memo,-1,sizeof(memo));
	for(int d=0;d<c;d++){
		scanf("%d%d",&a[d].first,&a[d].second);
		}
		b=c;cin>>c;
		for(int d=0;d<c;d++){
		scanf("%d%d",&a[b+d].first,&a[b+d].second);
		}
	b+=c;
	int k=0;
	for(int i=0;i<b;i++){
		k=max(k,saiki(i));
		}
		cout<<k<<endl;
	}
	}

Measured memory_bytes: 3044
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
typedef std::vector<int> vin;
const int HASH = 131;
const int MAXS = 2e6+5;
const int MOD = 1e9+7;
const int NOPE = -1;
vin G[MAXS]; // Matching T
char s[MAXS];
char t[MAXS];
int deg[MAXS]; // In-degree
int lvl[MAXS]; // Distance
int N, S, T;
vin pos;

void kr() {
  // Karp-Rabin
  int B = 1;
  int P = 0;
  for (int i = 0; i < T; ++i) {
    P = (1LL * HASH * P % MOD + t[i]) % MOD;
    B = 1LL * HASH * B % MOD;
  }
  int Q = 0;
  for (int i = 0; i < N; ++i) {
    Q = (1LL * HASH * Q % MOD + s[i]) % MOD;
    if (i >= T) {
      Q = (Q - 1LL * B * s[i-T] % MOD + MOD) % MOD;
    }
    if (P == Q) {
      pos.push_back(i-T+1);
    }
  }
}

void repeat() {
  // Concatenate S with itself
  N = S;
  int st = S + T;
  while (N < st) {
    for (int i = 0; i < S; ++i, ++N) {
      s[N] = s[i];
    }
    s[N] = '\0';
  }
}

int solve() {
  for (int u: pos) {
    int v = (u + T) % S;
    G[u].push_back(v);
    ++deg[v];
  }
  std::queue<int> Q;
  for (int i = 0; i < N; ++i) {
    if (!deg[i]) {
      lvl[i] = 0;
      Q.push(i);
    } else {
      lvl[i] = NOPE;
    }
  }
  while (!Q.empty()) {
    int cur = Q.front();
    Q.pop();
    for (int nxt: G[cur]) {
      if (!--deg[nxt]) {
        lvl[nxt] = lvl[cur] + 1;
        Q.push(nxt);
      }
    }
  }
  int ret = 0;
  for (int i = 0; i < N; ++i) {
    if (lvl[i] == NOPE) {
      return NOPE;
    }
    ret = std::max(lvl[i], ret);
  }
  return ret;
}

int main() {
  scanf(" %s%s", s, t);
  S = strlen(s);
  T = strlen(t);
  repeat();
  kr();
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 101740
n = int(input())
a = [0]
at = list(map(int, input().split()))
a.extend(at)
b = [0]
bt = list(map(int, input().split()))
b.extend(bt)
b.append(0)
ans = 0

for i in range(1, n+2):
  if a[i]>=b[i-1]:
    ans += b[i-1]
    a[i] -= b[i-1]
    b[i-1] = 0
  else:
    ans += a[i]
    b[i-1] -= a[i]
    a[i] = 0
  if a[i]>=b[i]:
    ans += b[i]
    a[i] -= b[i]
    b[i] = 0
  else:
    ans += a[i]
    b[i] -= a[i]
    a[i] = 0

print(ans)


Measured memory_bytes: 19168
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("-Ofast")
#include <bits/stdc++.h>
using namespace std;
 
typedef int in;
#define int long long
#define f first
#define s second
#define pb push_back
#define pp push
#define ceil(x) NEVER USE CEIL
#define sqrt(x) (int)(sqrt(x))
const int MAX=1e7;
const int MOD=1e9+7;
const int MAAX=1e18;

int dp[3005][3005];
string a,b;

int f(int idx1,int idx2){
	if(idx1==a.size()||idx2==b.size()){
		return dp[idx1][idx2]=0;
	}
	int &ret=dp[idx1][idx2];
	if(ret!=-1)
		return ret;
	ret=f(idx1+1,idx2);
	if(a[idx1]==b[idx2])
		ret=max(ret,f(idx1+1,idx2+1)+1);
	ret=max(ret,f(idx1,idx2+1));
	return ret;
}

in main()
{
	ios_base::sync_with_stdio(0);
    int tc=1;
    // cin>>tc;
    while(tc--)
    {
    	memset(dp,-1,sizeof dp);
		cin>>a>>b;
		f(0,0);
		string ans="";
		int idx1=0,idx2=0;
		while(idx1<a.size()&&idx2<b.size()){
			int ret=dp[idx1+1][idx2];
			ret=max(ret,dp[idx1][idx2+1]);
			if(a[idx1]==b[idx2]){
				ret=max(ret,dp[idx1+1][idx2+1]+1);
			}
			if(ret==dp[idx1+1][idx2])
				idx1++;
			else if(ret==dp[idx1][idx2+1])
				idx2++;
			else{
				ans+=a[idx1];
				idx1++;
				idx2++;
			}
		}
		cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 74480
function main(input){
	const args = input.split("\n");
  	const A = parseInt(args[0], 10);
  	const B = parseInt(args[1], 10);
  	const C = parseInt(args[2], 10);
  	const D = parseInt(args[3], 10);
  
    var count = 0;
    
    for (var a = 0; a <= A; a++){
    	for (var b =0; b<=B; b++){
        	for (var c=0; c<=C; c++){
            	var sum = (a*500)+ (b*100)+(c*50);
              	if (sum=== D) count++;
            }
        }
    
    }
 console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
-- modules to import --

import qualified Data.ByteString.Char8
import qualified Data.Maybe
import           Prelude

-- functions for this task --

readInteger'    = Prelude.fst . Data.Maybe.fromJust . Data.ByteString.Char8.readInteger
readListInteger = Prelude.map readInteger' . Data.ByteString.Char8.words

getInteger     = readInteger'    <$> Data.ByteString.Char8.getLine
getListInteger = readListInteger <$> Data.ByteString.Char8.getLine

task_A :: Integer -> Integer -> Integer -> Integer
task_A numPeople costTrain costTaxi
        | costTrainAll < costTaxi = costTrainAll
        | Prelude.otherwise       = costTaxi
        where
                costTrainAll = costTrain * numPeople

-- the main process is as follows --

main :: IO ()
main = do

        -- STEP.01
        -- read out the given data
        [n, a, b] <- getListInteger

        -- STEP.02
        -- calculate & output the answer of this task
        Prelude.print $ task_A (n) (a) (b)

Measured memory_bytes: 380
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    S = list(_ for _ in input())
    ans = 'yes'
    for s in S:
        if ''.join(S).count(s)>1:
            ans = 'no'
            break
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
enum Order{F, B};

using ll = long long;

int main(){
    ll N;
    cin >> N;
    vector<ll> as(N, 0);
    for (auto &&i: boost::irange(0LL, N)){
        cin >> as.at(i);
    }
    ll minimum = *min_element(as.begin(), as.end());
    ll maximum = *max_element(as.begin(), as.end());
    Order o;
    if (minimum >= 0){
        o = F;
    } else if (maximum < 0){
        o = B;
    } else if (maximum > abs(minimum)){
        o = F;
    } else {
        o = B;
    }
    vector<pair<ll, ll>> history{};
    if (o == B){
        for (auto &&i: boost::irange(0LL, N)){
            as.at(i) *= -1;
        }
        reverse(as.begin(), as.end());
        maximum = minimum * -1;
    }

    ll max_index;
    for (auto &&i: boost::irange(0LL, N)){
        if (as.at(i)==maximum){
            max_index = i;
            break;
        }
    }
    for (auto &&i: boost::irange(0LL, N)){
        if (as.at(i) < 0){
            as.at(i) += maximum;
            history.emplace_back(max_index, i);
        }
    }
    for (auto &&i: boost::irange(1LL, N)){
        as.at(i) += as.at(i-1);
        history.emplace_back(i-1, i);
    }
    cout << history.size() << endl;
    for (auto &&p: history){
        ll f, s;
        tie(f, s) = p;
        if (o == B){
            f = N-1-f;
            s = N-1-s;
        }
        cout << f + 1 << " " << s + 1 << endl;
    }

}

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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll m[55][55];

int main() {
	cin.sync_with_stdio(false); cin.tie(0);
	cin.exceptions(cin.failbit);

	for (;;) {
		int n; cin >> n; if (!n) break;
		ll fm = 0;
		rep(i, 1, n + 1) { m[0][i] = 1ll << i; fm |= 1ll << i; }

		vector<vi> f(33);
		rep(i, 1, n + 1) {
			int t; cin >> t;
			rep(j, 0, t) {
				int k; cin >> k;
				f[k].push_back(i);
			}
		}
		
		rep(i, 1, 31) {
			rep(j, 1, n + 1) m[i][j] = m[i - 1][j];
			ll mm = 0;
			for (int h : f[i]) mm |= m[i][h];
			if (mm == fm) {
				cout << i << endl;
				goto done;
			}
			for (int h : f[i]) m[i][h] = mm;
		}
		cout << -1 << endl;
done: void(0);
	}
}



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

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int mod = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int A, B, C, D; cin >> A >> B >> C >> D;
    int dp[C+1][D+1];
    FOR(i,A,C){
        FOR(j,B,D){
            if (i == A && j == B) dp[A][B] = 1;
            else {
                dp[i][j] = 0;
                if (i > A) dp[i][j] = (dp[i][j] + dp[i-1][j] * 1LL * j % mod) % mod;
                if (j > B) dp[i][j] = (dp[i][j] + dp[i][j-1] * 1LL * i % mod) % mod;
                if (i > A && j > B) dp[i][j] = (dp[i][j] - dp[i-1][j-1] * 1LL * (i-1) * (j-1) % mod + mod) % mod;
            }
        }
    }
    cout << dp[C][D] << '\n';
}



Measured memory_bytes: 38808
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0

for i in range(N):
    ans+=B[A[i]-1]
    if i>0:
        if A[i]==(A[i-1]+1):
            ans+=C[A[i-1]-1]
    #print(ans)
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
using namespace std;
#define mmax 200000+10
int a[mmax],b[mmax],x[30][mmax],y[mmax];
int fun(int k,int n,int v){//二分
    int l=1,r=n;
    int h=(l+r)/2;
    while(l<=r){
        if(v<=x[k][h]&&x[k][h-1]<v)
            return h;
        else if(v<=x[k][h])
            r=h-1;
        else if(v>x[k][h])
            l=h+1;
        h=(l+r)/2;
    }
    return n+1;
}
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++) scanf("%d",&b[i]);
    for(int k=0;k<28;k++){
        if(k==0)
            for(int i=1;i<=n;i++) x[k][i]=a[i]&1;//2ˆ0次幂,a[i]最后一位的拆分
        else
            for(int i=1;i<=n;i++) x[k][i]=x[k-1][i]^((1<<k)&a[i]);// 取出其a[i]后k位
    }
    long long ans=0;
    for(int k=0;k<28;k++) sort(x[k]+1, x[k]+1+n);
    for(int k=1;k<=28;k++){
        for(int i=1;i<=n;i++){
            y[i]^=(1<<(k-1))&b[i];//取出a[i]后k位
            int t=fun(k-1,n,(1<<k)-y[i]);//二分查找会产生进位项的位子
            //int t=int(lower_bound(x[k-1]+1, x[k-1]+1+n, (1<<k)-y[i])-x[k-1]);
            ans^=(((n-t+1)%2)<<k);//产生进位的异或和
        }
    }
    int q,w,e,r;
    for(int k=0;k<28;k++){
        q=w=e=r=0;
        for(int i=1;i<=n;i++){//算a[i]里的第k位的奇偶数量 0,1
            if((1<<k)&a[i]) q++;
            else w++;
        }
        for(int i=1;i<=n;i++){//算b[i]里的第k位的奇偶数量 0,1
            if((1<<k)&b[i]) e++;
            else r++;
        }
        ans^=(((((long long)1)*q*r%2+((long long)1)*w*e%2)%2)<<k);///产生不进位的异或和
    }
    printf("%lld\n",ans);
    return 0;
}


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

using i64 = std::int64_t;

namespace io {
  using i64 = std::int64_t;
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline i64 scan() {
    i64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(i64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

signed main() {
  using namespace io;
  i64 h = scan();
  i64 n = scan();
  for (int i = 0; i < n; i++) {
    i64 a = scan();
    h -= a;
  }
  if (h <= 0) {
    puts("Yes");
  } else {
    puts("No");
  }
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
          string[] Input = Console.ReadLine().Split(' ');
          string s = Input[0];
          Input[0] = Input[1];
          Input[1] = s;
          
          string s2 = Input[0];
          Input[0] = Input[2];
          Input[2] = s2;
          
          for(int i = 0; i < Input.Length; i++)
          {
          Console.Write(Input[i]);
            if(i < Input.Length - 1){
            Console.Write(" ");
            }
          }
          Console.WriteLine();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


ll dp[5000][5000], v[5000], n, flag[5000][5000], cum[500];
ll calc(ll l, ll r){
    if(flag[l][r]) return dp[l][r];
    flag[l][r] = 1;
    if(l==r) return 0;
    ll wiu = LINF;
    FOR(k, l, r) wiu = min(wiu, calc(l, k)+calc(k+1, r));
    return dp[l][r] = wiu+(cum[r]-cum[l-1]);
}
int main(){
    cin >> n;
    rep(i, n){
        cin >> v[i];
        cum[i+1] = cum[i]+v[i];
    }

    cout << calc(1, n) << endl;
}


Measured memory_bytes: 8028
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9 + 7;


int dp[20005][300];//dp[i][j]:=i番目までのみて信号の値がjの場合の二乗和の最小値

int main() {

	
	int n, m;
	ios::sync_with_stdio(false);
	cin.tie(0);

	while (cin >> n >> m, n | m)
	{
		vector<int> C(m + 10);
		vector<int> x(n + 10);
		for (int i = 1; i <= m; i++)
		{
			cin >> C[i];
		}
		for (int i = 0; i < n; i++)
		{
			cin >> x[i];
		}
		int mini = INF;

		memset(dp, INF, sizeof(dp));
		dp[0][128] = 0;

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < 256; j++)
			{
				if (dp[i][j] == INF)
				{
					continue;
				}
				for (int k = 1; k <= m; k++)
				{
					int code = max(0, min(255,j + C[k]));//次のコード

					dp[i + 1][code] = min(dp[i+1][code], dp[i][j] + (x[i]-code)*(x[i]-code));
				}
			}
		}
		int ans = INF;
		
		for (int i = 0; i <= 256; i++)
		{
			ans = min(ans, dp[n][i]);
		}
		cout << ans << endl;	

	}

	return 0;
}


Measured memory_bytes: 26656
a = input()
num = len(a)
ans = ''
while num>0:
    if a[num-1] == 'm':
        ans = 'dream' + ans
        num -= 5
    elif a[num-1] == 'e':
        ans = 'erase' + ans
        num -=5
    elif a[num-3:num] == 'mer':
        ans = 'dreamer'+ans
        num -=7
    elif a[num-3:num] == 'ser':
        ans = 'eraser'+ans
        num -= 6
    else:
        break
if ans == a:
    print('YES')
else:
    print('NO')

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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define LOCAL
#define MP make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define PF push_front 
#define PB push_back
#define PP push
#define lb lower_bound 
#define ub upper_bound
#define lowbit(x) x&(-x)
#define testbit(x,i) x&(1<<i)

inline void checkmin(int &x,int y){x=min(x,y);}
inline void checkmax(int &x,int y){x=max(x,y);}

const double pi=3.1415926;

int r;

int main() 
{
	#ifndef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>r;
    cout<<2.0f*(db)r*pi<<endl;
    /* end code */
	return 0;
}

Measured memory_bytes: 3736
using System;

class Program
{
  	static bool checkEven(int num, int[] array)
    {
      for(int i = 0; i < num; i++)
      {
      	if(array[i] % 2 != 0)
        {
          return false;
        }
      }
      return true;
    }
  
	static void Main()
    {
    	var num = int.Parse(Console.ReadLine());
    	string[] array = Console.ReadLine().Split(' ');
        int[] arrayNum = Array.ConvertAll(array, int.Parse);
      	int dividNum = 0;	
      
      	while(checkEven(num, arrayNum))
        {
        	for(int i = 0; i < num; i++)
            {
              arrayNum[i] = arrayNum[i]/2;
            }
          	dividNum++;
        }
      	Console.WriteLine(dividNum);
    }
}

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

int main() {
  long a,b,c,d;
  cin >> a >> b >> c >> d;
  while(true) {
    c-=b;
    if(c<=0) {
      cout << "Yes" << endl;
      break;
    }
    a-=d;
    if(a<=0) {
      cout << "No" << endl;
      break;
    }
  }
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  getline(cin, s);
  for (size_t i = 0; i < s.size(); ++i) {
    const char c = s[i];
    if (c >= 'a' && c <= 'z') {
      printf("%c", c - 0x20);
    } else if (c >= 'A' && c <= 'Z') {
      printf("%c", c + 0x20);
    } else {
      printf("%c", c);
    }
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 1164