akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ga = sc.nextInt();
        int sa = sc.nextInt();
        int ba = sc.nextInt();
        int gb = sc.nextInt();
        int sb = sc.nextInt();
        int bb = sc.nextInt();

        int[] ab = new int[N+1];
        ab[0] = 0;
        for(int i = 1; i<N+1; i++) {
            ab[i] = ab[i-1]+1;
            if(i-ga>=0) {
                ab[i] = Math.max(ab[i], ab[i - ga] + gb);
            }
            if(i-sa>=0) {
                ab[i] = Math.max(ab[i] , ab[i - sa] + sb);
            }
            if(i-ba>=0) {
                ab[i] = Math.max(ab[i] , ab[i - ba] + bb);
            }

        }

//        for(long l: ab){
//            System.out.print(l + " ");
//        }
//        System.out.println();

        int M = ab[N];
        //System.out.println(M);
        long[] btoa = new long[M+1];

        for(int i = 1; i<M+1; i++) {
            btoa[i] = btoa[i-1]+1;
            if(i-gb>=0) {
                btoa[i] = Math.max(btoa[i], btoa[i - gb] + ga);
            }
            if(i-sb>=0) {
                btoa[i] = Math.max(btoa[i] , btoa[i - sb] + sa);
            }
            if(i-bb>=0) {
                btoa[i] = Math.max(btoa[i] , btoa[i - bb] + ba);
            }
        }
//        for(long l: btoa){
//            System.out.print(l + " ");
//        }
//        System.out.println();
        System.out.println(btoa[M]);

    }
}

Measured memory_bytes: 217812
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )

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

const int INF = 100000000;
const double PI=3.14159265358979323846;


int main () {
    string S;
    cin >> S;
    int A[3] = {0,0,0};

    rep(i,0,S.size()) {
        if (S[i]=='a') {
            A[0]++;
        }
        else if (S[i]=='b') {
            A[1]++;
        }
        else {
            A[2]++;
        }
    }

    int p = S.size()/3;
    int r = S.size()%3;

    if (A[0]-p>=0 && A[1]-p>=0 && A[2]-p>=0 && A[0]-p<=1 && A[1]-p<=1 && A[2]-p<=1) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }


}









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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
LL dp[1<<13];
int main()
{
    LL n,m;
    cin>>n>>m;
    LL a[m+1],b[m+1],c[m+1];
    for(LL i=0; i<m; i++)
    {
        cin>>a[i]>>b[i];
        LL mask=0;
        for(LL j=0; j<b[i]; j++)
        {
            LL x;
            cin>>x;
            mask=mask|(1<<(x-1));
        }
        c[i]=mask;
    }
    for(LL i=0; i<(1<<n); i++)
        dp[i]=12345678;
    dp[0]=0;
    for(LL i=0; i<(1<<n); i++)
    {
        for(LL j=0; j<m; j++)
        {
            dp[i|c[j]]=min(dp[i|c[j]],dp[i]+a[j]);
        }
    }
//    for(LL i=0; i<(1<<n); i++)
//        cout<<dp[i]<<endl;
    if(dp[(1<<n)-1]==12345678)
        cout<<-1;
    else
        cout<<dp[(1<<n)-1];
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

ll A, V, B, W, T;

ll i, j, k;

int main(){
    scanf("%lld%lld%lld%lld%lld", &A, &V, &B, &W, &T);
    if(A>B)
        swap(A, B);
    if(A+V*T>=B+W*T){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) for(auto i: x){cout << i << " ";}
#define showm(m) for(auto i: m){cout << m.x << " ";}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

long mod = 1000000007;
/* C++の構造体 メンバがpublicなclass */
typedef 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;
    }
} mint_t;

ll intpow(mint_t m, int n)
{
    if (n == 0) return 1;
    mint_t ans(1);
    while (n >= 1)
    {
        if ((n % 2) == 0){
            m *= m.x;
            n /= 2;
        }else {
            ans *= m.x;
            n -= 1;
        }
    }
    return ans.x;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


mint comb(int n, int k){
    mint fact, ifact;
    fact = 1; ifact = 1;

    for (int i = n; i > n-k; i--) fact *= i;
    for (int i = 1; i <= k; i++) ifact *= i;

    return fact / ifact;
}

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

    mint ans = 2;
    //C(n,0)+ C(n,1) + ... + C(n,n) 
    // - C(n, 0) - C(n, a) - C(n, b)
    ans = ans.pow(n);
    ans -= comb(n,a) + comb(n,b);
    ans -= 1;
    cout << ans.x << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
long long t[1002],a[1002];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&t[i],&a[i]);
		if(t[i]>=t[i-1]&&a[i]>=a[i-1])continue;
		else
		{
			long long bt=t[i-1]/t[i],ba=a[i-1]/a[i],b;
			if(t[i-1]%t[i])bt++;
			if(a[i-1]%a[i])ba++;
			b=max(bt,ba);
			t[i]*=b;
			a[i]*=b;
		}
	}
	printf("%lld",a[n]+t[n]);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap

