akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDisjointSetOfCommonDivisors solver = new DDisjointSetOfCommonDivisors();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDisjointSetOfCommonDivisors {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            HashSet<Long> a = new HashSet<>();
            HashSet<Long> b = new HashSet<>();
            long an = in.nextLong();
            long bn = in.nextLong();
            Maths.primeFactors(an, a);
            Maths.primeFactors(bn, b);
//        out.println(b);
//        out.println(a);
            long ans = 0;
            for (Long x : a) {
                if (b.contains(x)) ans++;
            }

            out.println(ans + 1);
        }

    }

    static class Maths {
        static void primeFactors(long n, HashSet<Long> set) {
            if (n % 2 == 0) set.add((long) 2);
            while (n % 2 == 0) {
                n = n / 2;
            }
            for (int i = 3; i <= Math.sqrt(n); i = i + 2) {
                if (n % i == 0) set.add((long) i);
                while (n % i == 0) {
                    n = n / i;
                }
            }
            if (n > 2) set.add(n);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



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

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;

  double h_angle = (360.0 / 12.0 * h) + (360.0 / 12.0 * m / 60.0);
  double m_angle = 360.0 / 60.0 * m;
  double angle   = abs(h_angle - m_angle);
  double radian  = angle * M_PI / 180.0;
  double ans = sqrt(pow(a, 2) + pow(b, 2) - 2 * a * b * cos(radian));
  // cout << "M_PI    : " << M_PI << endl;
  // cout << "h_angle : " << h_angle << endl;
  // cout << "m_angle : " << m_angle << endl;
  // cout << "angle   : " << angle << endl;
  // cout << "radian  : " << radian << endl;
  // cout << "ans     : " << ans << endl;

  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 4248
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
#from math import floor, ceil
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
#inf = 10**17
#mod = 10**9 + 7

n,k=MI()
s=input()
#print(s)
ans=0
for i in range(n-1):
    u=s[i:i+1]
    v=s[i+1:i+2]
    if u==v:
        ans+=1
print(min(n-1,ans+2*k))

Measured memory_bytes: 3572
N=int(input())

def dfs(s):
    if int(s)>N:
        return 0
    else:
        if all(s.count(c)>=1 for c in "753"):
            res=1
        else:
            res=0
        for c in "753":
            res+=dfs(s+c)
        return res

print(dfs("0"))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N;cin>>N;
    vector<int> s(N);
    REP(i, N) cin >> s[i];
    bool dp[101][100001]={};
    dp[0][0]=true;
    REP(i,N) REP(j,1e5+1){
        dp[i+1][j]|=dp[i][j];
        if(s[i]+j<=1e5) dp[i+1][s[i]+j]|=dp[i][j];
    }
    int ans=0;
    REP(i,1e5+1) if(i%10!=0&&dp[N][i]) ans=max(ans,i);
    cout<<ans<<endl;
}

Measured memory_bytes: 10112
A, B = map(int, input().split())
S = input()

flg = True

if (len(S) != A + B + 1):
    flg = False
else:
    for i in range(len(S)):
        if i == A and S[i] != '-':
            flg = False
            break
        elif i != A:
            if S[i] < '0' or '9' < S[i]:
                flg = False
                break

print("Yes" if flg else "No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    string s;
    int q;
    cin >> s >> q;
    bool flip = false;
    stringstream h, t;
    t << s;
    rep(qi, q) {
        int ty;
        cin >> ty;
        if (ty == 1) {
            flip = !flip;
        } else {
            int tyty;
            char c;
            cin >> tyty >> c;
            if (!flip) {
                if (tyty == 1) {
                    h << c;
                } else {
                    t << c;
                }
            } else {
                if (tyty == 1) {
                    t << c;
                } else {
                    h << c;
                }
            }
        }
    }
    if (!flip) {
        string tmp = h.str();
        reverse(tmp.begin(), tmp.end());
        cout << tmp << t.str() << endl;
    } else {
        string tmp = t.str();
        reverse(tmp.begin(), tmp.end());
        cout << tmp << h.str() << endl;
    }
    return 0;
}


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

int main()
{
  string s;
  cin >> s;
  int n = s.size();
  if(n & 1)
    cout << "No";
  else
  {
    n /= 2;
    string s1 = "";
    while(n--)
    {
      s1 += "hi";
    }
    
    if(s == s1)
      cout << "Yes";
    else
       cout << "No";
  }
}

Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<std::vector<int> > g(n);
	rep(i,n-1) {
		int a,b;
		std::cin >> a >> b;
		a--;b--;
		g[a].emplace_back(b);
		g[b].emplace_back(a);
	}
	std::vector<int> c(n);
	rep(i,n) std::cin >> c[i];
	rep(i,n) {
		int x;
		std::cin >> x;
		c[i]=x-c[i];
	}
	std::vector<int> push(n,0);
	auto dfs = [&] (auto f, int i, int par) -> void {
		int psum=0,nmax=0;
		for(auto to:g[i]) {
			if(to==par) continue;
			f(f,to,i);
			psum+=push[to];
		}
		push[i]=psum-c[i];
	};
	dfs(dfs,0,-1);
	int min = 0;
	int count = 0;
	auto dfs2 = [&] (auto f, int i, int par, int x) -> void {
		x+=push[i];
		min=std::min(min,x);
		count+=x;
		for(auto to:g[i]) {
			if(to==par) continue;
			f(f,to,i,x);
		}
	};
	dfs2(dfs2,0,-1,0);
	count=0;
	debug(min);
	dfs2(dfs2,0,-1,-min);
	print(count);
	return 0;
}



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

