akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

template<class T,class U> void chmax(T& a, U b) {if(a<b)a=b;}
template<class T,class U> void chmin(T& a ,U b) {if(b<a)a=b;}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    ll a, b, k;
    cin >> a >> b >> k;

    if (k - a< 0) {
        cout << a - k << " " << b << endl;
    } else {
        cout << 0 << " " << max(0LL, b - (k - a)) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
// Problem : B - Between a and b ...
// Contest : AtCoder - AtCoder Beginner Contest 048
// URL : https://atcoder.jp/contests/abc048/tasks/abc048_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a) for (int i=0; i<(a); i++)
#define rep1(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define imax INT_MAX
#define imin INT_MIN
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
int main() { 
	ll a,b,x;
	cin>>a>>b>>x;
	cout<<b/x-a/x+(a%x==0);
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3580
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

// bitは最下位bitを0としたもの
#define GETBIT(data, bit) (((data) >> (bit)) & 1)

int main() {
    int n; scanf("%d", &n);
    int a[n], x[n][n - 1], y[n][n - 1];
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        for (int j = 0; j < a[i]; ++j)
            scanf("%d%d", &x[i][j], &y[i][j]);
    }

    int ret = 0;
    uint16_t maxbit = 1 << n;
    for (uint16_t bits = 1; bits < maxbit; ++bits) {
        bool ok = true;
        for (int i = 0; i < n && ok; ++i) {
            if (!GETBIT(bits, i))continue;
            for (int j = 0; j < a[i] && ok; ++j)
                if (GETBIT(bits, x[i][j] - 1) ^ y[i][j])ok = false;
        }
        if (ok) {
            int sum = 0;
            for (int i = 0; i < n; ++i)sum += GETBIT(bits, i);
            ret = MAX(ret, sum);
        }
    }

    printf("%d\n", ret);
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion


int32_t main() {
//    make(int, n);
//    cout << fixed << setprecision(10) <<  2 * n * M_PI;

    make(int, n);
    makev(a, n - 1);
    VI cnt(n + 1);
    for(int i = 0; i < a.size(); ++i){
        cnt[a[i]]++;
    }
    for(int i = 1; i<=n; ++i){
        cout << cnt[i] << '\n';
    }
    return 0;
}

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

// 延長短縮合成魔法の順番は関係ない
// 「N個の竹のそれぞれがどの長さの竹の材料になるか」の組み合わせを先に決め打ってよい
// 「N個の竹のそれぞれがどの長さの竹の材料になるか」の組み合わせは全部で4^N通り
// 一度合成してしまってからそれぞれに対して長さをA,B,Cに揃えに行く

int N, A, B, C;
vector<int> l;

int rec(int i, int a, int b, int c)
{
    if (i == N)
    {
        if (min(a, min(b, c)) == 0)
            return 1001001; // N個の竹の割当が偏っていて無の竹ができてしまった
        return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }
    int ret0 = rec(i + 1, a, b, c);
    int ret1 = rec(i + 1, a + l[i], b, c) + 10;
    int ret2 = rec(i + 1, a, b + l[i], c) + 10;
    int ret3 = rec(i + 1, a, b, c + l[i]) + 10;
    return min(ret0, min(ret1, min(ret2, ret3)));
}

int main()
{
    cin >> N >> A >> B >> C;
    l.resize(N);
    for (int i = 0; i < N; i++)
        cin >> l[i];
    cout << rec(0, 0, 0, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split(' '))
x = list(map(int, input().split(' ')))
if n >= m:
    print(0)
else:
    x.sort()
    d = [x[i+1] - x[i] for i in range(m-1)]
    d.sort()
    #print(d)
    print(sum(d[:m-n]))


Measured memory_bytes: 13968
s = int(input())
l = []
l.append(s)

count = 1
while True:
    count += 1
    
    n = l[-1]
    if n % 2 == 0:
        a = int(n / 2)
    else:
        a = int(3 * n + 1)
        
    if a in l:
        break
        
    l.append(a)
    
# print(l)
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;

	if (A*B % 2 == 1) {
		cout << "Yes" << endl;
	}

	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main()
{

string s;
cin>>s;
int flag=0,flag1=0,temp=0,b,m;
int a=s.size()-1; ///4
for(int i=0;i<s.size()/2;i++)
{
    if(s[i]==s[a-i])
    {
        continue;
    }
    else{temp++;
}
}
b=(a-1)/2;///1
for(int i=0;i<=b;i++)
{
    if(s[i]==s[b-i])
    {
        continue;
    }
    else{flag++;
}
}

    m=(a+3)/2;
      for(int i=m;i<=a;i++)
{
    if(s[i]==s[a-i])
    {
        continue;
    }
    else{flag1++;
}
    }
    if(temp==0 && flag==0 && flag1==0)
        cout<<"Yes"<<endl;

else
cout<<"No"<<endl;
     return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
double m = 0.00000001;
int main(void){
    ll A,B,C;
    cin >> A >> B >> C;
    ll X,Y;
    cin >> X >> Y;
    ll ans = INFL;
    for(int i = 0; i < 200010; i += 2){
        int x = X - i/2;
        int y = Y - i/2;
        x = max(x, 0);
        y = max(y, 0);
        ans = min(ans, i * C + x * A + y * B);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/*<----------------------------------------------------------------------->

<-------------------------------------------------------------------------->
            _           __                _      _____ _____ _____ 
  ___ _   _| |__   ___ / _|_ __ ___  __ _| | __ |___  |___  |___  |
 / __| | | | '_ \ / _ \ |_| '__/ _ \/ _` | |/ /    / /   / /   / / 
| (__| |_| | |_) |  __/  _| | |  __/ (_| |   <    / /   / /   / /  
 \___|\__,_|_.__/ \___|_| |_|  \___|\__,_|_|\_\  /_/   /_/   /_/   

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
typedef unordered_map <ll,ll> umap ; 
//#pragma GCC optimize "trapv"
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define em emplace_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<"\n"
#define pff(n) cout << n << " " ; 
#define ar array
#define endl "\n" 
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
long const M=1e9+7;
const long mxN =1e5+2 ;
const long mxNN =1e6+2 ;
void solve(){
    long double n ;cin>>n ;
    //string s ; cin >> s;
    cout << 2*(3.14*n) << endl ;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << setprecision(20) << fixed ;
    solve() ;
    //ll t ; cin >> t ; while(t--)solve();
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int P[2020];
vector<int> E[2020];
int A[2020];
int D[2020];
vector<int> C,ret;
int RE[2020];
int L[2020],R[2020],eid;

void dfs(int cur,int d) {
	D[cur]=d;
	L[cur]=eid++;
	if(E[cur].size()==0) C.push_back(cur);
	FORR(e,E[cur]) dfs(e,d+1);
	R[cur]=eid;
}

int lca(int x,int y) {
	while(D[x]>D[y]) x=P[x];
	while(D[x]<D[y]) y=P[y];
	while(x!=y) {
		x=P[x];
		y=P[y];
	}
	return x;
}

int up(int x,int num) {
	while(num--) x=P[x];
	return x;
}

int rotate(int x) {
	static int count=24999;
	count--;
	assert(count>=0);
	//cout<<"rot "<<x<<endl;
	ret.push_back(x);
	vector<int> v;
	while(x) {
		v.push_back(x);
		x=P[x];
	}
	reverse(ALL(v));
	int i;
	FORR(x,v) {
		swap(A[x],A[P[x]]);
		RE[A[x]]=x;
		RE[A[P[x]]]=P[x];
	}
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N-1) {
		cin>>P[i+1];
		E[P[i+1]].push_back(i+1);
	}
	FOR(i,N) {
		cin>>A[i];
		RE[A[i]]=i;
	}
	dfs(0,1);
	
	while(1) {
		int NG[2020]={};
		FOR(i,N) if(i!=A[i]) break;
		if(i==N) break;
		
		for(i=N-1;i>=0;i--) {
			FORR(e,E[i]) NG[i]|=NG[e] | (A[i]>A[e]);
			if(!(L[A[i]]<=L[i]&&L[i]<R[A[i]])) NG[i]=1;
		}
		
		x=A[0];
		for(i=N-1;i>=0;i--) if(L[x]<=L[i]&&L[i]<R[x]&&(NG[i]||!(L[x]<=L[A[i]]&&L[A[i]]<R[x]))) {
			rotate(i);
			break;
		}
		/*
		cout<<i<<"  ";
		FOR(i,N) cout<<i<<":"<<A[i]<<"  ";
		cout<<endl;
		*/
	}
	
	
	cout<<ret.size()<<endl;
	FORR(r,ret) cout<<r<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 640
# -*- coding: utf-8 -*-
import math

H, W = map(int, input().split())

ans = 0
if H == 1 or W == 1:
    ans = 1
else:
    q, mod = divmod(H, 2)
    if mod == 0:
        ans = W * q
    else:
        ans = W * q + math.ceil(W / 2)

print(ans)


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

ll N;
void dfs(string s, int index) {
  char c;
  vector<ll> cnt(10, 0);
  for (ll i = 0; i < s.size(); i++) {
    cnt[s[i] - 'a']++;
  }

  int p = 1;
  for (ll i = 0; i < s.size(); i++) {
    if (cnt[i] > 0) p = i + 2;
  }

  if (index < N) {
    for (ll i = 0; i < p; i++) {
      c = 'a' + i;
      dfs(s + c , index + 1);
    }
  } else {
    for (ll i = 0; i < p; i++) {
      c = 'a' + i;
      cout << (s + c) << '\n';
    }
  }
}

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

  cin >> N;
  if (N == 1) {
    cout << "a" << '\n';
    return 0;
  }
  
  N--;
  dfs("a", 1);
  return 0;
}

Measured memory_bytes: 1536
import sys
mod = pow(10, 9) + 7
sys.setrecursionlimit(pow(10, 8))

def power(x, y):
    if   y == 0: return 1
    elif y == 1	 : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else: return power(x, (y-1)//2)**2 * x % mod
    
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, power(b, mod-2))
def div2(a, b):
    return mul(a, modinv(b))

def modinv(a):
    b, u, v = mod, 1, 0
    while b:
        t = a//b
        a, u = a-t*b, u-t*v
        a, b, u, v = b, a, v, u
    u %= mod
    return u

def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r]
K, = map(int, input().split())
N = 3
B = [0] * (K+1)
r = 0
for i in range(K, 0, -1):
    ac = K//i
    c = power(ac, N)
    bsum = 0
    for j in range(ac-1):
        j += 2
        bsum += B[i*j]
    B[i] = (c - bsum)%mod
    r = (r+B[i]*i)%mod
print(r)



Measured memory_bytes: 62628
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = min([a,b,c,d,e])

if n % f == 0:
    print(int(n/f) + 4)
else:
    print(int(n/f) + 5)



Measured memory_bytes: 3060
line = gets.split(' ').map(&:to_i)
n = line[0]
l = line[1]
g = 0
for i in 1..n
  g+=l+i-1
end
minsa = 1000000
kotae = 0
for i in 1..n
  kg = g-(l+i-1)
  sa = (kg-g).abs
  if sa <= minsa
    minsa = sa
    kotae = kg
  end
end
puts kotae

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rforn(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define SQ(a) (a)*(a)


int main(){
	fast;
	int n, l;
	cin >> n >> l;
	vector<string> v;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		v.push_back(s);
	}
	
	sort(v.begin(),v.end());
	for(string s : v){
		cout << s;
	}
	return 0;
}


Measured memory_bytes: 3660
N=int(input())
works=[]
for _ in range(N):
    A,B=map(int,input().split())
    works.append([B,A])
n_works=sorted(works)
answer=0
number=0
for work in n_works:
    number+=work[1]
    if number>work[0]:
        answer=1
        break
if answer==0:
    print('Yes')
else:
    print('No')
    

Measured memory_bytes: 77852
package main

import (
	"fmt"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)

	var count int = 0
	var min int = 1000000
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
		if min > P[i] {
			count++
			min = P[i]
		}
	}

	fmt.Println(count)
}


Measured memory_bytes: 6444
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n,k;
string s;
int main(){
    cin>>n>>k;
    cin>>s;
    int cnt=0;
    rep(i,n){
        if(s[i]=='L'){
            if(i!=n-1&&s[i+1]=='L') ++cnt;
        }
        else{
            if(i!=0&&s[i-1]=='R') ++cnt;
        }
    }
    cout<<min(n-1,cnt+k*2)<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MAX (ll)(1e6 + 7)
#define INF (ll)(1e18 + 7)
#define MOD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;
ll mult (ll a, ll b) {
	return ((a % MOD) * (b % MOD)) % MOD;
}

ll add (ll a, ll b) {
	a += MOD;
	b += MOD;
	return (a + b) % MOD;
}

ll pw (ll a, ll b) {
	ll r = 1;
	while (b) {
		if (b & 1) {
			r = mult (r, a);
		}
		b >>= 1;
		a = mult (a, a);
	}
	return r;
}

int main () {
	ll n;
	cin >> n;
	ll a = pw (10, n);
	a = add (a , -mult (2, pw (9, n)));
	a = add (a, pw (8, n));
	cout << a << "\n";
}


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

int main()
{
	long long a, ans, re;

	while (cin >> a, a){
		re = 0;
		ans = 1;
		for (int i = 1; i <= a; i++){
			ans *= i;
			while (1){
				if (ans % 10 == 0){
					re++;
					ans /= 10;
				}
				else break;
			}
			ans %= 1000000;
		}
		cout << re << endl;
	}
	return (0);
}

Measured memory_bytes: 1156
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int p = 0, q, res = -10;
    char x;
    while(++p){
	if(p & 1){
	    if(x != '=')
		cin >> q;
	    if(res == -10)res = q;
	    else{
		switch(x){
		case '+':
		    res += q;
		    break;
		case '-':
		    res -= q;
		    break;
		case '*':
		    res *= q;
		    break;
		case '/':
		    res /= q;
		    break;
		case '=':
		    cout << res << endl;
		    return 0;
		}
	    }
	}
	else{
	    cin >> x;
	}
    }
}

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

int main(){
    int n; //階段の総数
    int m; //壊れている階段の総数
    vector<int> brokens(m,0); //壊れている階を格納する配列
    long long mod = pow(10,9) + 7;

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

    int index = 0; //brokenのindex
    vector<long long> dp(n+1,0);
    dp[0] = 1;

    //１段目
    if(1 == brokens[index]){
        index += 1;
    }else{
        dp[1] = dp[0];
    }

    //2段目以降
    for(int i=2; i<=n; i++){

        if(i == brokens[index]){
            index += 1;
        }else{
            dp[i] = dp[i-1] + dp[i-2];
        }

        dp[i] %= mod;
    }

    cout << dp[n] << endl;
}

Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
struct UnionFind{
  vector<int> r,p;
  UnionFind(){}
  UnionFind(int size){init(size);}
  void init(int size){
    r.resize(size,0);
    p.resize(size,0);
    for(int i=0;i<size;i++) r[i]=1,p[i]=i;
  }
  int find(int x){
    return (x==p[x]?x:p[x]=find(p[x]));
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};
struct edge{
  int from,to,cost;
  edge(){}
  edge(int from,int to,int cost):from(from),to(to),cost(cost){}
  bool operator<(const edge& e) const{
    return cost<e.cost;
  }
};
int kruskal(int N,vector<edge> edges){
  int res=0;
  sort(edges.begin(),edges.end());
  UnionFind uf(N+1);
  for(int i=0;i<(int)edges.size();i++){
    edge e=edges[i];
    if(!uf.same(e.from,e.to)){
      res+=e.cost;
      uf.unite(e.from,e.to);
    }
  }
  return res;
}
int main(){
  int V,E;
  cin>>V>>E;
  vector<edge> edges(E);
  for(int i=0;i<E;i++)
    cin>>edges[i].from>>edges[i].to>>edges[i].cost;
  cout<<kruskal(V,edges)<<endl;
  return 0;
}

/*
verified on 2017/04/26
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A&lang=jp
*/

Measured memory_bytes: 5204
#include <iostream>
#include <algorithm>
#include <utility>

using namespace std;

#define maxW 100010
#define maxN 102

typedef long long ll;

int n;
ll s;
ll cache[maxN][maxW], v[maxN], w[maxN];

ll rec(int i, ll W) {
    if (i < 0 || W < 0) return 0;
    if (cache[i][W] != -1) return cache[i][W];
    if (w[i] > W) return cache[i][W] = rec(i-1, W);
    return cache[i][W] = max(rec(i-1, W), v[i] + rec(i-1, W-w[i]));
}

int main() {
    cin >> n >> s;
    for (int i = 0; i<n; i++) {
        cin >> w[i] >> v[i];
        for (int j = 0; j<maxW; j++) {
            cache[i][j] = -1;
        }
    }
    cout << rec(n-1, s) << endl;
    return 0;
}

Measured memory_bytes: 78336
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define MOD 998244353 

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ordered_set<ll> ors;

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

ll power(ll a, ll n, ll m)
{
    ll ans=1;
    while(n)
    {
        if(n&1) ans=(ans*a)%m;
        n>>=1;
        a=(a*a)%m;
    }
    return ans;
}

ll invmod(ll a, ll m)
{
    return power(a,m-2,m);
}

ll lp[10000001];

void prime()
{
    repf(i,1,10000001) lp[i]=i;
    repf(i,2,10000001)
    {
        if(lp[i]==i)
        {
            for(ll j=2*i;j<10000001;j+=i)
            {
                if(lp[j]==j) lp[j]=i;
            }
        }
    }
}

ll w(ll a, ll b) {
    ll res=(b/2)*(a/2)+ceil((ld)b/2)*ceil((ld)a/2);
    return res;
}

ll W(ll a, ll b, ll c, ll d) {
    return w(c,d)-w(a-1,d)-w(c,b-1)+w(a-1,b-1);
}

ll B(ll a, ll b, ll c, ll d) {
    return (c-a+1)*(d-b+1)-W(a,b,c,d);
}

bool f[200];

void solve(ll tt) {
    ll x,n;
    cin>>x>>n;
    repf(i,0,n) {
        ll p;
        cin>>p;
        f[p]=true;
    }    
    ll dif=200,ans=-1;
    repf(i,0,105) {
        if(!f[i] && dif>abs(i-x)) {
            ans=i;
            dif=abs(i-x);
        }
    }
    cout<<ans<<endl;
}

int main()
{
    IOS;
    ll t;
    // cin>>t;
    t=1;
    repf(tt,1,t+1) {
        solve(tt);
    }
}     

Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
    public static int distance(String s1, String s2, int i, int j) {
        if (j == s2.length()) {
            return s1.length() - i;
        }
        if (i == s1.length()) {
            return s2.length() - j;
        }
        if (s1.charAt(i) == s2.charAt(j)) {
            return distance(s1, s2, i + 1, j + 1);
        }
        int rep = distance(s1, s2, i + 1, j + 1) + 1;
        return rep;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int dist = distance(in.next(), in.next(), 0, 0);
        System.out.println(dist);

    }

}

Measured memory_bytes: 87908
#!/usr/bin/env python
A,B,C,D = input().split()
A,B,C,D = int(A),int(B),int(C),int(D)

T_life = A
T_power = B
A_life = C
A_power = D

while True:
  A_life -= T_power
  if A_life <= 0:
    print("Yes")
    break
  T_life -= A_power
  if T_life <= 0:
    print("No")
    break


Measured memory_bytes: 9192
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  bool flg = true;
  if (s[2] != s[3]) flg = false;
  if (s[4] != s[5]) flg = false;
  if (flg) cout << "Yes";
  else cout << "No";

  return 0;
}


