akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define MAX_T 10005
#define MAX_V 105
using namespace std;

typedef pair<int,int> P;

/* ?????£?????????????§£ O(|V|+|E|) */
int V; //????????°
vector<int> G[MAX_V]; //??°???????????£??\??????????????¨???
vector<int> rG[MAX_V];//?????????????????????????????°??????
vector<int> vs;       //??°?????????????????????
bool used[MAX_V];     //?????§???????????????
int cmp[MAX_V];       //?±????????????£?????????????????????????????????

void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v]=true;
  for(int i=0;i<G[v].size();i++)if(!used[G[v][i]])dfs(G[v][i]);
  vs.push_back(v);
}

void rdfs(int v,int k){
  used[v]=true;
  cmp[v]=k;
  for(int i=0;i<rG[v].size();i++) if(!used[rG[v][i]])rdfs(rG[v][i],k);
}

int scc(){
  memset(used,0,sizeof(used));
  vs.clear();
  for(int v=0;v<V;v++) if(!used[v]) dfs(v);
  
  memset(used,0,sizeof(used));
  int k=0;
  for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]]) rdfs(vs[i],k++);
  return k;
}

int N, M, T, K, p[MAX_V], t[MAX_V], k[MAX_V], memo[MAX_V];
int dp[MAX_V][MAX_T];

vector<int> G2[MAX_V];
vector<int> nodelist[MAX_V];

void solve(){
    
  memset(dp,-1,sizeof(dp));

  for(int i=0;i<K;i++) dp[i][0]=0;
  
  for(int i=0;i<N;i++)
    nodelist[cmp[i]].push_back(i);
  
  int ans=0;
  
  for(int i=0;i<K;i++){
    
    for(int j=0;j<nodelist[i].size();j++){
      
      int node=nodelist[i][j];
      
      int maxk=k[node];
      
      if(!memo[node]&&nodelist[i].size()==1) maxk=1;
      
      int x=1;
    
      while(maxk){
      
	if(maxk<x) x=maxk;

	int y=t[node]*x, z=p[node]*x;
	
	for(int l=T;l>=0;l--){
	  
	  if(dp[i][l]==-1) continue;
	  
	  if(l+y<=T) dp[i][l+y]=max(dp[i][l+y], dp[i][l]+z);
	}
      
	maxk-=x;
      
	x*=2;
      }

      for(int l=0;l<=T;l++) ans=max(ans,dp[i][l]);
      
    }
    
    for(int j=0;j<G2[i].size();j++)
      for(int l=0;l<=T;l++) dp[G2[i][j]][l]=max(dp[G2[i][j]][l],dp[i][l]);
    
  }
  
  cout<<ans<<endl;
}

void init(){
  
  memset(memo,0,sizeof(memo));
  
  for(int i=0;i<N;i++){
    G[i].clear();
    rG[i].clear();
    G2[i].clear();
    nodelist[i].clear();
  }
  
  vs.clear();
  
}

signed main(){

  while(1){
    
    cin>>N>>M>>T;
    if(!N&&!M&&!T) break;
    
    V=N;
    
    init();
    
    for(int i=0;i<N;i++)
      cin>>p[i]>>t[i]>>k[i];
    
    for(int i=0;i<M;i++){
      int a, b;
      cin>>a>>b;
      if(a==b) memo[a-1]=1;
      add_edge(a-1,b-1);
    }
    
    K=scc();
    
    set<P> S;
    
    for(int i=0;i<N;i++)
      for(int j=0;j<G[i].size();j++)
	
	if(!S.count(P(cmp[i],cmp[G[i][j]]))){
	  
	  if(cmp[i]==cmp[G[i][j]]) continue;
	  
	  S.insert(P(cmp[i],cmp[G[i][j]]));
	  G2[cmp[i]].push_back(cmp[G[i][j]]);
	}
    
    solve();
    
  }
  
  return 0;
}

Measured memory_bytes: 11492
using System;

class Program
{
	static void Main(string[] args)
	{
		int i;

		string s = Console.ReadLine();
		string t = Console.ReadLine();

		int result = 0;

		for(i = 0; i < s.Length; i++)
        {
			if(s[i] != t[i])
            {
				result++;
            }
        }

		Console.WriteLine(result);

		return;
	}
}

Measured memory_bytes: 27516
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<utility>
#ifdef XS
	#include<De>
#endif
using namespace std;
#define MS(m) memset(m,0,sizeof(m))