int main()
{
    ll n,count=0;
    cin>>n;
    ll a[n];
    ll b[n];
    for (int i = 0; i < n; i++) 
    {
       cin>>a[i]>>b[i];
       
    }
    for (int i = 1; i < n-1; i++) 
    {
       if(a[i-1]==b[i-1] && a[i]==b[i] && a[i+1]==b[i+1])
       {
           count++;
           break;
       }
    }
    if(count>0)
    {
        cout<<"Yes"<<endl;
    }
	else
	{
	    cout<<"No"<<endl;
	}
}


Measured memory_bytes: 3612
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

int main(){
	string s;
	cin>>s;
	int MIN=200000;
	int MAX=0;
	rep(i,s.size()){
		if(s[i]=='A'){
			MIN=min(MIN,i);
		}
		if(s[i]=='Z'){
			MAX=max(MAX,i);
		}
	}
	cout<<MAX-MIN+1<<endl;

	return 0;
}














Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>

using namespace std;

int main() {

	while (1) {
		int n;
		cin >> n;
		if (n==0) break;

		int cnt = 0;
		for (int i = n + 1; i <= n * 2; i++) {
			bool flag = true;
			for (int j = 2; j*j <= i ; j++) {
				if (i%j == 0) {
					flag = false;
					break;
				}
			}
			if (flag) cnt++;
		}
		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 2964
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    n = [-1] * (N + 1) # 各町を何番目に通ったか
    
    i = 1
    cur_town = 1
    next_town = A[cur_town-1]
    while i <= K:
        cur_town = next_town
        # 次の町がまだ訪れたことのない町なら次の町へ
        if n[A[cur_town-1]] == -1:
            n[cur_town] = i
            next_town = A[cur_town-1]
            i += 1
        # ある場合
        else:
            # ループの長さ
            loop_len = i - n[A[cur_town-1]] + 1
            # 残り
            rest = K - i
            # print(n)
            # print(i, loop_len, rest, A[cur_town-1], n[A[cur_town-1]])
            if rest >= loop_len:
                n[cur_town] = i
                i += loop_len * int(rest // loop_len)
            else:
                next_town = A[cur_town-1]
                i += 1
    print(cur_town)

if __name__ == '__main__':
    main()

Measured memory_bytes: 32372
#include<bits/stdc++.h>
 
#define lli long long int
#define endl "\n"
 
using namespace std;
 
typedef long long int LLI;
typedef double DB;
 
void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}
 
 
bool comparator(pair<lli,lli> a,pair<lli,lli> b)
{
    if(a.first>b.first)
        return true;
    else if (a.first==b.second)
    {
        if(a.second>=b.second)
            return false;
        return true;
    }
    return false;
}
 
int mods(int x)
{
    if(x>0)
        return x;
    return -x;
}
 
lli gcd(lli a,lli b)
{
    return __gcd(a,b);
}
 
lli lcm(lli x,lli y,lli z)
{
    lli j=gcd(x,y);
    lli k=gcd(y*x/j,z);
    return (((x*y)/j)*z)/k;
} 

int isprime(int n)
{
    for(int i=2;i<=sqrt(n);++i)
    {
        if(n%i==0) return 0;
    }
    return 1;
}

int main()
{
    fastio();
    int n,d,x; cin>>n>>d>>x; int arr[n]={0}; for(int i=0;i<n;++i) cin>>arr[i]; x+=n; --d;
    for(int i=0;i<n;++i)
    {
        x+=(d/arr[i]);    
    }
    cout<<x;
    return 0;
}

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

int main(){
    int N, C, sum=0;
    cin >> N >> C;
    int p[C];

    for(int i=1; i<=C; i++){
        cin >> p[i];
        sum += p[i];
    }

    if(sum-N+1 > 0){
        if(sum%(N+1) == 0){
            cout << sum/(N+1) << endl;
        }else{
            cout << sum/(N+1)+1 << endl;
        }
    }else if(sum-N+1 < 0){
        cout << 1 << endl;
    }else{
        cout << sum/(N+1) << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
/************************************************
 * Au: Hany01
 * Date: Feb 25th, 2018
 * Prob: AGC021 D Reversed LCS
 * Email: hany01@foxmail.com
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
#define rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define fir first
#define sec second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define Mod (1000000007)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

inline int read()
{
	register int _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

inline void File()
{
#ifdef hany01
    freopen("agc021d.in", "r", stdin);
    freopen("agc021d.out", "w", stdout);
#endif
}

const int maxn = 310;

char s[maxn];
int n, k, f[maxn][maxn][maxn];

int main()
{
    File();
	scanf("%s", s + 1), n = strlen(s + 1), k = read();
	For(len, 1, n)
		For(st, 1, n - len + 1) {
			register int ed = st + len - 1;
			For(i, 0, k) {
				if (st == ed) f[st][ed][i] = 1;
				else if (st + 1 == ed) f[st][ed][i] = i || s[st] == s[ed] ? 2 : 1;
				else {
					f[st][ed][i] = max(f[st + 1][ed][i], f[st][ed - 1][i]);
					if (s[st] == s[ed]) chkmax(f[st][ed][i], f[st + 1][ed - 1][i] + 2);
					if (i) chkmax(f[st][ed][i], f[st + 1][ed - 1][i - 1] + 2);
				}
			}
		}
	printf("%d\n", f[1][n][k]);
    return 0;
}

Measured memory_bytes: 114560
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<59;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e5;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int x,y,z;

int main(){
	cin>>x>>y>>z;
	x-=2*z;
	cout<<x/(y+z)+x%(y+z)/y<<endl;
}

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

int main()
{
	map<int, bool> mp;
	int n;
	scanf("%d",&n);
	for (int i = 0; i < n; i++)
	{
		int temp;
		scanf("%d", &temp);
		if (mp[temp])
			mp.erase(temp);
		else
			mp[temp] = true;

	}
	cout << mp.size();
	return EXIT_SUCCESS;
}

Measured memory_bytes: 4864
N, x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))

s = 0
for i in range(N):
	if x - a[i] >= 0:
		x -= a[i]
		s += 1
	else:
		break

if s == N:
	if x != 0:
		s -= 1

print(s)

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

const int N=300005,mod=998244353;
int a[N],b[N],g[N],f[N];
int n;

namespace{
	inline int power(int x,int p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	#define inv(x) (power(x,mod-2))
	inline int fix(int x){
		return x>=mod?x-mod:x;
	}
}

void fwt(int a[],int b[]){
	REP(i,1<<n)b[i]=a[i];
	for(int k=0,d=1;k<n;k++,d<<=1)
		for(int i=0;i<(1<<n);i+=d<<1){
			int *l=b+i,*r=b+i+d,x,y;
			for(int j=0;j<d;j++,l++,r++){
				x=*l,y=*r;
				*l=fix(x+y);
				*r=fix(x+mod-y);
			}
		}
}

int main(){
	scanf("%d",&n);
	int s=0;
	REP(i,1<<n){
		scanf("%d",&a[i]);
		s=fix(s+a[i]);
	}
	s=inv(s);
	REP(i,1<<n)a[i]=(ll)a[i]*s%mod;
	fwt(a,b);
	REP(i,1<<n)g[i]=inv(b[i]+mod-1);
	fwt(g,f);
	int t=f[0];
	REP(i,1<<n){
		f[i]=fix(f[i]+mod-t);
		printf("%d\n",f[i]);
	}
	return 0;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define pb push_back
#define f first
#define s second 
#define int long long
int32_t main()
{
 
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
// int t;
// cin >> t;
// while(t--){

int n;
cin >> n;
int arr[n];
fo(i,0,n)cin >> arr[i];
sort(arr,arr+n,greater<int>());
ll sum = arr[0];
int p = 1;
int i = 1;
while(p < n){
	sum += arr[i]*2;
	p += 2;
	i++;
}
// cout << p << ' ' << i << endl;
if(p == n){
	sum -= arr[i-1];
}
else if(p == n+1){
	sum -= arr[i-1]*2;
}
cout << sum << endl;
   return 0;


}
 
 

 

Measured memory_bytes: 5144
l = [int(input())for i in range(5)]
l1 = ['']*5
ans = 0
for i in range(5):
    l1[i] = l[i]%10
    if l1[i] == 0:
        l1[i] = 10
for i in range(5):
    ans += -(-l[i]//10)
print(ans*10 - 10 + min(l1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer cout<<endl<<"answer : ";
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi //lld t=0;cin>>t;while(t--){
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0;string s;bool flag=false;
        cin>>n;
        lld a[n],b[n],c[n];
        for(i=0;i<n;i++)
            cin>>a[i]>>b[i]>>c[i];
        lld dp[3][n];
        memset(dp,0,sizeof(dp));
        dp[0][0]=a[0]; dp[1][0]=b[0]; dp[2][0]=c[0];
        for(i=1;i<n;i++)
        {
            dp[0][i]=a[i]+max(dp[1][i-1],dp[2][i-1]);
            dp[1][i]=b[i]+max(dp[0][i-1],dp[2][i-1]);
            dp[2][i]=c[i]+max(dp[0][i-1],dp[1][i-1]);
        }
        for(i=0;i<3;i++)
            ans=max(ans,dp[i][n-1]);
        //answer
        cout<<ans<<endl;
        //cout<<endl;
    //}
	return 0;
}
/*  CODED BY:-
           __        __
 /\   /\  |__)  /\  |  \ |__| \ /  /\
/~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\

*/


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int A, B, T;
    cin >> A >> B >> T;
    cout << (T / A) * B << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
int a[40],b;
char S[40];
int main ()
{
	scanf ("%s",S);
	for (b=0;S[b];b++) a[S[b]-'a']++;
	for (b=0;b<26;b++) b=a[b]>1?27:b;
	printf ("%s",b==26?"yes":"no");
	return 0;
}


Measured memory_bytes: 128
package main
import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	S := nextLine()
	if S == "SUN" {
		fmt.Println(7)
	} else if S == "MON" {
		fmt.Println(6)
	} else if S == "TUE" {
		fmt.Println(5)
	} else if S == "WED" {
		fmt.Println(4)
	} else if S == "THU" {
		fmt.Println(3)
	} else if S == "FRI" {
		fmt.Println(2)
	} else {
		fmt.Println(1)
	}
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 10010010010
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int main(){
    int a; cin >> a;
    string s; cin >> s;
    
    if(a>=3200) cout << s << endl;
    else cout << "red"<< endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

    if ((A+B)%2 == 0) {
        K = (A+B)/2;
        cout << K << endl;
    }
    else cout << "IMPOSSIBLE" << endl;
}

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

int main() {
  int N;
  cin >> N;
  string Si;
  vector<string> answerList = {"AC", "WA", "TLE", "RE"};
  vector<int> answerCount(4);
  for(int i=0;i<N;i++) {
    cin >> Si;
    auto itr = std::find(answerList.begin(), answerList.end(), Si);
    if (itr == answerList.end()) {
      cout << "Error. Si is not correct string." << endl;
      return 1;
    }
    int index = distance(answerList.begin(), itr);
    answerCount[index] += 1;
  }
  cout << "AC x " << answerCount[0] << endl;
  cout << "WA x " << answerCount[1] << endl;
  cout << "TLE x " << answerCount[2] << endl;
  cout << "RE x " << answerCount[3] << endl;
}

Measured memory_bytes: 3628
//ABC043 A - 高橋君とホテルイージー

#include <stdio.h>

int main(void) {
    int N, K, X, Y;
    int result;

    scanf("%d", &N);
    scanf("%d", &K);
    scanf("%d", &X);
    scanf("%d", &Y);

    if (N > K) {
        result = K * X + (N - K) * Y;
    } else {
        result = N * X;
    }

    // output
    printf("%d\n", result);

    return 0;
}

Measured memory_bytes: 128
x,n = map(int,input().split())
p = list(map(int,input().split()))
q = []

for i in range(-10, 200):
    if i not in p:
        q.append(i)

ans = 1000000

for i in q:
    if abs(x - ans) > abs(x - i):
        ans = i
    elif abs(x - ans) == abs(x - i):
        if i < ans:
            ans = i

print(ans)


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

using namespace std;

int func(int n)
{
    int sum = 0, largest = 0;
    for (int i = 2; i <= n; i++) {
        if (n % i == 0) {
            sum += i;
            largest = i;
            while (n % i == 0) {
                n /= i;
            }
        }
    }
    sum -= largest;
    return largest - sum;
}

int main()
{
    int a, b;
    while (cin >> a >> b, a) {
        if (func(a) > func(b)) {
            cout << 'a' << endl;
        } else {
            cout << 'b' << endl;
        }
    }        
    return 0;
}

Measured memory_bytes: 3028
#include <iostream>
using namespace std;
int n,s[200000],a,l,cnt,ans;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a;
        s[a-1]=i+1;
    }
    for(int i=0;i<n;i++){
        if(s[i]>l){
            l=s[i];
            cnt++;
        }
        else{
            l=s[i];
            ans=max(cnt,ans);
            cnt=1;
        }
    }
  	ans=max(cnt,ans);
    cout<<n-ans<<endl;
}


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

class Solve {
private:

public:
	bool is_last_query{};
	Solve()
	{
		int N, M;
		scanf("%d%d", &N, &M);
		if (N == 0)
		{
			is_last_query = true;
			return;
		}
		std::vector<int> P(N);
		for (auto& e: P) scanf("%d", &e);
		std::vector<int> former;
		former.reserve((N + 1) * (N + 1));
		former.push_back(0);
		for (auto& e: P) former.push_back(e);
		for (int i{}; i < N; i++)
			for (int j{}; j < N; j++)
				if (P[i] + P[j] <= M)
					former.push_back(P[i] + P[j]);
		std::sort(former.begin(), former.end());
		former.erase(std::unique(former.begin(), former.end()), former.end());
		int max{};
		for (int i{}, pair{(int)former.size() - 1}; i < (int)former.size(); i++)
		{
			while (former[i] + former[pair] > M) pair--;
			max = std::max(max, former[i] + former[pair]);
		}
		printf("%d\n", max);
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}



Measured memory_bytes: 7308
#include <iostream>
#include <string>
typedef long long ll;
//#include <algorithm>
using namespace std;

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

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

  int max = 0;
  int num = 0;
  for(int i = 0; i < N; i++){
    if(max <= h[i]){
      max = h[i];
      num++;
    }
  }
  cout << num << endl;

}


Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int n; cin >> n;
	cout << "ABC" << n << endl;
	return 0;
}

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

int main(void) {
	int n, k; cin >> n >> k;
	vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i];

	vector<int> dp(n, 0);
	dp[0] = 0; dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++) {
		dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
		for (int j = 2; j <= k && i - j >= 0; j++) {
			dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
		}
	}

	cout << dp[n-1] << endl;

	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

