akhauriyash/Code-Regression huggingface dataset:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#k, = map(int,read().split())

def make(k):
    n = 50
    q = k//n
    r = k%n
    
    a = [(n-1)+q]*n
    for i in range(r):
        for j in range(n):
            if i==j: a[j] += n
            else: a[j] -= 1
        

    return n,a


def judge(n,a):
    if max(a) < n:
        return 0
    
    ans = 0
    for i in range(n):
        if a[i] > 3*n:
            d = (a[i]-3*n)//(n+1)
            ans += d
            a[i] -= d*(n+1)
    
    #print(ans)
    if ans >= 2*n:
        ans += n*ans    
    else:
        for i in range(n):
            a[i] += ans

    #print(ans,a)
    #return
    
    while True:
        if max(a) < n:
            return ans
        
        idx = max(range(n),key=lambda i:a[i])
        for j in range(n):
            a[j] += 1
        a[idx] -= n+1
        ans += 1
        #print(idx,a)


#n,*a = map(int,read().split())


k, = map(int,read().split())

n,a = make(k)

print(n)
print(*a)

#print(n,a)
#print(k,judge(n,a))






Measured memory_bytes: 9204
program main
  implicit none

  integer :: n, l, a, i, mi = 300, su = 0

  read(*,*)n, l
  do i = 1, n
    a = l + i - 1
    if (abs(a) < abs(mi)) then
      mi = a
    end if
    su = su + a
  end do
  write(*,*)su - mi

end program main

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;


public class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> array = new ArrayList<String>();

		try {
			String str = null;
			while ((str = br.readLine()) != null) {
				array.add(str);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		int N = Integer.parseInt(array.get(0));
		int maxNumber = -1;
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 1; i <= N; i++) {
			String[] data = array.get(i).split(" ");
			int id = Integer.parseInt(data[0]);
			map.put(id, Integer.parseInt(data[1]));
			if(maxNumber == -1 || (map.get(id) > map.get(maxNumber))) {
				maxNumber = id;
			} else if((map.get(id) == map.get(maxNumber)) && id < maxNumber){
				maxNumber = id;
			}
		}
		System.out.println(maxNumber + " " + map.get(maxNumber));
	}
}

Measured memory_bytes: 16996
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rem(i, s, n) for (int i = (s); i >= (n); --i)
using ll = long long;
const int MAX = 1e9+7;

