akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long  ll;
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fora(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define kek cout<<endl; 
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<"No"; return 0;}
const ll MOD = 1e9 + 7;
const int N = 200005;
const int INF = 1e8;
const ll MOD1=998244353;
using namespace std;

int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
string a,b;
cin>>a>>b;
cout<<b+a;
return 0;
 

}

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

#define N 1000

using namespace std;

typedef long long int Int;

Int a[N],b[N],c[N],dist[100][100];

int main(void)
{
    int n,m;
    cin>>n>>m;

    for(int i = 0;i < m;i++)
    {
	cin>>a[i]>>b[i]>>c[i];
	a[i]--;
	b[i]--;
    }

    for(int i = 0;i < n;i++)
    {
	for(int j = 0;j < n;j++)
	{
	    if(i == j)
		dist[i][j] = 0;
	    else
		dist[i][j] = 1e9;
	}
    }

    for(int i = 0;i < m;i++) {
	dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
	dist[b[i]][a[i]] = min(dist[b[i]][a[i]],c[i]);
    }

    for(int i = 0;i < n;i++) {
	for(int s = 0;s < n;s++) {
	    for(int e = 0;e < n;e++) {
		dist[s][e] = min(dist[s][e],dist[s][i]+dist[i][e]);
	    }
	}
    }

    Int ans = m;
    for(int i = 0;i < m;i++) {
	bool flag = false;
	for(int j = 0;j < n;j++)
	    if(dist[j][a[i]]+c[i] == dist[j][b[i]])
		flag = true;
	if(flag)
	    --ans;
    }

    cout<<ans<<endl;

    return 0;
}


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

int main()
{
    int N;
    cin >> N;
    if (N % 10 == (N / 10) % 10 && (N / 10) % 10 == (N / 100) % 10)
    {
        cout << "Yes" << endl;
        return 0;
    }
    if ((N / 10) % 10 == (N / 100) % 10 && (N / 100) % 10 == (N / 1000) % 10)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<unordered_map>

using ull = unsigned long long;
using ll = long long;
using namespace std;

int main(void) {
    int n;
    cin >> n;

    unordered_map<ll, bool> memo;

    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        memo[a[i]] = !(memo[a[i]]);
    }

    // solve

    int out = 0;
    for(const auto& p : memo) {
        if (p.second) {
            out++;
        }
    }
    cout << out << endl;

    return 0;
}

Measured memory_bytes: 4772
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	a--, b--, c--, d--;

	string s;
	cin >> s;

	bool ok = true;
	const int from = min(a, b);
	const int to = max(c, d);

	rep(i, from, to){
		if(s[i] ==  '#' and s[i + 1] == '#'){
			ok = false;
		}
	}

	if(d < c){
		bool skip = false;

		rep(i, b, d + 1){
			if(i - 1 < 0) continue;
			if(i + 1 >= n) continue;
			if(s[i] == '#') continue;
			if(s[i - 1] == '.' and s[i + 1] == '.') skip = true;
		}

		if(skip == false) ok = false;
	}

	if(ok)
		puts("Yes");
	else
		puts("No");

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=2e6+5,M=1e6+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
int n,m;
int tg[N],mx[N];
pa p[N];
#define ls (k<<1)
#define rs (k<<1|1)
#define mid (((l)+(r))>>1)
#define lson ls,l,mid
#define rson rs,mid+1,r
#define rt 1,1,m+1
void mtg(int k,int val){tg[k]+=val;mx[k]+=val;}
il void pd(int k){if(tg[k]){mtg(ls,tg[k]);mtg(rs,tg[k]);tg[k]=0;}}
il void pu(int k){mx[k]=max(mx[ls],mx[rs]);}
void build(int k,int l,int r){
	if(l==r){mx[k]=l-m;return;}
	build(lson);build(rson);
	pu(k);
}
void ad(int k,int l,int r,int x,int y){
	if(l==x&&r==y){mtg(k,1);return;}
	pd(k);
	if(y<=mid)ad(lson,x,y);else
	if(x> mid)ad(rson,x,y);else
		ad(lson,x,mid),ad(rson,mid+1,y);
	pu(k);
}
int ask(int k,int l,int r,int x,int y){
	if(l==x&&r==y)return mx[k];
	pd(k);
	if(y<=mid)return ask(lson,x,y);else
	if(x> mid)return ask(rson,x,y);else
		return max(ask(lson,x,mid),ask(rson,mid+1,y));
}
int main(){
	read(n,m);build(rt);
	rep(i,1,n)read(p[i].w1,p[i].w2);
	sort(p+1,p+1+n);int pt=1,res=n-m;
	rep(i,0,m){
		while(pt<=n&&p[pt].w1<=i){ad(rt,1,p[pt].w2);pt++;}
		gmax(res,ask(rt,i+1,m+1)-i-1);
	}cout<<res<<endl;
}

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