template<typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    ll res = 0;
    int k;
    cin >> k;
    // vector<vector<int> > tmp(k + 1, vector<int>(k + 1));
    // FOR (i, 1, k + 1) {
    //     FOR (j, 1, k + 1) {
    //         tmp[i - 1][j - 1] = gcd(i, j);
    //     }
    // }
    // FOR (i, 1, k + 1) {
    //     FOR (j, 1, k + 1) {
    //         FOR (l, 1, k + 1) {
    //             res += gcd(tmp[i - 1][j - 1], l);
    //         }
    //     }
    // }
    FOR (i, 1, k + 1) {
        FOR (j, 1, k + 1) {
            FOR (l, 1, k + 1) {
                res += gcd(i, gcd(j, l));
            }
        }
    } 
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3652
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n>>m>>k;
l(i,n,m+1)
{
    if(i%k==0)
    {
        d++;
    }
}cout<<d<<endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stdio.h>

using namespace std;
typedef long long ll;

#include <functional>
template <typename T>
struct SegTree{
  int n;
  vector<T> node;
  T maxval;
  function<T(T,T)> fn;
  
public:
  SegTree(const vector<T> &v, T maxval0, function<T(T,T)> fn0){
    n=1;
    while((1<<(n-1))<(int)v.size()) n++;
    maxval=maxval0;
    fn=fn0;
    node.resize((1<<n)-1,maxval);
    for(int i=0;i<(int)v.size();i++){
      node[(1<<(n-1))-1+i]=v[i];
    }
    for(int i=(1<<(n-1))-2;0<=i;i--){
      node[i]=fn(node[2*i+1], node[2*i+2]);
    }
  }