typedef unsigned U;
typedef pair<int,int > P;
typedef long long ll;
void inp();
int main(){
#ifdef XS
	//freopen(".in","r",stdin);
#endif
	//while(1)
	//int n;scanf("%d",&n);for(int i=1;i<=n;i++)
	inp();
	return 0;
}
const int N = 51;
void inp(){
	ll n,sum,A[N];cin>>n;
	for(int i = 1;i<=n;i++)cin>>A[i];
	ll k = 0;
	while(1){
		sum = 0;
		for(int i = 1;i<=n;i++)sum += A[i]/n;
		if(!sum)break;
		k += sum;
		for(int i = 1;i<=n;i++){
			A[i] = sum - A[i]/n + A[i]%n;
		}
	}
	cout<<k<<endl;
}
//at79E.cc by xsthunder at Sun Jul 30 16:12:38 2017


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

void solve()
{
    int n,k,q;cin>>n>>k>>q;
    vector<int>arr(n+1,k-q);
    while(q--)
    {
        int l;cin>>l;
        arr[l]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(arr[i]>0)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
}
int32_t main()
{
         rapido;
         int t;
         //cin>>t;
         t=1;
         while(t--)
         solve();
}

Measured memory_bytes: 3960
#include <iostream>
#include <cstdlib>

using namespace std;

#define N_MAX 200000

int N;
long long a[N_MAX];
long long sum;

void solve() {
    long long tmp = a[0];
    long long ans = abs((sum-tmp)-tmp);
    for(int i = 1; i < N-1; i++) {
        tmp += a[i];
        ans = min(abs((sum-tmp)-tmp), ans);
    }
    cout << ans << endl;
}

int main() {
    cin >> N;
    for(int i = 0; i < N; i++) { 
        cin >> a[i];
        sum += a[i];
    }
    solve();
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
int main()
{/*
	string s,tmp;
	vector<string> str;
	getline(cin, s);
	stringstream ssm{ s };
	while (getline(ssm, tmp, ' '))
	{
		str.push_back(tmp);
		if (tmp == "\n") break;
	}
	for (int i = str.size()-1; i >= 0; i--)
	{
		cout << str[i] <<",";
	}
	cout<<flush;*/
	string s;
	char b=0;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		if (b == s[i])
		{
			cout << "Bad" << endl;
			return 0;
		}
		b = s[i];
	}
	cout << "Good" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define DEC(i, s) for (int i = (s); i >= 0; i--)

#define SIZE(v) (int)((v).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define FIND(m, w) ((m).find(w) != (m).end())

int n;
int field[6][6];
char memo[1 << 24];

void printField() {
  REP(y, n) {
    REP(x, n) {
      cout << field[y][x] << " ";
    }
    cout << endl;
  }
}

int encode() {
  int ret = 0;
  REP(y, n) REP(x, n) {
    if (y == 0 && x == 0) { continue; }
    ret |= field[y][x] << ((y * n) + x - 1);
  }
  return ret;
}

int calc(int y, int x) {
  int state = encode();
  if (memo[state] != -1) { return memo[state]; }
  int ret = 100;
  if (x == n) { ret = calc(y + 1, 0); }
  else if (y == n) { ret = 0; }
  else if (field[y][x] == 0) { ret = calc(y, x + 1); }
  else {
    field[y][x] = 0;
    field[y][n] = 1;
    field[n][x] = 1;
    FOREQ(ny, y + 1, n) {
      FOREQ(nx, x + 1, n) {
        field[ny][n] = 1;
        field[n][nx] = 1;
        //if (field[ny][x] == 1 && field[y][nx] == 1 && field[ny][nx] == 1) {
          //field[ny][x] = field[y][nx] = field[ny][nx] = 0;
          field[ny][x] ^=1;
          field[y][nx] ^=1;
          field[ny][nx] ^=1;
          ret = min(ret, calc(y, x + 1) + 1);
          field[ny][x] ^=1;
          field[y][nx] ^=1;
          field[ny][nx] ^=1;
          //field[ny][x] = field[y][nx] = field[ny][nx] = 1;
        //}
      }
    }
    field[y][x] = 1;
  }
  if (y == 0 && x == 0) { return ret; }
  return memo[state] = ret;
}

int main() {
  while (scanf("%d", &n), n) {
    MEMSET(memo, -1);
    MEMSET(field, 0);
    REP(y, n) REP(x, n) {
      scanf("%d", &field[y][x]);
    }
    REP(y, n) REP(x, n) {
      if (field[y][x] == 1) {
        FOR(ny, y, n) FOR(nx, x, n) {
          field[ny][nx] ^= 1;
        }
        field[y][x] = 1;
      }
    }
    int ans = calc(0, 0);
    while (ans--) { printf("myon"); }
    puts("");
  }
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define INF 1001001001
using namespace std;
const int MAXN = 100010;
int main() {
	int n;
	cin >> n;
	vector<int> dp(100100, INF);
	dp[0] = 0;
	vector<int> p;
	int a = 1;
	while (a < MAXN) {
		p.push_back(a);
		a *= 9;
	}
	a = 1;
	while (a < MAXN) {
		p.push_back(a);
		a *= 6;
	}
	for (int i = 0; i < MAXN; i++) {
		for (int m : p) {
			if (i + m > MAXN)
				continue;
			dp[i + m] = min(dp[i + m], dp[i] + 1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3748
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;



int main() {
	
	int n;
	unsigned long long ans[100000];
	int second_min;
	
	cin >> n;
	
	vector<pair<long long, int> > pairs(n+1);
	
	
	for( int i = 0; i < n; i++ ) {
		long long a;
		
		ans[i] = 0;
		
		cin >> a;
		
		pairs[i] = make_pair( a, i+1 );
	}
	
	pairs[n] = make_pair( 0, 0 );
	
	sort( pairs.begin(), pairs.end(), greater<pair<long long, int> >() );
	
	second_min = pairs[0].second;
	
	for ( int i = 0; i < n; i++ ) {
		if ( second_min > pairs[i].second ) {
			second_min = pairs[i].second;
		}
		
		ans[second_min-1] += ( pairs[i].first - pairs[i+1].first ) * (i+1);
	}
		
	
	for ( int i = 0; i < n; i++ ) {
		cout << ans[i] << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;
int n,m;
vector<vector<int>> nei;
int ans=0;
int dfs(int ii,int size,vector<int> dist,int last){
    if(ii==size){
        return 1;
    }
    int ret=0;
    for(int i=0;i<nei[last].size();i++){
        if(dist[nei[last][i]]!=-1){
            continue;
        }
        dist[nei[last][i]]=dist[last]+1;
        ret+=dfs(ii+1,size,dist,nei[last][i]);
        dist[nei[last][i]]=-1;
    }
    return ret;
}

int main(){    
    cin>>n>>m;
    nei.resize(n);
    vector<int> dist(n,-1);
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        nei[a].push_back(b);
        nei[b].push_back(a);
    }
    dist[0]=0;    
    cout<<dfs(1,n,dist,0)<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<cmath>
using namespace std;
int n,i,e,w,s=1e9,a[1<<19];
char c[1<<19];
int main()
{
	for(cin>>n;i<n;cin>>c[i],a[i]=w,w+=c[i++]==87);
	for(;i>0;s=min(s,a[--i]+e),e+=c[i]==69);
	cout<<s<<endl;
}

Measured memory_bytes: 1664
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  int n;
  cin >> n;
  if(n==1){
    cout << "Hello World"<< endl;
  }else{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
-- Your code here!
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
 
readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    a<-getInt
    s<-getLine
    putStrLn $ if a>=3200 then s else "red"
    

Measured memory_bytes: 380
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define itn int
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define matrix vector<vector<ll>>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; ++i){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000 * 1000 * 1000;
const ld PI = acos(-1.0);
const ll mod1 = inf + 7;
const ll mod2 = inf + 9;
const int MAXN = 1000005;
const ld EPS = 1e-11;
int hp = 179;
signed main()
{
	fastio();
	int n, k;
	cin >> n >> k;
	int cnt2 = 0;
	int cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (2 * (i%k) == k)cnt2++;
		if (i%k == 0)
		{
			cnt++;
		}
	}
	ll ans = 0;
	for (int a = 1; a <= n; ++a)
	{
		int lft = a % k;

		if (lft * 2 == k )
		{
			ans += 1LL * cnt2 * cnt2;
			//--cnt2;
		}
		else if( lft ==0)
		{
			ans += 1LL * cnt * cnt;
			//--cnt;
		}
		else
		{
			continue;
		}
	}
	cout << ans;
	sp;
}	

Measured memory_bytes: 504
def inpl(): return [int(i) for i in input().split()]
N = int(input())
a = inpl()
b = {a[i]: i for i in range(N)}

left = list(range(N+2))
right = list(range(N+2))

ans = 0
for i in range(N,0,-1):
    x = b[i]
    ans += i*(right[x]-x +1)*(x-left[x] +1)
    right[left[x] - 1] = right[x]
    left[right[x] + 1] = left[x]
print(ans)

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int x,n;
cin>>x>>n;
map<int,int>p;

rep(i,n){
    int a;
    cin>>a;
    p[a]++;
}
int u,d;
rep(i,100){
    if(!p.count(x+i)){
        u=x+i;
        break;
    }
}
rep(i,100){
    if(!p.count(x-i)){
        d=x-i;
        break;
    }
}
if(abs(x-u)>abs(x-d)){
    cout<<d<<endl;
}
else if(abs(x-u)==abs(x-d)){
    cout<<min(u,d)<<endl;
}
else{
    cout<<u<<endl;
}
return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cmath>
using namespace std;
 
int N, cost[100005], memo[500005];
 
int minCost(int v) {
  if (memo[v] != -1) return memo[v];
  if (v <= 0) return 0;
  
  int a = minCost(v - 1) + abs(cost[v] - cost[v - 1]);
  int b;
  if (v == 1) {
    b = 1000000000;
  }
  else {
    b = minCost(v - 2) + abs(cost[v] - cost[v - 2]);
  }
  
  
  memo[v] = min(a, b);
  
  return (min(a, b));
}
 
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> cost[i];
  
  for (int i = 0; i < 500005; i++) memo[i] = -1;
  
  cout << minCost(N - 1) << "\n";
  return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

struct Edge {
  int src, dst, wei;
  Edge(int s = 0, int d = 0, int w = 0) : src(s), dst(d), wei(w) {}
};
using Graph = vector<vector<Edge>>;

vector<int> Toposort(Graph &g) {
  int v = g.size(), k = 0;
  vector<int> res(v, -1), in(v);
  for (int i = 0; i < v; i++) {
    for (int j = 0; j < g[i].size(); j++) {
      Edge &x = g[i][j];
      in[x.dst]++;
    }
  }
  queue<int> q;
  for (int i = 0; i < v; i++) {
    if ((in[i] == 0)) {
      q.push(i);
      res[i] = 0;
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < g[u].size(); i++) {
      Edge &e = g[u][i];
      if (in[e.dst] == 1) {
        res[e.dst] = u + 1;
        q.push(e.dst);
      }
      in[e.dst]--;
    }
  }
  return res;
}

signed main() {
  int n, m;
  cin >> n >> m;
  Graph g(n);
  rep(i, n - 1 + m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(Edge(a, b, 0));
  }
  auto ans = Toposort(g);
  rep(i, n) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 7920
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<iostream>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
using namespace std;
ll kt(ll n){
  string key=to_string(n);
  return  key.size();
}
// index が条件を満たすかどうか
bool isOK(ll index, ll key,ll a, ll b) {
    if ( (a*index+b*kt(index))<= key) return true;
    else return false;
}
// 二分探索
ll binary_search(ll key,ll a,ll b) {
    ll left = 0; //「index = 0」が条件を満たすこともあるので、初期値は -1
    ll right = 1000000001; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        ll mid = left + (right - left) / 2;
        if (isOK(mid, key,a ,b)) left = mid;
        else right = mid;
    }
    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return left;
}

int main(){
  ll n;
  string s;
  cin >>n;
  cin >>s;
  int count =1;
  rep2(i,1,n)  if(s[i]!=s[i-1]) count++;
  cout <<count<<endl;
}

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

using namespace std;

int P, Q, R, C;

struct Data {
    int id, p, q, r, cal;
    Data() {}
    void Calculate() {
        cal = 4 * (p + r) + 9 * q;
    }
    bool isEat() {
        if (p <= P && q <= Q && r <= R && cal <= C)
            return true;
        else
            return false;
    }
};

int main()
{
    int n;

    while (cin >> n, n) {
        bool none = true;
        vector<Data> data(n);

        for (int i = 0; i < n; ++i) {
            cin >> data[i].id >> data[i].p >> data[i].q >> data[i].r;
            data[i].Calculate();
        }
        cin >> P >> Q >> R >> C;

        for (int i = 0; i < n; ++i) {
            if (data[i].isEat()) {
                cout << data[i].id << endl;
                none = false;
            }
        }
        if (none)
            cout << "NA\n";
    }

    return 0;
}

Measured memory_bytes: 1212
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def calc(x):
    lim=a*b
    mx=ceil(x, 2)*(x//2+1)
    return mx>=lim

Q=INT()
for _ in range(Q):
    a,b=MAP()

    # 例外処理
    if a==b:
        print(a*2-2)
        continue

    # 二分探索
    low=1
    hi=10**18
    while low+1<hi:
        mid=(hi+low)//2
        if calc(mid):
            hi=mid
        else:
            low=mid
    print(low-1)


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

class UnionFind {
private:
    vector<int> par, rank;
    int count;
public:
    UnionFind(int n) : par(n), rank(n), count(0) {
        for (int i = 0; i < n; i++)	par[i] = i;
    }
    int find(int p) {
        while(p != par[p]) {
            par[p] = par[par[p]];
            p = par[p];
        }
        return p;
    }
    int get_count() {
        return count;
    }
    bool connected(int p, int q) {
        return find(p) == find(q);
    }
    void unite(int p, int q) {
        p = find(p);
        q = find(q);
        if (p == q) return;
        if (rank[p] < rank[q]) {
            par[p] = q;
        } else {
            par[q] = p;
            if (rank[p] == rank[q]) rank[p]++;
        }
        count--;
    }
};

int main() {
    int N, K, L;
    cin >> N >> K >> L;
    
    UnionFind uf1(N), uf2(N);
    for (int i = 0; i < K; i++) {
        int a, b;
        cin >> a >> b;
        uf1.unite(--a, --b);
    }
    for (int i = 0; i < L; i++) {
        int a, b;
        cin >> a >> b;
        uf2.unite(--a, --b);
    }

    map<pair<int, int>, int> nums;
    for (int i = 0; i < N; i++) {
        nums[make_pair(uf1.find(i), uf2.find(i))]++;
    }
    for (int i = 0; i < N; i++) {
        if (i) cout << " ";
        cout << nums[make_pair(uf1.find(i), uf2.find(i))];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 15104
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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










int main(){
    int N; std::cin >> N;
    long long ans(0), d(0), s(0);
    {
        int A;
        for(int i(0); i < N; ++i){
            std::cin >> A;
            (s += A) %= MOD;
            (d += (long long)A*A) %= MOD;
        }
    }
    ans = (s * s - d) % MOD;
    if(ans < 0) ans += MOD;
    if(ans & 1) ans += MOD;
    ans /= 2;
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long a,b,c,d,n,x,y;
cin>>a>>b>>c>>d>>n;
n=n*4;
if(2*a<b)
b=2*a;
if(2*b<c)
c=2*b;
if(c*2<d)
d=c*2;
if(n==1)
cout<<a<<endl;
if(n>=2&&n<4)
cout<<n%2*a+n/2*b<<endl;
if(n>=4&&n<8)
{
x=n%4;
cout<<n/4*c+x/2*b+x%2*a<<endl;
}
if(n>=8)
{
x=n%8;
y=x%4;
cout<<n/8 *d+x/4*c+y/2*b+y%2*a<<endl;
}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int main(){

	int a,b,n;
	while(~scanf("%d %d %d",&a,&b,&n)){
		double num = (double)a/(double)b;
		int sum = 0;
		for(int i=1;i<=n;i++){
			num *= 10.0;
			ll tmp = (ll)(num + EPS);
			num -= (double)tmp;
			sum += tmp % 10;		
		}

		printf("%d\n",sum);
	}
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end



int main(){
   int t; cin>>t;
   while(t--){
      ll n,a,b,c,d; cin>>n>>a>>b>>c>>d;
      map<ll,ll> dp;
      function<ll(ll)> dfs=[&](ll m){
         if(m==0)return 0LL;
         if(m==1)return d;
         if(dp.count(m))return dp[m];
         ll res=INF; if(m<res/d)res=m*d;
         ll lb=(m/2)*2,rb=((m+1)/2)*2;
         chmin(res,dfs(lb/2)+a+abs(lb-m)*d);
         chmin(res,dfs(rb/2)+a+abs(rb-m)*d);
         lb=(m/3)*3,rb=((m+2)/3)*3;
         chmin(res,dfs(lb/3)+b+abs(lb-m)*d);
         chmin(res,dfs(rb/3)+b+abs(rb-m)*d);
         lb=(m/5)*5,rb=((m+4)/5)*5;
         chmin(res,dfs(lb/5)+c+abs(lb-m)*d);
         chmin(res,dfs(rb/5)+c+abs(rb-m)*d);
         return dp[m]=res;
      };
      cout<<dfs(n)<<endl;
   }
   return 0;
}

Measured memory_bytes: 4428
import java.util.Scanner;
import java.util.Arrays;
class Main{
	public static void main(String[] args){
	Scanner in = new Scanner(System.in);
		while(true){
			
			int[] num = new int[2];
			num[0] = in.nextInt();
			num[1] = in.nextInt();
			Arrays.sort(num);
			if(num[0] == 0 && num[1] == 0){
				break;
			}
			System.out.println(num[0] + " " + num[1]);
		}
	}
}


Measured memory_bytes: 37108
//y18-4 水ようかん(最大値の最小値→最小値固定)X
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace boost_multiprecision = boost::multiprecision;
#define LL long long
#define CINT boost_multiprecision::cpp_int
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int N;
vector<int> L;
vector<int> Lsum;
int sum = 0;

int dp[50005][51];

int solve(int m, int now, int c){//最大値の最小値を求める
    if(now == N && c > 0) return INT_MIN;
    if(now == N) return INT_MAX;
    if(dp[m][now] != INT_MAX) return dp[m][now];
    int re = INT_MAX-1;
    for(int i = now; i<N; i++){
        if(Lsum[i+1]-Lsum[now] >= m && Lsum[i+1]-Lsum[now] < sum)
            re = min(re, max(solve(m, i+1, c+1), Lsum[i+1]-Lsum[now]));
    }
    dp[m][now] = re;
    return re;
}

int main(){
    cin >> N;

    int maximum = INT_MIN;
    int minium = INT_MAX;
    
    Lsum.push_back(0);
    for(int i=0; i<N; i++){
        int l;
        cin >> l;
        L.push_back(l);
        sum += l;
        Lsum.push_back(sum);
        maximum = max(maximum,l);
        minium = min(minium,l);
    }

    for(int i=0; i<sum+1; i++){
        for(int j=0; j<N; j++){
            dp[i][j] = INT_MAX;
        }
    }

    int ans = INT_MAX;
    for(int i=minium; i<sum; i++){
        ans = min(ans, solve(i, 0, 0) - i);
        //cout << i << " " << solve(i, 0, 0) << endl;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 12876
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x)
{
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
const int MAXN = 55;
int n,m,sum,val[MAXN];
ll dp[MAXN][2505],ans;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n),read(m);dp[0][0]=1;
	for(ri i=1;i<=n;i++) read(val[i]),sum+=val[i];
	for(ri i=1;i<=n;i++)
		for(ri j=sum;j>=val[i];j--)
			for(ri k=1;k<=i;k++)
				dp[k][j]+=dp[k-1][j-val[i]];
	for(ri i=1;i<=n;i++){
		if(i*m>sum) break;
		ans+=dp[i][i*m];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
    int menu[5], menu_1[5], last_menu=0, min_time=10;
    int time=0;

    for(int i=0; i<5; i++){
        cin >> menu[i];
        menu_1[i] = menu[i] % 10;
    }

    for(int i=0; i<5; i++){
        if(min_time > menu_1[i]){
            if(menu_1[i] != 0){
                min_time = menu_1[i];
                last_menu = i;
            }
        }
    }

    for(int i=0; i<5; i++){
        if(i != last_menu){
            if(menu_1[i] == 0){
                time += menu[i];
            }
            else{
                time += menu[i] - menu[i] % 10 + 10;
            }
        }
    }
    
    time += menu[last_menu];
    cout << time << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    int N;
    cin >> N;

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

    vector<int> imosL(N + 1, 0);
    for (int i = 0; i < N; i++)
        imosL[i + 1] = max(imosL[i], A[i]);

    reverse(A.begin(), A.end());
    vector<int> imosR(N + 1, 0);
    for (int i = 0; i < N; i++)
        imosR[i + 1] = max(imosR[i], A[i]);

    for (int i = 0; i < N; i++) {
        int l = imosL[i];
        int r = imosR[N - 1 - i];

        cout << max(l, r) << endl;
    }

    return 0;
}


Measured memory_bytes: 3968
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for k in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for k in range(c)] for k in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353

N = INT()
A = LIST()

if A[0] != 0:
    print(0)
    exit()

C = Counter(A)
if C[0] > 1:
    print(0)
    exit()

depth = 0
ans = 1
prev = 1
for k, v in sorted(C.items()):
    if k != depth:
        print(0)
        exit()
    ans *= pow(prev, v, MOD)
    ans %= MOD
    depth += 1
    prev = v
print(ans)


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    vector<int> t(n);
    for (int i=0; i<n; i++) {
        cin >> s[i] >> t[i];
    }

    string x;
    cin >> x;
    int ans = 0;
    int f = false;
    for (int i=0; i<n; i++) {
        if (f) ans += t[i];
        if (s[i] == x) f = true;
    }

    cout << ans << endl;
}


Measured memory_bytes: 888
#include <stdio.h>

int main(void) {
    int H, W;
    int i, j;

    while(1){

        scanf("%d %d", &H, &W);

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

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

                if(i % 2 == 0 && j % 2 == 0){
                    printf("#");
                } else if (i % 2 == 0 && j % 2 == 1){
                    printf(".");
                } else if(i % 2 == 1 && j % 2 == 0){
                    printf(".");
                } else if (i % 2 == 1 && j % 2 == 1){
                    printf("#");
                }
            }

            printf("\n"); //一行出力したあとに改行

        }

        printf("\n");             //空行のための改行

    }


    return 0;
}


Measured memory_bytes: 2044
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
int main()
{
	vector<pair<long,long> >cb;
	long n,m,a,b,c,ans=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>a;
		cb.push_back(make_pair(a,1));
	}
	for(int i=0;i<m;i++)
	{
		cin>>b>>c;
		cb.push_back(make_pair(c,b));
	}
	sort(cb.begin(),cb.end(),greater<pair<long,long> >());
	for(int i=0;n>0;i++)
	{
		ans+=min(n,cb[i].second)*cb[i].first;
		n-=cb[i].second;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

void rec(int d, ll val, vector<ll> &all) {
    all.push_back(val);

    if (d == 10) return;

    for(int i = -1; i <= 1; i++) {
        int add = (val % 10) + i;
        if (add >= 0 && add <= 9) rec(d+1, val*10+add, all);
    }
}

int main() {

    int k;
    cin >> k;

    vector<ll> all;
    for(int i = 1; i < 10; i++) {
        rec(1, i, all);
    }

    sort(ALL(all));

    cout << all[k-1] << endl;

    return 0;
}

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

int main() {
  
  int x,a,b;
  cin >> x >> a >> b;
  if(x>=b-a){
    if(b-a<=0){
      cout << "delicious" << endl;
    } else {
      cout << "safe" << endl;
    }
  } else {
    cout << "dangerous" << endl;
      
}
}

Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

map<long long, long long> mp;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long A, B;
	cin >> A >> B;
	long long g = __gcd(A, B);
	long long x = g;
	for(long long i=2;i*i<=x;i++) {
		while(g%i==0) {
			g/=i;
			mp[i]++;
		}
	}
	if(g!=1) {
		mp[g]++;
	}
	cout << mp.size() + 1;
	return 0;
}


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

using namespace std;

int main()
{
	string s;
	string p;
	cin >> s >> p;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == p[0])
		{
			if (1 == p.size())
			{
				cout << "Yes" << endl;
				return 0;
			}
			int i_tmp = i + 1;
			for (int j = 1; j < p.size(); j++)
			{
				if (i_tmp > s.size() - 1)
				{
					i_tmp = 0;
				}

				if (s[i_tmp] == p[j])
				{
					if (j == p.size() - 1)
					{
						cout << "Yes" << endl;
						return 0;
					}
					i_tmp++;
				}
				else
				{
					break;
				}
			}
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3224
N = input()
A = map(int, raw_input().split())

for i in range(1,N):
    print " ".join(map(str, A))
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
print " ".join(map(str, A)) 

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL<<31;
constexpr static int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    llong r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    vector<llong> B;
    llong tmp = b, t = 1;
    B.push_back(0);
    while (tmp * t <= n) {
        B.push_back(tmp * t);
        ++t;
    }

    for (llong i = 0; i < ceil((double)n / r) + 1; ++i) {
        for (llong j = 0; j < ceil((double)n / g) + 1; ++j) {
            if (upper_bound(all(B), n - i * r - j * g) - lower_bound(all(B), n - i * r - j * g)) ++ans;
        }
    }

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

Measured memory_bytes: 256
// 1:50
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <tuple>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll,ll>;
using tll = tuple<ll,ll,ll>;
#define pb push_back
#define for1(i,n) for (ll i=0;i<(n);(i)++)
#define for2(i,m,n) for (ll i=(m);(i)<(n);(i)++)
#define for3(i,m,n,d) for (ll i=(m);(i)<(n);(i)+=(d))
#define INF (1LL << 60)
#define DEBUG 0
#if DEBUG
    #define dump(v1) dump_1(#v1, v1)
    #define dump2(v1,v2) dump_2(#v1, v1, #v2, v2)
    #define dump3(v1,v2,v3) dump_3(#v1, v1, #v2, v2, #v3, v3)
#else
    #define dump(v1)
    #define dump2(v1,v2)
    #define dump3(v1,v2,v3)
#endif
#if DEBUG
template <typename T>
void dump_1(const string& n1, const T& v1)
{
    cerr << n1 << ": " << v1 << endl;
}
template <typename T1, typename T2>
void dump_2(const string& n1, const T1& v1, const string& n2, const T2& v2)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << endl;
}
template <typename T1, typename T2, typename T3>
void dump_3(const string& n1, const T1& v1, const string& n2, const T2& v2, const string& n3, const T3& v3)
{
    cerr << n1 << ": " << v1 << "  " << n2 << ": " << v2 << "  " << n3 << ": " << v3 << endl;
}
template <typename T1,typename T2>
ostream& operator << (ostream& os, const pair<T1,T2>& v)
{
    os << "(" << v.first << ", " << v.second << ")";
    return os;
}
template <typename T1,typename T2, typename T3>
ostream& operator << (ostream& os, const tuple<T1,T2,T3>& v)
{
    os << "(" << get<0>(v) << ", " << get<1>(v) << ", " << get<2>(v) << ")";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const vector<T>& v)
{
    os << "[";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "]";
    return os;
}
template <typename T>
ostream& operator << (ostream& os, const set<T>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << *it;
    }
    os << "}";
    return os;
}
template <typename T1, typename T2>
ostream& operator << (ostream& os, const map<T1,T2>& v)
{
    os << "{";
    for (auto it = v.begin(); it != v.end(); it++) {
        if (it != v.begin()) {
            os << ", ";
        }
        os << it->first << ":" << it->second;
    }
    os << "}";
    return os;
}
#endif // DEBUG
template <typename T>
void print(const T& v)
{
    cout << v << endl;
}
//---------------------------------------------------------

ll A[3];

void solve()
{
    cin >> A[0] >> A[1] >> A[2];
    sort(A, A+3);
    print(A[0] + A[1]);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}


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

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            Console.WriteLine(Enumerable.Range(1, n).Sum(x => x * GetAllOfSum((long)n / x)));
        }

        private static decimal GetAllOfSum(decimal n)
        {
            return n * (n + 1) / 2;
        }
    }
}

Measured memory_bytes: 28356
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let vs: Vec<usize> = sc.vec(n);
    let cs: Vec<usize> = sc.vec(n);
    let result: usize = vs.iter().zip(cs.iter()).map(|x| {
        if x.0 >= x.1 {
            return x.0 - x.1;
        }
        0
    }).sum();
    println!("{}", result);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self.stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    string s;
    cin >> s;
    if(s=="ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}











Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int r = Integer.parseInt(br.readLine());

		System.out.println((double) (r * 2 * 3.14));
	}
}

Measured memory_bytes: 33228
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

import static java.util.Comparator.*;

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;
    }
    // 最大公約数の取得			
    long gcd(long a, long b) {			
    	if (b == 0)		
    		return a;	
    	return gcd(b, a % b);		
    }			
    			
    // 最小公倍数の取得			
    long lcm(long a, long b) {			
    	return a / gcd(a, b)  * b;		
    }			

    // ==================================================================
    public void solve() {
    	int N = Integer.parseInt(sc.next());
    	int K = Integer.parseInt(sc.next());
    	int[] V = new int[N];
    	for (int i = 0; i < N; i++) {
			V[i] = Integer.parseInt(sc.next());
		}
    	PriorityQueue<Integer> PQ = new PriorityQueue<>();
    	int M = Math.min(N, K);
    	long ans = 0, total;
    	Integer wk;
    	for (int l = 0; l <= M; l++) {
			for (int r = 0; r <= M - l; r++) {
				total = 0;
				PQ.clear();
				for (int i = 0; i < l; i++) {
					total += V[i];
					PQ.add(V[i]);
				}
				for (int i = N - 1; i > N - 1 - r; i--) {
					total += V[i];
					PQ.add(V[i]);
				}
				for (int i = 0; i < K - r - l; i++) {
					wk = PQ.poll();
					if(wk == null || wk >= 0)		break;
					total -= wk;
				}
				ans = Math.max(ans, total);
			}
		}
    	out.println(ans);
    }
    // ==================================================================
}
class PP{
	public int key, val;
	public PP(int key, int val) {
		this.key = key;
		this.val = val;
	}
	public int getKey() {
		return key;
	}
	public int getVal() {
		return val;
	}
}

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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int sum=0;
  rep(i,n) sum+=a[i];
  if(a[m-1]*4*m>=sum) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main(){
int A;int B;int C;
cin >> A;cin>> B;cin>>C;
 
if(A<C&&C<B){
cout <<"Yes" <<endl;
}else if(B<C&&C<A){
cout <<"Yes" <<endl;
}
else{
cout <<"No" <<endl;
}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb          push_back
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,i,j,k,l,sum=0,flag=0,t,ans=0;
int dp[10001][101][2];
string s;
int f(int pos, int rem , int bada){
	//cout<<pos<<" "<<rem<<" "<<bada<<endl;
	if(pos==n)
		return (rem == 0);
	if(dp[pos][rem][bada]!=-1)
		return dp[pos][rem][bada];
	int ans=0;
	if(bada==0){
		for(int j=0;j<=(s[pos]-'0');j++){
			ans= (ans+f(pos+1,(rem +j)%k,j<s[pos]-'0'))%hell;
		}
	}else{
		for(int j=0;j<=9;j++){
			ans=(ans+f(pos+1,(rem+j)%k,1))%hell;
		}
	}
	return dp[pos][rem][bada]=ans;
}
void solve(){
 	memset(dp,-1,sizeof dp);
    cin>>s;
     n = s.size();
    cin>>k;
    cout<<(f(0,0,0)-1+hell)%hell<<endl;
}
signed main()
{
    ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 16896
#include <iostream>
#include <cmath>

using namespace std;

bool is_sq(int m)
{
  int sq = (int)sqrt(m);
  return (m == sq*sq);
}
int main(void){
  int n;
  cin >> n;
  int count = 0;
  for(int m = 1; m <= n; m+=2){
    int f_c = 0;
    if(is_sq(m)){
      continue;
    }
    for(int i = 1; i < sqrt(m); i++){
      if(m % i == 0){
        f_c++;
      }
    }
    if(f_c == 4){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int h, w, i, j;
	while (1) {
		scanf("%d %d", &h, &w);
		if (h == 0 && w == 0)
			break;

		for (i = 1; i <= h; i++) {
			for (j = 1; j <= w; j++) {
				printf("#");
			}printf("\n");
		}printf("\n");
	}
	
	return(0);
}


Measured memory_bytes: 2068
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container;

void main()
{
    auto N = readln.chomp.to!int;
    auto YS = new long[](N+1);
    YS[] = 1;
    YS[0] = 0;
    foreach (i; 2..N+1) {
        long k = 1;
        while (i*k <= N) {
            YS[i*k] += 1;
            k += 1;
        }
    }
    long r;
    foreach (i; 1..N+1) r += YS[i] * i;
    writeln(r);
}

Measured memory_bytes: 80920