akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int p[200006],n,ans=0,ma=9999999;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&p[i]);
	for(int i=0;i<n;i++){
		if(p[i]<=ma) ans++;
		ma=min(p[i],ma);
	}
	printf("%d",ans);
	return 0;
}


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

using namespace std;

void solve()
{
	int a, b;
	cin >> a >> b;
	cout << max(max(a, b) * 2 - 1, a + b) << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 2 * 1e5 + 10;
char a[maxn], b[maxn];
int ans = 0;
int main(){
	scanf(" %s %s", a, b);
	int len = strlen(a);
	for(int i = 0; i < len; ++ i){
		if(a[i] != b[i])
			ans ++;
	}
	printf("%d\n", ans);
	return 0;
} 

Measured memory_bytes: 2084
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
using namespace std;

void update(vector<int> &t)
{
    vector<int> t2(t);
    for (int i = 0; i < t.size(); i++) {
        t2[i] = t[t[i]];
    }
    t = t2;
}

int main()
{
    string s;
    cin >> s;

    int len = s.length();

    vector<int> t1(len);
    for (int i = 0; i < len; i++) {
        if (s[i] == 'R')
            t1[i] = i + 1;
        else
            t1[i] = i - 1;
    }

    for (int i = 0; i < 17; i++) {
        update(t1);
    }

    vector<int> sum(len);
    for (int i = 0; i < len; i++) {
        sum[t1[i]]++;
    }
    for (int i = 0; i < len; i++) {
        cout << sum[i] << " ";
    }

    cout << endl;
}

Measured memory_bytes: 1400
n,m=io.read("*n","*n","*l")

t={}
if m>=1 then
    for i=1,m do
        s,c=io.read("*n","*n","*l")
        c=tostring(c)
        if not t[s] or t[s]==c then
            t[s]=c
        else
            print(-1)
            return
        end
    end
    for i=1,n do
        if not t[i] and i==1 then
            t[i]="1"
        elseif not t[i] then
            t[i]="0"
        end
    end
    x="0"
    for i=1,n do
        x=x..t[i]
    end
    if #x:sub(2,n+1)~=#tostring(tonumber(x)) then
        print(-1)
        return
    elseif #x:sub(2,n+1)==#tostring(tonumber(x)) then
        print(tonumber(x))
        return
    end
else
    if n==1 then
        print(0)
        return
    else
        x="100"
        print(x:sub(1,n))
        return
    end
end

Measured memory_bytes: 760
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var ABCD = Sarray();
            var L = ABCD[0] + ABCD[1];
            var R = ABCD[2] + ABCD[3];
            if (R < L)
                WriteLine("Left");
            else if (R == L)
                WriteLine("Balanced");
            else
                WriteLine("Right");
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28148
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res="{"; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res+"}";}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H,W;
  cin >> H >> W;
  MAT2D(m,int,H+2,W+2);
  REP(i,H) {
    string s;
    cin >> s;
    REP(j,W) {
      if (s[j] == '.') m[i+1][j+1] = 1;
    }
  }
  MAT2D(d0,int,H+2,W+2);
  MAT2D(d1,int,H+2,W+2);
  MAT2D(d2,int,H+2,W+2);
  MAT2D(d3,int,H+2,W+2);
  RREP(i,1,H+1) {
    RREP(j,1,W+1) {
      if (m[i][j] == 1) {
        d0[i][j] = d0[i][j-1] + 1;
        d1[i][j] = d1[i-1][j] + 1;
      }
      int ri = H+1-i, rj = W+1-j;
      if (m[ri][rj] == 1) {
        d2[ri][rj] = d2[ri][rj+1] + 1;
        d3[ri][rj] = d3[ri+1][rj] + 1;
      }
    }
  }
  int ans = 0;
  RREP(i,1,H+1) {
    RREP(j,1,W+1) {
      ans = max(ans, d0[i][j]+d1[i][j]+d2[i][j]+d3[i][j]);
    }
  }
  cout << ans - 3 << endl;
  return 0;
}


