akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<bits/stdc++.h>
#include<vector>
#define fo(i,n) for(long long i=0;i<n;i++)
#define ll long long int
#define inf 999999999999999999
#define pb push_back
#define fi first
#define se second
#define vi vector<ll>
#define vii vector<vector<ll>>
#define pi pair<ll,ll>
#define mp make_pair
#define MOD 1000000007
#define tr(c,it) for(auto it = (c).begin(); it != (c).end(); ++it)
#define fio ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
//cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
//freopen("explicit.in", "r", stdin);
//freopen("explicit.out", "w", stdout);
 
void SieveOfEratosthenes() 
{ 
    bool prime[10000001];
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=10000000; p++) 
    { 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (ll i=p*p; i<=10000000; i += p) {
                prime[i] = false; 
            }
        } 
    }  
} 
ll leastprime[1000005]={0};
void leastPrimeFactor(ll n)
{
	ll i,j;
	leastprime[1]=1;
	for(i=2;i<=n;i++)
	{
		if(leastprime[i]==0)
		{
			leastprime[i]=i;
			for(j=2*i;j<=n;j=j+i)
			{
				if(leastprime[j]==0)
				{
					leastprime[j]=i;
				}
			}
		}
	}
}
ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
	if(b%a==0)
	   return a;
	return gcd(b%a,a);
}
ll nCrModpDP(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C));   
    C[0] = 1;
    for (ll i = 1; i <= n; i++) 
    {
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 
ll nCrModp(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
   ll ni = n%p, ri = r%p; 
  
   return (nCrModp(n/p, r/p, p) * 
           nCrModpDP(ni, ri, p)) % p; 
} 
int32_t main() 
{
    fio
	ll j,i,n,t,l,r,c,h,k,m,maxi,d,x;
	cin>>n;
	ll co=1,se=1;
	ll a[n];
	for(j=0;j<n;j++)
		cin>>a[j];
	c=a[0];
	for(j=1;j<n;j++)
	{
		c=gcd(a[j],c);
	}
	if(c!=1)
		se=-1;
	leastPrimeFactor(1000001);
	ll prime[1000001]={0};
	for(j=0;j<n;j++)
	{
		k=a[j];
		d=leastprime[k];
		// cout<<d<<endl;
		set<ll> s;
		while(k!=1)
		{
			s.insert(d);
			k=k/d;
			d=leastprime[k];
		}
		tr(s,it)
		{
			prime[*it]++;
			if(prime[*it]>=2)
				co=-1;
		}

	}
	if(co==1)
		cout<<"pairwise coprime";
	else if(se==1)
		cout<<"setwise coprime";
	else
		cout<<"not coprime";
}





	

		

Measured memory_bytes: 27056
import numpy as np
s = np.array(list(input().rstrip()))
t = np.array(list(input().rstrip()))
ls, lt = len(s), len(t)
dp = np.zeros((ls+1, lt+1), dtype=np.int64)

for i in range(1, ls+1):
  dp[i, 1:] = dp[i-1, :-1] + (s[i-1] == t)
  dp[i] = np.maximum(dp[i], dp[i-1])
  # print(dp[i])
  dp[i] = np.maximum.accumulate(dp[i])
  # print(dp[i])
answer = ''
x, y = lt, ls
while x > 0 and y > 0:
  # print(answer, x, y)
  if s[y-1] == t[x-1]:
    answer = s[y-1] + answer
    x, y = x-1, y-1
  elif dp[y, x] == dp[y, x-1]:
    x -= 1
  else:
    y -= 1
print(answer)

Measured memory_bytes: 96956
#include<bits/stdc++.h>
#define fastio     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x)     (x).begin() , (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl       '\n'
#define MAX        1000000
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
typedef long long int ll;
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}


const ll mod = 1e9+7;
const double eps = 1e-9;
const double pi = acos(-1);

void solve(){
    int k;
    int n;
    cin>>n>>k;
    bool arr[11];
    memset(arr,false,sizeof(arr));
    for(int i=0;i<k;i++) {
        int t;
        cin>>t;
        arr[t]=true;
    }
    for(int i=n;i<100000;i++) {
        string ans=to_string(i);
        for(int j=0;j<(int)ans.size();j++) {
            if(arr[ans[j]-'0'])goto E;
        }
        cout<<i<<"\n";break;E:;
    }
}





int main(){
    fastio
    int test=1;
    while(test--)
        solve();
    return 0;
}


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