  T query(int a, int b){
    int l=(1<<(n-1))-1+a;
    int r=(1<<(n-1))-1+b;
    
    int m=0; 
    T ans=maxval;
    while(true){
      if(r<=(l+1)*(1<<m)-1){
        break;
      }else if(((l&1)==0) && ((l+2)*(1<<m)-1<=r)){
        ans=fn(ans,node[l]);
        ++l;
      }else if((l+3)*(1<<m)-1<=r){
        l/=2; ++m;
      }else if((l+2)*(1<<m)-1<=r){
        ans=fn(ans,node[l]);
        ++l;
      }else{
        l=l*2+1; --m;
      }
    }
    return ans;
  }

  T get(int p){
    return node[(1<<(n-1))-1+p];
  }
  
  int update(int p, T val){
    int cur=(1<<(n-1))-1+p;
    node[cur]=val;
    for(int i=0;i<n-1;i++){
      cur=(cur-1)/2;
      node[cur]=fn(node[2*cur+1],node[2*cur+2]);
    }
    return 0;
  }
    
};

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

  vector<ll> a(N);
  vector<vector<int>> p(N);

  for(int i=0;i<N;i++) cin >> a[i];
  vector<ll> b(N);
  copy(a.begin(),a.end(),b.begin());
  sort(b.begin(),b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  //for(auto bi:b) cout << bi << " " ; cout << endl;
  for(auto &ai:a) ai=distance(b.begin(),lower_bound(b.begin(),b.end(),ai));
  //for(auto bi:a) cout << bi << " " ; cout << endl;
  
  for(int i=0;i<N-1;i++){
    int u,v;
    cin >> u >> v;
    --u; --v;
    p[u].push_back(v);
    p[v].push_back(u);
  }

  int ni=0;
  vector<int> r(N,0);
  vector<int> c(N,0);
  SegTree<int> st(r,0,[](int l0,int r0){return max(l0,r0);});
  r[ni]=1;

  deque<pair<int,int>> q;
  q.push_back(make_pair(ni,1));
  st.update(a[ni],1);

  while(!q.empty()){
    pair<int,int> from=q.back();
    int f=0;
    //cout << from.first << endl;
    for(;c[from.first]<p[from.first].size();c[from.first]++){
      int to=p[from.first][c[from.first]];
      if(r[to]!=0) continue;
      q.push_back(make_pair(to,st.get(a[to])));
      st.update(a[to],max(st.get(a[to]),st.query(0,a[to])+1));
      r[to]=st.node[0];
      //cout << to << " ";
      //for(auto qi:q) cout << qi.first << "(" << qi.second << ") "; cout << endl;
      //for(int i=0; i<N ;i++) cout << st.get(i) << " "; cout << endl;
      f=1;
      break;
    }
    if(f==0){
      st.update(a[from.first],from.second);
      q.pop_back();
    }
  }
  
  for(int i=0;i<N;i++) cout << r[i] << endl;

}


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