int main() {
  string s, t;
  cin >> s >> t;  
  int ans = 1e9;
  // sのある地点からt.size分比較することを繰り返す
  // 範囲外エラー対策のためiはi+t.sizeがs.sizeを超えないようにする
  for (int i = 0; i <= s.size() - t.size(); i++) {
    int count = 0;  // t.size分比較した中で何文字違っていたか
    rep(j, t.size()) if (s[i+j] != t[j]) count++;
    ans = min(ans, count);  // 違いが最も少ないときが答え
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

vector<ll> inv,fact,invfact;
void setupCombination(ll n_max,ll mod){
    fact.resize(n_max+1);
    inv.resize(n_max+1);
    invfact.resize(n_max+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    for(ll i=0;i<n_max;i++){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll getCombination(ll n,ll k,ll mod){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}

/*
max 448,000,000
count_map['0']=0;
for(auto x : count_map) {
    string key = x.first;
    ll value = x.second;
}
*/
ll getMod(ll value,ll mod){
    if(value == 0) return 0;
    if(mod==0) return -1;
    value %= mod;
    if(value<0) value += mod;
    return value;
}
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N;
    cin >> M;
    cin >> K;


    ll allnum = N*M;
    setupCombination(allnum+10,MOD);
    ll base = getCombination(allnum-2,K-2,MOD);
    base = getMod(base,MOD);

    ll ans = 0;
    for( ll yoko = 0 ; yoko <N ; yoko++ ){
        for( ll tate = 0 ; tate <M ; tate++ ){
            ll count = (N-yoko) * (M-tate);
            if(tate*yoko>0) count *=2;
            ll distance = yoko + tate;
            //cout << distance << " : " << count << endl;
            ll dA = count * distance;
            dA = getMod(dA,MOD);

            ans += dA;
            ans = getMod(ans,MOD);
        }
    }

    ans = ans * base;
    ans = getMod(ans,MOD);
    cout << ans << endl;

  

}

Measured memory_bytes: 7976
//Code by ASIM FOIZE AIMON
//CSE'19;CUET
//avoid copy paste//Hit the frined button
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise cout.precision(10); cout << fixed;
#define endl "\n"
#define int int64_t
#define ll long long
#define yes printf("YES\n")
#define no printf("NO\n")

int32_t main()
{
    /*#ifndef ONLINE_JUDGE
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/input.txt", "r", stdin);
        freopen("/media/AIMON/SSDVol/Progs/CodeForces/output.txt", "w", stdout);
    #endif*/
    ll a[10001],n,i,j,c,d,e,f,g,h,s=0,t,m,p,x,y,z,k;
    cin>>m>>x>>y>>z;
    c=m*y;
    d=m*z;
    e=x*y;
    f=x*z;
    g=max(c,d);
    h=max(g,e);
    i=max(h,f);
    cout<<i<<endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define N 100005

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n;
	cin>>n;
	ll a[n];
	for(int i=0;i<n;i++){
        cin>>a[i];
	}
	ll mxdp[n][n], mndp[n][n];
	mem(mxdp, 0);
	mem(mndp, 0);
	ll pre[n];
	pre[0] = a[0];
	for(int i=1;i<n;i++){
        pre[i] = pre[i-1] + a[i];
	}
	for(int i=0;i<n;i++){
        mxdp[0][i] = a[i];
	}
	for(int i=1;i<n;i++){
        for(int j=0;j+i<n;j++){
            mxdp[i][j] = max(a[j] + mndp[i-1][j+1], a[i+j] + mndp[i-1][j]);
            mndp[i][j] = pre[j+i] - mxdp[i][j] - (j>0?pre[j-1]:0);
        }
	}
	ll x = mxdp[n-1][0];
	ll y = mndp[n-1][0];
	cout<<x-y;
	return 0;
}


Measured memory_bytes: 140928
#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 x;
  cin >> x;
  int ans;
  while (true){
    // 素数かどうかの判定フラグ
    bool flag = true;
    // repマクロは使わずに2以上ｘの平方根以下の全てのiについて調べるループを書く
    for (int i = 2; i*i <= (int)(x); i++) {
      // xを割り切るものがあれば素数でないのでfalseにする
      if (x % i == 0) flag = false;
    }
  if (flag == true) break;
  x++;
  }
  cout << x << endl;
}


Measured memory_bytes: 3632
using System;
class Program
{
  static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    int k = int.Parse(Console.ReadLine());
    int x = int.Parse(Console.ReadLine());
    int y = int.Parse(Console.ReadLine());

    int sum = 0;
    if (n <= k) {
      sum = n * x;
    }
    else
    {
      sum = k * x + (n - k) * y;
    }

    Console.WriteLine(sum);
  }
}


Measured memory_bytes: 2648
fun main(args: Array<String>) {

    val s = readLine()!!

    for(i in s.indices){
        if(i % 2 == 0){
            if(!(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
                println("No")
                return
            }
            continue
        }
        if(!(s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
            println("No")
            return
        }
    }
    println("Yes")
}

Measured memory_bytes: 33720
#include <bits/stdc++.h>
using namespace std;
int main(){
  long int S_int; cin >> S_int;
  string S = to_string(S_int);
  int dp = 1, len = S.length(), N = pow(2, S.length() - 1);
  long int tot, left, ans = S_int;
  for(; dp < N; dp++){
    tot = 0;
    left = 0;
    for(int i = 0; i < len - 1; i++){
      if(dp & (1 << i)){
        tot += atoi(S.substr(left, i - left + 1).c_str());
        left = i + 1;
      }
    }
    ans += tot + atoi(S.substr(left, len - left).c_str());
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int h = scanner.nextInt(), w = scanner.nextInt();
			char[][] input = new char[h][];
			IntStream.range(0, h).forEach(i -> input[i] = scanner.next().toCharArray());
			char[][] output = new char[2 * h][w];
			IntStream.range(0, 2 * h).forEach(i -> IntStream.range(0, w).forEach(j -> output[i][j] = input[i / 2][j]));
			IntStream.range(0, 2 * h).forEach(i -> System.out.println(output[i]));
		}
	}
}


Measured memory_bytes: 38480
// READ & UNDERSTAND
// ll, int overflow, array bounds
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int a,b,c;
	cin >> a >> b >> c;
	int cnt = b/a;
	cnt = min(cnt,c);
	cout << cnt << endl;
}	


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;

void unzip(char c, int n, char str[], int *pos)
{
        for (int i = 0; i < n; i++) {
                str[(*pos)++] = c;
        }
}

int main()
{
        const int STRMAX = 51, STRMAX2 = 101;
        char str[STRMAX], str2[STRMAX2];

        while (scanf("%s", str) != EOF) {
                int pos = 0;
                for (int i = 0; i < strlen(str); i++) {
                        if (str[i] == '@') {
                                int n = str[++i] - '0';
                                char c = str[++i];
                                unzip(c, n, str2, &pos);
                        } else {
                                str2[pos++] = str[i];
                        }
                }
                str2[pos] = '\0';
                printf("%s\n", str2);
        }

        return 0;
}

Measured memory_bytes: 2504
N = int(input())
Nlist = [list(map(int, input().split())) for i in range(N)]
Nlist.sort(key=lambda x: x[1])
time = 0
ans = "Yes"
for i in range(N):
    time += Nlist[i][0]
    if time > Nlist[i][1]:
        ans = "No"
        break
print(ans)


Measured memory_bytes: 47092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  vector<int> a(9);
  rep(i,9) cin >>a[i];
  vector<bool> b(9);
  int n;
  cin >>n;
  rep(i,n){
    int x;
    cin >>x;
    rep(i,9){
      if(x == a[i]) b[i] = 1;
    }
  }
  bool c = 0;
  if(b[0]&b[1]&b[2]) c = 1;
  if(b[3]&b[4]&b[5]) c = 1;
  if(b[6]&b[7]&b[8]) c = 1;
  if(b[0]&b[3]&b[6]) c = 1;
  if(b[1]&b[4]&b[7]) c = 1;
  if(b[2]&b[5]&b[8]) c = 1;
  if(b[0]&b[4]&b[8]) c = 1;
  if(b[2]&b[4]&b[6]) c = 1;
  string ans = c ? "Yes" : "No";
  cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
if sum(A)<sum(B):
    print(-1)
else:
    D=[]
    d=0
    a=0
    for i in range(len(A)):
        c=A[i]-B[i]
        D.append(c)
        if c<0:
            a+=1
            d-=c
    D.sort()
    j=1
    while d>0:
        if d>D[-j]:
            a+=1
            d-=D[-j]
            j+=1
        else:
            a+=1
            break
    print(a)


Measured memory_bytes: 18356
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
using Graph = vector<vector<int>>;

int main() {
  string s; cin >> s;
  ll p = 2019;

  ll n = s.size();
  vector<int> d(n+1);
  d[n] = 0;
  ll cnt = 1;
  for(int i = n-1; i >= 0; i--){
    ll a = (s[i]-'0')*cnt % p;
    d[i] = (d[i+1] + a) % p;
    cnt *= 10;
    cnt %= p;
  }

  //組み合わせの数を計算
  vector<int> sum(p, 0);
  ll ans = 0;
  Rep(i, 0, n){
    ans += sum[d[i]];
    sum[d[i]]++;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    vector<double> b(n);
    vector<double> c(n+1);
    double ans = 0;
    c[0] = 0;
    
    rep(i, n)  {
        cin >> p[i];
    }
    rep(i, n) {
       b[i] = ((((double)p[i]) / 2) * (2 + (p[i] - 1))) / p[i];
    }
   rep(i, n) {
        c[i+1] = c[i] + b[i];
    }
    for(int i = k; i < n+1; i++) {
        ans = max(ans, c[i] - c[i-k]);
    }
    cout << fixed;
    cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 4096
from itertools import combinations
from math import sqrt
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]

res = 0
for Y,Z in combinations(X, 2):
    r = sqrt(sum((y-z)**2 for y,z in zip(Y,Z)))
    if r == float(int(r)):
        res += 1
print(res)

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

class Main {
	// Main
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] board = new int[9];
		StringTokenizer st = new StringTokenizer(br.readLine()," ");
		for (int i = 0; i < 9; i++) {
			if (i==3||i==6) {
				st = new StringTokenizer(br.readLine(), " ");
			}
			board[i] = Integer.parseInt(st.nextToken());
		}
		Deque<state> mainq = new ArrayDeque<state>();
		BitSet cl = new BitSet(500000);
		mainq.add(new state(board, 0));
		cl.set(hashBoard(board));
		int minStep = -1;
		while(!mainq.isEmpty()){
			final state s = mainq.remove();
			if (hashBoard(s.board) == 46233) {
				minStep = s.move;
				break;
			}
			int pos;
			for(pos = 0; pos<9 && s.board[pos] != 0; pos++);
			
			if (pos%3 != 0) {
				final int[] next = Arrays.copyOf(s.board, s.board.length);
				next[pos] = next[pos-1];
				next[pos-1] = 0;
				final int h = hashBoard(next);
				if(!cl.get(h)){
					cl.set(h);
					mainq.add(new state(next, s.move+1));
				}
			}
			
			if (pos%3 != 2) {
				final int[] next = Arrays.copyOf(s.board, s.board.length);
				next[pos] = next[pos+1];
				next[pos+1] = 0;
				final int h = hashBoard(next);
				if(!cl.get(h)){
					cl.set(h);
					mainq.add(new state(next, s.move+1));
				}
			}
			
			if (pos > 2) {
				final int[] next = Arrays.copyOf(s.board, s.board.length);
				next[pos] = next[pos - 3];
				next[pos-3] = 0;
				final int h = hashBoard(next);
				if(!cl.get(h)){
					cl.set(h);
					mainq.add(new state(next, s.move+1));
				}
			}
			
			if (pos < 6) {
				final int[] next = Arrays.copyOf(s.board, s.board.length);
				next[pos] = next[pos + 3];
				next[pos+3] = 0;
				final int h = hashBoard(next);
				if(!cl.get(h)){
					cl.set(h);
					mainq.add(new state(next, s.move+1));
				}
			}
		} //end while
	System.out.println(minStep);	
	}// End Main
	
	// Hash the game board state
	private static int hashBoard(int[] board){
		int h = board[0];
		for (int i = 1; i < 8; i++) {
			h = h*(9-i);
			h = h+board[i];
			for (int a = 0; a < i; a++) {
				if (board[a]<board[i]) {
					--h;
				}
			}
		}
		return h;
	}// End Hash Board
}





// State Class
class state{
	final int[] board;
	final int move;
	state(int[] board, int move){
		this.board = board;
		this.move = move;
	}
}


Measured memory_bytes: 60496
#include<bits/stdc++.h>
using namespace std;
int a[]={100,101,102,103,104,105};
int flg=0;
void func(int x,int l){
if(x<0)
return ;
if(x==0)
{   
	flg=1;
	return ;
}
for(int i=l;i<6;i++)
{   
	if(flg==0)
	func(x-a[i],i);
}
}
int main(){
int x;
cin>>x;
func(x,0);
cout<<flg;
}


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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

static constexpr ll nc2(ll n) { return n <= 1 ? 0 : n * (n - 1) / 2; }

int main() {
  ll N;
  cin >> N;
  vec<ll> A(N);
  unordered_map<ll, ll> m;
  REP(i, N) {
    cin >> A[i];
    m[A[i]]++;
  }

  ll acc = 0;
  for (const auto &[_, v] : m) {
    acc += nc2(v);
  }

  REP(i, N) { cout << acc - (m[A[i]] - 1) << endl; }
  return 0;
}


Measured memory_bytes: 11780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		long x;
		if (a == 1) {
			if (b >= 2) {
				b = b - 2;
				System.out.println(b);
			} else {
				System.out.println(1);
			}
		}

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

		if (a >= 3) {
			if (b == 1) {
				System.out.println(a - 2);
			}
			if (b == 2) {
				System.out.println(0);
			}

			if (b >= 3) {
				x = (a - 2) * (b - 2);
				System.out.println(x);
			}
		}

	}
}


