akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

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

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  double a, b, t; cin >> a >> b >> t;
  double now = a;
  int ans = 0;
  while (true){
    if (now > t + 0.5) break;
    ans += b;
    now += a;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())

"""
2(a+b+c) = nK <= 6N
n=1,2,......,6N//K

a+b=iK-c<=2
2N>=iK-c

a+c=iK
a+b=jK
b-c=XK Xは整数
b+c=kK kは自然数
2b=(X+k)K 
b=X'K/2
→K=2a：bはa刻み
→K=2a-1：bはK刻み
"""


# max_n = (2*N)//K
# count = 0
# anslist = []
# for sum_ab in range(K, 2*N + 1, K):
#     print(("a+b", sum_ab))
#     min_a = sum_ab - N if sum_ab - N >= 1 else 1

#     for a in range(min_a, min(sum_ab, N+1)):
#         b = sum_ab - a
#         if (a - b) % K != 0:
#             continue
#         if b < 1 or b > N:
#             break
#         lower = min(a, b)
#         for c in range(1, N+1):
#             if (lower + c) % K == 0:
#                 # print((a, b, c))
#                 anslist.append([a, b, c])
#                 count += 1
# anslist.sort(key=lambda x: x[0])
# print(anslist)
# print(count)

if K % 2 == 0:
    kizami = K // 2
    max_kizami = N // kizami
    pa1 = max_kizami // 2
    pa2 = max_kizami - pa1
    print(pa1**3+pa2**3)
else:
    kizami = K
    max_kizami = N // kizami
    print(max_kizami**3)

"""偶数の場合
a+b=K max_kizami通り
    kizami kizami [kizami,kizami+K,...]
a+b=2K 2max_kizami　+　N//K通り
    1kizami 3kizami [kizami,kizami+K,...]
    2kizami 2kizami [2kizami,4kizami,...]
    3kizami 1kizami [kizami,kizami+K,...]


a+b=2(N//K)K
    max_kizami*kizami max_kizami*kizami [kizami,...]
"""
"""奇数の場合
K K [K,2K,...]

2K K []
K 2K []

3K K []
2K 2K []
K 3K []



max_kizami
"""


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

#include <atcoder/dsu>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define inf 2e9
#define linf 9000000000000000000ll
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using namespace atcoder;

int n, q;