using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
void writerLn(int x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000]{ 1 };
list<int>que;

void bfs(int u, char t) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (t) {
				if (d[v] > d[p] && !ok[v]) {
					ok[v] = 1; cnt++; que.emplace_back(v);
				}
			}
			else if (!~d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	memset(d, -1, sizeof(d));
	d[0] = 0; bfs(0, 0);
	rep(i, m) {
		if (d[u[i]] > d[v[i]])swap(u[i], v[i]);
	}
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
		}
	}
	bfs(0, 1);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]], 1);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 14716
/* 

И пусть меня погубит, то к чему я
Бегу, не жалея ног.
И если мне суждено сгореть на восходе,
Я буду идти вперёд.

*/


/* it was worth becoming a chemist */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned int uni;
typedef unsigned long long unll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<long long, int> pli;
typedef pair<int, long long> pil;
typedef vector<int> vi;
typedef vector<long long> vll;

#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
#define NAME "puts"
#define F first
#define S second

const ll INF = 1e18;
const int inf = 1e9;
const int mod = 1e9 + 7;
const db EPS = (db) 1e-9;
const db pi = acos(-1.0);
const int MAXN = 2e5 + 5;

int n;

int main() {	
    cout << setprecision(9) << fixed;

	cin >> n;
	cout << double(double(n - n / 2) / double(n));
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll n,m,dp[1002][1002];
ll mod = 1000000007;
char c;
int main(){
    ios::sync_with_stdio(false);
    cin >> n >> m;
    dp[1][1] = 1;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            cin >> c;
            if(i == 1 && j == 1)continue;
            if(c == '.'){
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] %= mod;
            }
        }
    }
    
    cout << dp[n][m];
    
    
    return 0;
}