int main()
{
	// ?????°??£?¨?
	int r = 0, // ??¨????????°
		c = 0, // ??¨????????°
		input = 0, // ??\?????¨
		linesum = 0, // ???????????¨
		columnsum = 0, // ???????????¨
		allsum = 0, // ??¨??¨???????????¨
		table[101][101]; // ??¨

	// ??§?¨??????????
	// r, c??\??????
	cin >> r >> c;

	// ??¨???????????\???????????°????????°?????°????????????
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			// ?????\???
			cin >> input;
			// ??????????????§?¨??????£??\???
			table[i][j] = input;
		}
	}

	// ??¨??????????????????????????°????????°?????°????????????
	// ?????????????????§????????????
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			// ????????§?¨????????????????
			cout << table[i][j] << " ";
			// ???????????¨?????°???????????????
			linesum += table[i][j];
		}
		// ??????????????????
		cout << linesum << endl;
		// ??¨??¨???????????¨???????????????
		allsum += linesum;
		// ???????????¨?????°????????????
		linesum = 0;
	}

	// ??????????????????????????????
	for (int i = 0; i < c; i++)
	{
		for (int j = 0; j < r; j++)
		{
			// ???????????¨?????°???????????????
			columnsum += table[j][i];
		}
		// ??????????????????
		cout << columnsum << " ";

		// ???????????¨?????°????????????
		columnsum = 0;
	}

	// ??¨??¨?????????????????????
	cout << allsum << endl;

	return 0;
}

Measured memory_bytes: 1200
//by xxj
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
//const int mod=;
ll a[200007];
int fa[200007];
int n;
ll d;
vector<pair<ll,pii> > edge;
int ff(int x){
	if (fa[x]==x){
		return x;
	}
	return fa[x]=ff(fa[x]);
}
void solve(int l,int r){
	if (l==r){
		return;
	}
	int mid=(l+r)>>1;
	ll mnl=linf,mnr=linf;
	int pl,pr;
	ll t;
	for (int i=mid;i>=l;i--){
		t=a[i]-1ll*i*d;
		if (t<mnl){
			mnl=t;
			pl=i;
		}
	}
	for (int i=mid+1;i<=r;i++){
		t=a[i]+1ll*i*d;
		if (t<mnr){
			mnr=t;
			pr=i;
		}
	}
	for (int i=mid;i>=l;i--){
		t=a[i]-1ll*i*d;
		edge.push_back(mp(t+mnr,mp(pr,i)));
	}
	for (int i=mid+1;i<=r;i++){
		t=a[i]+1ll*i*d;
		edge.push_back(mp(t+mnl,mp(pl,i)));
	}
	solve(l,mid);
	solve(mid+1,r); 
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%lld",&n,&d);
	for (int i=0;i<n;i++){
		scanf("%lld",a+i);
		fa[i]=i;
	}
	solve(0,n-1);
	sort(edge.begin(),edge.end());
	int f1,f2;
	ll ans=0;
	for (int i=0;i<edge.size();i++){
		pii p=edge[i].second;
		f1=ff(p.first);
		f2=ff(p.second);
		if (f1!=f2){
			ans+=edge[i].first;
			fa[f1]=f2;
		}
	}
	printf("%lld\n",ans);
	return 0;
}
/*
input:
*/

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

using namespace std;

using ll = long long;

mt19937 mt(736);


class dsu
{
	vector<int> par, siz;

public:
	dsu(int n) : par(n, -1), siz(n, 1)
	{}

	int get_par(int v)
	{
		return par[v] == -1 ? v : get_par(par[v]);
	}


	bool unite(int a, int b)
	{
		a = get_par(a);
		b = get_par(b);

		if (a == b)
			return false;

		if (siz[a] < siz[b])
			swap(a, b);

		par[b] = a;
		siz[a] += siz[b];

		return true;
	}
};