#d = {1:2, 3:5, 6:10, 1000043:3814}
#zip(d.keys(), d.values())<<ap>>(list |c| sorted |c| reversed |c| list |c| print)



a = map(int,input().split())<<ap>>(sorted)
if a[0] == a[1] and a[1] == a[2]:
    print(1);
elif a[0] != a[1] and a[1] != a[2]:
    print(3);
else:
    print(2);



Measured memory_bytes: 20224
import itertools
from collections import defaultdict
from sys import exit

N = int(input())
balls = sorted([tuple(map(int, input().split())) for _ in range(N)])

if N == 1:
    print(1)
    exit()

d = defaultdict(int)
for i, j in itertools.combinations(range(N), 2):
    d[(balls[j][0] - balls[i][0], balls[j][1] - balls[i][1])] += 1
print(N - max(d.values()))


Measured memory_bytes: 3572
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define MAXN 110
#define MAXW 10010
int N, W;
int v[MAXN], w[MAXN];
long long dp[MAXN][MAXW];
int main(void) {
    cin >> N >> W;
    for (int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }
    for (int i = 0; i < W; i++) {
        dp[0][i] = 0;
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) {
                dp[i+1][j] = dp[i][j];
            } else {
                dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 9348
#include<cstdio>
#include<vector>
#include<algorithm>
#include<map>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;


int main(void)
{
	int n, m;
	while(scanf("%d%d", &n, &m)==2)
	{
		vpii ab(n);
		map<int,int> x;

		for(int i=0;i<n;i++)
		{
			scanf("%d%d", &ab[i].first, &ab[i].second);
		}
		sort(ab.begin(), ab.end());

		int ans=0;
		int h=0;
		for(int i=1;i<=m;i++)
		{
			for(;h<ab.size() && ab[h].first<=i;h++)
			{
				x[ab[h].second]++;
			}
			if(!x.empty())
			{
				auto it=x.rbegin();
				ans+=it->first;
				it->second--;
				if(it->second<=0)
				{
					x.erase(it->first);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 1536
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main(){    
  int A,B;
  cin >> A >> B;

  if(A > 12){
    cout << B << endl;
  }
  else if(6 <= A && A <= 12){
      cout << B/2 << endl;
  }
  else{
    cout << "0" << endl;
  } 
}


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

using namespace std;

int main(){
    double l,r;
    vector<pair<int,int>> ans(4,make_pair(0,0));
    while(true){
        cin>>l>>r;
        if(cin.fail())break;
        if(l>=1.1)ans[0].first++;
        else if(l>=0.6)ans[1].first++;
        else if(l>=0.2)ans[2].first++;
        else ans[3].first++;

        if(r>=1.1)ans[0].second++;
        else if(r>=0.6)ans[1].second++;
        else if(r>=0.2)ans[2].second++;
        else ans[3].second++;
    }
    for(auto i:ans)cout<<i.first<<" "<<i.second<<endl;
    return 0;
}


Measured memory_bytes: 3100
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  while(1){
    ll n,a,b,c,x;
    cin>>n>>a>>b>>c>>x;
    if(n==0 && a==0 && b==0 && c==0 && x==0) break;
    vector<ll> v(n);
    rep(i,n) cin>>v[i];
    reverse(ALL(v));
    ll cnt=0;
    while(v.size()>=1 && cnt<=10000){
      if(x==v[v.size()-1]) v.pop_back();
      if(v.size()==0) break;
      x=(a*x+b)%c;
      cnt++;
    }
    if(cnt<=10000) cout<<cnt<<endl;
    else cout<<-1<<endl;
  }
}


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

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int h,w;
vector<string>board;

ll solve(){
    ll ans = 0;
    vector<vector<ll>>dist(h, vector<ll>(w,-1));
    queue<pii>que;
    rep(i, 0, h){
        rep(j, 0, w){
            if(board[i][j]=='#'){
                dist[i][j]=0;
                que.push(pii(i, j));
            }
        }
    }
    while(!que.empty()){
        pii now = que.front();
        que.pop();
        int x = now.first;
        int y = now.second;
        rep(i, 0, 4){
            int nx = x + dx[i];
            int ny = y + dy[i]; 
            //cout << nx << " " << ny << " " << endl;
            if(nx>=h || nx<0 || ny>=w || ny<0)continue;
            if(dist[nx][ny]==-1){
                dist[nx][ny] = dist[x][y]+1;
                que.push(pii(nx,ny));
                //cout << i << endl;
            }
        }
    }
    rep(i, 0, h){
        rep(j, 0, w){
            ans = max(ans, dist[i][j]);
            //cout << dist[i][j] << endl;
        }
    }
    return ans;
}
int main() {
    cin >> h >> w;
    board.resize(h);
    rep(i, 0, h){
        cin >> board[i];
    }
    cout << solve() << endl;
}

Measured memory_bytes: 17296
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
LL A[100000 + 10];
int n, k;
//模拟装货过程
bool check(LL P) {
    int cnt = k;
    for (int i = 0; i < n; ) {
        LL t = P;
        cnt--;
        // 卡车已经用完，证明卡车当前最大装载量不能装完货物
        if (cnt < 0)
            return false;
        while (i < n && t >= 0) {
            // 剩余重量可以装上当前货物
            if (t >= A[i])
                t -= A[i],i++;
            //装不下则用下一辆卡车去装
            if (t < A[i])
                break;
        }
    }
    return true;
}
// 二分找出P的最小值
LL BinarySearch(LL sum) {
    LL left = 0, right = sum;
    LL mid;
    while (left + 1 < right) {
        mid = (left + right) / 2;
        //可以装好货物
        if (check(mid))
            right = mid;
        else
            left = mid;
    }

    return right;
}
int main() {
    LL sum = 0;
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &A[i]);
        sum += A[i];
    }
    LL P = BinarySearch(sum);
    printf("%lld\n", P);
    return 0;
}


Measured memory_bytes: 3992
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

char Shift(int, char);

int main(){
  int i, n;
  string str, _str;
  string The = "the", This = "this", That = "that";
  string::iterator iter1, iter2, iter3;

  while(getline(cin, str)){
    n=1;
    while(1){
      _str = str;
      for(i=0; i<_str.size(); i++)
	_str[i] = Shift(n, _str[i]);

      iter1 = search(_str.begin(), _str.end(), The.begin(), The.end());
      iter2 = search(_str.begin(), _str.end(), This.begin(), This.end());
      iter3 = search(_str.begin(), _str.end(), That.begin(), That.end());

      if(iter1 != _str.end() || iter2 != _str.end() || iter3 != _str.end())
	break;

      n++;
    }

    cout << _str << endl;
  }

  return 0;
}

char Shift(int n, char c){
  int x;
  if(c >= 'a' && c <= 'z'){
    x = c + n;
    if(x > 122) x -= 26;
    c = x;
  }
  return c;
}

Measured memory_bytes: 0
import itertools
import numpy as np
import math

N = int(input())
X = [[] for _ in range(N)]
for i in range(N):
    X[i] = list(map(int, input().split()))
permutations_list = list(itertools.permutations([i for i in range(N)]))

ans = 0
for i in range(len(permutations_list)):
    x = np.argsort(permutations_list[i])
    for j in range(N-1):
        x_i = X[x[j]][0]
        y_i = X[x[j]][1]
        x_j = X[x[j+1]][0]
        y_j = X[x[j+1]][1]
        ans += math.sqrt(pow(x_i - x_j, 2) + pow(y_i - y_j, 2))
print(ans/len(permutations_list))

Measured memory_bytes: 17012
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int k,n;
  cin >> k >> n;
  int a1,previous,next;
  cin >> a1;
  int m = 0;
  for(int i=1;i<n;i++){
    if(i==1){
      previous = a1;
      cin >> next;
    }else{
      previous = next;
      cin >> next;
    }
    m = max(next-previous,m);
  }
  m = max(m,k-(next-a1));
  cout << k-m << endl;
  return 0;
}


Measured memory_bytes: 384
n = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.split(', ')
n = list(map(int, n))
k = int(input())
print(n[k-1])

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

int main(){
    ll n;
    cin>>n;
    ll h=0;
    ll now=0;
    ll ans=0;
    rep(i,n){
        cin>>now;
        if(now>=h)ans++;
        h=max(now,h);
    }
    cout<<ans<<endl;

}



Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct frep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr frep(int l_, int r_): l(std::min(l_, r_)), r(r_) {}
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct brep {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr brep(int l_, int r_): r(std::max(l_, r_) - 1), l(l_ - 1) {}
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

template <class T>
inline T scan() {
  T res;
  std::cin >> res;
  return res;
}

constexpr int inf = (1 << 30) - 1;

int H, N;
int A[1000], B[1000];
int dp[1000][10001];

int main() {
  std::cin >> H >> N;
  for (int i: frep(0, N)) {
    std::cin >> A[i] >> B[i];
  }
  for (int i: frep(0, N)) {
    for (int j: frep(0, H + 1)) {
      dp[i][j] = inf;
    }
  }
  dp[0][0] = 0;
  for (int i: frep(0, N)) {
    for (int j: frep(0, H + 1)) {
      if (i + 1 < N) {
        chmin(dp[i + 1][j], dp[i][j]);
      }
      chmin(dp[i][std::min(H, j + A[i])], dp[i][j] + B[i]);
    }
  }
  std::cout << dp[N - 1][H] << '\n';
  return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

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

vector<vector<int>> number;
vector<int> tmp_num;
ll cnt = 0;
void dfs(int N, int idx, int M){
    if(idx > N) {
        number.push_back(tmp_num);
        //rep(i,tmp_num.size()){
        //    cout << tmp_num[i] << " ";
        //}
        //cout << endl;
        return ;
    }
    int stt;
    if(idx == 1) stt = 1;
    else stt = tmp_num[idx-2];
    for (int i = stt; i <= M; i++){
        tmp_num.push_back(i);
        dfs(N,idx+1,M);
        tmp_num.pop_back();
    }
}

int main(){
    int N,M,Q;
    cin >> N >> M >> Q;
    int a[Q][4];
    rep(i,Q) cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    ll max_val = 0;
    dfs(N,1,M);
    ll max_cnt = 0;
    rep(i,number.size()){
        ll cnt = 0;
        rep(j,Q){
            if((number[i][a[j][1]-1] - number[i][a[j][0]-1]) == a[j][2]) cnt += a[j][3];
        }
        max_cnt = MAX(max_cnt,cnt);
    }
    cout << max_cnt << endl;
    

    return 0;
}


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

uint64_t recur(uint64_t i) {
  
  if ( i == 1 ) {
    return 1;
  }
  
  return 1 + recur( i / 2 ) * 2;  
}

int main()
{
    // スペース区切りの整数の入力
    uint64_t h;
    cin >> h;
  
    uint64_t result = recur(h);

    // 出力
    cout << result << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
using ll = long long;

const ll MOD = 1e9 + 7;

int main() {
  int N;
  cin >> N;
  vector<ll> a(N), b(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  vector<int> sumL(N + 1, 0), sumG(N + 1, 0);
  for (int i = 0; i < N; i++) {
    sumL[i + 1] = sumL[i] + (b[i] < a[i]);
    sumG[i + 1] = sumG[i] + (b[i] > a[i]);
  }
  ll res = 1;
  int i = 0, j = 0;
  for (int k = 0; k < N; k++) {
    ll c = 1;
    if (b[k] < a[k]) {
      while (i < N && a[i] < b[k]) ++i;
      if (i < k) {
        c += sumL[k] - sumL[i];
      }
    } else {
      while (j < N && b[j] < a[k]) ++j;
      if (j < k) {
        c += sumG[k] - sumG[j];
      }
    }
    res = res * c % MOD;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <cstdio>
int N,P,a[2];
int main(){
  scanf("%d%d",&N,&P);
  for(int i=0;i<N;i++){
    int x;
    scanf("%d",&x);
    a[x%2]++;
  }
  if(a[1]==0){
    if(P==1)printf("0");
    else printf("%lld",1LL<<N);
  }
  else{
    printf("%lld",1LL<<(N-1));
  }
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
    int k, s, ans = 0;
    cin>>k>>s;
    if(s == 3*k){
        ans = 1;
    }
    else {
        for(int i = 0; i <= k; i++){
            for(int j = 0; j <= k; j++){
                if(i+j <= s && i+j >= s-k)ans++;
            }
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define pr(num) cout << num << "\n"
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 100010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;


int main(void) {
    ll N;
    cin >> N;
    ll dp[MAX];
    ll c[]={1, 6, 36, 216, 216*6, 216*36, 216*216, 9, 81, 729, 729*9, 729*81};
    ll i, j;
    for(i=0; i<=N; i++) {
        dp[i]=INF;
    }
    
    dp[0]=0;
    
    for(i=1; i<=12; i++) {
        for(j=0; j<=N; j++) {
            if(j>=c[i-1])
                dp[j]=min(dp[j], dp[j-c[i-1]]+1);
        }
    }
    
    pr(dp[N]);
    
}

























Measured memory_bytes: 1024
module Main where

import           Data.Char (isLower, isUpper)
import Text.ParserCombinators.ReadP (ReadP, char, satisfy, many, eof, readP_to_S)
import Control.Monad.State
import Data.List (delete)

parser :: ReadP ()
parser = char 'A' *> lowerChar *> many lowerChar *> char 'C' *> many lowerChar *> lowerChar *> eof
-- parser = char 'A' *> many1 lowerChar *> char 'C' *> many1 lowerChar *> eof

lowerChar :: ReadP Char
lowerChar = satisfy isLower

f :: String -> Result
f s = if not . null . readP_to_S parser $ s then AC else WA

main :: IO ()
-- main = interact $ show . f
main = print . f =<< getLine

data Result
  = AC
  | WA
  deriving (Show, Eq)

-- f :: String -> Result
-- f s = if isHeadA s && containsC s && isRemainLower s then AC else WA

isHeadA :: String -> Bool
isHeadA ('A' : _) = True
isHeadA _         = False

containsC :: String -> Bool
containsC = (1 ==) . length . filter ('C' ==) . init . drop 2

isRemainLower :: String -> Bool
isRemainLower = all isLower . remain

remain :: String -> String
remain s =
  -- filter (`notElem` "AC") s
  delete 'A' $ delete 'C' s

  -- let
  --   middle = filter ('C' /=) . init . drop 2
  -- in
  --   (s !! 1 : middle s) ++ [last s]

tests :: [Bool]
tests =
  [ test1
  , test2
  , test3
  , test4
  , test5
  ]

test1, test2, test3, test4, test5 :: Bool
test1 = f "AtCoder" == AC
test2 = f "ACoder" == WA
test3 = f "AcycliC" == WA
test4 = f "AtCoCo" == WA
test5 = f "Atcoder" == WA

-- f :: String -> Result
-- f s = runState (mapM (g (length s)) $ zip [0..] s) 0

-- g :: Int -> (Int, Char) -> State Int Bool
-- g l (0, c)
--   | c /= 'A' = return False
-- g l (i, c)
--   | isUpper c = do
--     if i == 0 || i == l - 1 || c /= 'C'
--       then return False
--       else modify succ

-- g _ _ = return True


Measured memory_bytes: 380
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define nl '\n'

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int , int> pi;

void solve()
{
	string s, t;
	cin>>s>>t;
	int answer = 0;
	int n = (int) s.size();
	for(int i=0 ;i<n; i++)
	{
		if(s[i] != t[i]) answer++;
	}
	cout<<answer<<nl;
}

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


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define int long long
using namespace std;

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

  for (int j = 1; j <= N; j++) {
    if ((int)(double(j) * 1.08) == N) {
      cout << j << endl;
      return 0;
    }
  }

  cout << ":(" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;
#define MAX 100

int M[MAX][MAX];

int main(){
  int n,u,v,j;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>v;
    u--;
    for(int k=0;k<v;k++){
      cin>>j;
      M[u][--j]=1;
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j)cout<<" ";
      cout<<M[i][j];
    }
    cout<<endl;
  }
}


Measured memory_bytes: 3112
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int A = int.Parse(input[0]);
            int B = int.Parse(input[2]);
            if (input[1]=="+")
            {
                Console.WriteLine(A + B);
            }
            else
            {
                Console.WriteLine(A - B);
            }

        }  
    }
}

Measured memory_bytes: 11092
import sys
input = sys.stdin.readline
n = int(input())
num = list(map(int, input().split()))
mod = 10**9+7
num = tuple(num)

from collections import Counter
def factorization(a):
        yy, j = [], 2
        y = yy.append
        while(a > 1):
            for i in range(j, int(a**0.5)+1):
                if a % i == 0:
                    y(i)
                    a, j = a//i, i
                    break
            else:
                y(a)
                break
        return Counter(yy)
      
def primeFactor(N):
    i, n, ret, d, sq = 2, N, {}, 2, 99
    while i <= sq:
        k = 0
        while n % i == 0: n, k, ret[i] = n//i, k+1, k+1
        if k > 0 or i == 97: sq = int(n**(1/2)+0.5)
        if i < 4: i = i * 2 - 1
        else: i, d = i+d, d^6
    if n > 1: ret[n] = 1
    return ret
  
lcd = dict()
for i in num:
  j = factorization(i)
  for x,y in j.items():
    if not x in lcd.keys():
      lcd[x] = y
    else:
      lcd[x] = max(lcd[x],y)

lc = 1
for i,j in lcd.items():
  lc *= pow(i,j,mod)
  
ans =0
for i in range(n):
  ans += lc*pow(num[i], mod-2, mod)
  ans %= mod
print(ans)

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

using namespace std;

int n,i;
long long a[55];

int main(){
	scanf("%d", &n);
	
	for(i = 0; i < n; i++)
	scanf("%lld", &a[i]);
	
	int p = 0;
	
	for(i = 1; i < n; i++){
		if(abs(a[i]) > abs(a[p]))
		p = i;
	}
	
	vector <pair<int, int> > sol;
	
	for(i = 0; i < n; i++){
		if(i != p){
			a[i] += a[p];
			sol.push_back({p, i});
		}
	}
	
	if(a[p] >= 0){
		for(i = 1; i < n; i++){
			if(a[i] < a[i - 1]){
				a[i] += a[i - 1];
				sol.push_back({i - 1, i});
			}
		}
	}
	else{
		for(i = n - 2; i >= 0; i--){
			if(a[i] > a[i + 1]){
				a[i] += a[i + 1];
				sol.push_back({i + 1, i});
			}
		}
	}
	
	printf("%d\n", sol.size());
	
	for(i = 0; i < sol.size(); i++)
	printf("%d %d\n", sol[i].first + 1, sol[i].second + 1);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int a,b,ans;
  scanf("%d %d",&a,&b);
  ans=abs(abs(a)-abs(b));
  if(a>0){
    if(b>0){
      if(a>b)ans+=2;
      else ans+=0;
    }
    else ans+=1;
  }
  else if(a==0){
    if(b<0)ans++;
  }
  else{
    if(b>0)ans++;
    else{
      if(a>b)ans+=2;
    }
  }
  printf("%d\n",ans);
  return 0;
}
      
      


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int N; cin >> N;
    rep(i, 100000){
        if(i * i > N){
            cout << (i - 1)*(i - 1) << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 384
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 8000;

int x, y;

string s;

bool dpx[MAX_N][MAX_N * 2], dpy[MAX_N][MAX_N * 2];
vector<int> L[2];

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

    cin >> s >> x >> y;

    bool isx = 0;
    int l = 0;
    L[0].push_back(0);
    L[1].push_back(0);
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'F') {
            l++;
        } else {
            if (l > 0) {
                L[isx].push_back(l);
            }
            isx = !isx;
            l = 0;
        }

        if (s[i] == 'F' && i == s.size() - 1) {
            L[isx].push_back(l);
        }
    }
    int xmax = 0;
    for (int i = 1; i < L[0].size(); i++) {
        xmax += L[0][i];
    }
    int ymax = 0;
    for (int i = 1; i < L[1].size(); i++) {
        ymax += L[1][i];
    }

    dpx[0][xmax] = 1;
    for (int i = 0; i < L[0].size() - 1; i++) {
        for (int j = 0; j <= 2 * xmax; j++) {
            if (i == 0 && s[0] == 'F') {
                dpx[i + 1][j + L[0][i + 1]] |= dpx[i][j];
            } else {
                dpx[i + 1][j + L[0][i + 1]] |= dpx[i][j];
                if (j >= L[0][i + 1]) {
                    dpx[i + 1][j - L[0][i + 1]] |= dpx[i][j];
                }
            }
        }
    }

    dpy[0][ymax] = 1;
    for (int i = 0; i < L[1].size() - 1; i++) {
        for (int j = 0; j <= 2 * ymax; j++) {
            dpy[i + 1][j + L[1][i + 1]] |= dpy[i][j];
            if (j >= L[1][i + 1]) {
                dpy[i + 1][j - L[1][i + 1]] |= dpy[i][j];
            }
        }
    }

    /*
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < L[i].size(); j++) {
            cout << "i = " << i << ", j = " << j << ", L = " << L[i][j] << "\n";
        }
    }

    for (int i = 0; i < L[0].size(); i++) {
        for (int j = 0; j <= 2 * xmax; j++) {
            cout << "i = " << i << ", j = " << j << ", dpx = " << dpx[i][j] << "\n";
        }
    }
    for (int i = 0; i < L[1].size(); i++) {
        for (int j = 0; j <= 2 * ymax; j++) {
            cout << "i = " << i << ", j = " << j << ", dpy = " << dpy[i][j] << "\n";
        }
    }
    */

    if (dpx[L[0].size() - 1][x + xmax] && dpy[L[1].size() - 1][y + ymax]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

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

int main(){
	int a1, a2, a3;
  	cin >> a1 >> a2 >> a3;
  	
  	int ans = a1 + a2 + a3;
  	if(ans > 21) cout << "bust" << endl;
  	else cout << "win" << endl;
}

Measured memory_bytes: 3608
import math

def f(n):
    arr = list()
    temp = n
    for i in range(2, int(math.sqrt(n)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(tuple([i, cnt]))

    if temp != 1:
        tup = tuple([temp, 1])
        arr.append(tup)

    if len(arr) == 0:
        tup = tuple([n, 1])
        arr.append(tup)

    return arr

N = int(input())
if N == 1:
    print(0)
    exit()

t = f(N)
res = 0

for a in t:
    cnt = 0
    c = 0
    while cnt <= a[1]:
        c += 1
        cnt += c
    res += c - 1
    
print(res)


Measured memory_bytes: 9244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll x;cin>>x;
    ll n=x%11;
    if(n==0){
        cout<<2*x/11<<endl;
    }else if(n<=6){
        cout<<2*(x/11)+1<<endl;
    }else{
        cout<<2*(x/11)+2<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int i, j, n, m, x, max, _max;

  scanf("%d %d", &n, &m);

  for(i=0, max=0; i<n; ++i){
    for(j=0, _max=0; j<m; ++j){
      scanf("%d", &x);
      _max += x;
    }
    if(max < _max) max = _max;
  }

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

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	long long x, y, z;
	cin >> x >> y;

	if (x % y == 0) {
		z = -1;
	} else {
		z = x;
	}

	cout << z << '\n';
}

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

using namespace std;

#ifndef ONLINE_JUDGE
  #define pr_debug(...) do { printf("DEBUG: line %d: %s: ", __LINE__, __PRETTY_FUNCTION__); printf(__VA_ARGS__); } while(0)
  #define pr_vars(...) do { pr_debug(" "); pr_var(split(#__VA_ARGS__, ',').begin(), __VA_ARGS__); } while(0)
#else
  __attribute__ ((constructor)) static void fast_cin() { ios_base::sync_with_stdio(false); cin.tie(0); }
  #define pr_debug(...) do { } while(0)
  #define pr_vars(...) do { } while(0)
#endif /* ONLINE_JUDGE */

using ll = int64_t;
using ull = uint64_t;
#define X first
#define Y second
#define pb push_back

template<typename T> ostream &operator<< (ostream &fout, const vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fout << vec[i] << ' '; return fout; }

template<typename T> istream &operator>> (istream &fin, vector<T> &vec)
{ for (size_t i = 0; i < vec.size(); i++) fin >> vec[i]; return fin; }

vector<string> split(const string &s, char c) { vector<string> v; ull st = 0, fn = 0, lvl = 0;
for ( ; fn < s.size(); fn++ ) { if (s[fn] == c && lvl == 0) { v.push_back(s.substr(st, fn - st)); st = fn + 1; }
if (s[fn] == '(') { lvl++; } if (s[fn] == ')') { lvl--; } } v.push_back(s.substr(st, fn - st)); return v; }

void pr_var(vector<string>::iterator it) { (void) it; cout << endl; }
template<typename T, typename... Args> void pr_var(vector<string>::iterator it, T a, Args... args)
{ cout << *it << "=" << a << "  "; pr_var(++it, args...); }

ll div_ceil(ll n, ll d) { ll res = n / d; if (res >= 0) res += n % d ? 1 : 0; return res; }
ll gcd(ll a, ll b) { a = llabs(a); b = llabs(b); while (a && b) a > b ? a %= b : b %= a; return a + b; }
ll lcm(ll a, ll b) { ll c = gcd(a, b); return c == 0 ? 0 : llabs(a / c * b); }

#define setp(a) fixed << setprecision(a)
const double PI = acos(-1.0);
constexpr double EPS = 1e-9;
constexpr ll INF = numeric_limits<ll>::max();
constexpr ll MOD = 1e9 + 7;

using mp = pair<ll, ll>;
using mt = tuple<ll, ll, ll>;    // unpack: tie(ll, ll, ll) = mt;

constexpr ll MAX = 1e5 + 5;

int main()
{
    ll res = 0;
    ll a, b, c, d; cin >> a >> b >> c >> d;
    vector<ll> v = {a + c, b + c, a + d, b + d};
    sort(v.begin(), v.end());
    res = v[0];

    cout << res << endl;
    return 0;
}


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

int main(){
    int n,a,b;cin>>n>>a>>b;
    long long ans = 1;
    if (a>b||(n==1&&a!=b)) ans = 0;
    else if(n==1&&a==b) ans = 1;
    else ans += (long long)(b-a)*(n-2);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(void) {
    long long int a, i, X;
    i = 100;
    scanf("%lld", &X);
    for(a = 0; X > i; a++) {
        i = i + i/100;
    }
    printf("%lld\n", a);
    return 0;
}

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

int main(int argc, char const *argv[])
{
    int n; cin >> n;
    int m = sqrt(n*2);
    if (m*(m+1)!=n*2) cout << "No" << endl;
    else {
        cout << "Yes" << endl << m+1 << endl;
        vector<vector<int> > x(m+1, vector<int>(m, 0));
        int voffset=1, idx=0, size=m;
        while (size>0) {
            for(int i=0;i<size;++i) {
                x[idx][i+idx] = i+voffset;
                x[idx+1+i][idx] = i+voffset;
            }
            voffset += size; --size; ++idx;
        }
        for(auto vec: x) {
            cout << vec.size();
            for(auto val: vec) cout << " " << val;
            cout << endl;
        }
    }
    return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = 0;
  bool ok = true;

  ll na, nb, nc;
  while(ok) {
    //    printf("%lld %lld %lld\n", a, b, c);
    if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
      break;
    }
    na = b / 2 + c / 2;
    nb = a/ 2 + c / 2;
    nc = a / 2 + b / 2;
    ans ++;
    if(ans > 30) {
      ok = false;
      break;
    }
    a = na;
    b = nb;
    c = nc;
  }
  

 cout << (ok?ans:-1) << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

int main(){
  long double t, x;
  cin >> t >> x;
  cout << t / x << endl;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  char c[6];
  for(int i=0; i<6; i++){
    cin >> c[i];
  }
  if(c[0] == c[5] && c[1] == c[4] && c[2] == c[3])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
typedef complex<double> Point;
#define X real()
#define Y imag()

double dot(Point a, Point b) {
	return a.X*b.X + a.Y*b.Y;
}

Point proj(Point a1, Point a2, Point p) {
	return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}

int main(void){
	double x1,y1,x2,y2,x,y;
	int q;
	cin>>x1>>y1>>x2>>y2>>q;
	rep(i,q){
		cin>>x>>y;
		Point p=proj({x1,y1},{x2,y2},{x,y});
		printf("%.9f %.9f\n",p.X,p.Y);
	}
	return 0;
}

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

int main() {  
  ll s;
  cin >> s;
  cout << 0 << ' ' << 0 << ' ' << 1000000000 << ' ' << 1 << ' ';
  ll x3, y3;
  y3 = (s + 999999999) / 1000000000;
  x3 = 1000000000 * y3 - s;
  cout << x3 << ' ' << y3 << endl;
}  

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) V vec(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define callp(a) for(cont elm:a)debgp(elm)
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

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

  int H,W,D,Q;
  cin>>H>>W>>D;
  VP A(H*W+1);
  reps(i,H){
    reps(j,W){
      int a;cin>>a;
      A[a]={i,j};
    }
  }
  cin>>Q;
  VP query(Q);
  rep(i,Q)cin>>query[i].fi>>query[i].se;

  VL mp(H*W+1,0);
  reps(i,D){
    for(int j=i+D;j<=H*W;j+=D){
      ll res=abs(A[j].fi-A[j-D].fi)+abs(A[j].se-A[j-D].se);
      mp[j]=mp[j-D]+res;
    }
  }

  for(auto q:query)
    cout<<mp[q.se]-mp[q.fi]<<"\n";

  
  
  
  return 0;
}



Measured memory_bytes: 4864
S = input()
T = input()
s, t = len(S), len(T)
L = []
for i in range(s-t+1):
  if all(S[i+j]==T[j] or S[i+j]=="?" for j in range(t)):
    L.append(S[:i]+T+S[i+t:])
L = [l.replace("?", "a") for l in L]
print(min(L) if len(L)>0 else "UNRESTORABLE")

Measured memory_bytes: 9128