Measured memory_bytes: 8064
# Problem: https://atcoder.jp/contests/abc061/tasks/abc061_b
# Python 1st Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def solver(cityNumber, roadNumber):
    result = [0] * cityNumber
    fromList = []
    toList = []
    for _ in range(0, roadNumber, +1):
        tmp_f, tmp_t = MI()
        fromList.append(tmp_f -1)
        toList.append(tmp_t - 1)
    # print("from_LIST:{}".format(fromList))
    # print("to_LIST{}".format(toList))
    city_Count_List = [0] * cityNumber
    for j in range(0,roadNumber,+1):
        city_Count_List[fromList[j]] = city_Count_List[fromList[j]] + 1
        city_Count_List[toList[j]] = city_Count_List[toList[j]] + 1
    result = city_Count_List
    return result
if __name__ == "__main__":
    N, M = MI()
    answerList = solver(N, M)
    for j in range(0, N, +1):
        print("{}".format(answerList[j]))


Measured memory_bytes: 3064
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    K = I()

    # メソッドのみ版
    def search(s):
        d = collections.defaultdict(lambda: inf)
        q = [(1,s)]
        d[s] = 1
        qi = 0
        v = [False] * (K+1)
        v[s] = True
        while len(q):
            k, u = heapq.heappop(q)
            if u == 0:
                return k
            t = u*10 % K
            v[u] = True
            while not v[t]:
                if t == 0:
                    return k
                if d[t] > k:
                    heapq.heappush(q, (k, t))
                    d[t] = k
                v[t] = True
                t = t*10 % K

            i = 1
            t = (u+i) % K
            while not v[t] and t != u:
                if d[t] > k+1:
                    heapq.heappush(q, (k+1, t))
                    d[t] = k+1
                    i = i*10 % K
                    t = (u+i) % K
                else:
                    break

    return search(1)