void dfs(const vector<vector<pair<int, int>>> &gr, vector<bool> &used, vector<bool> &col, const unordered_set<int> &rev,
         int v, bool c)
{
	if (used[v])
		return;
	used[v] = true;
	col[v] = c;

	for (auto it : gr[v])
	{
		auto nc = c;

		if (rev.count(it.second))
			nc = !nc;

		dfs(gr, used, col, rev, it.first, nc);
	}
}


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int n, m;

	cin >> n >> m;

	vector<int> d(n);

	for (auto &it : d)
		cin >> it;

	vector<pair<int, int>> edges;

	for (int i = 0; i < m; i++)
	{
		int a, b;

		cin >> a >> b;
		a--;
		b--;

		edges.emplace_back(a, b);
	}

	vector<pair<int, int>> best(n, {-1, -1});
	vector<int> c(m, (int) numeric_limits<int>::max());

	for (int i = 0; i < m; i++)
	{
		int a, b;

		tie(a, b) = edges[i];

		if (best[a].first == -1 || pair<int, int>{d[b], i} < pair<int, int>{d[best[a].first], best[a].second})
			best[a] = {b, i};
		if (best[b].first == -1 || pair<int, int>{d[a], i} < pair<int, int>{d[best[b].first], best[b].second})
			best[b] = {a, i};
	}

	if (find(best.begin(), best.end(), pair<int, int>{-1, -1}) != best.end())
	{
		cout << -1 << endl;

		return;
	}

	for (int i = 0; i < n; i++)
		if (d[best[i].first] > d[i])
		{
			cout << -1 << endl;
			cerr << "bad: " << i << endl;

			return;
		}

	unordered_set<int> rev;
	vector<vector<pair<int, int>>> gr(n);

	for (auto &e : best)
	{
		c[e.second] = abs(d[edges[e.second].first] - d[edges[e.second].second]);

		if (c[e.second] == 0)
		{
			c[e.second] = d[edges[e.second].first];
			rev.insert(e.second);
		}

		auto be = edges[e.second];

		gr[be.first].emplace_back(be.second, e.second);
		gr[be.second].emplace_back(be.first, e.second);
	}

	vector<bool> used(n), col(n);

	for (int i = 0; i < n; i++)
		dfs(gr, used, col, rev, i, false);

	assert(count(col.begin(), col.end(), false));
	assert(count(col.begin(), col.end(), true));

	for (auto it : col)
		cout << (it ? 'B' : 'W');
	cout << endl;

	for (auto &it : c)
	{
		it = min(it, (int) 1e9);

		cout << it << '\n';
	}
}


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

	cout << fixed;

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");

	solve(fin);

	cout << "clock: " << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}


Measured memory_bytes: 13808
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s = input()
x,y = map(int, input().split())

xs = []
ys = []
isx = True
i = 0
n = len(s)
while i<n and s[i]=="F":
    x -= 1
    i += 1

while i<n:
    c = 0
    while i<n and s[i]=="F":
        i += 1
        c += 1
    if isx and c>0:
        xs.append(c)
    elif c>0:
        ys.append(c)
    isx = not isx
    i += 1
    
def sub(l, target):
    # lの一部の符号を反転してtargetを作れるか
    val = sum(l)
    prev = [False] * (2*(val+1))
    prev[val] = True
    current = None
    for num in l:
        current = [False] * (2*(val+1))
        for i in range(2*(val+1)):
            if i-num>=0 and prev[i-num]:
                current[i] = True
            if i+num<(2*val+2) and prev[i+num]:
                current[i] = True
        prev = current
    if current is None:
        current = prev
    return current[target+val]

if sum(abs(item) for item in xs)>=abs(x) and sum(abs(item) for item in ys)>=abs(y) and sub(xs, x) and sub(ys, y):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 74704
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

string s;

