akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountll
#define m_p make_pair
#define infi 1e18+1
#define eps 0.000000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
//////////////
auto clk=clock();
#define all(x) x.begin(),x.end()
#define S second
#define F first
#define sz(x) ((long long)x.size())
#define int long long  
#define f80 __float128
#define pii pair<int,int>
/////////////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int x,y;
	cin>>x>>y;
	for(int i=0;i<=100;++i){
		for(int j=0;j<=100;++j)
		{
			if(i+j==x&&i*2+j*4==y){
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	#ifdef ANIKET_GOYAL
		// cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
	#endif
}

Measured memory_bytes: 3656
N = int(input())
H = list(map(int, input().split()))
DP = [0]*N
DP[1] = abs(H[0]-H[1])
for i in range(2,N):
    DP[i] = min(DP[i-1]+abs(H[i-1]-H[i]),DP[i-2]+abs(H[i-2]-H[i]))
print(DP[-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
#define fup(i,a,b) for(int i=a;i<=b;++i)
#define fdw(i,a,b) for(int i=a;i>=b;--i)
#define sync ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define cl(a) memset(a,0,sizeof(a))
#define gcd __gcd
#define fi first
#define se second
#define pb push_back
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
#define int ll
//ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//ll ksm(ll a,ll b,ll mod){ll res=1;a%=mod;for(;b;b>>=1){if(b&1) res=res*a%mod;a=a*a%mod;}return res;}
//ll oula(ll n){ ll res=n;for(ll i=2;i*i<=n;i++){if(n%i==0){ res=res-res/i;while(n%i==0) n/=i;}}if(n>1) res=res-res/n;return res;}
//bool MRT(ll x){if(x==2)return true;fup(i,1,50){ll now=rand()%(x-2)+2;if(ksm(now,x-1,x)!=1)return false;}return true;}
//void shai(int n)fup(i,2,n){if(isprime[i]){v.push_back(i);for(int j=2*i;j<=10000;j+=i)isprime[j]=0;}}//"埃氏筛筛选素数"
const int mod=1000000007;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
const int N=210000;

signed main()
{

    sync;
    int n,x,y;
    cin>>n>>x>>y;
    vector<ll> ans(n+1, 0);
    ll mini;
    for(int i = 1; i <= n; i++)
    {
        for(int j = i+1; j <= n; j++)
        {
            mini = min({abs(x - i) + 1 + abs(y - j),abs(y - i) + 1 + abs(x - j),j - i});
            ans[mini]++;
        }
    }
    for(int i = 1; i < n; i++)
        cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 256
S=input()
N=len(S)

r=0
l=0
ans=[0]*N
i=0
while i<N:
    if S[i]=='R':
        if l>0:
            ans[i-l]=l
            x,y=i-l-1,i-l
            if ans[x]>ans[y]:
                if ans[x]%2:
                    ans[x],ans[y]=0--(ans[x]+ans[y])//2,(ans[x]+ans[y])//2
                else:
                    ans[x],ans[y]=(ans[x]+ans[y])//2,0--(ans[x]+ans[y])//2
            else:
                if ans[y]%2:
                    ans[x],ans[y]=(ans[x]+ans[y])//2,0--(ans[x]+ans[y])//2
                else:
                    ans[x],ans[y]=0--(ans[x]+ans[y])//2,(ans[x]+ans[y])//2

        r+=1
        l=0
    else:
        ans[i-1]=r
        r=0
        l+=1
    i+=1

ans[i-l]=l
x,y=i-l-1,i-l
if ans[x]>ans[y]:
    if ans[x]%2:
        ans[x],ans[y]=0--(ans[x]+ans[y])//2,(ans[x]+ans[y])//2
    else:
        ans[x],ans[y]=(ans[x]+ans[y])//2,0--(ans[x]+ans[y])//2
else:
    if ans[y]%2:
        ans[x],ans[y]=(ans[x]+ans[y])//2,0--(ans[x]+ans[y])//2
    else:
        ans[x],ans[y]=0--(ans[x]+ans[y])//2,(ans[x]+ans[y])//2

print(*ans)

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

int pow(int n) {
  int p = 1;
  for (int i = 0; i < n; i++) {
    p *= 10;
  }
  return p;
}

int sum10(int n) {
  int a = 0;
  for (int i = 8; i >= 0; i--) {
    a += (n/pow(i));
    n = n % pow(i);
  }
  return a;
}
    

int main() {
  int n;
  cin >> n;
  if (n % sum10(n) == 0) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,S=0; cin >>N;
  vector<int> a(N);  
  for(int i=0; i<N; i++){
    cin >> a[i] ;
    S += a[i];
  }
  sort(a.begin(), a.end());
  if(S > 2 * a[N-1]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N=int(input())
d,t={},[]
for i in list(map(int,input().split())):
    d[i]=d.get(i,0)+1
d=sorted(list(d.items()))
for j in range(len(d)):
    k=len(d)-j-1
    if d[k][1]>3:
        if len(t)==0:
            print((d[k][0])**2)
            exit()
    if d[k][1]>1:
        t.append(d[k][0])
        if len(t)==2:
            print(t[0]*t[1])
            exit()
print(0)            
    

Measured memory_bytes: 21000
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double ans,l,w,h;
	l=n/3.0;
	w=n/3.0;
	h=n-l-w;
	printf("%.12f",l*w*h);
	return 0;
}

Measured memory_bytes: 256
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}
#define ll long long
ll gcd (ll a, ll b) {
    while (b > 0) {
        ll t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int arr[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n, c, k;
    cin >> n >> c >> k;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    sort(arr + 1, arr + n + 1);
    int pos = 1, res = 0;
    while (pos <= n) {
        int cnt = 1, j = pos + 1;
        while (cnt < c && j <= n && arr[j] <= arr[pos] + k) {
            cnt++, j++;
        } pos = j;
        res++;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
vector< vector <long long > >C;
void comb()
{
  C.resize(51);
  C[0].push_back(1);
  for(int i=1;i<=50;i++)
  {
    C[i].resize(i+1);
    C[i][0]=1;
    C[i][i]=1;
  }
  for(int i=2;i<51;i++)
  {
    for(int j=1;j<i;j++)C[i][j]=C[i-1][j]+C[i-1][j-1];
  }
}
int main()
{
  comb();
  int n,p;
  cin>>n>>p;
  vector<int>a(n);
  int even=0,odd=0;
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)
  {
    if(a[i]%2==0)even++;
    else odd++;
  }
  long long eans=pow(2,even);
  long long oans=0;
  if(p==0)
  {
    
    for(int i=0;i<=odd;i+=2)
    {
      oans+=C[odd][i];
    }
  }
  else 
  {
    for(int i=1;i<=odd;i+=2)
    {
      oans+=C[odd][i];
    }
  }
  long long ans=eans*oans;
  cout<<ans<<endl;
  //cout<< even <<' '<<odd<<endl;
  return 0;
}
    

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { std::cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { std::cin >> first; Scan(rest...); }
#define OUT(d) std::cout<<d;
#define FOUT(n, d) std::cout<<std::fixed<<std::setprecision(n)<<d;
#define SOUT(n, c, d) std::cout<<std::setw(n)<<std::setfill(c)<<d;
#define SP std::cout<<" ";
#define TAB std::cout<<"\t";
#define BR std::cout<<"\n";
#define ENDL std::cout<<std::endl;
#define FLUSH std::cout<<std::flush;
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
#define PAIR std::pair<int, int>
#define IN(a, x, b) (a<=x && x<=b)
#define IN2(a0, y, a1, b0, x, b1) (a0<=y && y<a1 && b0<=x && x<b1)
#define SHOW(d) {std::cout << #d << "\t:" << d << "\n";}
#define SHOWVECTOR(v) {std::cout << #v << "\t:";for(const auto& i : v){std::cout << i << " ";}std::cout << "\n";}
#define SHOWVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout << j << " ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR2(v) {std::cout << #v << "\t:\n";for(const auto& i : v){for(const auto& j : i){std::cout<<'('<<j.first<<", "<<j.second<<") ";}std::cout << "\n";}}
#define SHOWPAIRVECTOR(v) {for(const auto& i:v){std::cout<<'('<<i.first<<", "<<i.second<<") ";}std::cout<<"\n";}
#define CHECKTIME(state) {auto start=std::chrono::system_clock::now();state();auto end=std::chrono::system_clock::now();auto res=std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count();std::cerr<<"[Time:"<<res<<"ns  ("<<res/(1.0e9)<<"s)]\n";}
#define SHOWQUEUE(a) {std::queue<decltype(a.front())> tmp(a);std::cout << #a << "\t:";for(int i=0; i<static_cast<int>(a.size()); ++i){std::cout << tmp.front() << "\n";tmp.pop();}std::cout << "\n";}
#include <assert.h>

//#define int ll
using ll = long long;
constexpr int INFINT = 1 << 30;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 0.0000001;
constexpr int MOD = 1000000007;

signed main() {
	INIT;
	VAR(int, n);
	OUT(n*(n + 1) / 2)BR;
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int a, b, c, k; scanf("%d%d%d%d", &a, &b, &c, &k);
  for (int i = 0; i < k; ++i) {
    if (b <= a) b *= 2;
    else if (c <= b) c *= 2;
    if (a < b && b < c) break;
  }
  if (a < b && b < c) printf("Yes");
  else printf("No");
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3712
def main():
    s = input()
    k = int(input())
    index = k + 1

    for i in range(len(s)):
        if s[i] != "1":
            index = i
            break

    if index < k:
        print(s[index])
    else:
        print(1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61816
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 10;
int fact[N];

struct node{
  int id, x, y;	
};

bool cmp(node a, node b){
  return a.id < b.id;	
}

double dist(node a, node b){
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}

void solve(){
 fact[0] = 1;
 for (int i = 1; i < N; i++)
   fact[i] = i * fact[i - 1];
 cout << fixed;
 cout << setprecision(11);
 int n;
 cin >> n;
 vector<node> v(n);
 for (int i = 0; i < n; i++){
	cin >> v[i].x >> v[i].y;
	v[i].id = i + 1; 
  }
  double sum = 0.0;
  int cnt = fact[n];
  do{
	for (int i = 0; i + 1 < n; i++)
	 sum += dist(v[i], v[i + 1]);
  } while (next_permutation(v.begin(), v.end(), cmp));
 double ret = sum * 1.0 / cnt;
 cout << ret << endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();	
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ALDS1_3
{
    class Program
    {
        static void Main(string[] args)
        {
            var stack = new Stack<int>();
            foreach (var op in Console.ReadLine().Split(' '))
            {
                int num;
                if (int.TryParse(op, out num))
                {
                    stack.Push(num);
                }
                else
                {
                    stack.Push(Calc(op, stack.Pop(), stack.Pop()));
                }
            }

            Console.WriteLine(stack.Pop());
        }

        private static int Calc(string operat, int operand1, int operand2)
        {
            switch (operat)
            {
                case "+":
                    return operand2 + operand1;
                case "-":
                    return operand2 - operand1;
                case "*":
                    return operand2 * operand1;
                default:
                    throw new ArgumentException();
            }
        }

    }
}

Measured memory_bytes: 5996
#include <cstring>
#include <iomanip>
#include <iostream>

using namespace std;

/** Problem0086 : Patrol **/
int main()
{
	int edge[110]={0};
	int a, b;
	
	while (cin >> a >> b) {
		if (a != 0 && b != 0) {
			edge[a]++;
			edge[b]++;
		} else {
			if (edge[1]%2==0 || edge[2]%2==0) {
				cout << "NG" << endl;
				goto end;
			}
			
			for (int i=3; i<110; i++) {
				if (edge[i] % 2 == 1) {
					cout << "NG" << endl;
					goto end;
				}
			}
			cout << "OK" << endl;
			
		end:
			memset(edge, 0, sizeof(edge));
		}
	}
	return 0;
}

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


const int N = 1e5 + 10, M = 998244353;
int n, a[N];
int ans = 1e9;

int dp[N];
bool solved[N];

int calcMin(int i)
{
	if (i == n - 1)
	{
		return 0;
	}

	if (solved[i])
	{
		return dp[i];
	}

	if (i < n - 2)
	{
		dp[i] = min(abs(a[i] - a[i + 1]) + calcMin(i + 1), abs(a[i] - a[i + 2]) + calcMin(i + 2));
	}
	else
	{
		dp[i] = abs(a[i] - a[i + 1]) + calcMin(i + 1);
	}

	solved[i] = 1;
	return dp[i];
}

int main() {


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

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

	cout << calcMin(0) << "\n";
	
	return 0;
}

/*
int calcMin(int i)
{
	if (i == n - 1)
	{
		return 0;
	}
	if (i < n - 2)
	{
		return min(abs(a[i] - a[i + 1]) + calcMin(i + 1), abs(a[i] - a[i + 2]) + calcMin(i + 2));
	}
	return abs(a[i] - a[i + 1]) + calcMin(i + 1);
}
*/

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

signed main()
{
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    if (c < d)
    {
        for (int i = b; i <= d - 2; i++)
        {
            if (s[i - 1] == '#' && s[i] == '#')
            {
                cout << "No" << endl;
                return 0;
            }
        }
        for (int i = a; i <= c - 2; i++)
        {
            if (s[i - 1] == '#' && s[i] == '#')
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    else
    {
        for (int i = b; i <= d - 2; i++)
        {
            if (s[i - 1] == '#' && s[i] == '#')
            {
                cout << "No" << endl;
                return 0;
            }
        }
        bool f = false;
        for (int i = b; i <= d; i++)
        {
            if (s[i - 2] == '.' && s[i - 1] == '.' && s[i] == '.')
            {
                f = true;
            }
        }
        if (!f)
        {
            cout << "No" << endl;
            return 0;
        }
        for (int i = a; i <= c - 2; i++)
        {
            if (s[i - 1] == '#' && s[i] == '#')
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int N;cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];
  
  ll ans=0;
  rep(i,N-1){
    if(A[i]>A[i+1]){
      ans += A[i]-A[i+1];
      A[i+1]=A[i];
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4760
n,m = list(map(int, input().split()))
a=[]
b=[]
c=[]
d=[]
y=0
for i in range(n):
    tmp=list(map(int, input().split()))
    a.append(tmp[0])
    b.append(tmp[1])
for i in range(m):
    tmp=list(map(int, input().split()))
    c.append(tmp[0])
    d.append(tmp[1])
for i in range(n):
    x=[1000000000]*m
    for j in range(m):
        x[j]=abs(c[j]-a[i])+abs(d[j]-b[i])
        if x[y] > x[j]:
            y = j
    print(y+1)
    y=0


Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
 
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define MCLR(a) memset((a), -1 ,sizeof(a))
#define SZ(a) (sizeof(a))
#define FILL(a,v) fill((int*)a,(int*)(a+(SZ(a)/SZ(*(a)))),v)

bool cheak(int x,int y,int xMax,int yMax)
{return x >= 0 && y >= 0 && xMax > x && yMax > y;}
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int INF = 2147483647;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;

const int MAX = 20020;
int dp[MAX][256];

int main()
{
	int n,m;
	while(cin >> n >> m && n)
	{
		int c[20],x[MAX];
		REP(i,m)cin >> c[i];
		REP(i,n)cin >> x[i];
		
		FILL(dp,INF);
		dp[0][128] = 0;

		REP(i,n)
		REP(j,256)
		if(dp[i][j] != INF)
		REP(k,m)
		{
			int tmp = j+c[k];
			if(tmp < 0)
				tmp = 0;
			if(tmp > 255)
				tmp = 255;
			
			int val = pow(x[i]-tmp,2);
			if(val+dp[i][j] < dp[i+1][tmp])
				dp[i+1][tmp] = val+dp[i][j];
		}

		int ans = INF;
		REP(j,256)
		ans = min(dp[n][j],ans);
		
		cout << ans << endl;
	}

	return 0;

}

Measured memory_bytes: 21256
#include <iostream>

using namespace std;

int solve(int n){
  int res = 0;
  for(int i=1;i<=n;i++){
    int j = i;
    while(j%5 == 0){
      res++;
      j /= 5;
    }
  }
  return res;
}

int main(){
  int n;
  while(cin>>n && n){
    cout << solve(n) <<endl;
  }
  return 0;
}

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

typedef long long ll;
const int mod = 1e9 + 7;

void add_self(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}

void sub_self(int &a, int b) {
    a -= b;
    if (a < 0) a += mod;
}

int main() {
    int n, k;
    scanf("%d%d", &n, &k);

    // dp[i] : no of ways to distribute such that we used i candies
    int dp[k+1];
    memset(dp, 0, sizeof(dp));
    dp[0] = 1;

    for (int child = 0; child < n; ++child) {
        int candy_lmt;
        scanf("%d", &candy_lmt);

        vector<int> partial_sum(k+1);

        for (int used = k; used >= 0; --used) {
            int L = used + 1;
            int R = used + min(k-used, candy_lmt);

            if (L <= R) {
                add_self(partial_sum[L], dp[used]);
            }
            if (R+1 <= k) {
                sub_self(partial_sum[R+1], dp[used]);
            }
        }

        int sum = 0;

        for (int i = 0; i <= k; ++i) {
            add_self(sum, partial_sum[i]);
            add_self(dp[i], sum);
        }

    }
    
    printf("%d\n", dp[k]);
}

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

typedef long long ll;
typedef pair<int, int> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  int n, ans = 0;
  string s;
  cin >> n >> s;

  rep(i, 0, n) {
    string ss;
    cin >> ss;
    rep(i, 0, ss.length()) {
      int f = false;
      rep(j, 1, ss.length()) {
        if(ss.length() <= i + j * (s.length() - 1)) break;
        string as = "";
        rep(k, 0, s.length()) {
          as += ss[i + j * k];
        }
        if(as == s) {
          ans++;
          f++;
          break;
        }
      }
      if(f) break;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    while(a%2==0){
      a/=2;
      c++;
    }
  }
  cout<<c;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N, X = map(int, readline().split())
  L = list(map(int, readline().split()))
  D = 0
  ans = 1
  for i in range(N):
    D += L[i]
    if D<=X:
      ans += 1
    else:
      break
  print(ans)
  
if __name__ == '__main__':
  main()

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n,k,s;
cin>>n>>k>>s;
vector<int>A(n);
int cnt=0;
rep(i,n){
    if(cnt<k){
        A[i]=s;
    }
    else{
        if(s<(int)(1e9)){
            A[i]=s+1;
        }
        else{
            A[i]=1;
        }
    }
    cnt++;
}
rep(i,n)cout<<A[i]<<endl;
return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
  
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int a[n + 5];
    rep( i , n ){
      cin >> a[i];
    }
    sort(a,a +n);
    //    bool mid = ( a[n / 2] == a[n / 2 - 1] ? false : true);
    cout << a[n / 2] - a[n / 2 - 1]  << '\n';
    return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i=  0; i < n; i++) {
    cin >> vec[i];
  }
  bool ok = true;
  for (int i = n - 2; i >= 0; i--) {
    if (vec[i] > vec[i + 1]) {
      --vec[i];
      ok &= (vec[i] <= vec[i + 1]);
    }
  }
  cout << (ok ? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>

using namespace std;

inline bool cheak(int x, int y, int xMax, int yMax){ return x >= 0 && y >= 0 && xMax > x && yMax > y; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }

typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef long long ll;
typedef unsigned long long ull;

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

const int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };
const int mod = 1000000007;
const int INF = 1e9;

string s;
int t;

string cip();
string str();
char let();

string cip(){
	string ret;
	while (t < s.size() && s[t] != ']'){
		ret += str();
	}
	return ret;
}

string str(){
	string ret;
	if (s[t] == '['){
		t++; ret = cip(); t++;
		reverse(ret.begin(), ret.end());
		return ret;
	}
	else{
		return string(1,let());
	}
}

char let(){
	if (s[t] == '+'){
		t++; char c = let();
		if (c == 'Z')c = 'A';
		else c++;
		return c;
	}else
	if (s[t] == '-'){
		t++; char c = let();
		if (c == 'A')c = 'Z';
		else c--;
		return c;
	}
	else{
		t++;
		return s[t-1];
	}
}


string dfs(int n){

	if (n == s.size()){
		t = 0;
		return cip();
	}

	string ret(90,'Z'+1);

	if (s[n] == '?'){
		for (char c = 'A'; c <= 'Z'; c++){
			s[n] = c;
			ret = min(ret,dfs(n+1));
		}
		s[n] = '?';
	}
	else{
		ret = dfs(n + 1);
	}
	return ret;
}


int main(){

	while (cin >> s && s != "."){
		cout << dfs(0) << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
    string o, e;
    cin>>o>>e;
    int a, b;
    a = o.size();
    b = e.size();
    int n = a+b;
    int i, j, k;
    j = 0;
    k = 0;
    for( i = 1; i<=n; i++)
    {
        if(i%2 == 0)
        {
            cout<<e[j];
            j++;
        }
        else
        {
            cout<<o[k];
            k++;
        }
    }
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int INF=1001001001;
const int mod=1e9+7;
int main() {
  int64_t a,b,x;
  cin>>a>>b>>x;
  if(a==0){cout<<b/x+1<<endl;}
  else{cout<<b/x-(a-1)/x<<endl;}
  return 0;
}

Measured memory_bytes: 3576
function main()
  n = parse(Int, readline())
  v = map(x -> parse(Int, x), split(readline(), " "))
  c = map(x -> parse(Int, x), split(readline(), " "))
  
  ans = 0
  for i in 1:n
    a = v[i] - c[i]
    if a > 0
      ans += a
    end
  end
  println(ans)
end

main()

Measured memory_bytes: 131356
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int h, w;
    cin >> h >> w;

    auto a = initVec2<int>(h, w);
    rep(i, h) rep(j, w) cin >> a[i][j];

    vector<tuple<int, int, int, int>> ans;
    rep(i, h){
        rep(j, w){
            if(a[i][j] % 2 == 0){
                continue;
            }
            if(j == w - 1){
                if(i == h - 1){
                    continue;
                }
                ans.emplace_back(i + 1, j + 1, i + 2, j + 1);
                a[i+1][j]++;
                continue;
            }
            ans.emplace_back(i + 1, j + 1, i + 1, j + 2);
            a[i][j+1]++;
        }
    }

    cout << SZ(ans) << endl;
    rep(i, SZ(ans)){
        int a, b, c, d;
        tie(a, b, c, d) = ans[i];
        cout << a << " " << b << " " << c << " " << d << endl;
    }

    return 0;
}


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

using namespace std;

#define int				long long
#define pb 				push_back
#define endl 			'\n'
#define F				first
#define S				second
#define mod				(ll)998244353
#define mp              make_pair
#define lb				lower_bound
#define ub				upper_bound
#define ios 			ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inf				1e18
#define mem(a,x)		for(int i=0;i<(int)(sizeof(a)/sizeof(a[0]));i++) a[i] = x;
#define trace(a)		cout<<(#a)<<" --> "<<a<<endl
#define trace2(a,b)		{trace(a);trace(b);}
#define trace3(a,b,c)	{trace(a);trace(b);trace(c);}
#define trace4(a,b,c,d) {trace(a);trace(b);trace(c);trace(d);}
#define M_PI           	3.14159265358979323846

signed main(){
	ios;
	int a,b,c;
	cin>>a>>b>>c;
	a-=b;
	cout<<max(0LL,c-a);
	return 0;
}






Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C - Guess The Number
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 3;

/* typedef */

/* global variables */

int ds[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  memset(ds, -1, sizeof(ds));

  while (m--) {
    int si, ci;
    scanf("%d%d", &si, &ci);
    si--;

    if (ds[si] >= 0 && ds[si] != ci) {
      puts("-1");
      return 0;
    }
    ds[si] = ci;
  }

  for (int i = 0; i < n; i++)
    if (ds[i] < 0) ds[i] = (i == 0 && n > 1) ? 1 : 0;

  if (n > 1 && ds[0] == 0) {
    puts("-1");
    return 0;
  }

  for (int i = 0; i < n; i++) printf("%d", ds[i]);
  putchar('\n');
  return 0;
}


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

int main()
{
	int q;
	std::cin >> q;
	std::set<int> si;
	while (q--) {
		int a, v;
		std::cin >> a >> v;
		if (a == 0) {
			si.insert(v);
			std::cout << si.size() << std::endl;
		} else if (a == 1) {
			if (si.count(v)) {
				std::cout << 1;
			} else {
				std::cout << 0;
			}
			std::cout << std::endl;
		} else {
			si.erase(v);
		}
	}

	return 0;
}


Measured memory_bytes: 12380
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef tuple<ll,ll,ll> tll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//templete
vint node[SIZE];
vint tree[SIZE];
bool done[SIZE]={};
int ord[SIZE]={},low[SIZE]={};
int k=0;
vint articulation;
void DFS(int now,int prev){
	done[now]=1;
	ord[now]=k;
	low[now]=k;
	k++;
	bool isArticulation=0;
	int ct=0;

	for(int next:node[now]){
		if(!done[next]){
			ct++;
			DFS(next,now);
			low[now]=min(low[now],low[next]);
			if(~prev && ord[now]<=low[next])
				isArticulation=1;
		}
		else if(next!=prev){
			low[now]=min(low[now],ord[next]);
		}
	}
	if(prev==-1 && ct>1)
		isArticulation=1;
	if(isArticulation)
		articulation.pb(now);

	return;
}
int main() {
	int V,E;
	cin>>V>>E;
	for(int i=0;i<E;i++){
		int a,b;
		cin>>a>>b;
		node[a].pb(b);
		node[b].pb(a);
	}
	DFS(0,-1);
	sort(articulation.begin(),articulation.end());
	for(int i:articulation)
		cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 9284
import std.stdio;
import std.range;
//arrival, leaving
void showTime(int t){
	int h = t / 3600, m = t % 3600 / 60, s = t % 3600 % 60;
	writefln("%d %d %d", h, m, s);
}

void main(){
	int[] kt;
	for(int i=3;i;i--){
		int ah, am, as, lh, lm, ls;
		readf("%d %d %d %d %d %d\n", &ah, &am, &as, &lh, &lm, &ls);
		kt ~= (lh-ah) * 3600 + (lm-am) * 60 + (ls-as);
	}
	while(!kt.empty())
		showTime(kt.front), kt.popFront();
}

Measured memory_bytes: 996
#include<stdio.h>
 
int main(){
    int t[30];
    for(int i=0;i<30;i++)t[i]=i+1;
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i=0;i<b;i++){
        int c,d;
        scanf("%d,%d",&c,&d);
        int s=t[c-1];
        t[c-1]=t[d-1];
        t[d-1]=s;
    }
    for(int i=0;i<a;i++)printf("%d\n",t[i]);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
long long  n;
cin >>n;
vector<long long >a(n*3);
long long  ans =0;
for(long long  i=0;i<n*3;i++){
    cin >> a.at(i);
}
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
long long  che =0;
for(long long  i=1;i<n*3;i+=2){
    if(che!=n){
 ans+=a.at(i);
 che++;
    }
    else{
        break;
    }
}
cout << ans <<endl;
}



Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
 
using namespace std;
 
int main()
{
    int x,a,b,c;
    while(scanf("%d%d%d%d",&a,&b,&c,&x)!=EOF)
    {
        int ans=0;
        for (int i=0;i<=a;i++)
            for (int j=0;j<=b;j++)
            for (int k=0;k<=c;k++)
            if (500*i+100*j+50*k==x) ans++;
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
n, a, b = gets.chomp.split(" ").map(&:to_i)
candidates = (1..n).to_a
sum = candidates.select do |c|
  digit_sum = c.to_s.chars.map(&:to_i).reduce(:+)
  a <= digit_sum && digit_sum <= b
end.reduce(:+)
puts sum

Measured memory_bytes: 1916
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			me = scanner.nextInt();
			if (me == 0)
				break;
			n = scanner.nextInt();
			a = new int[n + 2];
			for (int i = 1; i <= n; i++)
				a[i] = scanner.nextInt();
			n += 2;
			boolean[] vis = new boolean[n];
			bfs(0, vis);
			if (!vis[n - 1]) {
				System.out.println("NG");
				continue;
			}
			boolean ok = true;
			for (int s = 1; s < n - 1; s++) {
				if (vis[s]) {
					boolean[] vis2 = new boolean[n];
					bfs(s, vis2);
					if (!vis2[n - 1]) {
						ok = false;
						break;
					}
				}
			}
			System.out.println(ok ? "OK" : "NG");
		}
	}

	private void bfs(int s, boolean[] vis) {
		for (int i = 0; i < n; i++)
			vis[i] = (i == s);
		int[] Q = new int[n];
		int head = 0;
		int tail = 0;
		Q[tail++] = s;
		while (head < tail) {
			int x = Q[head++];
			for (int d = 1; d <= me; d++) {
				int xx = Math.min(x + d, n - 1);
				xx = Math.max(Math.min(xx + a[xx], n - 1), 0);
				if (!vis[xx]) {
					vis[xx] = true;
					Q[tail++] = xx;
				}
			}
		}
	}

	int n, me;
	int[] a;
}

Measured memory_bytes: 61992
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
const int INF = 1e9+7;
int main(){
    //primeiro A e ultimo Z
    int primA = INF, ultZ = -INF;
    string s; cin>>s;
    for(int i=0; i<(int)s.size(); i++){
        if(s[i]=='A')primA = min(i, primA);
        else if(s[i]=='Z')ultZ = max(ultZ, i);
    }
    cout<<ultZ-primA+1<<endl;
}

Measured memory_bytes: 640
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL vmax(vi v, LL n) {
	int MAX = 0;
	f(i, 0, n) {
		MAX = max(MAX, v[i]);
	}
	return MAX;
}

LL vmin(vi v, LL n) {
	int MIN = LL_INF;
	f(i, 0, n) {
		MIN = min(MIN, v[i]);
	}
	return MIN;
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//エラトステネスの篩
void sieve(LL n) {
	vb s(n + 1, true);
	f(i, 2, n + 1) {
		for (int j = 2; i*j <= n; j++) {
			s[i*j] = false;
		}
	}
	cout << "2から" << n << "までの素数" << endl;
	f(i, 2, n + 1) {
		if (s[i]) {
			cout << i << " ";
		}
	}
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n;
	st s;
	cin >> n >> s;
	vi b(n + 1, 0);
	f(i, 0, n) {
		if (s[i] == '#') {
			b[i + 1] = b[i] + 1;
		}
		else {
			b[i + 1] = b[i];
		}
	}
	int ans = LL_INF;
	f(i, 0, n + 1) {
		ans = min(ans,b[i] + n - i - (b[n] - b[i]));
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 2180
a,b = (int(x) for x in input().split())


my_index = []
for i in range(1010):
    if int((i*0.08)) ==a and int((i*0.1))==b:
        my_index.append(i)
    if int((i*0.08)) ==b and int((i*0.1))==a:
        my_index.append(i)

if my_index != []:
    print(min(my_index))
else:
    print(-1)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<limits.h>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
using namespace std;

long long  mod = 1000000007;

long max(long x, long y) {
	return x > y ? x : y;
}

long min(long x, long y) {
	return x < y ? x : y;
}

long factorial(long n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * factorial(n - 1);
	}
}

long long  fel(long long  n,long long  f) {

		if (f == 1) {
			return n % mod;
		}
		else if (f % 2 == 0) {
			return (fel(n,f / 2) * fel(n,f / 2)) % mod;
		}
		else {
			return ((n  * fel(n,f / 2) %mod) * fel(n,f / 2))% mod;
		}
	

}


int main()
{
	string s, t;
	cin >> s >> t;
	cout << t + s;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	int in1, in2;
	cin >> n >> m;
	vvi p(n), l(m);
	rep(i, n) {
		cin >> in1;
		rep(j, in1) {
			cin >> in2;
			p[i].push_back(in2-1);
			l[in2 - 1].push_back(i);
		}
	}
	queue<int> pq, lq;
	vb up(n, false), ul(m, false);
	int ok = 1;
	up[0] = true;
	pq.push(0);
	while (ok<n) {
		while (!pq.empty()) {
			int tp = pq.front();
			rep(i, p[tp].size()) {
				if (!ul[p[tp][i]]) {
					ul[p[tp][i]] = true;
					lq.push(p[tp][i]);
				}
			}
			pq.pop();
		}
		while (!lq.empty()) {
			int tl = lq.front();
			rep(i, l[tl].size()) {
				if (!up[l[tl][i]]) {
					up[l[tl][i]] = true;
					pq.push(l[tl][i]);
					ok++;
				}
			}
			lq.pop();
		}
		if (ok < n&&pq.empty()) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 8952
#  --*-coding:utf-8-*--

def main():
    N,M = map(int, input().split())

    ac = [0]*(N+1)
    wa = [0]*(N+1)

    for _ in range(M):
        P,S = input().split()
        p = int(P)

        if S == 'AC':
            if ac[p] == 0:
                ac[p] = 1
        elif ac[p] == 0:
            wa[p] += 1

    sumOfWa = sum(w if a == 1 else 0 for (a,w) in zip(ac, wa))
    print(sum(ac), sumOfWa)
        


if __name__ == '__main__':
    main()


Measured memory_bytes: 4596
#include<iostream>
#include<cstring>

using namespace std;
 
int main()
{
  char N[1000000];

  cin >> N;

  int sum = 0;
  int len = strlen(N);

  for(int i=0;i<len;i++)
    sum+=N[i]-'0';

  if((sum%9)==0)
    cout << "Yes";
  else
    cout << "No";
}

      

Measured memory_bytes: 3760
N= int(input())
s= [input() for i in range(N)]
a=0
for i in range(N):
    s[i]=sorted(s[i])
s=sorted(s)
dp=s[0]
tmp=0
for i in range(N-1):
    if dp==s[i+1]:
        tmp+=1
    else:
        a+=int((1+tmp)/2*tmp)
        tmp=0
        dp=s[i+1]

a+=int((1+tmp)/2*tmp)
print(a)



Measured memory_bytes: 111448
MOD = 1000000007
N = int(input())
A = list(map(int, input().split()))
ans = 0
B = [0]*(N-1)
sumA = sum(A)
for i in range(1, N):
    sumA -= A[i-1]
    B[i-1] = sumA
for i in range(0, N-1):
    ans += A[i] * B[i]
    ans %= MOD
print(ans)

Measured memory_bytes: 31676
#include<bits/stdc++.h>
using namespace std;
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
using namespace std;
int main()
{ 
int l;
cin>>l;
cout<<fixed;
cout<<setprecision(10);
double y=(double)l/3;

cout<<y*y*y;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y, z;
    cin >> x >> y >> z;
    cout << (x - z) / (y + z);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
#define endl '\n'

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    // ll t;
    ll t=1;
    // cin >> t;
    while(t--){
        int n; cin >> n;
        string s; cin >> s;
        int cnt=0;
        for(int i=0;i<n;i++){
            int j=i,f=0;
            while(s[i]==s[j]){
                j++;
                if(f==0) cnt++,f=1;
            }
            i=j-1; f=0;
        }
        cout << cnt << endl;
    }

}


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


int main(){
      int n,k;
      string s;
      cin >>n>>k>>s;
      k --;
      if(s[k]=='A') s[k] = 'a';
      else if(s[k]=='B') s[k] = 'b';
      else if(s[k]=='C') s[k] = 'c';
      cout << s <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	string s;cin >> s;
	int sis = s.length();
	int n;cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int pl = 0;
		string t; cin >> t;
		int sit = t.length();
		for (int j = 0; j <sit ; j++) {
			string qs = "";
			for (int k = j; k < j + sis; k++) {
				qs = qs + t[k%sit];
			}
			if (qs == s) {
				pl = 1;
			}
		}
		ans += pl;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3228