print(main())




Measured memory_bytes: 23792
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b,c;
    a=b=0;
    for(int i=0;i<4;i++){
        cin>>c;
        a+=c;
    }
    for(int i=0;i<4;i++){
        cin>>c;
        b+=c;
    }
    c=max(a,b);
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 1160
#[allow(dead_code)]
const MOD: usize = 1_000000000 + 7;

fn main() {
    let mut cin = Scanner::new();
    let n = cin.next_usize();
    let mut t = (0..n).map(|_| cin.next_f64()).collect::<Vec<_>>();
    let mut v = (0..n).map(|_| cin.next_f64()).collect::<Vec<_>>();
    t.push(1.0);
    v.push(0.0);

    let mut ans = 0_f64;
    let mut cur_v = 0_f64;
    for i in 0..n {
        let mut acc_t = v[i] - cur_v;
        let mut dec_t = t[i];
        let mut sum_t = t[i];
        for j in i+1..t.len() {
            if dec_t > sum_t - (v[i] - v[j]) {
                dec_t = sum_t - (v[i] - v[j]);
            }
            sum_t += t[j];
        }
        if acc_t > dec_t {
            acc_t = (acc_t + dec_t) / 2.0;
            dec_t = acc_t;
        }
        if acc_t > t[i] {
            acc_t = t[i];
            dec_t = acc_t;
        }
        ans += cur_v * acc_t + acc_t * acc_t / 2.0;
        cur_v += acc_t;
        ans += cur_v * (dec_t - acc_t);
        ans += cur_v * (t[i] - dec_t) - (t[i] - dec_t) * (t[i] - dec_t) / 2.0;
        cur_v -= (t[i] - dec_t);
    }

    println!("{:.9}", ans);
}


struct Scanner {
    reader: std::io::Stdin,
    tokens: std::collections::VecDeque<String>,
}

impl Scanner {
    fn new() -> Self {
        Scanner {
            reader: std::io::stdin(),
            tokens: std::collections::VecDeque::new(),
        }
    }