Measured memory_bytes: 23764
#include <string.h>
#include <algorithm>
#include <cstdio>
#include <limits>
#define max_n 100
#define max_m 1000
#define max_l 1000
#define   min_int(a,b)  ( ((a)<(b) ) ? (a) : (b) )
using namespace std;
class Req{
public:
  char house;
  int time;
};
class LessReq {
public:
    bool operator()(const Req& x, const Req& y) const {
        return x.time < y.time; 
    }
};
int n,m,l;
int dist[max_n][max_n];
Req reqs[max_l];
//リクエストx配送後に、リクエストy配送可能かを示す有向グラフ（DAG）
int req_graph[max_l][max_l];
int num_child[max_l];//各リクエストxの子の数
int parent[max_l]; //被覆パスにおけるリクエストxの親
int till[max_l];
bool visited[max_l];
int halfmax = (numeric_limits<int>::max())/2;
 
//すべての宅間の最短距離を算出、distに記録
void compute_dist(){
  register int i,j,k;
   
  for(k=0;k<n;k++){
    for(i=0;i<k;i++){
      for(j=i+1;j<k;j++){  //i<j<k
        dist[i][j] = min_int(dist[i][j],dist[i][k]+dist[j][k]);
      }
      for(j=k+1;j<n;j++){  //i<k<j
        dist[i][j] = min_int(dist[i][j],dist[i][k]+dist[k][j]);
      }
    }
    for(i=k+1;i<n;i++){
      for(j=i+1;j<n;j++){  //k<i<j
        dist[i][j] = min_int(dist[i][j],dist[k][i]+dist[k][j]);
      }      
    }
  }
  for(i=0;i<n;i++)for(j=i+1;j<n;j++){
    dist[j][i] = dist[i][j];
  }
}
//req_graphの構成
void compute_req_graph(){
  int i,j,h1,h2;
 
  memset(num_child,0,l*sizeof(int));
  for(i=0;i<l;i++) for(j=i+1;j<l;j++){
      h1 = reqs[i].house; h2 = reqs[j].house;      
      if((dist[h1][h2] != halfmax) //h1、h2間に経路あり
         && (dist[h1][h2] <= reqs[j].time - reqs[i].time)){
        req_graph[i][num_child[i]++] = j;
      }      
  } 
}
 