int main(){
    int n, W; cin >> n >> W;
    vector<ll> w(n), v(n);
    rep(i, 0, n) cin >> w[i] >> v[i];

    ll sum_v = accumulate(v.begin(), v.end(), 0LL);

    vector<vector<ll>> dp(n+1, vector<ll>(sum_v+1, MAX));
    dp[0][0] = 0;
        
    rep(i, 0, n){
        rep(j, 0, sum_v+1){
            if(j > v[i]) dp[i+1][j] = min(dp[i][j-v[i]] + w[i], dp[i][j]);
            else dp[i+1][j] = min(dp[i][j], w[i]);
        }
    }

    rem(i, sum_v, 0){
        if(dp[n][i] <= W){
            cout << i << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 80256
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);

int count(string s) {
	int ans = 0;
	rep(i, s.size()) {
		ans += s[i] - '0';
	}
	return ans;
}

signed main()
{
	std::cin.sync_with_stdio(false);
	std::cin.tie(0);

	string N;
	cin >> N;

	int ans = count(N);

	for (int i = 0; i < N.size(); ++i) {
		if (N[i] != '0') {
			string M = N;
			M[i] -= 1;
			REP(j, i + 1, M.size())M[j] = '9';
			ans = max(ans, count(M));
		}
		
	}
	cout << ans << endl;

	return 0;
}

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

int n;
int a[300][300];
int f[300][300];

int main()
{
  cin >> n;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      cin >> a[i][j];
    }
  }

  for(int k = 0; k < n; k++){
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        if(a[i][k] + a[k][j] < a[i][j]){
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }

  for(int k = 0; k < n; k++){
    for(int i = 0; i < n; i++){
      for(int j = 0; j < n; j++){
        if(a[i][k] + a[k][j] == a[i][j] && a[i][k] && a[k][j]){
          f[i][j] = 1;
        }
      }
    }
  }


  ll ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= i; j++){
      if(!f[i][j]) ans += a[i][j];
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, d; cin >> n >> d;
	vector<long long> mv(n + 2), A(n + 2), B(n + 2);
	for(int i = 1; i <= n; i++) cin >> mv[i];
	A[0] = d;
	for(int i = 1; i <= n; i++) A[i] = min(A[i - 1], abs(A[i - 1] - mv[i]));
	B[n + 1] = 1;
	for(int i = n; i >= 1; i--){
		if(B[i + 1] <= mv[i] / 2) B[i] = B[i + 1];
		else B[i] = B[i + 1] + mv[i];
	}
	int q; cin >> q;
	while(q--){
		int x; cin >> x;
		if(A[x - 1] >= B[x + 1]) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
struct node {
  int x, y;
} a[N], b[N];
int n, e[N][N], vs[N], mx[N];

bool dfs(int x) {
  for(int i = 1; i <= n; ++i) {
    if(vs[i] || !e[x][i]) continue;
    vs[i] = 1;
    if(!mx[i] || dfs(mx[i])) {
      mx[i] = x;
      return true;
    }
  }
  return false;
}

int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; ++i) {
    scanf("%d%d", &a[i].x, &a[i].y);
  }
  for(int i = 1; i <= n; ++i) {
    scanf("%d%d", &b[i].x, &b[i].y);
  }
  for(int i = 1; i <= n; ++i)
    for(int j = 1; j <= n; ++j) {
      if(a[i].x <= b[j].x && a[i].y <= b[j].y) {
        e[i][j] = 1;
      }
    }
  int ans = 0;
  for(int i = 1; i <= n; ++i) {
    memset(vs, 0, sizeof vs);
    if(dfs(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}

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

ans=float("inf")
for l in range(n-k+1):
    r=l+k-1
    ans=min(ans,
            abs(add[l])+abs(add[r]-add[l]),
            abs(add[r])+abs(add[r]-add[l])
            )

print(ans)

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

using namespace std;

using ll = long long;
using ld = long double;

void solve() {
    int n, W;
    cin >> n >> W;
    W++;
    vector<int> w(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(W, 0));
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < W; j++) {
            dp[i][j] = max(j - w[i - 1] >= 0 ? dp[i - 1][j - w[i - 1]] + v[i - 1] : 0LL, dp[i - 1][j]);
            ans = max(dp[i][j], ans);
        }
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) solve();

    return 0;
}


Measured memory_bytes: 80256
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N;
std::vector<int>a;

int main()
{
	in >> N;
	a.resize(N);
	rep(i, N) in >> a[i];
	rep(i, N)
	{
		rep(j, N)
		{
			if (i != j && abs(a[i] - a[j]) % (N - 1) == 0)
			{
				out << a[i] << " " << a[j] << std::endl;
				return 0;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  ll n;
  cin >> n;

  ll ans = sqrt(n);

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
// #include <algorithm>
// #include <numeric>
// #include <set>
// #include <cmath>
// #include <string>
// #include <map>
// #include <iomanip>

// #define MOD 1000000007

using namespace std;
// typedef unsigned long long ull;
// typedef long long ll;

void p() {
    cout << "\n";
}
template<class Head, class... Body>
void p(Head head, Body... body) {
    cout << head << ",";
    p(body...);
}


int main(int argc, char const *argv[]) {
    int N;
    string S;
    cin >> N >> S;

    int lc = 0, rc = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == '(') {
            lc += 1;
        } else if (lc > 0) {
            lc -= 1;
        }
        if (S[N-1-i] == ')') {
            rc += 1;
        } else if (rc > 0) {
            rc -= 1;
        }
    }

    string pre, post;
    for (int i = 0; i < rc; i++) {
        pre += '(';
    }
    for (int i = 0; i < lc; i++) {
        post += ')';
    }

    cout << pre + S + post << endl;

    return 0;
}


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


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

        vector<int> v;

        for(int i=0;i<n;i++){
                int temp;
                cin>>temp;

                v.push_back(temp);
        }

        int count=0;

        for(int i=0;i<n;i++){
                if(v[i]>=k){
                        ++count;
                }
        }

        cout<<count<<endl;
}


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

namespace D {
	class Program {
		static void Main(string[] args) {
			var nk = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
			int n = nk[0];
			int k = nk[1];
			var pp = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();

			var ans = new double[pp.Length];

			double max = -33344444;
			int maxindex = 0;

			for (int i = 0; i < k; ++i) ans[0] += pp[i];
			for(int i = 1; i <= pp.Length - k; ++i) {
				ans[i] = ans[i - 1];
				ans[i] -= pp[i - 1];
				ans[i] += pp[i + k - 1];
				if(ans[i] >= max) {
					max = ans[i];
					maxindex = i;
				}
			}

			// foreach (var aa in ans) Console.Write(aa + " ");Console.WriteLine();
			double ansss = 0;
			for(int i = maxindex; i < k + maxindex; ++i) {
				double ngo = 0;
				for (int j = 1; j <= pp[i]; ++j) ngo += j;
				ansss += ngo / pp[i];
			}
			Console.WriteLine(ansss);
		}
	}
}


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

int main(){
    int n, m;
    cin >> n >> m;
    int sum = m*1900 + (n-m)*100;
    int ans = sum*pow(2, m);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll par[100010],ranki[100010]; 

void init(int n){
  fr(i,n){
    par[i]=i;
    ranki[i]=0;
  }
}

int find(int x){
  if(par[x]==x) return x;
  else return par[x]=find(par[x]);
}
 
void unit(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;
  if(ranki[x]<ranki[y]) par[x]=y;
  else par[y]=x;
  if(ranki[x]==ranki[y]) ranki[x]++;
}
 
bool same(int x,int y){
  return find(x)==find(y);
}


int main(){
  ll n,m,k,l;
  vector<ll> v[100010];
  cin>>n>>m;
  fr(i,n){
    cin>>k;
    fr(j,k){
      cin>>l;
      v[l].pb(i);
    }
  }
  init(n);
  Fr(l,m) if(v[l].size()>1) fr(i,v[l].size()-1) unit(v[l][i],v[l][i+1]);
  bool f=1;
  fr(i,n-1) f=f&&same(i,i+1);
  cout<<(f?"YES":"NO")<<endl;
}

Measured memory_bytes: 5376
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T1, class T2>bool chmax(T1& a, const T2& b) { return a < b ? a = b, 1 : 0; }
template<class T1, class T2>bool chmin(T1& a, const T2& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    int ans = 0;
    rep(i, 3) if (S[i] == T[i]) ans++;

    write(ans);
}

Measured memory_bytes: 256
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define ff first
#define ss second
#define mkp make_pair    
#define mkt make_tuple
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vc vector<char> 
#define vll vector< pair<ll,ll> > 
#define pr pair<ll,ll>
#define mps map<string ,ll>
#define mpc map<char ,char>
#define mpl map<ll,ll>
#define tpl tuple<ll,ll,ll>
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;
//	   cin>>t;
	      while(t--)
{

/*
cupofcoffee
cupofhottea*/
ll n,j,k,i;
string s,t;
cin>>s>>t;
ll c=0;
fo(i,s.length())
{
	if(s[i]!=t[i])
	c++;
}
cout<<c;
ee;
}
return 0;
}



Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,q;
  cin>>n>>k>>q;
  vector<int> a(n);
  vector<int> o(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    o.at(i)=a.at(i);
  }
  a.push_back(0);
  sort(o.begin(),o.end());
  int m;
  for(int x=0;x<n;x++){
    vector<vector<int>> c(x+1);
    for(int i=0,p=0;i<=n;i++){
      if(a.at(i)==0){
        sort(c.at(p).begin(),c.at(p).end());
        p++;
      }else
        c.at(p).push_back(a.at(i));
    }
    vector<int> ch;
    for(auto x:c)
      for(int i=0;i<max((int)x.size()-k+1,0);i++)
        ch.push_back(x.at(i));
    if(ch.size()<q)
      break;
    sort(ch.begin(),ch.end());
    m=(x==0?ch.at(q-1)-ch.at(0):min(m,ch.at(q-1)-ch.at(0)));
    for(int i=0;i<n;i++){
      if(a.at(i)==o.at(x)){
        a.at(i)=0;
        break;
      }
    }
  }
  cout<<m<<endl;
}

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;
	if (A + B < C + C) {
		cout << X * A + Y * B << '\n';
	} else {
		int cnt = 2 * min(X, Y);
		cout << min(2 * max(X, Y) * C, cnt * C + A * (X - cnt / 2) + B * (Y - cnt / 2)) << '\n';
	}

	return 0;
}


Measured memory_bytes: 256
/*----------------------------------------
			Author: kkkstra
----------------------------------------*/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 1000000 + 10;
inline int read()
{
	char ch = getchar();
	int f = 1, x = 0;
	while (ch < '0' || ch > '9')
	{
		if (ch == '-')
			f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}

int num[10] = {1, 10, 100, 1000, 10000, 100000, 1000000};
int ans[10] = {0, 9, 9, 909, 909, 90909, 90909};

int main()
{
	int n, i;
	cin >> n;
	if (n == 0)
	{
		printf("0\n");
		return 0;
	}
	for (i = 1; i <= 6; ++i)
		if (n / num[i] == 0)
			break;

	//cout << i << endl;
	int Ans = ans[i - 1];
	if (i % 2)
		Ans += n - num[i - 1] + 1;
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#define fup(i,a,b) for(int i=a;i<=b;i++)
#define fdw(i,a,b) for(int i=a;i>=b;i--)
#define sync ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define cl(a) memset(a,0,sizeof(a))
using namespace std;
typedef long long ll;
const int N=2e5+10;
int a[N];
int main()
{
    int n;
    cin>>n;
    cin>>a[1];
    int t=a[1],ans=1;
    fup(i,2,n)
    {
        cin>>a[i];
        if(t>=a[i])
        {
            t=a[i];
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
//#include "IntMod.h"
//typedef IntMod<1000000007> MInt;

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>

using namespace std;
#define REP(i,a,n) for(int i = a; i < n; ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;

typedef pair<LL, LL> PP;


char a;
int main() {
	cin >> a;
	REP(i, 0, 5) {
		if (a == "aiueo"[i]) {
			cout << "vowel" << endl;
			return 0;
		}
	}
	cout << "consonant" << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int N;
    cin >> N;
    vector<ll> h(N), dp(N, 1e15);
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    dp[0] = 0;
    for (int i = 0; i < N; i++)
    {
        if (i + 1 < N)
            dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
        if (i + 2 < N)
            dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
    cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1792
import math
a, b, x = [ int(x) for x in input().split(' ') ]
low, high = 0, math.pi / 2
while (high - low) / math.pi * 180 > 1e-12:
    alpha = (low + high) / 2
    if alpha < math.atan(b/a):
        vol = a * (a * b - a * a * math.tan(alpha) / 2)
    else:
        vol = a * (b * b * math.tan(math.pi / 2 - alpha) / 2)
    if vol >= x:
        low = alpha
    else:
        high = alpha
print(low / math.pi * 180)



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

using namespace std;

int main(){

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	string S, T;

	cin>>S>>T;

	if(S.size() == T.size() - 1){

		bool same = true;
		for(int i=0; i<S.size(); i++){
			if(S[i] != T[i]){
				same = false;
				break;
			}
		}

		if(same){
			cout<<"Yes\n";
		}else{
			cout<<"No\n";
		}

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


	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int64_t n,a,b,c,d,e;
  cin >> n >> a >> b >> c >> d >> e;
  
  int64_t x = min({a,b,c,d,e});
  
  cout << (n+x-1)/x + 4 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1000000000;

int h, w, c;
vector<pair<int, int>> conn[10];

int cost[10];

vector<int> d;
void dijkstra(int s, vector<int>& d) {
    int n = 10;
    d.assign(n, INF);
    vector<bool> u(n, false);

    d[s] = 0;
    for (int i = 0; i < n; i++) {
        int v = -1;
        for (int j = 0; j < n; j++) {
            if (!u[j] && (v == -1 || d[j] < d[v])) 
                v = j;
        }

        if (d[v] == INF) break;

        u[v] = true;
        for (auto edge : conn[v]) {
            int to = edge.first;
            int len = edge.second;

            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
            }
        }
    }
}


int main() {
    cin.sync_with_stdio(0); cin.tie(0);
    cin >> h >> w;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> c;
            if (i != j) conn[i].push_back({j, c});
        }
    }

    for (int i = 0; i < 10; i++) {
        dijkstra(i, d);
        cost[i] = d[1];
        // cout << cost[i] << "\n";
    }

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> c;
            if (c != -1) {
                // cout << c << " " << cost[c] << '\n';
                ans += cost[c];
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N%10 == 7 || N%100-N%10 == 70 || N-N%100 == 700){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cstdio>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    string s;
    int tmp = 0;
    while(getline(cin,s)){
        for(int i = 0;i < 26;i++){
            string tmp(s);
            for(int j = 0;j < s.length();j++){

                if(isalpha(s[j])){
                    tmp[j] = (s[j]-'a'+i)%26 + 'a';
                }
            }
               
            if(tmp.find("the")!=-1||tmp.find("this")!=-1||tmp.find("that")!=-1) {
                cout << tmp << endl;
                break;  
            }
        }
        
    }


    return 0;
}


Measured memory_bytes: 3144
n = int(input())
ans = [0] * 4
for i in range(n):
  s = input()
  if s == "AC":
    ans[0] += 1
  elif s == "WA":
    ans[1] += 1
  elif s == "TLE":
    ans[2] += 1
  elif s == "RE":
    ans[3] += 1
print ("AC x",ans[0])
print ("WA x",ans[1])
print ("TLE x",ans[2])
print ("RE x",ans[3])

Measured memory_bytes: 9220
#include <iostream>
#include <string>
using namespace std;
  int N;
  string s[109];
  string s1,s2;
  bool flag;
int main() {
  cin >> N;
  s1="";
  flag=true;
  for(int i=0;i<N;i++){
    s2=s1;
    cin >> s[i];
    s1=s[i];
    if(i>0){
      for(int j=0;j<i;j++){
        if(s[i]==s[j]){
          flag=false;
        }
      }
      if(s1.substr(0,1)!=s2.substr(s2.size()-1,1)){
        flag=false;
      }
    }
  }
  if(flag){
    cout << "Yes" << "\n";
  }else{
    cout << "No" << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

int c[4] = {10, 50, 100, 500};

int calc(int n){
    int res = 0;
    repb(i, 3, 0){
        if(n >= c[i]){
            res += n / c[i];
            n %= c[i];
        }
    }
    return res;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    int d[4];
    for(int ii = 0;; ii++){
        cin >> n;
        if(n == 0) break;
        if(ii) cout << endl;
        int sum = 0;
        rep(i, 0, 4){
            cin >> d[i];
            sum += d[i];
        }
        int coin = INF;
        int ans[4] = {};
        rep(i, 0, d[0] + 1){
            rep(j, 0, d[1] + 1){
                rep(k, 0, d[2] + 1){
                    rep(l, 0, d[3] + 1){
                        int tmp = i + j + k + l;
                        int now = 10 * i + 50 * j + 100 * k + 500 * l;
                        if(now < n) continue;
                        tmp = sum - tmp;
                        tmp += calc(now - n);
                        if(tmp < coin){
                            coin = tmp;
                            ans[0] = i;
                            ans[1] = j;
                            ans[2] = k;
                            ans[3] = l;
                        }
                    }
                }
            }
        }
        rep(i, 0, 4){
            if(ans[i] == 0) continue;
            cout << c[i] << ' ' << ans[i] << endl;
        }
    }
}


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

#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 rep3(i, n, s) for (Int i = n - 1; i >= s; i--)
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).end()
 
double EPS = 1e-10;
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

int main() {
    Int n, x;
    cin >> n >> x;
    if (x == 1 or x == 2 * n - 1) {
        print("No");
        return 0;
    }
    vector<Int> res(2 * n - 1);
    res[n - 2] = x - 1;
    res[n - 1] = x;
    res[n] = x + 1;
    Int cnt = 1;
    if (cnt == x - 1) cnt += 3;
    rep(i, n - 2) {
        res[i] = cnt;
        cnt++;
        if (cnt == x - 1) cnt += 3;
    }
    rep2(i, n + 1, 2 * n - 1) {
        res[i] = cnt;
        cnt++;
        if (cnt == x - 1) cnt += 3;
    }
    print("Yes");
    rep(i, res.size()) {
        print(res[i]);
    }
    return 0;
}

Measured memory_bytes: 3072
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    
    int n,a; cin>> n>> a;

    int l=a;
    int r=a+n-1;
    
    int eat;
    if(r<=0) eat=r;
    else if(l>=0) eat=l;
    else eat=0;
    
    int ans = (r+l)*(r-l+1)/2 - eat;
    
    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
// A - Haiku

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(){
    string s;
    cin >> s;
    int a=0;

    for(int i=0;i<4;i++){
        if(s[i]=='+') a++;
        else a--;
    }

    cout << a << endl;

    return 0;
}


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

typedef long long ll;
const int maxn=1e3+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int h,n;
int a[maxn],b[maxn];
int dp[10007];

int32_t main()
{
    IOS
    cin>>h>>n;
    for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
    for (int i=1;i<=h;i++)
    {
        dp[i]=inf;
        for (int j=1;j<=n;j++)
        {
            dp[i]=min(dp[i],dp[max(0,i-a[j])]+b[j]);
        }
    }
    cout<<dp[h]<<endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <cstdio>
#include <complex>
#include <map>
#include <cstring>

using namespace std;

int n;
map<int, int> freq;

void solve()
{
    cin >> n;
    int x;
    for(int i = 0; i < n; ++ i) {
        scanf("%d", &x);
        freq[x] ++;
    }
    long long ans = 0;
    vector<int> vec;
    for(auto e: freq) {
        if (e.second >= 4) {
            ans = max(ans, 1ll * e.first * e.first);
        }
        if (e.second >= 2) {
            vec.push_back(e.first);
        }
    }
    reverse(vec.begin(), vec.end());
    if (vec.size() >= 2) {
        ans = max(ans, 1ll * vec[0] * vec[1]);
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 4992
N = int(input())
line = list(map(int,input().split()))
p = list(map(int,input().split()))
r = list(map(int,input().split()))
ans = 0
count = -30
for i in line:
    if count == i-1:
        ans += r[i-2]
    count = i
    ans += p[i-1]
    
print(ans)



Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;


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

	int W, H, N;
	vector<int> X0, X1, Y0, Y1;

	cin >> W >> H >> N;
	for(int i=0; i<N; i++){
		int x, y, a;
		cin >> x >> y >> a;
		if(a == 1){ X0.push_back(x);}
		else if(a == 2){ X1.push_back(x);}
		else if(a == 3){ Y0.push_back(y);}
		else if(a == 4){ Y1.push_back(y);}
	}

	int x0 = - 1, x1 = W+1, y0 = -1, y1 = H+1;
	if(X0.size() > 0){
		sort(X0.begin(), X0.end());
		x0 = X0[X0.size()-1];
	}
	if(X1.size() > 0){
		sort(X1.begin(), X1.end());
		x1 = X1[0];
	}
	if(Y0.size() > 0){
		sort(Y0.begin(), Y0.end());
		y0 = Y0[Y0.size()-1];
	}
	if(Y1.size() > 0){
		sort(Y1.begin(), Y1.end());
		y1 = Y1[0];
	}

	int ans = 0;
	for(int i=1; i<=W; i++){
		for(int j=1; j<=H; j++){
			if(x0 < i && i <= x1 && y0 < j && j <= y1){
				ans++;
			}
		}
	}

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



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

int main(){
    long long int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(N);
    vector<int> B(M);

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

    for (int j=0; j<M; j++){
        cin >> B[j];
    }

    long long int weightA = 0;
    int a, len_A=N;
    for (int i=0; i<N; i++){
        a = A[i];
        if (weightA + a > K){
            len_A = i;
            break;
        }else{
            weightA += a;
        }
    }

    long long int max_count, current_count;
    max_count = len_A;
    current_count = len_A;
    len_A = len_A;

    long long int weightB = 0;
    long long int b;
    for (int j=0; j<M; j++){
        b = B[j];

        if (len_A == 0 && weightA + weightB + b > K){
            break;
        }


        if (weightA + weightB + b <= K){
            weightB += b;
            current_count++;
        }else{
            while (weightA + weightB + b > K){
                len_A--;
                weightA -= A[len_A];
                current_count--;
                if (len_A == 0){
                    break;
                }
            }
            if (weightA + weightB + b <= K){
                weightB += b;
                current_count++;
            }
        }
        max_count = max(max_count, current_count);
    }
    cout << max_count << endl;
}

Measured memory_bytes: 4488
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<set>
#include<iostream>
#include<stdlib.h>
using namespace std;
typedef long long ll;
#include<stdio.h>

//最大公約数をユークリッドの互除法で、再帰的に求める
ll gcd(ll x, ll y) {
	ll r = y%x;
	if (r == 0)return x;
	else gcd(r, x);
}

int main(void) {
	ll N;
	double tmp = 0, max = 0;
	cin >> N;
	ll *a = (ll*)malloc(sizeof(ll)*N);
	for (ll i = 0;i < N;i++)cin >> a[i];
	sort(a, a + N);
	cout << abs(a[N - 1] - a[0]) << endl;
	return 0;
}

Measured memory_bytes: 256
void main()
{
    long n, m;
    rdVals(n, m);

    long[] tree = new long[n];
    foreach (i; 0 .. m)
    {
        long a, b;
        rdVals(a, b);
        --a, --b;
        ++tree[a], ++tree[b];
    }

    writeln(tree.all!"a % 2 == 0" ? "YES" : "NO");
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4092
# tenka1-2018C - Align
def main():
    N, *A = map(int, open(0).read().split())
    A.sort()
    if N & 1:
        low, high, mid = A[: N // 2], A[N // 2 + 1 :], A[N // 2]
        x = (sum(high) - sum(low)) * 2 - mid + low[-1]
        y = (sum(high) - sum(low)) * 2 + mid - high[0]
        ans = max(x, y)
    else:
        low, high = A[: N // 2], A[N // 2 :]
        ans = (sum(high) - sum(low)) * 2 - high[0] + low[-1]
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 14452
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

void dfs(ll i, ll p, const vector<vl> &g, vl &dis) {
  for (auto&& j : g[i]) {
    if (j != p) {
      dis[j] = 1 + dis[i];
      dfs(j, i, g, dis);
    }
  }
}

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

  ll n, u, v;
  cin >> n >> u >> v;
  vector<vl> g(n);
  rep(i, n-1) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<vl> dis(2, vl(n));

  dfs(u-1, -1, g, dis[0]);
  dfs(v-1, -1, g, dis[1]);

  ll ans = 0;
  rep(i, n) {
    if (dis[0][i] < dis[1][i]) {
      cmax(ans, dis[1][i]-1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 13936
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    vector<int> time(n);
    REP(i,n) cin>>time[i];
    sort(time.begin(),time.end());
    long long ans = 0;
    REP(i,n){
      ans += time[i] * (n-i-1);
    }
    cout<<ans<<endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define pii pair<int, int>;
#define ss second
#define ff first
#define all(x) ((x).begin(), (x).end())

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;
const ll oo = 1 << 31;

int main(void){
    ll a ;
    cin >> a;
    cout << a*a << endl;
return 0;
}

Measured memory_bytes: 256
def main():
    n=int(input())
    fre=[int(''.join(input().split()),2) for i in range(n)]
    pay=[list(map(int,input().split())) for i in range(n)]
    
    ans=-10**9
    for bit in range(1,1<<10):
        money=0
        for i in range(n):
            cnt=format(bit&fre[i],'b').count('1')
            money+=pay[i][cnt]
        ans=max(money,ans)
    print(ans)
if __name__=='__main__':
    main()

Measured memory_bytes: 3064
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
#define MOD (1e9+7)
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")



/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main() { 
  int a,b,c;cin>>a>>b>>c;
  if(a+b+c > 21){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }
}

Measured memory_bytes: 256
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>

using namespace std;

/// 各桁の和
int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
/// 最小公倍数 
int gcd(int x, int y){
      if(x<y){
          int temp = x;
          x = y;
          y = temp;
      }
      int r = x % y;
       while(r!=0){
           x = y;
           y = r;
           r = x % y;
       }
      return y;
   }



int main(){
  int N;
  int A,B;
  cin >> N >> A >> B;
  int C;
  if(A+B >= N){
      C = A + B - N;
  }
  else C = 0;
  cout << min(A,B) << " " << C <<endl;
  }


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

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

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

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

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

ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    (a *= a) %= MOD;
    n >>= 1;
  }
  return res;
}

const ll maxf = 10000000;
ll fact[maxf+5];

void fact_init(){
  fact[0] = 1;
  for(ll i=1; i<=maxf; i++){
    fact[i] = (fact[i-1] * i) % MOD;
  }
}

ll comb(ll a, ll b){
  if(a<b || a<0 || b<0) return 0;
  if(fact[0] == 0) fact_init();
  return (fact[a] * modpow((fact[a-b]*fact[b])%MOD, MOD-2)) % MOD;
}

ll naive_comb(ll a, ll b){
  ll res = 1;
  for (ll i = a; i > a - b; i--) res = res * i % MOD;
  for (ll i = 1; i <= b; i++) res = (res * modpow(i, MOD-2)) % MOD;
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,a,b; cin>>n>>a>>b;
  ll ans=modpow(2,n)-1-naive_comb(n,a)-naive_comb(n,b);
  
  while(ans<0) ans+=MOD;
  ans%=MOD;
  cout<<ans<<endl;
}

Measured memory_bytes: 256
n=int(input())
#print(n)
low = list(map(int,input().split()))
#print("INPUT = ")
#print(low)
count = 0
for i in range(n):
	tmp = int(low[i])
	while tmp % 2 == 0 and tmp !=0:
		tmp = tmp// 2
		count = count + 1
#		print("COUNT=", count, "TMP=",tmp)
#print("ANS = ")
print(count)

Measured memory_bytes: 4148
A,B = list(map(int,input().split(" ")))
S = input()

for i in range(len(S)):

    if i==A:
        if S[i]!="-":
            print("No")
            exit()
    else:
        if not ord('0')<=ord(str(S[i]))<=ord('9'):
            print("No")
            exit()
print("Yes")
            


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
const ll MOD=1e+9+7;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  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{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};
const int NMAX=100010;
mint fact[NMAX],infac[NMAX];
void Make_Fact(){
  fact[0]=fact[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    fact[i]=fact[i-1]*(mint)i;
  }
}
void Make_InvFact(){
  infac[0]=infac[1]=1;
  for(int i=2;i<=NMAX-1;++i){
    infac[i]=infac[i-1]/(mint)i;	
  }
}
mint Comb(int n,int k){
  if(n<0||k<0||n-k<0) return 0;
  return fact[n]*infac[k]*infac[n-k];
}

int main()
{
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }

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

  Make_Fact();
  Make_InvFact();
  
  mint res;
  rep(i,n-k+1){
    res += (mint)(-a[i])*Comb(n-1-i,k-1);
  }
  for(ll i=k-1;i<n;++i){
    res += (mint)a[i]*Comb(i,k-1);
  }

  cout << res.x << "\n";
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
  int a;
  cin >> a;
  if(a%2==0){
      cout << (a/2)*(a/2) << endl;
  }else{
      cout << (a/2)*(a/2+1) <<endl;
  }
  return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;
typedef pair<int, int> p_ii;



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

	int ans = 1;
	set<int>redcnt; redcnt.insert(0);

	for (i = 0; i < m; i++) {
		ball[a[i]]--; ball[b[i]]++;
		if (redcnt.count(a[i])!=0) {
			if (ball[a[i]] == 0) {
				redcnt.erase(a[i]);
				ans--;
			}
			if (redcnt.count(b[i]) == 0) {
				redcnt.insert(b[i]);
				ans++;
			}
		}
		else {
			if (ball[a[i]] < 0)ball[a[i]] = 0;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6144
import numpy as np

inf=10**7
n=int(input())
coin=[6**x for x in range(10)]
coin+=[9**x for x in range(1,10)]

dp=[0]*(n+1)
for (i,x) in enumerate(dp):
    dp[i]+=inf
dp[0]=0


for i in range(n+1):
    for x in coin:
        if(i+x<=n):
            dp[i+x]=min(dp[i+x],dp[i]+1)
print(dp[-1])

Measured memory_bytes: 15944
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S;
	cin>>S;
	char *p = (char*)S.c_str();
	bool isC=false;
	while (*p!='\0'){
		if (!isC){
			if (*p=='C'){
				isC=true;
			}
		}
		if (*p == 'F'){
			if (isC){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		p++;
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256