Measured memory_bytes: 78848
//2019.9.2 by ljz
//email 573902690@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f
#define unl __int128
#define eps 5.6e-8
#define RG register
#define db double
#define pc(x) __builtin_popcount(x)
//#define pc(x) __builtin_popcountll(x)
typedef pair<int,int> Pair;
#define mp make_pair
#define fi first
#define se second
#define pi acos(-1.0)
#define pb push_back
#define ull unsigned LL
#define gc getchar
//template <class T>using Tree=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//inline char gc() {
//    static char buf[100000],*p1,*p2;
//    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
//}
//inline int read() {
//    res s=0,ch=gc();
//    while(ch<'0'||ch>'9')ch=gc();
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s;
//}
inline int read() {
    res s=0,ch=gc(),w=1;
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s*w;
}
inline LL Read() {
    RG LL s=0;
    res ch=gc();
    while(ch<'0'||ch>'9')ch=gc();
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
    return s;
}
//inline LL Read() {
//    RG LL s=0;
//    res ch=gc(),w=1;
//    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=gc();}
//    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=gc();
//    return s*w;
//}
//inline void write(RG unl x){
//    if(x>10)write(x/10);
//    putchar(int(x%10)+'0');
//}
inline void swap(res &x,res &y) {
    x^=y^=x^=y;
}
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//clock_t start=clock();
//inline void ck(){
//    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
//}
const int N=1e5+10;
namespace MAIN{
    int n;
    int a[N];
    inline LL get(const RG LL &x,const res &y,const res &fl){
        return (x-fl)/y+fl;
    }
    inline void MAIN(){
        n=read();
        for(res i=1;i<=n;i++)a[i]=read();
        RG LL L=2,R=2;
        for(res i=n;i;i--){
            RG LL pl=get(L,a[i],1),pr=get(R,a[i],0);
            if(pl>pr){puts("-1");return;}
            L=pl*a[i],R=(pr+1)*a[i]-1;
//            printf("%lld %lld\n",L,R);
        }
        printf("%lld %lld\n",L,R);
    }
}
int main(){
//    srand(19260817);
//    freopen("signin.in","r",stdin);
//    freopen("signin.out","w",stdout);
    MAIN::MAIN();
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define lg long long
int main(){
	int T;
	cin>>T;
	for(int i=1;i<=T;i++){
		lg x,y;
		cin>>x>>y;
		lg t=sqrt(x*y-1);
		if(t*t>=x*y) t--;
		lg res=t*2;
		if(t*(t+1)>=(x*y))--res;
		if(t>=x)--res;
		if(t>=y)--res;
		cout<<res<<'\n';
	}
	return 0;
}

Measured memory_bytes: 256
/**
*	created: 27.08.2020 23:16:47
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// 重み付きUnionFind
struct UnionFind {
    vector<int> par, wei;
    UnionFind(int n) : par(n,-1), wei(n,0) {}
    int root(int x) {
        if (par[x] < 0) return x;
        int r = root(par[x]); wei[x] += wei[par[x]];
        return par[x] = root(par[x]);
    }
    bool unite(int x, int y, int w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) {swap(x,y); w *= -1;}
        par[x] += par[y]; par[y] = x; wei[y] = w;
        return true;
    }
    bool same(int x, int y) {return root(x) == root(y);}
    int weight(int x) {root(x); return wei[x];}
    int size(int x) {return -par[root(x)];}
    int diff(int x, int y) {return weight(y) - weight(x);}
};

signed main() {
    int n, m; cin >> n >> m;
    UnionFind uf(n);
    rep(i,m) {
        int l, r, d; cin >> l >> r >> d; l--; r--;
        if (uf.same(l,r) && uf.diff(l,r) != d) {
            cout << "No" << endl;
            return 0;
        }
        else uf.unite(l,r,d);
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 4668
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n, k;
ll ans;
int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d%d", &n, &k);
    if(k == 0) printf("%lld\n", 1ll * n * n);
    else
    {
        for(int b = k + 1; b <= n; b ++)
        {
            int x = n / b;//5 / 3 = 1

            ans += 1ll * x * (b - k) + max(0ll, 1ll * (n % b - k + 1));
        }
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 256
console.log((args=>{
  const [[N,A,B],...h] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  let ok = Math.ceil(1e9/B), ng = 0;
  bisect: while ( ok > ng+1 ) {
    let m = (ok+ng) >> 1, k = m;
    for ( let i = 0; i < N; i++ ) {
      let r = h[i] - m*B;
      if ( r <= 0 ) continue;
      k -= Math.ceil(r/(A-B));
    }
    if ( k >= 0 ) ok = m;
    else ng = m;
  }
  return `${ok}`;
})(require('fs').readFileSync('/dev/stdin','utf8')));


Measured memory_bytes: 94368
// ABC_120_B

#include <bits/stdc++.h>
using namespace std;

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

  auto maxi = max(a, b);
  vector<int> vec;
  
  for (int i = 1; i <= maxi; ++i) {
    if((a%i==0) && (b%i==0)) vec.push_back(i);
    else continue;
  }

  sort(vec.rbegin(), vec.rend());

  cout << vec[k-1] << "\n";

  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main()
{
	char line[3];
	int count = 0;
	scanf("%s", line);
	for (size_t i = 0; i < 3; i++)
	{
		if (line[i] == '1')
			count++;
	}
	printf("%d", count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i > 0; i++)

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int s;
  cin >> s;
  vector<int> num(1000);
  set<int> ans;
  int ANS = 0;
  num[0] = s;
  ans.insert(s);
  rep(i,1000) {
    if(num[i-1]%2 == 0) num[i] = num[i-1]/2;
    if(num[i-1]%2 == 1) num[i] = num[i-1]*3+1;
    
    if(ans.count(num[i])){
       ANS = i+1;
       break;
    }else ans.insert(num[i]);
  }
  cout << ANS << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    int ask= 0;
    if(a + b > 2*c)
    {
        int u = min(x,y);
        ask += 2*c*u;
        x-=u,y-=u;
        ask += min(x*a + y*b,2*c*(x?x:y));
    }
    else ask += x*a + y*b;
    cout<<ask<<endl;
    return 0;
}


Measured memory_bytes: 256
import math
n=int(input())
l1=math.ceil(math.log(n,6))
l2=math.ceil(math.log(n,9))
dp=[i for i in range(n+1)]
for i in range(1,l1+1):
    for j in range(n):
        if j+6**i<n+1:
            dp[j+6**i]=min(dp[j]+1,dp[j+6**i])
for i in range(1,l1+1):
    for j in range(n):
        if j+9**i<n+1:
            dp[j+9**i]=min(dp[j]+1,dp[j+9**i])
print(dp[-1])

Measured memory_bytes: 7064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.1415926535897932;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll N, A;
ll ans = linf;

int main() {
    cin >> N >> A;
    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }
    for (ll i = 1; i < 40; i++) {
        ll st = 0, en = 1000000000001;
        while (en-st > 1) {
            ll mid = (st + en) / 2;
            if (mid > inf && mid < N && i > 1) {
                en = mid;
                continue;
            }
            ll tmp = 1;
            rep(j,i) {
                tmp *= mid;
                if (tmp > N) break;
            }
            if (tmp >= N) en = mid;
            else st = mid;
        }
        ll b = en-1;
        ll cnt = i*b;
        ll tmp = 1;
        rep(j,i) tmp *= b;
        while (true) {
            tmp = (tmp/b) * (b+1);
            cnt++;
            if (tmp >= N) break;
        }
        ans = min(ans, A*(i-1)+cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
typedef long long ll;


int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int post = a[n-1];
  for(int i = n-1; i >= 0; --i) {
    if(post >= a[i]) {
      post = a[i];
    } else if(post >= a[i]-1) {
      post = a[i] - 1;
    } else {
      puts("No");
      return 0;
    }
  }

  puts("Yes");

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int i, j;
	int Bin[3][3];
	bool b[3][3] = {};
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			cin >> Bin[i][j];
		}
	}
	int n;
	cin >> n;
	for (i = 0; i < n; i++) {
		int a;
		cin >> a;
		for (int k = 0; k < 3; k++) {
			for (int l = 0; l < 3; l++) {
				if (Bin[k][l] == a) b[k][l]++;
			}
		}
	}
	bool flag = false;
	if (b[0][0] && b[0][1] && b[0][2]) flag++;
	if (b[1][0] && b[1][1] && b[1][2]) flag++;
	if (b[2][0] && b[2][1] && b[2][2]) flag++;
	if (b[0][0] && b[1][0] && b[2][0]) flag++;
	if (b[0][1] && b[1][1] && b[2][1]) flag++;
	if (b[0][2] && b[1][2] && b[2][2]) flag++;
	if (b[0][0] && b[1][1] && b[2][2]) flag++;
	if (b[0][2] && b[1][1] && b[2][0]) flag++;
	if (flag) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
S = input()

ans = 0
for i in range(len(S)):
    tmp = 0
    for j in range(i, len(S)):
        if S[j] == 'A' or S[j] == 'T' or S[j] == 'G' or S[j] == 'C':
            tmp += 1
        else:
            break
    ans = max(ans, tmp)

print(ans)




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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const int INF = 100100100;

int main() {
    int n,q; cin >> n >> q;
    fenwick_tree<ll> fw(n);
    rep(i,n) {
        ll a; cin >> a;
        fw.add(i,a);
    }

    rep(i,q) {
        int t; cin >> t;
        if (!t) {
            int p;
            ll x;
            cin >> p >> x;
            fw.add(p,x);
        } else {
            int l,r; cin >> l >> r;
            cout << fw.sum(l,r) << endl;
        }
    }
    return 0;
}

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

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String result = "";
		while(true){
			String[] s = br.readLine().split(" ");			
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			if(a==0 && b==0){break;}
			if(a < b){
				result += a +" "+b+"\n";
			}else{
				result += b +" "+a+"\n";
			}
		}
		System.out.print(result);

	}

}

Measured memory_bytes: 89296
n,a,b = map(int,input().split())
if (a+b) % 2 == 0:
    print(abs(a-b)//2)
else:
    if a-1 > n-b:
        print(n-b+1+abs(a-b)//2)
    else:
        print(a+abs(a-b)//2)


Measured memory_bytes: 2940
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll tmpn = n;
    if ((n & 1) == 0) {
        ll ans = 0;
        ll d = 1;
        while (d <= n) {
            ans += n / (d * 10);
            d *= 5;
        }
        cout << ans << '\n';
    } else {
        cout << 0 << '\n';
    }
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
//ll memo[2001];
//ll dfs(ll now){
//    ll& ret = memo[now];
//    if(ret != -1) return ret;
//    ret = 0;
//    if(now < 3) return ret;
//    ret = 1;
//    for(int i = 3; i <= now; i++){
//        ll L = i, R = now-i;
//        if(R < 3) break;
//
//        cout << now << " " << L << " " << R << endl;
//
//        ret *= dfs(L)*dfs(R)%MOD;
//        ret %= MOD;
//    }
//    ret += 1;
//
//    return ret;
//}
       
template<class Type>
Type solve(Type res = Type()){
    ll S; cin >> S;
//    fill(memo,memo+2001,-1);
//
//    res = dfs(S);
//    for(int i = 0; i <= S;i++){
//        cout << i << " : " << memo[i] << endl;
//    }
    
    ll N = S;//(S+2)/3;
    auto dp = make_v<ll>(N+1,S+1);
    dp[0][0] = 1;
    for(int i = 0; i < N;i++){
        for(int j = 0; j <= S; j++){
            if(dp[i][j] == 0) continue;
            for(int k = 3; j+k <= S; k++){
                dp[i+1][j+k] += dp[i][j];
                dp[i+1][j+k] %= MOD;
                // if(dp[i+1][j+k]>=MOD) dp[i+1][j+k]-=MOD;
            }
        }
    }
    
    for(int i = 0; i <= N;i++){
        (res += dp[i][S])%=MOD;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 34440
# !/usr/bin/python

"""
https://atcoder.jp/contests/abc179/tasks/abc179_b
B - Go to Jail
"""

def solve(n):
    count = 0
    p_d1, p_d2 = list(map(int, input().split()))
    if p_d1 == p_d2: count = 1
    n -= 1

    while n:
        d1, d2 = list(map(int, input().split()))
        if d1 == d2 and p_d1 == p_d2:
            count += 1
            if count == 3: return "Yes"
        elif d1 == d2: count = 1
        else: count = 0
        p_d1 = d1
        p_d2 = d2

        n -= 1

    return "No"

if __name__ == "__main__":
    n = int(input())

    print(solve(n))


Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
using UL=unsigned int;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

struct Line{
 LL l,r,x;
 bool operator<(const Line& r)const{ return x < r.x; }
};

int H,W;
LL X[999], Y[999];
LL Xp[1000], Yp[1000];

Line HL[1000];
Line VL[1000];

int G[2001][2001];

int main(){
 scanf("%d%d",&W,&H);
 rep(i,W) scanf("%lld%lld%lld",&VL[i].l,&VL[i].r,&VL[i].x);
 rep(i,H) scanf("%lld%lld%lld",&HL[i].x,&HL[i].l,&HL[i].r);
 sort(HL,HL+H);
 sort(VL,VL+W);

 rep(i,H-1) Y[i] = HL[i+1].x - HL[i].x;
 rep(i,H) Yp[i] = HL[i].x;
 rep(i,W-1) X[i] = VL[i+1].x - VL[i].x;
 rep(i,W) Xp[i] = VL[i].x;

 rep(y,H*2+1)rep(x,W*2+1){
  G[x][y] = 0;
  if(y&x&1) G[x][y] = -1;
 }
 rep(y,H)rep(x,W-1){
  if(HL[y].l <= Xp[x] && Xp[x+1] <= HL[y].r)
   G[x*2+2][y*2+1] = -1;
  if(Xp[x] == Xp[x+1]) G[x*2+2][y*2+1] = -1;
 }
 rep(x,W)rep(y,H-1){
  if(VL[x].l <= Yp[y] && Yp[y+1] <= VL[x].r)
   G[x*2+1][y*2+2] = -1;
  if(Yp[y] == Yp[y+1]) G[x*2+1][y*2+2] = -1;
 }

 int sx=0,sy=0;
 rep(x,W-1) if(Xp[x]<=0 && 0<=Xp[x+1]) sx = x*2+2;
 if(Xp[W-1]<0) sx = W*2;
 rep(y,H-1) if(Yp[y]<=0 && 0<=Yp[y+1]) sy = y*2+2;
 if(Yp[H-1]<0) sy = H*2;

 queue<pair<int,int>> Q;
 Q.push({sx,sy});
 while(Q.size()){
  int px = Q.front().first;
  int py = Q.front().second; Q.pop();
  if(G[px][py]) continue;
  G[px][py] = 1;
  Q.push({px-1,py});
  Q.push({px+1,py});
  Q.push({px,py-1});
  Q.push({px,py+1});

  if(px==0 || py==0 || px==W*2 || py==H*2){
   cout<<"INF"<<endl; return 0;
  }
 }

 LL ans = 0;
 rep(x,W-1) rep(y,H-1){
  if(G[x*2+2][y*2+2] == 1) ans += X[x]*Y[y];
 }

 cout<<ans<<endl;

 return 0;
}


Measured memory_bytes: 19452
require 'set'; require 'prime'
INF=Float::INFINITY
n = gets.chomp.to_i
 
ct, ca = gets.split.map(&:to_i)
(n-1).times do
  t, a = gets.split.map(&:to_i)
  l=0; r = 10**18
  mid = 0
  while l < r
    mid = (l + r) /2
    if ct <= t * mid && ca <= a * mid
      r = mid
    else
      l = mid + 1
    end
  end
  ct = t * l
  ca = a * l
  # p [ct, ca]
end
 
puts ct + ca

Measured memory_bytes: 2428
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    string s;
    cin>>s;
    int a=(s[0]-'0')*10+(s[1]-'0');
    int b=(s[2]-'0')*10+(s[3]-'0');
    if((a>0 && a<=12) && (b>0 && b<=12))
    {
        cout<<"AMBIGUOUS\n";
    }
    else if(a>0 && a<=12)
    {
        cout<<"MMYY\n";
    }
    else if(b>0 && b<=12)
    {
        cout<<"YYMM\n";
    }
    else cout<<"NA\n";
    return 0;
}

Measured memory_bytes: 256
import cython
 
def main():
    import sys
    readline = sys.stdin.readline
    
    N: cython.longlong
    N = int(readline())
    S = [readline().strip() for i in range(N)]
    
    D = []
    L, R = [], []
    for s in S:
        l: cython.longlong = 0
        r: cython.longlong = 0
        for c in s:
            if c == ')':
                if l > 0: l -= 1
                else: r += 1
            else: l += 1
        if l == 0 and r == 0:pass
        elif l == 0: R.append(r)
        elif r == 0: L.append(l)
        else: D.append((l, r))
    
    L: cython.longlong
    R: cython.longlong
    L = sum(L)
    R = sum(R)
    
    inc = []
    dec = []
    for l, r in D:
        if l > r:
            inc.append((l, r))
        else:
            dec.append((l, r))
    
    inc.sort(key=lambda x:x[1])
    dec.sort(key=lambda x:-x[1])
    
    D = inc + dec
    
    l: cython.longlong
    r: cython.longlong
    for _, (l,r) in enumerate(D):
        L -= r
        if L < 0:
            print('No')
            exit(0)
        L += l
    
    if L == R:
        print('Yes')
    else:
        print('No')
 
if __name__ == '__main__':
    main()

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

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    vector<int> seikai(n,0);
    rp(i,q){
        int a;
        cin >> a;
        a--;
        seikai.at(a)++;
    }
    rp(i,n){
        if(k-q+seikai.at(i)>0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
# https://atcoder.jp/contests/abc106/tasks/abc106_b
import fractions

N = int(input())


def is_8(num):
    if num < 1:
        return False
    elif num == 1:
        return False
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
        if len(divisor_list) == 8:
            return True

cnt = 0
for i in range(1, N + 1, 2):
    if is_8(i):
        cnt += 1

print(cnt)


Measured memory_bytes: 5048
def calc_dist(pos_a,pos_b):
  return abs(pos_a[0] - pos_b[0])+abs(pos_a[1] - pos_b[1])

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

for a_pos in a:
  min_d=float("inf")
  min_d_i=-1
  for i,b_pos in enumerate(b):
    d=calc_dist(a_pos,b_pos)
    if d < min_d:
      min_d=d
      min_d_i=i+1
  print(min_d_i)

Measured memory_bytes: 9140
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h:usize,
        w:usize,
        c:[chars;h]
    }
    for i in 0..h {
        for j in 0..w {
            print!("{}", c[i][j]);
        }
        println!();
        for j in 0..w {
            print!("{}", c[i][j]);
        }
        println!();
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353,maxn=3000;
int a,b,c,d,comb[3333][3333],pw1[3333],pw2[3333],ans,dp[3333][3333],sum,pw[3333],ipw[3333],fuck,ifuck,pre[3333],ia,ib;
void add(int &x,int y)
{
	x+=y;
	if (x>=mod) x-=mod;
}
int binpow(int a,int t)
{
	int res=1,p=a;
	for (int i=t;i;i>>=1)
	{
		if (i&1) res=1ll*res*p%mod;
		p=1ll*p*p%mod;
	}
	return res;
}
int main()
{
	comb[0][0]=1;
	for (int i=1;i<=maxn;i++)
	{
		comb[i][0]=1;
		for (int j=1;j<=i;j++)
		{
			comb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%mod;
		}
	}
	scanf("%d%d%d%d",&a,&b,&c,&d);
	pw1[0]=pw2[0]=1;
	for (int i=1;i<=maxn;i++)
	{
		pw1[i]=1ll*pw1[i-1]*a%mod;
		pw2[i]=1ll*pw2[i-1]*b%mod;
	}
	ia=binpow(a,mod-2);ib=binpow(b,mod-2);
	dp[0][0]=1;
	for (int i=1;i<=c-a+1;i++)
	{
		fuck=(1ll*ia*(i-1)+1)%mod;ifuck=binpow(fuck,mod-2);
		pw[0]=ipw[0]=1;
		for (int j=1;j<=d-b;j++) pw[j]=1ll*pw[j-1]*fuck%mod;
		for (int j=1;j<=d-b;j++) ipw[j]=1ll*ipw[j-1]*ifuck%mod;
		pre[0]=dp[i-1][0];
		for (int j=1;j<=d-b;j++) pre[j]=(1ll*dp[i-1][j]*ipw[j]+pre[j-1])%mod;
		if (i==c-a+1)
		{
			ans=1ll*pre[d-b]*pw[d-b]%mod*pw1[d-b]%mod*pw2[c-a]%mod;
			break;
		}
		for (int j=0;j<=d-b;j++)
		{
			dp[i][j]=1ll*dp[i-1][j]*((1ll*ib*j+1)%mod)%mod;
			if (j) dp[i][j]=(1ll*pre[j-1]*pw[j]%mod*ib+dp[i][j])%mod;
		}
	}
	printf("%d\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 71428
import collections
import sys

*data, = map(int, sys.stdin.read().split()[::-1])

def inp():
    return data.pop()

h, w, m = inp(), inp(), inp()


targets = set()
xs = []
ys = []
for _ in range(m):
    y, x = inp(), inp()
    # y -= 1
    # x -= 1
    ys.append(y)
    xs.append(x)
    targets.add((y, x))

x_stat = collections.Counter(xs)
y_stat = collections.Counter(ys)

xs = sorted(set(xs), key=lambda obj: x_stat[obj], reverse=True)
ys = sorted(set(ys), key=lambda obj: y_stat[obj], reverse=True)

mx_x = x_stat[xs[0]]
mx_y = y_stat[ys[0]]
while xs and x_stat[xs[-1]] < x_stat[xs[0]]:
    xs.pop()
while ys and y_stat[ys[-1]] < y_stat[ys[0]]:
    ys.pop()
# print(xs, x_stat)
# print(ys, y_stat)

found = False
for x in xs:
    for y in ys:
        if (y, x) not in targets:
            found = True
            break
ans = mx_y + mx_x
if not found:
    ans -= 1
print(ans)






Measured memory_bytes: 209904
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))
using namespace std;

int main(void)
{
	string S; cin >> S;
	string ans;
	rep(i, 0, S.length())ans.push_back('x');
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys


def resolve(in_):
    N = next(in_).strip()
    K = int(next(in_))

    # exact
    dp0 = [[0] * (K + 1) for _ in range(len(N) + 1)]
    dp0[0][0] = 1
    # smaller
    dp1 = [[0] * (K + 1) for _ in range(len(N) + 1)]

    ord_zero = ord('0')
    for i, s in enumerate(map(lambda s: s - ord_zero, N)):
        for j in range(K + 1):
            dp1[i + 1][j] += dp1[i][j]
            if s > 0:
                dp1[i + 1][j] += dp0[i][j]
            else:
                dp0[i + 1][j] += dp0[i][j]
            if j < K:
                # smaller -> smaller
                dp1[i + 1][j + 1] += dp1[i][j] * 9
                # exact -> smaller
                dp1[i + 1][j + 1] += dp0[i][j] * max(0, (s - 1))
                # exact -> exact
                if s > 0:
                    dp0[i + 1][j + 1] += dp0[i][j]

    return dp0[len(N)][K] + dp1[len(N)][K]


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
program abc100_a;
{$APPTYPE CONSOLE}
uses
  SysUtils;

const
  a16: Integer = 16; // 分割したシート数
var
  i,j,n,x:Integer;
//  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k:Integer;
  l:array[0 ..16] of Integer;
//  s,s123,s1,s2,s3:string;
//  al:string = 'abcdefghijklmnopqrstuvwxyz';
//  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Read(n);    // E869120
    Readln(x);  // square1001

    if (n > ( a16 / 2 )) or (x > ( a16 / 2 )) or ( n + x > a16 ) then begin
      writeln(':(');
      exit;
    end;
//    count:=0;
//    max  :=0;
//配列初期化
    for i := 0 to 16 do begin
      l[i] := 0;
    end;

//E869120が取得するシートを取る
    for i := 1 to n do begin
      j :=  2*i-1;
      l[j] := 1;
    end;


//square1001が取得するシートを取る
    for i := 1 to x do begin
      j :=  2*i;
      if l[j] <> 0 then begin
        writeln(':(');
        exit;
      end;
      l[j] := 2;
    end;


    Writeln('Yay!');

    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 128
N = int(input())
a = list(map(int, input().split()))

d = set()
for aa in a[0], a[1]:
    for i in range(1, int(aa ** 0.5) + 1):
        if aa % i == 0:
            d.add(i)
            d.add(aa // i)  # i == aa//iのときは重複する
# aの2要素の約数全列挙

# print(d)

g = 1
for dd in d:
    cnt = 0
    for aa in a:
        if aa % dd == 0:
            cnt += 1
    if cnt >= N - 1:
        # N-1個以上の要素を割るなら、求める最大公約数足り得る
        g = max(g, dd)
print(g)


# def is_p(x):
#     if x <= 1: return False
#     for i in range(2, int(x ** 1 / 2) + 1):
#         if x % i == 0:
#             return False
#     else:
#         return True
#
#
# b = (i for i in range(100) if is_p(i))
# t = 1
# for i, bb in enumerate(b, 1):
#     t *= bb
#     t, i
#     if t > 10 ** 9:
#         bb
#         break
# (2, 1)
# (6, 2)
# (30, 3)
# (210, 4)
# (2310, 5)
# (30030, 6)
# (510510, 7)
# (9699690, 8)
# (223092870, 9)
# (6469693230, 10)
# 29
# 小さい方から9個の素数の積で、10**9以内の最大数となる

# 数列で最小の値が素数9個の積で、
# 次に小さい値も重複しない素数9個の積の場合、
# それら素数18個からなる全約数は、
# 2 ** (9 * 2)個あり、
# これら全てについて、10**5個の要素に対し、割り切れるかを試すとTLEになる。
# ただ、10**5個の要素の素因数分解で現れる素数が全く重ならないということは、
# 鳩ノ巣から考えられないんだと思う
# 配列aから2つの要素を取り出したときの、それぞれの約数を全列挙したものの和集合の要素数は、
# 具体的に幾つと見積もればいいのだろうか


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

ll inf=1ll<<60;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ll n,i,t,p,ans=0;
	cin>>n;
	t=sqrt(n);
	for (i=t;i>=1;i--){
		if (n%i==0){
			p=max(i,n/i);
			while (p>0){
				p/=10;
				ans++;
			}
			break;
		}
	}
	cout<<ans;
	return 0;
}

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

typedef long long LL;


LL cal(LL num,LL BASE)
{
    LL sum = 0;
    while(num)
    {
        sum += num % BASE;
        num /= BASE;
    }

    return sum;
}

LL n,S;
vector<LL> V;

LL solve(LL num)
{
//    for(int i = 2;i <= 10000000;++i)
//        if(cal(n,i) == S) return i;


    if(num < 0) return -1;
    if(num == 0) return n+1;

    LL m = sqrt(num+0.5);
    V.clear();

    for(int i = 1;i <= m;++i)
        if(num % i == 0)
        {
            LL a = i,b = num/i;

            a++,b++;
            V.push_back(a);
            V.push_back(b);
        }

    sort(V.begin(),V.end());
    int sz = V.size();
    for(int i = 0;i < sz;++i)
    {
        LL v = V[i];
        if(v < 2) continue;
        if(cal(n,v) == S) return v;
    }

    return -1;

}

int main()
{
   // freopen("./test.txt","r",stdin);
    scanf("%lld %lld",&n,&S);

    LL res = solve(n-S);
    printf("%lld\n",res);


    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<vvvll> vvvvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define PI 3.141592653589793
#define MOD 1000000007

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

int main()
{
	IOS;
	ll k;
	cin>>k;
	if(k==0)
	{
		cout<<"2"<<endl;
		cout<<"1 1";
		return 0;
	}
	vll v(50,49);
	for(ll i=0;i<50;i++)
	{
		v[i]+=k/50;
	}
	ll rem=k%50;
	for(ll i=0;i<rem;i++)
	{
		v[i]+=50 - (rem-1);
	}
	for(ll i=rem;i<50;i++)
	{
		v[i]-=rem;
	}
	cout<<50<<endl;
	for(auto it:v)
	{
		cout<<it<<" ";
	}
	return 0;
}

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

string data[3000];
int c;

bool search(string);
void input(string);
void swap(char *,char *);

int main(){
	string str;
	string str1,str2; //1gariba-su
	int m,size,size1,size2;
	cin >> m;
	while(m--){
		c=0;
		cin >> str;
		size=str.size();
		input(str); //12??????
		for(int i=1;i<size;i++){	//1bunkatu
			str1.assign(str,0,i);
			str2.assign(str,i,size-i);
			size1=str1.size();
			size2=str2.size();
			if(search(str2+str1)) input(str2+str1);	//21??????
			for(int j=0;j<size1/2;j++) swap(&str1[j],&str1[size1-j-1]);//1?????¢
			if(search(str1+str2)) input(str1+str2); //12??????
			if(search(str2+str1)) input(str2+str1); //21??????
			for(int j=0;j<size2/2;j++) swap(&str2[j],&str2[size2-j-1]);//2?????¢
			if(search(str1+str2)) input(str1+str2); //12??????
			if(search(str2+str1)) input(str2+str1); //21??????
			for(int j=0;j<size1/2;j++) swap(&str1[j],&str1[size1-j-1]);//1?????¢
			if(search(str1+str2)) input(str1+str2); //12??????
			if(search(str2+str1)) input(str2+str1); //21??????
		}
		cout << c << endl;
	}
	return 0;
}

bool search(string str){
	for(int i=0;i<c;i++){
		if(str==data[i]) return false;	//??????????????°
	}
	return true;	//??????????????°
}

void input(string str){
	data[c]=str;
	c++;
}

void swap(char *a,char *b){
	char w;
	w=*a;
	*a=*b;
	*b=w;
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back
#define ll long long
#define ld long double
#define fi first
#define se second
const ll mod = 1000000000+7;
const int N = 100000+50;

ll dp[N][3];
ll v[N][3];
int k;

ll go(int x,int t){
	if(x==0)return 0;
	if(dp[x][t]!=-1)return dp[x][t];
	return dp[x][t] = v[x][t] + max(go(x-1,(t+1)%3),go(x-1,(t+2)%3));
}

main()
{ 
	SPEED;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n ;
	cin >> n;
	memset(dp,-1,sizeof(dp));
	for(int i = 1; i<=n;  i++)
	{
		cin >> v[i][0] >> v[i][1] >> v[i][2];
	}
	cout <<max({ go(n,0),go(n,1),go(n,2)}) << endl;
}

Measured memory_bytes: 11136
using System;
using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
using System.Text;


namespace aizu
{
	public class EntryPoint
	{
		public static int[] SplitToInt(string line)
		{
			return Regex.Split(line, " ").Select(x => int.Parse(x)).ToArray();
		}
		public static double[] SplitToDouble(string line)
		{
			return Regex.Split(line, " ").Select(x => double.Parse(x)).ToArray();
		}
		public static long[] SplitToLong(string line)
		{
			return Regex.Split(line, " ").Select(x => long.Parse(x)).ToArray();
		}
		public static void Main()
		{
			var line = Console.ReadLine();
			var v = SplitToLong(line);
			
			var a = v[0];
			var b = v[1];
			
			Console.WriteLine(string.Format("{0} {1} {2:f8}", a / b, a % b, a / (double)b));
		}
	}


}

Measured memory_bytes: 7128
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		out.println(max(a+b,max(a-b,a*b)));
	}
}


Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output14.txt", "w", stdout);
#endif
	long l, r, d;
	cin >> l >> r >> d;
	long i, ans = 0;
	for (i = l; i <= r; i++)
	{
		if (i % d == 0)
			ans++;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 3568
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
//#define MAX_INDEX 1000000001

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n; cin >> n;
	int a[100001] = {};
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		//巨大な配列を確保するとセグフォするので、n以上の削除するべき数はここでカウントする
		int num; cin >> num;
		if (num > n) {
			ans++;
			continue;
		}
		a[num]++;
	}
	for (int i = 1; i <= n; ++i) {
		//個数が合わない数は削除するので、出現数をカウントする
		//自身の大きさより出現数が小さい場合は全削除
		//出現数が大きい場合は、自身の大きさと等しい個数まで削除
		if (a[i] != i) {
			if (a[i] < i) {
				ans += a[i];
			} else if (a[i] > i) {
				ans += (a[i] - i);
			}
		}
	}
	cout << ans << endl;
    return;
}

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



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X;
    cin >> X;
    if(X >= 2000) {
        cout << 1 << endl;
        return 0;
    }
    int num = X / 100;
    if(X % 100 <= num * 5) {
        cout << 1 << endl;
    } else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 384
//  Mayank Agarwal
//  IIIT Hyderabad



#include<bits/stdc++.h>
using namespace std;
const long long int M = 1000000007; 
#define ll long long int
#define ld double
#define pb push_back
#define mp make_pair
ll power(ll x, ll y,  ll p) 
{ 
    ll res = 1;      
    x = x % p;   
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;x = (x*x) % p; 
    } return res%p; 
} 
ll modinver(ll a,ll b)
{
    return (power(a,1,M)*power(b,M-2,M))%M;
}
void SieveOfEratosthenes(int n) 
{   
    bool prime[10005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,m;
    cin>>n>>m;
    if(n>=13)
    {
    	cout<<m<<'\n';
    }
    else if(n>=6)
    {
    	cout<<m/2<<'\n';
    }
    else
    {
    	cout<<"0\n";
    }

}


Measured memory_bytes: 256