int find(int i, bool root){
  int child, x, found;
  //親権の空いている子を探す
  visited[i] = true;  
  if(till[i] < num_child[i]){    
    while((++(till[i])) < num_child[i]){
      child = req_graph[i][till[i]];
      if(parent[child] >= 0) continue;
      parent[child] = i; //childを自分の子とする
      return child;
    }
  }
  //他の親から親権を譲ってもらえる子を探す  
  for(int j = 0;j < num_child[i]; j++){
    child = req_graph[i][j];
    x = parent[child]; //x: childのパス上の親
    if(visited[x]) continue;
    found = find(x,false); //xからchildの親権をもらう交渉
    if(found < 0) continue;
    parent[child] = i; //childの親権獲得
    return child;
  }
  return -1;
}
//req_graphのパス被覆を求め、被覆数を返す。
int num_covers(){
  int num=0;
  memset(till,-1,l*sizeof(int));
  memset(parent,-1,l*sizeof(int));
  for(int i=0;i<l;i++){
    memset(visited,0,l*sizeof(bool));
    find(i,true);
  }
  for(int i=0;i<l;i++) if(parent[i]<0) num++;
  return num;
}
 
//プレゼント配送に必要なサンタの数を出力する関数
int santas(){
  int u,v,d,i,j;
  //入力読み込み
  for(i=0;i<n;i++) dist[i][i] = 0;
  for(i=0;i<n;i++) for(j=i+1;j<n;j++) dist[i][j] = halfmax;
  for(i=0;i<m;i++){
    scanf("%d%d%d",&u,&v,&d);
    dist[u][v] = d;
  }
  for(i=0;i<l;i++){
    scanf("%d%d",&(reqs[i].house),&(reqs[i].time));
  }
  compute_dist();//すべてのhouse間の最短距離を算出、distに記録
  sort(reqs,reqs+l,LessReq());
  compute_req_graph();//req_graphの構成
  int res = num_covers();
  return res;
}
 