Measured memory_bytes: 256
nk = input().split(" ");
n = int(nk[0]);
k = int(nk[1]);

ans = 0;
for i in range(1,n+1) :
	j = 0;
	while i*(2**j) < k :
		j += 1;
	ans += (1/n)*(1/2)**j;
print(ans);

Measured memory_bytes: 3060
import java.io.*;

/**
 * Created by Ayushi on 27/07/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        long a = Long.parseLong(temp[0]);
        long b = Long.parseLong(temp[1]);
        r.close();

        if ((a+b)%2 == 1) {
            System.out.println("IMPOSSIBLE");
        }
        else {
            System.out.println((a+b) / 2);
        }
    }
}


Measured memory_bytes: 21588
#include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<set>
#include<tuple>
#include<utility>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define enter "\n"

typedef long long ll;


int abc105_b(){
    //入力
    int n;
    cin >> n;
    bool ans = false;
    
    //処理
    REP(i,n){
        int tmp = n-4*i;
        if(tmp>=0 && tmp%7==0){
            ans = true;
            break;
        }
    }
    
    //出力
    if(ans) cout << "Yes" << enter;
    else cout << "No" << enter;
    return 0;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    abc105_b();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 300000

int parent(int a){
  return a/2;
}

int left(int a){
  return 2*a;
}

int right(int a){
  return (2*a)+1;
}

int main(int argc, const char * argv[]){
  int a,i;
  int b[MAX+1];

  scanf("%d",&a);
  for(i=1;i<=a;i++){
    scanf("%d",&b[i]);
  }

  for(i=1;i<=a;i++){
    printf("node %d: key = %d, ",i,b[i]);
    if(parent(i)>=1){
      printf("parent key = %d, ",b[parent(i)]);
    }
        if(left(i)<=a){
      printf("left key = %d, ",b[left(i)]);
    }
    if(right(i)<=a){
      printf("right key = %d, ",b[right(i)]);
    }
    printf("\n");
  }
  return 0;
}



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

import sys
import os
from collections import deque


N = int(sys.stdin.readline())
q = deque()

lines = sys.stdin.readlines()
for s in lines:
    lst = s.split()
    command = lst[0]
    if command == 'insert':
        q.appendleft(lst[1])
    elif command == 'delete':
        try:
            q.remove(lst[1])
        except Exception:
            pass
    elif command == 'deleteFirst':
        q.popleft()
    elif command == 'deleteLast':
        q.pop()

print(*q)

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

int main() {
   string s;
   cin >> s;
   while(1){
      rep(i,2)
      s.pop_back();
      if(s.substr(0,s.size()/2)==s.substr(s.size()/2))
      break;
   }
   cout << s.size() << endl;
}

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

using namespace std;

template<class INT>
INT mod_pow(INT n, INT k, INT p){
    if (k == 0)
        return 1;
    if (k % 2 == 0){
        INT res = mod_pow(n, k / 2, p);
        return res * res % p;
    }
    return mod_pow(n, k - 1, p) * n % p;
}

template<class INT>
vector<INT> fact(INT n, INT p=INT(1e9 + 7)){
    vector<INT> f(n + 1);
    f[0] = 1;
    for (INT i = 0; i < n; i++)
        f[i + 1] = (i + 1) * f[i] % p;
    return f;
}

template<class INT>
vector<INT> invfact(INT n, const vector<INT> &f, INT p=INT(1e9 + 7)){
    vector<INT> inv(n + 1);
    inv[n] = mod_pow<INT>(f[n], p - 2, p);
    for (INT i = n; i > 0; i--)
        inv[i - 1] = inv[i] * i % p;
    return inv;
}

template<class INT>
INT comb(INT a, INT b, const vector<INT> &f, const vector<INT> &invf, INT p=(INT)(1e9 + 7)){
    if (a < b)
        return 0;
    if (a < 0 or b < 0)
        return 0;
    return f[a] * invf[b] % p * invf[a - b] % p;
}

int main(){
    int64_t n, k;
    cin >> n >> k;
    auto f = fact(n);
    auto invf = invfact(n, f);
    const int64_t p = 1e9 + 7;
    
    int64_t ans = 0;
    for (int64_t i = 0; i <= min(n - 1, k); i++){
        ans += comb(n, i, f, invf) * comb(n - 1, i, f, invf) % p;
        ans %= p;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	cin >> n;
	LL cnts[10][10] = {};
	string s;
	for(int i = 1; i <= n; ++i){
		convert(i, s);
		++cnts[s[0] - '0'][*s.rbegin() - '0'];
	}
	LL ans = 0;
	for(int i = 0; i < 10; ++i)
	for(int j = 0; j < 10; ++j){
		ans += cnts[i][j] * cnts[j][i];
	}
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){
	throw;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

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

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n,m,k;
int a[111111],b[111111];
int c[111111],d[111111];
int memo[111111];
map<P,int>bl;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
    cin>>n>>m>>k;
    rep(i,m)cin>>a[i]>>b[i];
    rep(i,k)cin>>c[i]>>d[i];
    rep(i,m){a[i]--;b[i]--;}
    rep(i,k){c[i]--;d[i]--;}
    UnionFind uni(n+1);

    rep(i,m){
        uni.unionSet(a[i],b[i]);
        memo[a[i]]++;
        memo[b[i]]++;
        bl[mp(a[i],b[i])]++;
        bl[mp(b[i],a[i])]++;
    }

    rep(i,k){
        if(uni.findSet(c[i],d[i])){
            memo[c[i]]++;
            memo[d[i]]++;
        }
    }

    rep(i,n){
        //cout<<memo[i]<<" "<<uni.size(i)<<endl;
        cout<<uni.size(i)-memo[i]-1<<" ";
    }
    cout<<endl;
    return 0;
}


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

public class Main {
	void run() {
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		c = Math.min(c, a + b + 1);
		out.println(c + b);
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = Main.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";
		
		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			//out.print("Case #" + (test + 1) + ": ");
			new Main().run();
		}
		br.close();
		out.close();
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}
		
		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		
		String next() {
			findToken();
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (2000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  string s;
  cin >> s;
  rep(i,s.size()-1){
    if(s[i]=='A'&&s[i+1]=='C'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

const ll mod = 1000000007LL;

ll modpow(ll a, ll b) {
	if (b == 0) return 1;
	ll tmp = modpow(a, b / 2);
	if (b % 2 == 0)
		return tmp * tmp % mod;
	return tmp * tmp % mod * a % mod;
}

int main() {
	int N, K; cin >> N >> K;
	vector<ll> all_k(K + 1, 0);
	for (int i = 1; i <= K; ++i) {
		all_k[i] = modpow(K / i, N);
	}
	for (int i = K; i > 0; --i) {
		ll dis = 0;
		for (ll j = 2; i * j <= K; ++j)
			dis = (dis + all_k[j * i]) % mod;
		all_k[i] = (all_k[i] - dis + mod) % mod;
	}
	ll res = 0;
	for (int i = 1; i <= K; ++i) {
		res += i * all_k[i] % mod;
		res %= mod;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4052
//auto 関数名 = [(&:ラムダ外の引数をとる時))](引数の型1 引数名1, 引数の型2, 引数名2, ...) { 関数の処理 }; //inside main() define function. take care of };
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//   bitset<ビット数> s(tmp);
//   // (ビット列sに対する処理)
// }
// sort(配列変数.begin(), 配列変数.end());
// do {
//   // 順列に対する処理
// } while (next_permutation(配列変数.begin(), 配列変数.end()));
//const double PI = acos(-1); M_PI
// cout << fixed << setprecision(10);
// set<int>st{ 3,1,4,1,5,9,2,6,5,3,5 };
//     for (auto itr = st.begin(); itr != st.end(); ++itr) {
//         cout << *itr;
//     }
#include <bits/stdc++.h>
#include <regex>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end() //sort(all(vec)); ,reverse(all(vec));etc
int main(){
    int n,x;
    cin>>n>>x;
    vector<int>m(n);
    int sum=0;
    int min=10000;
    rep(i,n){
        cin>>m.at(i);
        sum+=m.at(i);
        if(min>m.at(i)){
            min=m.at(i);
        }
    }
    x-=sum;
    x/=min;
    cout<<n+x<<endl;


}

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

int n;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  const int md = (int) 1e9 + 7;
  cin >> n;
  vector<int> a(n);
  range(i, 0, n) cin >> a[i];
  int s = *max_element(a.begin(), a.end());
  vector<int> dp(n + 1);
  vector<int> sum(s + 1);
  dp[n] = 1;
  sum[a[n - 1]]++;
  husk(i, n - 1, -1) {
    dp[i] = sum[a[i]];
    if(i > 0 && a[i - 1] != a[i]) {
      sum[a[i - 1]] += dp[i];
      if(sum[a[i - 1]] >= md) sum[a[i - 1]] -= md;
    }
  }
  cout << dp[0];
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)

using namespace std;

struct P {
	int x;
	int y;
};

struct L {
	int i;
	int v;
};

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int h, w, m; cin >> h >> w >> m;
	vector<P> ps(m);

	vector<L> hs(h);
	FOR_LT(i, 0, h) {
		hs[i].i = i;
	}
	vector<L> ws(w);
	FOR_LT(j, 0, w) {
		ws[j].i = j;
	}
	
	FOR_LT(i, 0, m) {
		int x, y; cin >> x >> y;
		x--;
		y--;
		hs[x].v++;
		ws[y].v++;
		ps[i] = { x, y };
	}
	
	sort(hs.begin(), hs.end(), [](const auto& lhs, const auto& rhs) {
		return lhs.v > rhs.v;
	});
	sort(ws.begin(), ws.end(), [](const auto& lhs, const auto& rhs) {
		return lhs.v > rhs.v;
	});
	int hv = hs.begin()->v;
	set<int> hi;
	{
		auto it = hs.begin();
		while (it != hs.end() && hv == it->v) {
			hi.insert(it->i);
			it++;
		}
	}
	int wv = ws.begin()->v;
	set<int> wi;
	{
		auto it = ws.begin();
		while (it != ws.end() && wv == it->v) {
			wi.insert(it->i);
			it++;
		}
	}

	size_t on = hi.size() * wi.size();
	FOR_LT(i, 0, m) {
		P& p = ps[i];
		if (hi.find(p.x) != hi.end() && wi.find(p.y) != wi.end()) {
			on--;
		}
	}

	int64_t ans = hv + wv;
	if (on == 0) {
		ans--;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 38264
#include <stdio.h>

int main()
{
    int i, max, min, size;
    double sum=0;
    scanf("%d", &size);
    int arr[size];

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

    max = -9999999999;
    min=9999999999;

    for(i=0; i<size; i++)
    {
        if(arr[i] > max)
        {
            max = arr[i];
        }

        if(arr[i] < min)
        {
            min = arr[i];
        }
        sum=sum+arr[i];
    }

    printf("%d %d %.0lf\n",min,max,sum);

    return 0;
}



Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

int n, a[100000], g[2][100001];

int main() {
	cin >> n;
	inc(i, n) { cin >> a[i]; }
	
	inc(i, n) { g[0][i + 1] = gcd(g[0][i], a[i]); }
	dec(i, n) { g[1][i] = gcd(g[1][i + 1], a[i]); }
	
	int ans = 0;
	inc(i, n) { setmax(ans, gcd(g[0][i], g[1][i + 1])); }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1408
def diff(s,t):
    assert len(s) == len(t)
    #print(s,t)
    c = 0
    for i,j in zip(s,t):
        if i != j:
            c+=1
        else:
            pass
    return c
s=input()
t=input()
n=len(s)
m=len(t)
min_=10**5
for i in range(n-m+1):
    min_=min(min_,diff(s[i:m+i],t))
print(min_)

Measured memory_bytes: 67360
#include <stdio.h>

int main() {
	int N;
	scanf("%d", &N);
	int j = 100;
	for (int i = 0; i < 3; i++) {
		int t = N / j;
		if (t == 7) {
			printf("Yes");
			return 0;
		}
		N = N - j * t;
		j = j / 10;
		//printf("%d %d %d\n",N, t, j);
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
int n,k;
int main()
{
	cin>>n>>k;
	cout<<n-k+1;
	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
ans = 1000
for i in range(len(s)-len(t)+1):
    temp = 0
    sub = s[i:i+len(t)]
    for j in range(len(t)):
        if sub[j] != t[j]:
            temp += 1
    if temp < ans:
        ans = temp
print(ans)

Measured memory_bytes: 9048
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A, B;
    cin >> A >> B;
    if(A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0) {
        cout << "Possible" << endl;
        return 0;
    }
    cout << "Impossible" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, m, x, a = 1e9; cin >> n >> m >> x;
  v1i v(n); v2i u(n, v1i(m));
  rep(i, n){
    cin >> v[i];
    rep(j, m) cin >> u[i][j];
  }
  rep(i, 1 << n){
    v1i d(m, 0);
    int c = 0;
    rep(j, n){
      if(i & 1 << j){
        c += v[j];
        rep(k, m) d[k] += u[j][k];
      }
    }
    bool b = 1;
    rep(j, m){
      if(d[j] < x){
        b = 0;
        break;
      }
    }
    if(b) a = min(a, c);
  }
  if(a == 1e9) a = -1;
  cout << a << "\n";
  return 0;
}

Measured memory_bytes: 3636