int main() {
    cin >> n >> q;
    dsu ds(n);
    rep(i, q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            ds.merge(u, v);
        } else {
            cout << ds.same(u, v) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3956
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new MyInputStream();
            var N = cin.ri();
            var s = new int[N];

            for (int i = 0; i < N; ++i)
                s[i] = cin.ri();

            Array.Sort(s);

            var sum = s.Sum();

            if (sum % 10 != 0)
            {
                WriteLine(sum);
                return;
            }
            else
            {
                for (int i = 0; i < N; ++i)
                {
                    if ((sum - s[i]) % 10 != 0)
                    {
                        WriteLine(sum - s[i]);
                        return;
                    }
                }
            }
            WriteLine(0);
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Trim().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
        public string r() => Read();
        public int ri() => ReadInt();
        public long rl() => ReadLong();
        public double rd() => ReadDouble();
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 1000000007
using namespace std;
int main()
{
    fastio;
    ull n,fact=1,i;
    cin>>n;
    for (i=1;i<=n;i++)
        fact = (fact*i)%(mod);
    cout<<fact<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <string>
#include <queue>
#include <memory>
#include <deque>
#include <set>
#include <unordered_set>
#include <cmath>
#include <list>
#include <cassert>
#include <cstring>

using namespace std;

using big = long long;

const int N = 20000;

big a[N], b[N];

int main() {
	std::ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  big ans = 1ll << 60;
  for (int moves = 0; moves < n; ++moves) {
    big s = 1ll * m * moves;
    for (int i = 0; i < n; ++i) {
      s += a[i];
    }
    for (int i = 0; i < n; ++i) {
      b[i] = min(a[i], a[(i + (n - 1)) % n]);
    }
    for (int i = 0; i < n; ++i) {
      a[i] = b[i];
    }
    ans = min(ans, s);
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void)
{
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  int left = A+B;
  int right = C + D;
  if( left < right ) {
    cout << "Right" << endl;
  } else if( left > right ) {
   	cout << "Left" << endl;
  } else {
    cout << "Balanced" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N,M,X,cost_r=0,cost_l=0;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int [] cost = new int[N];
        for(int a=0;a<N;a++){
            cost[a]=0;
        }
        for(int a=0;a<M;a++){
            int num=sc.nextInt();
            cost[num] =1;
        }
        for(int a=1;a<N-1;a++){
            if(X-a>=0){
                cost_l += cost[X-a];
            }
            if(X+a<=N-1){
                cost_r+=cost[X+a];
            }
        }
        if(cost_r>=cost_l) System.out.println(cost_l);
        else System.out.println(cost_r);
    }
}

Measured memory_bytes: 21972
#include <iostream>
 
int main()
{
    long long N;
    std::cin >> N;
    long long ans = 0;
    for (long long i=1; i<N+1; i++)
    {
        long long n = N/i;
        ans += i*(n*(n+1))/2;
    }
    std::cout << ans;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
vector<vector<pair<ll,ll>>> E(111111);
vi ans(111111);
bool vis[111111];
void dfs(ll now,ll cost){
  for(int i=0;i<E[now].size();i++){
    ll to=E[now][i].F;
    ll co=E[now][i].S;
    if(vis[to])continue;
    //cout<<now<<" "<<to<<" "<<co<<" "<<cost<<endl;
    if((co)%2){
      ans[to]=(ans[now]+1)%2;
      vis[to]=true;
      dfs(to,cost+co);
    }else{
      ans[to]=ans[now];
      vis[to]=true;
      dfs(to,cost+co);
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  for(int i=0;i<n-1;i++){
    ll a,b,c;cin>>a>>b>>c;
    E[--a].pb(mp(--b,c));
    E[b].pb(mp(a,c));
  }
  ans[0]=0;
  vis[0]=true;
  dfs(0,0);
  for(int i=0;i<n;i++)
    cout<<ans[i]<<endl;
  return 0;
}


Measured memory_bytes: 10752
function main(input) {
  input=input.trim()
  const a = parseInt(input.split(" ")[0], 10);
  const op = input.split(" ")[1];
  const b = parseInt(input.split(" ")[2], 10);
  if(op=="+"){
    console.log(a+b);
  }else{
    console.log(a-b);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long MOD = 1000000007;

long long fact(long long k) {
	long long sum = 1;
	for (long long i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long pow_mod(int a, int b) {
	long long ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

long long powll(long long a, long long  b) {
	long long ans = 1;
	for (long long  i = 0; i < b; i++)
		ans = ans * a;

	return ans;
}


int main()
{
	long long n, ans = 0;
	string x;

	cin >> n;

	vector<string> s(n);
	vector<long long> t(n);

	for (int i = 0; i < n; i++)
		cin >> s[i] >> t[i];

	cin >> x;

	for (int i = n - 1; i >= 0; i--) {
		if (x.compare(s[i]) == 0)
			break;
		else
			ans += t[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <complex>
#include <cmath>
using namespace std;

typedef complex<double> P;
typedef const P &rP;

#define EPS 1e-7

double ans;
vector<P> pnts;

double dot(rP va, rP vb){
	return real(va) * real(vb) + imag(va) * imag(vb);
}

double cross(rP a, rP b){
	return real(a) * imag(b) - imag(a) * real(b);
}

double distance_ls_p(rP a, rP b, rP c){
	if( dot(b - a, c - a) <= 0.0 ) return abs(c - a);
	if( dot(a - b, c - b) <= 0.0 ) return abs(c - b);
	return abs(cross(b - a, c - a)) / abs(b - a);
}

bool contains(const vector<P> &plg, rP pt){
	int cnt = 0;
	double y = imag(pt);

	for(int i = 0; i < plg.size(); ++i){
		int j = (i + 1 == plg.size() ? 0: i + 1);

		if( distance_ls_p(plg[i], plg[j], pt) < EPS ){
			return false;
		}

		double dyi = imag(plg[i]) - y;
		double dyj = y - imag(plg[j]);
		double tx = (dyi * real(plg[j]) + dyj * real(plg[i])) / (dyi + dyj);

		if(imag(plg[i]) >= y && imag(plg[j]) < y){
			if( tx < real(pt) ) ++cnt;
		}
		else if(imag(plg[i]) < y && imag(plg[j]) >= y){
			if( tx < real(pt) ) ++cnt;
		}
	}

	return (cnt % 2 != 0);
}

P intersect(rP pa1, rP pa2, rP pb1, rP pb2){
	P da12 = pa2 - pa1;
	P db21 = pb1 - pb2;
	P dab1 = pb1 - pa1;
	double D = cross(da12, db21);
	double t = cross(dab1, db21) / D;
	return pa1 + t * da12;
}


void dfs(int now, rP prev, int S, double len, double sum){
	if(now == 1){
		ans = min(ans, sum);
		return;
	}

	vector<P> tri(3);

	for(int i = 1; i < pnts.size(); ++i){
		if(S >> i & 1){ continue; }
		if(abs(cross(pnts[now], pnts[i])) < EPS){
			continue;
		}

		int T = S | 1 << i;
		double nl = len;
		P base = prev;
		P pos = pnts[now];

		while(1){
			int idx = -1;
			double minarg = 9.9;
			double maxnorm = -1.0;

			tri[0] = base;
			tri[1] = pos;
			tri[2] = pnts[i];
			for(int j = 2; j < pnts.size(); ++j){
				if(!contains(tri, pnts[j])){
					bool cntn = false;
					for(int k = 0; k < 3; ++k){
						if(norm(pnts[j] - tri[k]) < EPS){
							cntn = true;
							break;
						}
					}
					if(cntn){
						continue;
					}

					double d1 = abs(pnts[j] - base), d2 = abs(pnts[j] - pnts[i]);
					double d3 = abs(pnts[i] - base);
					if(abs(d1 + d2 - d3) > EPS){
						continue;
					}
				}
				double a = abs(arg((pnts[j] - base) / (pos - base)));
				double nm = norm(pnts[j] - base);
				if(a + EPS < minarg){
					minarg = a;
					maxnorm = nm;
					idx = j;
				}
				else if(abs(a - minarg) < EPS && maxnorm < nm){
					minarg = a;
					maxnorm = nm;
					idx = j;
				}
			}

			if(idx == -1) break;

			pos = intersect(pos, pnts[i], base, pnts[idx]);
			nl -= abs(pnts[idx] - base);
			base = pnts[idx];
			T |= 1 << idx;
		}

		if(nl > abs(pnts[1] - base) - EPS){
			dfs(i, base, T, nl, sum + abs(pnts[now] - pnts[i]));
		}
	}
}


int main(){
	int n, x, y;
	while(scanf("%d", &n), n){
		pnts.resize(n + 2);
		for(int i = 0; i < n + 2; ++i){
			scanf("%d%d", &x, &y);
			pnts[i] = P(x, y);
		}

		if(norm(pnts[0]) < norm(pnts[1])){
			puts("-1");
		}
		else{
			ans = abs(pnts[0]) + abs(pnts[1]);
			dfs(0, P(), 1, abs(pnts[0]), 0.0);
			printf("%f\n", ans);
		}
	}
}

Measured memory_bytes: 1172
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	int ma=0;
	vi in(n);
	rep(i,n){
		int a,b;
		cin>>a>>b;
		ma=max(a,ma);
		in[i]=-b;
	}
	sort(all(in));
	int co=0;
	int t=0;
	while(m>0&&t<n&&-in[t]>ma){
		m+=in[t];
		t++;
		co++;
	}
	if(m>0)co+=(m+ma-1)/ma;
	cout<<co<<endl;
}





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

namespace ConsoleApplication2
{
    class Program
    {


        static void Main(string[] args)
        {

            while (true)
            {
                int[] inputs = Console.ReadLine()
                    .Split(' ')
                    .Select(x => int.Parse(x))
                    .ToArray();

                int h =  inputs[0];
                int w =  inputs[1];

                bool finished = (h == 0) && (w == 0);

                if(finished)
                    break;

                for (int i = 0; i < h; i++)
                {
                    for (int j = 0; j < w; j++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}

Measured memory_bytes: 9400
#include <iostream>
#include<vector>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
typedef long long int lld;
typedef unsigned long long int llu;
using namespace std;
const int m=1e9;
int main()
{
	int n,k;
	cin>>n>>k;
	int a[n],i,j;
	for(i=0;i<n;i++) cin>>a[i];
    int dp[n];
    dp[n-1]=0;
    for(i=n-2;i>=0;i--)
    {
    	int temp=1;
    	dp[i]=m;
    	while(i+temp<n && temp<=k)
    	{
    		dp[i]=min(abs(a[i+temp]-a[i])+dp[i+temp],dp[i]);
    		temp++;
		}
	}
	cout<<dp[0];
}

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

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

    vector<int> L(N);
    for (int &l : L)
    {
        cin >> l;
    }
    sort(L.begin(), L.end());
    L.push_back(100000);

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int threshold = L[i] + L[j];
            int l = 0;
            int r = N;
            int c;
            while (r - l > 1)
            {
                c = (l + r) / 2;
                if (L[c] < threshold)
                {
                    l = c;
                }
                else
                {
                    r = c;
                }
            }
            ans += max(0, l - j);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

char s[200010];

int main(){
  scanf("%s", &s);
  int n = strlen(s);

  int ss=0;
  int res=0;
  rep(i,n){
    if(s[i]=='S'){
      ss++;
    }
    else if(s[i]=='T'){
      if(ss>0){
        ss--;
      } else {
        res++;
      }
    }
  }
  res += ss;
  cout<<res<<endl;

  return 0;
}


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

using namespace std;

int main(void){
  int n, x, c;
  while(true){
    scanf("%d %d", &n, &x);
    if(n == 0 && x == 0){
      return 0;
    }
    c = 0;
    for(int i = 1;i <= n;++i){
      for(int j = i;j <= n;++j){
        for(int k = j;k <= n;++k){
          if(i != j && j != k && k != i && i + j + k == x){
            ++c;
          }
        }
      }
    }
    printf("%d\n", c);
  }
}



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

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

    long n, k, a[100000 + 10], b[100000 + 10], c, keta = 0, tmp, tmpp, ans, cnt = 0, pos;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }

    c = k;
    while(1){
        c /= 2;
        keta++;
        if(c == 0)break;
    }
    tmp = 0;
    for(int i = keta; i >= 0; i--){
        if((k & (1LL << i)) != 0){
            tmpp = 0;
            if(tmp < k){
                for(int j = 0; j < i; j++){
                    tmpp = (tmpp | (1LL << j));
                }
            }
            if((tmp | tmpp) <= k){
                pos = (tmp | tmpp);
            }
            else{
                pos = tmp;
            }
            if(i == 0)pos = k;
            for(int j = 0; j < n; j++){
                if((pos | a[j]) == pos)cnt += b[j];
            }
            ans = max(ans, cnt);
            tmp = (tmp | (k & (1LL << i)));
            cnt = 0;
        }
    }
    for(int i = 0; i < n; i++){
        if((k | a[i]) == k)cnt += b[i];
    }
    
    cout << max(ans, cnt) << "\n";
    return 0;
}


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

using namespace std;
typedef long long ll;
#define next asdnext
#define prev asdprev
#define all(x) (x).begin(), (x).end()
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  if (s.size() == 2) {
    if (s[0] == s[1])
      cout << "1 2";
    else
      cout << "-1 -1";
    return 0;
  }
  for (int i = 0; i < s.size() - 2; i++) {
    if (s[i] == s[i + 1] || s[i] == s[i + 2]) {
      cout << i + 1 << ' ' << i + 3;
      return 0;
    }
  }
  cout << "-1 -1";

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    long long ans=0;
    cin>>n;
    if(n%2)
        cout<<0;
    else
    {

       for(long long i =1;i<=n;i*=5)
       {
           ans+=n/(i*10);
           //ans--;
           //cout<<
       }
       cout<<ans;
    }
//124999999999999995
//111111111111111111

}

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

int main(int, char**) {
  std::string S;
  std::cin >> S;
  if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <utility>
#include <array>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char buf[20];char *p=buf;if(n<0)pcu('-'),n*=-1;
	if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10; while (p!=buf)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

int main() {
	array<string, 8> a;
	for (auto &y: a)
		scan(y);
	int i, j, go[] = {0, 8, 1}, back[] = {7, -1, -1};
	const struct {int r, *i, *j, &x, &y;} tr[] =
		{90, go, back, i, j, 180, back, back, j, i, 270, back, go, i, j};
	auto loop = [](int o[], int &k, auto f) {
		for (k = o[0]; k != o[1]; k += o[2]) f();};
	for (auto &t: tr) {
		outl(t.r);
		loop(t.i, i, [&] {
			 loop(t.j, j, [&] {
				  out(a[t.y][t.x]);});
			 outl();});
	}
}


Measured memory_bytes: 2708
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> A(n);


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

	A.erase(unique(A.begin(), A.end()), A.end());

	A.shrink_to_fit();

	for (int l = 0; l < A.size(); l++) {
		if (l == 0) cout << A[l];
		else cout << " " << A[l];
	}
	cout << endl;
}




Measured memory_bytes: 3664
(n,m,),*a=$<.map{|z|z.split.map &:to_i}
r=[-1]*-~n
c=r.dup
f=->x{r[x]>0?f[r[x]]:x}
a.map{|u,v|x,y=[f[u],f[v]].sort
m>0&&x!=y&&[r[x]+=r[y],r[y]=y=x]
x==y&&[c[u]-=1,c[v]-=1]
m-=1}
(1..n).map{|i|p c[i]-r[f[i]]}

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

#define rep(i, n) for ( int i = 0; i < (n); ++i )
using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

int main( void )
{
	ll n, x, y;
	cin >> n >> x >> y;

	ll d[n] = {};
	for ( ll i = 1; i <= n - 1; i++ ) {
		for ( ll j = i + 1; j <= n; j++ ) {
			d[min(min(abs(j - i), abs(x - i) + 1 + abs(j - y)), abs(y - i) + 1 + abs(j - x))]++;
		}
	}

	for ( ll i = 1; i < n; i++ ) {
		cout << d[i] << endl;
	}
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

macro_rules! read_value {

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

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

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

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

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


fn main() {
    use std::cmp::min;
    use std::cmp::max;
    input! {
        n: usize,
        m: usize,
        k: usize,
        A: [usize; n],
        B: [usize; m]
    }
    let mut count:usize = 0;
    let mut a = vec![0; n+1];
    let mut b = vec![0; m+1];
    for i in 1..n+1{
        a[i] = a[i-1] + A[i-1]
    }
    for i in 1..m+1{
        b[i] = b[i-1] + B[i-1]
    }
    let (mut ans, mut j) = (0, m);
    for i in 0..n+1{
        if a[i] > k{
            break
        }
        while b[j] > k - a[i]{
            j -= 1;
        }
        ans = max(ans, i+j);
    }
    println!("{}", ans)
}


Measured memory_bytes: 12524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    cout << N * 800 - N / 15 * 200 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>
#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


ll a[MAX];



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



  cin >> n;
  rep(i, n) cin >> a[i];
  RFOR(i, 1, n) {
    if (a[i - 1] > a[i] + 1) {
      cout << "No" << endl;
      return 0;
    }
    else {
      if (a[i - 1] > a[i]) a[i - 1]--;
    }
  }
  cout << "Yes" << endl;




  return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
h = list(map(int, input().split()))
m = count = 0
for i in range(n-1):
    if h[i] >= h[i+1]:
        count += 1
    else:
        count = 0
    if count > m:
        m = count
print("{}".format(m))


Measured memory_bytes: 14224
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
    int a, b;
    cin >> a >> b;
    cout << a * b << "\n";
	return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,k,a; 
  int l,r;
  int b=0;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    cin>>a;
  }
  if((n-1)%(k-1)!=0) b=1;
  cout<<(n-1)/(k-1)+b<<"\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll              long long
#define dd              double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vll             vector<long long>
#define vdd             vector<double>
#define vpii            vector<pair<int,int>>
#define vpll            vector<pair<long long,long long>>
#define vvi             vector<vector<int>>
#define vvl             vector<vector<long long>>
#define mii             map<int,int>
#define mll             map<long long,long long>
#define umii            unordered_map<int,int>
#define umll            unordered_map<long long,long long>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep2(i,a,b)     for(int i=a;i<b;i++)
#define rev(i,n)        for(int i=n;i>=0;i--)
#define rev2(i,a,b)     for(int i=a;i>=b;i--)
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define inf             9e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define fio             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl            '\n'
#define all(x)          x.begin(),x.end()
#define d0(x)           cout <<x<<" "
#define d1(x)           cout <<x<<endl
#define d2(x,y)         cout <<x<<" "<<y<<endl
#define d3(x,y,z)       cout <<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w)     cout <<x<<" "<<y<<" "<<z<<" "<<w<<endl
#define read2(x,y)      cin>>x>>y
#define read3(x,y,z)    cin>>x>>y>>z
#define read4(x,y,z,w)  cin>>x>>y>>z>>w
#define read5(x,y,z,w,a)cin>>x>>y>>z>>w>>a
#define sz(a)           (int)a.size()
const ll mod=1e9+7;
const double PI = 3.14159265359;
const ll MOD=998244353;
void i_o()
{
   #ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
   #endif
}

int main() {

   fio
   i_o();
   ll a,b,c,k;
   cin>>a>>b>>c>>k;
   ll ans=0;
   if(k<=a){
      ans+=k;
      d1(ans);
   }
   else if(k<=(a+b)){
      ans+=a;
      d1(ans);
   }
   else if(k<=(a+b+c)){
      ans+=a-(k-a-b);
      d1(ans);
   }
   

   return 0;
}



Measured memory_bytes: 3640
#include<stdio.h>
#define N 25

typedef struct{
  int p;
  int sib;
  int left;
  int right;
  int deg;
  int dep;
  int hei;
  
}Node;

Node T[N];

void depth(int,int);
void height(int,int);

int main(){
  int n,i,j,l,r,key;
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
   T[i].p=-1;
   T[i].left=-1;
   T[i].right=-1;
   T[i].sib=-1;
   }
  for(i=0;i<n;i++){
    scanf("%d",&key);
    scanf("%d",&l);
    scanf("%d",&r);
    T[key].left=l;
    T[key].right=r;
    if(l!=-1 && r==-1){
    T[l].p=key;
       T[l].sib=r;
    }
    else if(l==-1 && r!=-1){
      T[r].p=key;
      T[r].sib=l;
     }
    else if(l!=-1 && r!=-1){
       T[l].p=key;
       T[l].sib=r;
       T[r].p=key;
       T[r].sib=l;
    }

    if(l==-1 && r==-1) T[key].deg=0;
    else if(l==-1 || r==-1) T[key].deg=1;
    else T[key].deg=2;
  }
  for(i=0;i<n;i++){
    if(T[i].p==-1) {
    T[i].dep=0;
    depth(i,T[i].dep);
    }
    if(T[i].left==-1 && T[i].right==-1) {
    T[i].hei=0;
    height(i,T[i].hei);
    }
  }
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].p,T[i].sib,T[i].deg,T[i].dep,T[i].hei);
    if(T[i].p==-1) printf("root\n");
    else if(T[i].deg==0) printf("leaf\n");
    else printf("internal node\n");
  }
  return 0;
}

void depth(int id,int count){
  T[id].dep=count;
  if(T[id].left==-1 && T[id].right==-1)return;
  else if(T[id].left==-1) depth(T[id].right,T[id].dep+1);
  else if(T[id].right==-1) depth(T[id].left,T[id].dep+1);
  else   { depth(T[id].left,T[id].dep+1);
          depth(T[id].right,T[id].dep+1);
   }
}

void height(int id,int count){
  if(T[id].hei<=count){
  T[id].hei=count;
  }
  if(T[id].p==-1) return;
  else {
       height(T[id].p,T[id].hei+1);
   }
}

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

using namespace std;

#define int long long 
#define INF 21000000000

signed main(){
		int a,b;
		cin >> a >> b;
		vector<int> n;
		for(int i=0;i<a;i++){
				int tmp;
				cin >> tmp;
				n.push_back(tmp);
		}
		int ans = 1;
		a -= b;
		while(a>0){
				ans++;
				a = a - b + 1;
		}
		cout << ans << endl;
}



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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n;
    cin >> n;
    bool f = false;
    for(int i = 1; i <= 9; i++){
        if(n % i == 0 && n / i <= 9){
            f = true;
            break;
        }
    }
    cout << (f? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
        static char wildcard='?';
        static boolean isWild;
        static boolean matches;
        static int ans=-1;
        static String ansString="UNRESTORABLE";

        public static void main(String[] args){
                Scanner scn=new Scanner(System.in);
                String sPrime=scn.next();
                String T=scn.next();
                int sLength=sPrime.length();
                int TLength=T.length();
                int i,j,k;

                for(i=0;i<sLength-TLength+1;i++){
                        for(j=0,k=i;j<TLength;j++,k++){
                                isWild=sPrime.charAt(k)==wildcard;
                                matches=sPrime.charAt(k)==T.charAt(j);
                                if(!isWild && !matches){
                                        break;
                                }
                                if(j==TLength-1){
                                        ans=i;
                                }
                        }
                }

                if(ans!=-1){
                        ansString="";
                        for(i=0;i<ans;i++){
                                isWild=sPrime.charAt(i)==wildcard;
                                if(isWild){
                                        ansString+="a";
                                }else{
                                        ansString+=sPrime.charAt(i);
                                }
                        }
                        ansString+=T;
                        for(i=ans+TLength;i<sLength;i++){
                                isWild=sPrime.charAt(i)==wildcard;
                                if(isWild){
                                        ansString+="a";
                                }else{
                                        ansString+=sPrime.charAt(i);
                                }
                        }
                        System.out.println(ansString);
                }else{
                        System.out.println(ansString);
                }
        }
}

Measured memory_bytes: 21844
object Main extends App {
    for (Array(a, b, n) <- io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))) {
        var rem = a
        var res = 0
        (0 until n).foreach(_ => {
            rem = rem % b * 10
            res += rem / b
        })
        println(res)
    }
}

Measured memory_bytes: 44100
#include <stdio.h>
#include <string.h>

int main() {
	int n;
	char s[105];

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

	int flag = 1;

	if(n % 2 == 1) {
		puts("No");
	}
	else {
		for(int i = 0; i < n / 2; i++) {
			if(s[i] != s[i + n / 2]) flag = 0;
		}

		if(flag) puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1616
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,a[100005],d=0,ans=0;
int32_t main(){
CODE_START;
cin>>n;
cout<<n*(n-1)/2<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  rep(i, N) cin >> A[i];
  sort(A, A+N);
  bool check = true;
  rep(i, N-1){
  if (A[i] == A[i+1]) check = false;
  }
  if (check) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 4368
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
//cout << fixed << setprecision(20) << *** << endl;
#define rep(i,N) for(int i=0;i<(int)N;++i)
typedef long long ll;
using namespace std;
int main()
{
	ll N,ANS=0;
	vector<ll>V;
	cin>>N;
	rep(i,N){
		ll t;
		cin>>t;
		V.push_back(t-1);
	}
	rep(i,V.size()){
		if(V[V[i]]==i)ANS++;
	}
	cout<<ANS/2<<endl;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int A=0,T=0,R=0,N = 0;
string H , W;
cin >> H >> W;
N = H.size();
//vector<char> vec(H)(W);
for(int i = 0;i < N; i++){
	if(H.at(i) != W.at(i)) T++;
}
cout << T <<endl;

}

Measured memory_bytes: 3908
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        final long MAX = 1000000000000000000L;

        long ans = 1L;
        for (int i = 0; i < n; i++) {
            long a = sc.nextLong();

            if (a == 0) {
                System.out.println(0);
                return;
            }

            if (ans < 0) {
                continue;
            } else {
                if (a > MAX/ans)
                    ans = -1;
                else
                    ans *= a;
            }
        }

        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

        int nextInt() {
            return Integer.parseInt(next());
        }

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

Measured memory_bytes: 47752
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int ll 
#define FOR(i,s,e) for(ll i = s; i <= (ll)e; ++i)
#define DEC(i,s,e) for(ll i = s; i >= (ll)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "LINE: " << __LINE__ << "\n";
typedef pair <ll, ll> pi;
typedef tuple<ll,ll,ll> ti3;
string cts(char x) {string t(1,x); return t;}
ll rand(ll a, ll b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (ll)1e18 + 500;
template <typename T> void chmax(T& a, T b) { a = max(a, b); }
template <typename T> void chmin(T& a, T b) { a = min(a, b); }
const int MAXN = 200005;
#ifndef LOCAL
#define cerr if(0)cout
#endif
vector<int>sum1,sum2;
int32_t main() 
{
	IAMSPEED
	int n,m,k; cin >> n >> m >> k;
	vector<int> v1(n+5),v2(m+5);
	FOR(i,1,n)cin>>v1[i];
	FOR(i,1,m)cin>>v2[i];
	int sum = 0;
	FOR(i,1,n){
		sum+=v1[i];
		sum1.pb(sum);
	}
	sum=0;
	FOR(i,1,m) {
		sum+=v2[i];
		sum2.pb(sum);
	}
	sum = 0;
	ll ans = 0;
	FOR(i,1,n) {
		db(i);
		sum+=v1[i];
		int leftt = k-sum;
		if(leftt<0)break;
		chmax(ans,i+(upper_bound(all(sum2),leftt)-sum2.begin()));
		db(ans);
	}
	sum = 0;
	FOR(i,1,m) {
		sum+=v2[i];
		int leftt=k-sum;
		if(leftt<0)break;
		chmax(ans,i+(upper_bound(all(sum1),leftt)-sum1.begin()));
	}
	cout<<ans;
		
}


Measured memory_bytes: 11128
use proconio::*;
use proconio::marker::*;

type Link = Option<Box<Node>>;

const F: usize = 26;

#[derive(Default)]
struct Node {
    cnt: [u32; F],
    next: [Link; F],
}

fn run() {
    input! {
        n: usize,
        mut s: [Bytes; n],
    }
    s.sort_by_key(|s| s.len());
    let mut root = Some(Box::new(Node::default()));
    let mut ans = 0;
    for s in s.iter_mut().rev() {
        s.reverse();
        let mut now = root.take().unwrap();
        let mut stack = vec![];
        for c in s.iter() {
            let k = (*c - b'a') as usize;
            if now.next[k].is_none() {
                now.next[k] = Some(Box::new(Node::default()));
            }
            let next = now.next[k].take().unwrap();
            stack.push(now);
            now = next;
        }
        let mut bit = 0;
        for (i, c) in s.iter().rev().enumerate() {
            let mut parent = stack.pop().unwrap();
            let k = (*c - b'a') as usize;
            if i == 0 {
                ans += parent.cnt[k] as usize;
            }
            bit |= 1 << k;
            for (j, cnt) in parent.cnt.iter_mut().enumerate() {
                *cnt += ((bit >> j) & 1) as u32;
            }
            parent.next[k] = Some(now);
            now = parent;
        }
        root = Some(now);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

int main() {
  string N;
  cin >> N;
  int sum=0;
  for(int i=0;i<N.size();i++){
    if(N.at(i)=='1'){
      sum+=1;
    }
	if(N.at(i)=='2'){
      sum+=2;
    }
    if(N.at(i)=='3'){
      sum+=3;
    }
    if(N.at(i)=='4'){
      sum+=4;
    }
    if(N.at(i)=='5'){
      sum+=5;
    }
    if(N.at(i)=='6'){
      sum+=6;
    }
    if(N.at(i)=='7'){
      sum+=7;
    }
    if(N.at(i)=='8'){
      sum+=8;
    }
    if(N.at(i)=='9'){
      sum+=9;
    }
  }
  if(sum%9==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}



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

int main(){
  int N;
  cin >> N;
  int sum=0;
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
    while(true){
      if(a%2==1)break;
      else{
        a=a/2;
        sum+=1;
      }
    }
  }
  cout << sum;
}




Measured memory_bytes: 256
#pragma warning (disable :4996)
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const double PI = cos(-1.0);
const double eps = 1e-12;
#define For(i,n,m) for(int i=n;i<=m;++i)
#define clr(a,b) memset(a,b,sizeof(a))


int k, a, b;
int main() {
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> k >> a >> b;
	int aa = a / k, bb = b / k;
	if (a % k == 0) aa = a / k;
	else aa = a / k + 1;
	if (aa <= bb) cout << "OK\n";
	else cout << "NG\n";
}

Measured memory_bytes: 3652
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main() {
  // ========================================================
  int n;
  string a, b;
  cin >> n >> a >> b;
  REP(i, n) { cout << a[i] << b[i]; }
  cout << endl;
}

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

//最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int a, b; cin >> a >> b;
    if(a < 10 && b < 10) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }

    

    return 0;
}

Measured memory_bytes: 256
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
sa = {}
for i in xy:
    for j in xy:
        if i != j:
            a = ",".join([str(i[0] - j[0]), str(i[1] - j[1])])
            if a not in sa:
                sa[a] = 1
            else:
                sa[a] += 1
ans = 0
for i in sa.values():
    ans = max(ans, i)
print(n - ans)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;

template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

int N, M, target;
int key[(int)1e3 + 5], cost[(int)1e3 + 5], memo[(int)1e3 + 5][(int)(1 << 12)];

int util(int idx, int mask){
  if(idx < 0) return (mask == target ? 0 : INF);
    
  int &ret = memo[idx][mask];
  if(ret != -1) return ret;

  ret = INF;
  min_self(ret, util(idx - 1, mask));
  min_self(ret, util(idx - 1, mask | key[idx]) + cost[idx]);

  return ret;
}

int main(){
  FAST_IO  
  memset(memo, -1, sizeof memo);
  cin >> N >> M;
  target = (1 << N) - 1;

  for(int rep = 0, b; rep < M; ++rep){
    int mask = 0;
    cin >> cost[rep] >> b;
    for(int itr = 0, w; itr < b; ++itr){
      cin >> w;
      mask |= (1 << (w - 1));
    }

    key[rep] = mask;
  }

  cout << (util(M - 1, 0) == INF ? -1 : util(M - 1, 0)) << '\n';
  return 0;
}

Measured memory_bytes: 16384