//以下メイン関数
int main(){
  while(1){    
    scanf("%d%d%d",&n,&m,&l);
    if((n == 0) && (m == 0) && (l == 0)) break;    
    printf("%d\n",santas());
  }
  return 0;
}

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


class Main {

    static int n,m;
    static char arr[][];
    static long memo[][];

    public static long dp(int i , int j)
    {
        if(i == n-1 && j == m-1)
            return 1l;

        if(i >= n || j >= m)
            return 0l;

        if(memo[i][j] != -1)
            return memo[i][j];

        memo[i][j] = 0l;

        if(arr[i][j] == '.')
            memo[i][j] = dp(i+1 , j)%(1000000000+7) + dp(i , j+1)%(1000000000+7);

        return memo[i][j]%(1000000000+7);
    }

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        StringTokenizer st1 = new StringTokenizer(br.readLine());

        n = Integer.parseInt(st1.nextToken());
        m = Integer.parseInt(st1.nextToken());

        arr = new char[n][m];
        memo = new long[n][m];

        for(int i = 0 ; i < n ; i++)
        {
            String ss = br.readLine();

            for(int j = 0 ; j < m ; j++)
            {
                arr[i][j] = ss.charAt(j);
                memo[i][j] = -1;
            }
        }

        out.println(dp(0,0));