    fn next(&mut self) -> String {
        if self.tokens.is_empty() {
            let mut s = String::new();
            loop {
                self.reader.read_line(&mut s).ok();
                let s = s.trim();
                if s.len() != 0 {
                    for it in s.split_whitespace() {
                        self.tokens.push_back(it.into())
                    }
                    break;
                }
            }
        }
        self.tokens.pop_front().unwrap()
    }

    fn next_generics<T>(&mut self) -> T where
        T: std::str::FromStr + std::marker::Copy,
        <T as std::str::FromStr>::Err: std::fmt::Debug
    {
        self.next().parse().unwrap()
    }
    
    #[allow(dead_code)] fn next_i32(&mut self) -> i32 { self.next_generics::<i32>() }
    #[allow(dead_code)] fn next_i64(&mut self) -> i64 { self.next_generics::<i64>() }
    #[allow(dead_code)] fn next_u64(&mut self) -> u64 { self.next_generics::<u64>() }
    #[allow(dead_code)] fn next_f64(&mut self) -> f64 { self.next_generics::<f64>() }
    #[allow(dead_code)] fn next_usize(&mut self) -> usize { self.next_generics::<usize>() }
    #[allow(dead_code)] fn next_isize(&mut self) -> isize { self.next_generics::<isize>() }
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
  
   int n;
   cin>>n;
   int W,w[n+1],val[n+1];
   cin>>W;

   w[0]=0;val[0]=0;
   long long int v;
   for(int i=1;i<=n;i++)
   {
       cin>>w[i]>>val[i];
       v+=val[i];   }
      long long int dp[n+1][v+1];

//dp[0][0]=0;
for(int i=0;i<=n;i++)
{
    for(int j=0;j<=v;j++)
    {
        dp[i][j]=1e10;
    }
}
dp[0][0]=0;
for(int i=0;i<=n;i++)
dp[i][0]=0;

 for(int i=1;i<=n;i++)
 {
     for(int j=1;j<=v;j++)
     {
         if(j>=val[i])
         dp[i][j]=min(dp[i-1][j-val[i]]+w[i],dp[i-1][j]);
         else
         dp[i][j]=dp[i-1][j];

     }
 }
long long int res=0;
for(int i=0;i<=v;i++)
{//cout<<dp[n][i]<<" ";
if(dp[n][i]<=W)
{res=i;}
}
cout<<res;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
//#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}


inline void solve(){

  int n;
  int a, b;
  
  cin >> a >> b;

  if(a < 6)
    b = 0;
  else if(a < 13)
    b/=2;

  cout << b fin;
  

  

}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a + b > c + d) cout << "Left";
  else if(a + b == c + d) cout << "Balanced";
  else cout << "Right";
  return 0;
}


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

using namespace std;

int isPal(string sen)
{
  int i,j;
  
  for(i=0,j=sen.length()-1;i<j;i++,j--){
    if(sen[i] != sen[j]) return 0;
  }
  
  return 1;
}

int main()
{
  string s;
  
  cin >> s;
  
  int n = s.length();
  
  string a = s.substr(0,(n-1)/2);
  int k = n+1 - (n+3)/2;
  string b = s.substr(((n+3)/2)-1,k);
    
  if(isPal(s) && isPal(a) && isPal(b)) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int A[4][3][10] = {};
    int n, b, f, r, v, i, j, k, l;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d %d %d %d", &b, &f, &r, &v);
        A[b - 1][f - 1][r - 1] += v;
    }
    
    for(j = 0; j < 4; j++){
        for(k = 0; k < 3; k++){
            for(l = 0; l < 10; l++){
                printf(" %d", A[j][k][l]);
            }
            printf("\n");
        }
        if(j < 3) printf("####################\n");  
    }
    return 0;
}


Measured memory_bytes: 2104
use std::io::*;
use std::io;
use std::str::FromStr;
fn read(s: &mut StdinLock) -> u32 {
    s.by_ref()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .fold(0, |a, x| (x as u8 - b'0') as u32 + a * 10)
}

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();

    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (n, k) = (it.next().unwrap(), it.next().unwrap());


    let mut v = Vec::new();

    let mut s = stdin.lock();
    let s = &mut s;

    for _ in 0..n {
        let n = read(s);
        v.push(n);
    }
    v.sort();


    let mut ans = 0;

    for i in 0..k {
        ans += v[v.len() - i - 1];
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352