int main(){
	cin >> s;
	if(s.size()<4){
		cout<< "No" << endl;
		return 0;
	}
	string t = s.substr(0,4);
	if(t =="YAKI")cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define s(x) (x).begin(),(x).end();
using namespace std;
typedef long long ll; 
int main(){
	int s,k;
	cin >>s >>k;
	int ans = 0;
	for(int x=0; x<=s;x++){
		for(int y=0; y<=s;y++){
		int z = k - x - y;
		if(0<=z&&z<=s)ans++;}}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

// Template for atcoder
public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};

    void solve() throws IOException {
        int n = nextInt();
        Map<String, Integer> hm = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String str = nextString();
            hm.put(str, hm.getOrDefault(str, 0) + 1);
        }
        String mid = " x ";
        outln("AC" + mid + hm.getOrDefault("AC", 0));
        outln("WA" + mid + hm.getOrDefault("WA", 0));
        outln("TLE" + mid + hm.getOrDefault("TLE", 0));
        outln("RE" + mid + hm.getOrDefault("RE", 0));
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


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

int main()
{
	int a,b;
	int road[101];
	
	for(int i=0;i<101;i++){
		road[i] = 0;
	}
	while(cin >> a >> b){
		if(!a&&!b){
			bool flag = true;
			if(road[1]%2 == 0 || road[2]%2 == 0)
				flag = false;
			for(int i=3;i<=100;i++){
				if(road[i]%2 == 1)
					flag = false;
			}
			if(flag)
				cout << "OK" << endl;
			else
				cout << "NG" << endl;
			for(int i=0;i<101;i++){
				road[i] = 0;
			}
		}
		else{
			road[a]++;
			road[b]++;
		}
	}
	return 0;
}

Measured memory_bytes: 0
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int solve(){
  int n;cin>>n;
  int a[n]; rep(i, n) {cin>>a[i];}

  int ans = 0;
  rep(h, 1, 101){
    bool ne = true;
    rep(i, n){
      if (a[i]>=h && ne) {
        ans++;
        ne = false;
      }
      else if(a[i]>=h){
      }
      else if(a[i]<h){
        ne = true;
      }
    }
    // dump(h, ans);
  }
  cout << ans << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
int main()
{
	std::vector<std::string>result;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		std::string s1, s2;
		std::cin >> s1 >> s2;
		std::string shorter, longer;
		if (s1.length() < s2.length())
		{
			shorter = s1;
			longer = s2;
		}
		else
		{
			shorter = s2;
			longer = s1;
		}
		std::string sum;
		int remainder = 0;
		for (int j = (int)shorter.length() - 1, k = (int)longer.length() - 1; j >= 0; j--, k--)
		{
			int digit = (int)(shorter[j] - '0' + longer[k] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		for (int j = (int)(longer.length() - shorter.length() - 1); j >= 0; j--)
		{
			int digit = (int)(longer[j] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		if (remainder != 0)
		{
			sum.push_back((char)(remainder + '0'));
		}
		result.push_back(sum);
	}
	for (auto i : result)
	{
		if (i.length() > 80)
		{
			std::cout << "overflow";
		}
		else
		{
			for (int j = (int)i.length() - 1; j >= 0; j--)
			{
				std::cout << i[j];
			}
		}
		std::cout << std::endl;
	}
	return 0;
}


Measured memory_bytes: 2996
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int h, a;
  cin >> h >> a;
  int ans = (h % a == 0)? h/a: (h/a) + 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,x;
  cin>>a>>b>>c;
  for(int i=1;i<a+1;i++){
    int d=i/10000;
    int e=i%10000/1000;
    int f=i%1000/100;
    int g=i%100/10;
    int h=i%10;
    int j=d+e+f+g+h;
    if(j>=b && j<=c){
      x+=i;
    }
  }
  cout<<x<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;

int main() {
    int n, p;
    string s;
    cin >> n;
    vector<tuple<string, int, int>> sp;
    for(int i = 0; i < n; ++i) {
        cin >> s >> p;
        sp.push_back(make_tuple(s, -p, i+1));
    }
    sort(sp.begin(), sp.end());
    for(int i = 0; i < n; ++i) {
        cout << get<2>(sp[i]) << '\n';
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
  
ll R=0;
double ans=0;

int main(){
  cin>>R;
  ans=M_PI*R*2;
  //cout<<ans;
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;
using ll = long long;
using v1 = vector<int>;
using vl = vector<long long>;
using v2 = vector<vector<int>>;
using v3 = vector<vector<char>>;
using vd = vector<double>;
int main(){
	double a, b, x;
	cin >> a >> b >> x;
	double i = 2*x / (a*b);
	double PI = 3.14159265359;
	double ans;
	if(i > a){
		double i = 2*x/(a*a) - b;
		double j = b - i;
		double c = a*a / (a*a + j * j);
		ans = acos(sqrt(c))*180/PI;
	}else{
		double c = i*i / (i*i + b* b);
		ans = acos(sqrt(c))*180/PI;
	}
	cout << fixed << setprecision(15) << ans << endl;
}


Measured memory_bytes: 4036
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define all(x) (x).begin(), (x).end()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20

constexpr lint MOD = 1e9 + 7;
int A, B, C, D, E, F, G, H, I, J, K, L, M, N;
int O, P, Q, R, S, T, U, V, W, X, Y, Z;
// string s;
vi ans;
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> N >> X >> Y;
    X--; Y--;
    ans.assign(N, 0);

    rep(i, N) {
        rep(j, N) {
            int l = min(i, j);
            int r = max(i, j);
            int c1 = r - l;
            if (l > X && r < Y) {
                int c2 = l - X + Y - r + 1;
                ans[min(c1, c2)]++;
            } else if (l <= X && r <= Y) {
                int c2 = X - l + Y - r + 1;
                ans[min(c1, c2)]++;
            } else if (l >= X && r >= Y) {
                int c2 = l - X + r - Y + 1;
                ans[min(c1, c2)]++;
            } else if (l == X && r == Y) {
                ans[1]++;
            } else {
                ans[X - l + r - Y + 1]++;
            }
        }
    }

    rep1(i, N-1) {
        cout << ans[i] / 2 << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

int N,M; 

vector<vector<int>> to;

vector<int> par; 

void init(){
  to = vector<vector<int>> (N); par = vector<int> (N);
  for(int i = 0; i < N; i++){
    par[i] = i;}}

int root(int x){
  if( par[x] == x){ return x ;}
  else{ return par[x] = root(par[x]);}
}

void unite(int x, int y){
  if(root(x) == root(y)){ return ;}
  else{ par[root(x)] = root(y);}
}

bool isroot(int x){
  return x == par[x];}

  
    



int main(){
 cin >> N >> M;
  init();
 for(int i = 0 ; i  < M; i++){
   int x,y,z; cin >> x >> y >> z; x--; y--;
   unite(x,y);}
 int ans = 0;
  for(int i = 0; i < N; i++){
    if(isroot(i)){ ans++;}}
  cout << ans << endl; return 0;}
  
   
  
  

Measured memory_bytes: 2944
#include <stdio.h>

int main(void){
	double a, b, f;
	int d, r;

	scanf("%lf%lf", &a, &b);

	d = (int)a / (int)b;
	r = (int)a % (int)b;
	f = a / b;

	printf("%d %d %f\n", d, r, f);

	return 0;
}

Measured memory_bytes: 648
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

# bit長
bit_len = n
INF = 10 ** 7
ans = INF


for num in range(2 ** bit_len):
    tmp = [0 for i in range(m)]
    c = 0
    for i in range(bit_len):
        if num & (1 << i):
            # 処理
            c += ca[i][0]
            for j in range(1, m+1):
                tmp[j-1] += ca[i][j]
    if min(tmp) >= x:
        ans = min(ans, c)
if ans == INF:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9164
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char> > A(H, vector<char>(W, ' '));
  vector<vector<char> > A2(H, vector<char>(W, ' '));  
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cin >> A[i][j];
    }
  }
  vector<int> count(26, 0);
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){  
      count[A[i][j]-'a']++;
    }
  }
  /*
  for (int i = 0; i < 26; i++){
    cerr << count[i] << ' ';
  }
  cerr << endl;
  */
  for (int i = 0; i < H/2; i++){
    for (int j = 0; j < W/2; j++){
      for (int c = 0; c < 26; c++){
        if (count[c] >= 4){
          A2[i][j] = (char)('a'+c);
          A2[i][W-j-1] = (char)('a'+c);
          A2[H-i-1][j] = (char)('a'+c);
          A2[H-i-1][W-j-1] = (char)('a'+c);
          //cerr << "check1" << ',' << i << ',' << j << ',' << A2[i][j] << endl;
          count[c] -= 4;
          break;
        }
      }
    }
  }
  if (((H % 2) == 1) && ((W % 2) == 0)){
    for (int j = 0; j < W/2; j++){
      for (int c = 0; c < 26; c++){
        if (count[c] >= 2){
          A2[H/2][j] = (char)('a'+c);
          A2[H/2][W-j-1] = (char)('a'+c);
          //cerr << "check2" << ',' << j << ',' << A2[H/2][j] << endl;          
          count[c] -= 2;
          break;
        }
      }
    }
  }else if (((H % 2) == 0) && ((W % 2) == 1)){
    for (int i = 0; i < H/2; i++){
      for (int c = 0; c < 26; c++){
        if (count[c] >= 2){
          A2[i][W/2] = (char)('a'+c);
          A2[H-i-1][W/2] = (char)('a'+c);
          //cerr << "check3" << ',' << i << ',' << A2[i][W/2] << endl;          
          count[c] -= 2;
          break;
        }
      }
    }
  }else{
    for (int j = 0; j < W/2; j++){
      for (int c = 0; c < 26; c++){
        if (count[c] >= 2){
          A2[H/2][j] = (char)('a'+c);
          A2[H/2][W-j-1] = (char)('a'+c);
          //cerr << "check4" << ',' <<  j << ',' << A2[H/2][j] << endl;          
          count[c] -= 2;
          break;
        }
      }
    }
    for (int i = 0; i < H/2; i++){
      for (int c = 0; c < 26; c++){
        if (count[c] >= 2){
          A2[i][W/2] = (char)('a'+c);
          A2[H-i-1][W/2] = (char)('a'+c);
          //cerr << "check5" << ',' << i << ',' << A2[i][W/2] << endl;          
          count[c] -= 2;
          break;
        }
      }
    }
    for (int c = 0; c < 26; c++){
      if (count[c] > 0){
        A2[H/2][W/2] = (char)('a'+c);
        count[c] -= 1;
        break;
      }
    }
  }
  bool judge = true;
  for (int i = 0; i < 26; i++){
    //cerr << count[i] << ' ';
    if (count[i] != 0){
      judge = false;
    }
  }
  //cerr << endl;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      //cerr << A2[i][j];
      if (A2[i][j] == ' '){
        judge = false;
      }
    }
    //cerr << endl;
  }
  //cerr << endl;
  if (judge){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n; int cnt = 0;
    for(int i = 1; i <= n; i++){
        if(i&1){
            int foo = 0;
            for(int j = 1; j <= i; j++){
                if(i%j == 0)foo++;
            }
            if(foo == 8){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3588
# from https://twitter.com/wakuwinmail_C/status/950277218411855872

N, Y = gets.split.map(&:to_i)

x = y = 0
z = Y / 1000

rest = z - N

if rest < 0
  x = y = z = -1
else

ch = [rest / 4, z / 5].min
z -= ch * 5
y += ch
rest -= ch * 4

ch = [rest, y / 2].min
y -= ch * 2
x += ch
rest -= ch

if rest > 0
  x = y = z = -1
end

end

puts "#{x} #{y} #{z}"


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;

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

    if (s != 1e+9){
        rep(i, k) cout << s << " ";
        rep(i, n - k) cout << s + 1 << " ";
        cout << endl;
    }
    else {
        rep(i, k) cout << s << " ";
        rep(i, n - k) cout << 1 << " ";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
def main():
    n = int(input())
    d = {chr(i):0 for i in range(ord('a'), ord('z')+1)}
    line = input()
    for i in range(ord('a'), ord('z')+1):
        d[chr(i)] += line.count(chr(i))
    
    for _ in range(n-1):
        line = input()
        for i in range(ord('a'), ord('z')+1):
            cnt = line.count(chr(i))
            if d[chr(i)] != 0 and d[chr(i)] > cnt:
                d[chr(i)] = cnt

    ans = ''
    for key, value in sorted(d.items(), key=lambda x: x[0]):
        if value != 0:
            ans += key*value
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n = int(input())
h = list(map(int, input().split()))



l = []
count = 0

for i in range(n-1):
    if h[i + 1] <= h[i]:
        count += 1
    else:
        l.append(count)
        count = 0
        
l.append(count)
        
print(max(l))


Measured memory_bytes: 14252
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let b: Vec<usize> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let c: Vec<usize> = (0..(n - 1)).map(|_| it.next().unwrap().parse().unwrap()).collect();
    let mut ans = b.iter().fold(0, |s, b| s + b);
    for i in 0..(n - 1) {
        if a[i] + 1 == a[i + 1] {
            ans += c[a[i] - 1];
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}

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

using namespace std;

int main(void) {
    string A, B;
    cin >> A >> B;
    if(A == B) {
        cout << "EQUAL" << endl;
    } else if((A.size() == B.size() && A > B) || A.size() > B.size()) {
        cout << "GREATER" << endl;
    } else {
        cout << "LESS" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()

alp = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
       'Q','R','S','T','U','V','W','X','Y','Z']*2

word = []

for i in range(len(s)):
  num = alp.index(s[i])
  word.append(alp[num + n])
              
print(*word, sep='')

Measured memory_bytes: 4724
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {

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

    long x = in.nextLong();

    long p = 100;
    long years = 0;
    while (p < x) {
      p += p/100;
      years++;
    }
    System.out.println(years);
  }

  static class InputReader {

    private final InputStream stream;
    private final byte[] buf = new byte[8192];
    private int curChar, snumChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int snext() {
      if (snumChars == -1) throw new InputMismatchException();
      if (curChar >= snumChars) {
        curChar = 0;
        try {
          snumChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (snumChars <= 0) return -1;
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public long nextLong() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = snext();
      }
      long res = 0;
      do {
        if (c < '0' || c > '9') throw new InputMismatchException();
        res *= 10;
        res += c - '0';
        c = snext();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public int[] nextIntArray(int n) {
      int a[] = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = nextInt();
      }
      return a;
    }

    public String readString() {
      int c = snext();
      while (isSpaceChar(c)) {
        c = snext();
      }
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public String nextLine() {
      int c = snext();
      while (isSpaceChar(c)) c = snext();
      StringBuilder res = new StringBuilder();
      do {
        res.appendCodePoint(c);
        c = snext();
      } while (!isEndOfLine(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) return filter.isSpaceChar(c);
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private boolean isEndOfLine(int c) {
      return c == '\n' || c == '\r' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);
    }
  }
}


Measured memory_bytes: 32384
#include<cstdio>
#include<cstring>
#include<algorithm>
#define reg register
typedef long long ll;
const int MN=2e5;
struct edge{int t,nxt,c;}es[(MN<<1)+5];
int h[MN+5],cnt;
inline void ins(int s,int t,int c){es[++cnt]=(edge){t,h[s],c};h[s]=cnt;}
int dis[MN+5],q[MN+5],he,ta;
bool inq[MN];
inline void SPFA(){
	memset(dis,0x3f,sizeof(dis));
	he=ta=0;q[ta++]=inq[1]=dis[1]=1;
	while(he!=ta){
		reg int v=q[he++];he%=MN;
		for(reg int i=h[v];~i;i=es[i].nxt)
			if(dis[es[i].t]>dis[v]+es[i].c){
				dis[es[i].t]=dis[v]+es[i].c;
				if(!inq[es[i].t]){
					inq[es[i].t]=1;
					if(dis[es[i].t]<dis[q[he]])he=(he-1)%MN,q[he]=es[i].t;
					else q[ta++]=es[i].t,ta%=MN;
				}
			}
		inq[v]=0;
	}
}
int main(){
	memset(h,-1,sizeof(h));int k;scanf("%d",&k);
	for(reg int i=1;i<k;i++){
		ins(i,(i*10)%k,0);if((i+1)%10)ins(i,(i+1)%k,1);
	}
	SPFA();printf("%d\n",dis[0]);
    return 0;
}

Measured memory_bytes: 5888
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    long long N, W;
    cin >> N >> W;

    vector<long long> w(N), v(N);
    for (int i = 0; i < N; i++)cin >> w[i] >> v[i];

    vector<vector<long long>> dp(N + 1, vector<long long>(W + 1, 0));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j - w[i] >= 0) {
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            } else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }


    cout << dp[N][W] << endl;

    return 0;
}
















































Measured memory_bytes: 80256
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
max=ab[0][1]
min=ab[0][0]

for i in range(1,m):
    if min<ab[i][0]:
        min=ab[i][0]
    if ab[i][1]<max:
        max=ab[i][1]
if max<min:
    print("0")
else:
    print(max-min+1)

Measured memory_bytes: 27340
// practice01.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include <iostream>
#include <iomanip>
int main()
{
	long long max = -9223372036854775808LL, min = 9223372036854775807LL, sum = 0LL;
	int n;
	int a[10000];
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
		if (max < a[i]) max = a[i];
		if (min > a[i]) min = a[i];
		sum += a[i];
	}
	std::cout << min << " " << max << " " << sum << std::endl;
    return 0;
}




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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    auto conv=[](int n){return n/100*60+n%100;};

    int N,L,R;
    while(cin>>N>>L>>R,N||L||R){
        L=conv(L);R=conv(R);
        int cnt[24*60]={};
        rep(i,N){
            int M;cin>>M;
            rep(j,M){
                int l,r;cin>>l>>r;
                l=conv(l);r=conv(r);
                reps(k,l,r)cnt[k]++;
            }
        }

        int ans=0;
        int sum=0;
        reps(i,L,R){
            if(cnt[i]==N)sum=0;
            else sum++;
            chmax(ans,sum);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 2972
#include <bits/stdc++.h>
#include <cmath>
#define pb push_back

using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int numdays;
    int dp[3][100100];
    
    cin >> numdays;
    vector <int> a(numdays), b(numdays), c(numdays);
    for(int i = 0; i < numdays; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    dp[0][0] = a[0];
    dp[1][0] = b[0];
    dp[2][0] = c[0];
    for(int i = 1; i < numdays; 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]);
    }
    cout << max(dp[0][numdays - 1], max(dp[1][numdays - 1], dp[2][numdays - 1])) << endl;
    
    return 0;
}

Measured memory_bytes: 2560
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+5,L=20;
typedef long long ll;
int a[N];
int p[N][L];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    int L;
    scanf("%d",&L);
    a[0]=0;
    for(int i=1,j=0;i<=n;i++){
        while(a[j]+L<a[i])
            j++;
        p[i][0]=j;
    }
    for(int i=1;i<=n;i++)
        for(int j=1;(1<<j)<=i;j++)
            p[i][j]=p[p[i][j-1]][j-1];
    int q;
    scanf("%d",&q);
    while(q--){
        int l,r;
        scanf("%d%d",&l,&r);
        if(l>r)
            swap(l,r);
        int g=0;
        while(1<<g<=r)
            g++;
        g--;
        int ans=0;
        for(int i=g;i>=0;i--)
            if(p[r][i]>=l)
                r=p[r][i],ans+=1<<i;
        if(r>l)
            ans++;
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 8960
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;


void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


/* 注意 

    1LL<<60 * N とかのオーバーフローに気を付けろ
    制約がヒントになる、ちゃんと全ての制約を見ろ

*/

int f(ll b, ll n) {
    int res = 0;
    while(n != 0) { res += n%b; n /= b; }
    return res;
}

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

    ll n, s; cin >> n >> s;
    if (n < s) { cout << -1 << endl; return 0; }
    if (n == s) { cout << n+1 << endl; return 0; }

    for(ll b=2; b*b<=n; ++b) {
        if (f(b, n) == s) { cout << b << endl; return 0; }
    }

    /*
        √n < b の時
        n を b 進表記しても 2 桁
        つまり考える問題は n, s が与えられるので
        
        1. n = pb + q 
        2. 1 ≤ p < √n
        3. 0 ≤ q < b;
        4. p + q = s

        を満たす３つ組 (p, q, b) のうち
        b が最小になるものを求めて b を出力するということになる
        条件 2. に注目すると p の範囲は全探索できる
    */

    ll const inf = 1LL<<59;
    ll ans = inf;
    for(ll p=1; p*p<n; ++p) {
        if ((p+n-s)%p == 0) {
            ll b = (p+n-s)/p;
            ll q = s - p;
            if(0<=q && q<b) chmin(ans, b);
        }
    }
    cout << (ans==inf? -1:ans) << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static boolean[][] graph;

    private static boolean allVisited(boolean[] visited) {
        for (int i = 0; i < visited.length; i++) {
            if (!visited[i]) {
                return false;
            }
        }
        return true;
    }

    private static int dfs(int v, int n, boolean[] visited) {
        if (allVisited(visited)) {
            return 1;
        }

        int result = 0;
        for (int i = 0; i < n; i++) {
            // pathがない、もしくはすでに訪れている場合はスキップ
            if (!graph[v][i] || visited[i]) {
                continue;
            }
            visited[i] = true;
            result += dfs(i, n, visited);
            visited[i] = false;
        }
        return result;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();
        graph = new boolean[n][n];
        for (int i = 0; i < m; i++) {
            a.add(sc.nextInt());
            b.add(sc.nextInt());
        }
        for (int i = 0; i < m; i++) {
            graph[a.get(i) - 1][b.get(i) - 1] = true;
            graph[b.get(i) - 1][a.get(i) - 1] = true;
        }
        boolean[] visited = new boolean[n];
        for (int i = 0; i < n; i++) {
            visited[i] = false;
        }

        visited[0] = true;
        // 隣接頂点が全て訪問済みとなるまでグラフを辿る
        System.out.println(dfs(0, n, visited));
    }
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a+b)%2==0){
            System.out.println((a+b)/2);
        }else {
            System.out.println((a+b)/2+1);
        }
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int a[11];
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    int ans = 1;
    for (i = 0; i < n; i++)
        ans *= 3;
    int b = 1;
    for (i = 0; i < n; i++)
        if (a[i] % 2 == 0)
            b *= 2;
    ans -= b;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
n, m, c = map(int,input().split())
b = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(n)]

ans = 0
i = j = 0
for i in range(n):
    for j in range(m):
        a[i][j] = a[i][j]*b[j]
    if sum(a[i])+c > 0:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream> 

using namespace std;

int main() {
	string S;
	cin >> S;
	int b=0;
	for(int i = 0;i<4;i++){
		int a=0;
		if(S[i]==S[0])a++;
		if(S[i]==S[1])a++;
		if(S[i]==S[2])a++;
		if(S[i]==S[3])a++;
		if(a==2)b++;
	}

	if(b==4)cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256