        out.flush();
        out.close();
    }

}

Measured memory_bytes: 37716
N = int(input())
A = [int(input()) for _ in range(N)]
def solve(A,n):
    import bisect
    dp = [float('inf')] * n
    for i in range(n-1,-1,-1):
        k = bisect.bisect_right(dp, A[i])
        dp[k] = A[i]
    ans = 0
    for a in dp:
        if a != float('inf'):
            ans += 1
        else:
            break
    return ans
print(solve(A,N))

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

int main(){
  ll h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  ll temp=(h2*60+m2)-(h1*60+m1)-k;
  cout<<temp<<endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s;
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}

int main() {
	cin >> n;
	ll res = INF;
	for (ll i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			chmin(res, i + n / i);
		}
	}
	cout << res-2 << endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	char a[2][3];
	for(int i=0;i<2;i++){
		for(int j=0;j<3;j++)
			cin>>a[i][j];
	}
	for(int j=0;j<3;j++){
		if(a[0][j]!=a[1][3-j-1])
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 256
import heapq


def small_multiple(k):
    # kの倍数で各桁の総数が最も小さくなるような、各桁の総数
    dist = [float("inf")] * k
    q = []
    # kで割った余りが1になるような最小の数は1
    heapq.heappush(q, (1, 1))

    while q:
        n, c = heapq.heappop(q)
        if dist[n] <= c:
            continue
        dist[n] = c

        if dist[(n + 1) % k] > c + 1:
            heapq.heappush(q, ((n + 1) % k, c + 1))
        if dist[(n * 10) % k] > c:
            heapq.heappush(q, ((n * 10) % k, c))

    print(dist[0])


def main():
    k = int(input())
    small_multiple(k)


if __name__ == "__main__":
    main()


Measured memory_bytes: 120908
#include <set>
#include <iostream>
#include <cstdio>
#include <algorithm>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define f first
#define s second
#define mp make_pair

typedef long long ll;

using namespace std;

int n, m, l;
int k[2000];
int s[100000];
int f[100000];

ll *sbuff;
ll *mbuff;

ll *sum[2000];
ll *memo[2000];

void init(){
  int nn = n * (n + 1) / 2;
  sbuff = (ll*)malloc(sizeof(ll) * nn);
  mbuff = (ll*)malloc(sizeof(ll) * nn);

  REP(i,n) sum[i] = (ll*)&sbuff[i * (i + 1) / 2];
  REP(i,n) memo[i] = (ll*)&mbuff[i * (i + 1) / 2];
}

ll solve(int l, int r){
  if(l < r) swap(l, r);
  if(memo[l][r] != -1) return memo[l][r];

  int next = max(l, r) + 1;
  ll ret = 0;

  if(next == n){
    ret = sum[l][r];
  }else{
    ret = sum[next][l] + solve(next, r);
    ret = min(ret, sum[next][r] + solve(l, next));
  }

  return memo[l][r] = ret;
}

int main(){
  scanf("%d%d%d", &n, &m, &l);
  REP(i,n){scanf("%d", k+i); k[i]--;}
  REP(i,m){scanf("%d", s+i);}

  sort(k, k+n);

  init();

  for(int i = 0; i < n; i++){
    sum[i][i] = s[k[i]];
    if(i != n - 1){
      for(int j = k[i]; j <= k[i+1]; j++){
	sum[i+1][i] += s[j];
      }
    }
  }
  for(int len = 2; len < n; len++){
    for(int i = 0; i + len < n; i++){
      sum[i+len][i] = sum[i+1][i] + sum[i+len][i+1] - s[k[i+1]];
    }
  }

  REP(i,n) REP(j,n) if(i >= j) sum[i][j] /= l;

  // REP(i,n) { REP(j,n) printf("%3d ", (int)sum[i][j]); puts(""); }
  // REP(i,n) printf("%d (%d)\n", k[i], s[k[i]]);

  REP(i,n) REP(j,n) if(i >= j) memo[i][j] = -1;

  ll ans = solve(0, 0);

  cout << ans << endl;

  return 0;
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

bool match(char x, char y) {
  return (x == y) || x == '?' || y == '?';
}

vector<bool> diff_k(const string &a, const string &b) {
  vector<bool> res(4040, true);
  rep(k, 4040) {
    rep(i, a.size()) {
      ll j = i - k;
      if (j < 0 || j >= b.size())
        continue;
      if (!match(a[i], b[j]))
        res[k] = false;
    }
  }
  return res;
}

signed main() {
  ll ans = 1000000;
  vector<string> v(3);
  rep(i,3) { cin >> v[i]; }
  sort(begin(v), end(v));
  do {
    auto &a = v[0], &b = v[1], &c = v[2];

    auto d1 = diff_k(a, b); // b を a からk文字ずらしたときに、成り立つかどうか
    auto d2 = diff_k(a, c); // c を a からk文字ずらしたときに、成り立つかどうか
    auto d3 = diff_k(b, c); // c を b からk文字ずらしたときに、成り立つかどうか

    rep(x, 2020)
      rep(y, 2020)
        if (d1[x] && d2[x+y] && d3[y]) {
          ll t = max({(ll)a.size(), (ll)b.size()+x, (ll)c.size()+x+y});
          chmin(ans, t);
        }
  } while(next_permutation(begin(v), end(v)));
  cout << ans << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  int a,b,c;
  cin >> a >> b >> c;

  cout << (a+b>=c ? "Yes" : "No") << endl;
  return 0;
} 

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

string last = "zyxwvutsrqponmlkjihgfedcba";

int main(int argc, char const *argv[]) {
	std::vector<bool> check(26,true);
	string str;
	std::cin >> str;
	// 最大単語処理
	if (str == last) {
		std::cout << -1 << '\n';
		return 0;
	}

	for (size_t i = 0; i < str.size(); i++) {
		check[str[i]-'a'] = false;
	}

	// 単語が26時の場合
	if (str.size() == 26) {
		std::vector<bool> used(26,false);
		char ch = str[str.size()-1];
		used[ch - 'a'] = true;
		for (size_t i = str.size()-1; i >= 0; i--) {
			if (ch > str[i]) {
				for (size_t j = 0; j < used.size(); j++) {
					if (used[j] && (char)('a' + j) > str[i]) {
						string ans = str.substr(0,i+1);
						ans[ans.size()-1] = (char)('a' + j);
						std::cout << ans << '\n';
						return 0;
					}
				}
			}
			else {
				ch = str[i];
				used[ch - 'a'] = true;
			}
		}
	}

	// 26字じゃない場合は付け足したものが最小
	for (int i = 0; i < check.size(); i++) {
		if (check[i]) {
			std::cout << str + (char)('a' + i) << '\n';
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p

n = int(input())
a = [int(x) for x in input().split()]

if n == 2:
    print(max(a))
else:
    x, y, z = a[0], a[1], a[2]
    p, q, r = gcd(x, y), gcd(y, z), gcd(z, x)
    gcd_max = max(p, q, r)
    if gcd_max == p:
        without = z
    elif gcd_max == q:
        without = x
    else:
        without = y

    k = gcd(gcd_max, without)   
    for i in range(3, n):
        a_i = a[i]
        if a_i % gcd_max != 0:
            l = gcd(gcd_max, a_i)
            if l >= k:
                gcd_max = l
            else:
                gcd_max = k
                without = a_i
        k = gcd(k, a_i)
    print(gcd_max)

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


using namespace std;


#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


ll sum(int n);


void go(){
	ll a,v,b,w,t;cin>>a>>v>>b>>w>>t;
	if(abs(a-b)<=(v-w)*t) {
		cout << "YES";
	}else {
		cout << "NO";
	}
}
int main(){
   
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}

ll sum(int n){                
   if(n == 0){
      return n;
   }else{
      return sum(n/10) + n%10;
   }
}


Measured memory_bytes: 3628
/*


*/


#include <stdio.h>
#include <string.h>
#include <ctype.h>


int mystrtol(char text[], char **pEnd);


int main(void){
	
	char text[101];
	int sum;
	int i, temp;
	char *pStart;
	char *pEnd;
	
	while(fgets(text, sizeof(text), stdin) != NULL){
		
		i = 0;
		pStart = text;
		
		text[strlen(text)-1] = '\0';
		
		while(pStart[i] != '\0'){
			
			if(isdigit(pStart[i])){
				
				temp = mystrtol(pStart+i, &pEnd);
				//printf("temp = %d\n", temp);
				
				pStart = pEnd;
				i = 0;
				
				sum += temp;
				
			}
			else{
				
				i++;
				
			}
			
			
		}
		
	}
	
	printf("%d\n", sum);
	
	return 0;
	
}



int mystrtol(char text[], char **pEnd){
	
	int value;
	int i = 0;
	char temp[32];
	
	while(isdigit(text[i])){
		
		temp[i] = text[i];
		i++;
		
	}
	
	
	temp[i] = '\0';
	
	*pEnd = &text[i];
	
	
	return atoi(temp);
	
}

Measured memory_bytes: 528
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_set>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const unordered_set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int T, n, m;
vi d;

int dfs(int i, vi v){
	if(i == n) return count_if(ALL(v), [](int i){return i;});
	int res = 15;
	std::function<void(vi&, int, int)> rec = [&](vi &t, int l, int sum){
		if(l >= 15) return;
		if(t.size() == d[i]){
			auto v2 = v;
			for(int j : t) v2[j] |= 1<<i;
			res = min(res, dfs(i+1, v2));
		}else{
			if(v[l]) rec(t, l+1, sum);
			if(!(sum & v[l])){
				t.pb(l);
				rec(t, l+1, sum | v[l]);
				t.pop_back();
			}
		}
	};
	vi t;
	rec(t, 0, 0);
	return res;
}

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	cin >> n;
	d.resize(n);
	REP(i, n) cin >> d[i];
	sort(RALL(d));
	ll ans = 0;
	REP(i, n){
		if(d[i] >= 5){
			ans += d[i] - 5;
			d[i] = 5;
		}
	}
	cout << ans + dfs(0, vi(15)) << endl;
	return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 1000000007
#define int long long
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
int n, d[100010];
signed main() {
	cin >> n;
	rep(i, n)cin >> d[i];
	sort(d, d + n);
	cout << d[n / 2] - d[n / 2 - 1] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
 
int main(void) {
 
 	int d[5];
 	int i, j;

 	for(i = 0; i < 5; i++) {
	 	scanf("%d", &d[i]);
 	}

 	for(i = 0; i < 5; i++) {
 		if(d[i] == 0){
 			j = i + 1;
 		}
 	}

    printf("%d", j);
	
	return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    string s;
    cin >> s;
    rep(i,s.size()-1){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2<<endl;
            return 0;
        }else{
            if(i<s.size()-2){
                set<char> sc;
                sc.insert(s[i]);
                sc.insert(s[i+1]);
                sc.insert(s[i+2]);
                if(sc.size()==2){
                    cout<<i+1<<" "<<i+3<<endl;
                    return 0;
                }
            }
        }
    }
    cout << "-1" << " -1" << endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var N = IO.GetInt();
            var sum = 0;
            var temp = N;
            while (temp > 0)
            {
                sum += temp % 10;
                temp /= 10;
            }

            var ans = N % sum == 0 ? "Yes" : "No";
            Console.WriteLine(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

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

int main() {
	int a,b;
	cin>>a>>b;
	string p;
	if(a<b) p = '<';
	else if(a==b) p = "==";
	else p = '>';

	cout << "a " << p << " b" << endl;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main() {
	cin>>a>>b;
	int lena=a.length(),lenb=b.length();
	for(int i=0; i<lena-1; i++)
		for(int j=i+1; j<lena; j++) {
			if(a[i]>a[j]) swap(a[i],a[j]);
		}
	for(int i=0; i<lenb-1; ++i)
		for(int j=i+1; j<lenb; j++) {
			if(b[i]<b[j]) swap(b[i],b[j]);
		}
	if(a<b) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i, j;
  int N; scanf("%d", &N);
  int L[10] = {};
  int max_index = 0;
  int max = 0;
  int total = 0;
  
  for(i = 0; i < N; i++){
    scanf("%d", &L[i]);
    if(max < L[i]){
      max = L[i];
      max_index = i;
    }
  }
  for(j = 0; j < N; j++){
    if(j != max_index){
      total += L[j];
    }
  }
  (max < total ? printf("Yes") : printf("No"));
  
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int divs[] = {3, 5, 15, 25, 75};
int traverse(int *prime_map, int idx, int val) {
    if(val==1) return 1;
    if(idx >= 100) return 0;
    int i;
    int ans = 0;
    ans += traverse(prime_map, idx+1, val);
    for(i = 0; i < 5; i++) {
        if(val%divs[i]) continue;
        int d = divs[i];
        if(prime_map[idx] >= d-1) {
            prime_map[idx] -= (d-1);
            ans += traverse(prime_map, idx+1, val/d);
            prime_map[idx] += (d-1);
        }
    }
    return ans;
}

#define TARGET_VAL 75
#define NUM_MAX 100
int main(void) {
    int num = get_int();
    static int prime_map[NUM_MAX+1];

    int i;
    for(i = 2; i <= num; i++) {
        int cur = i;
        int divisor = 2;
        while(cur>1) {
            if(cur%divisor) { divisor++; continue; }
            cur /= divisor;
            prime_map[divisor]++;
        }
    }

#ifdef DEBUG
    for(i = 2; i <= num; i++) printf(" %d", prime_map[i]);
    putchar('\n');
#endif

    int64_t ans = traverse(prime_map, 0, TARGET_VAL);

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  Int n=s.size();
  string ans="keyence";
  auto YES=[](){cout<<"YES"<<endl;exit(0);};
  for(Int i=0;i<=7;i++){
    string a=s.substr(0,i);
    string b=s.substr(n-(7-i),7-i);
    //cout<<a<<" "<<b<<endl;
    if(a+b==ans) YES();
  }
  cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void solve(){
    int k;
    cin>>k;
    long long int l = 0;
    for(int i=1;i<=1e+6 ;i++){
        l = (l*10 +7)%k;
        if(l==0){
            cout<<i;
            return;
        }
    }
    cout<<"-1";
}
int main(){
	solve();
}

Measured memory_bytes: 3608