akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define maxN 200005
#define mod 1000000007
#define pi 3.14159265358979323846264338327950

void solve()
{
    int n, m;
    cin >> n >> m;
    int all[105] = {}, vote = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> all[i];
        vote += all[i];
    }
    int temp = 0;
    for (int i = 0; i < n; i++)
    {
        if (all[i]*(4*m) >= vote)
        {
            temp++;
        }
    }
    if (temp >= m)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
}

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

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
using ld = long double;
using ulli = unsigned long long int;
#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(args...) do {cerr << #args << " : "; debug(args); } while(0)
#define all(v) ((v).begin()),((v).end())
#define size(x) (int) x.size() 
#define pb emplace_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
void debug () {cerr << endl;}
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template < typename T, typename ... hello>void debug( T arg, const hello &... rest) {cerr << arg << ' ';debug(rest...);}
const int maxN = 1000000;
long long isVisited[maxN / 64 + 200];
vector<int> primes;
void bitwise_seive_gen(int limit){
    limit += 100;
    int sq = sqrt (limit);
	for (long long i = 3; i <= sq; i += 2) {
		if(!(isVisited[i/64]&(1LL<<(i%64)))) {
			for(long long j = i * i; j <= limit; j += 2 * i) {
				isVisited[j/64] |= (1LL<<(j%64));
			}
		}
	}
	primes.pb(2);
	for (long long i = 3; i <= limit; i += 2) {
		if(!(isVisited[i / 64] & (1LL << (i % 64)))) {
			primes.pb(i);
		}
	}
}
int prime_factorization(lli n){
	vector<pair<int,int>> prime_pairs;
	for(auto i : primes){
		if(i * i > n){
			break;
		}
		if(n % i == 0){
			int count = 0;
			while(n % i == 0){
				n /= i;
				count += 1;
			}
			prime_pairs.pb(i,count);
		}
	}
	int ans = 0;
	if(n > 1){
		ans += 1;
	}
	for(int i = 0;i < size(prime_pairs) ; i++){
		int res = 0;
		for(int x = 1;;x++){
			if(x * (x + 1) / 2 <=prime_pairs[i].second){
				res = x;
			}else{
				break;
			}
		}
		ans += res;
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    bitwise_seive_gen(maxN);
    lli n;
    cin >> n;
    cout<<prime_factorization(n);
}


Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef long double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define sortvec(a) sort(a.begin(), a.end())
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define cerr if(true)cerr
void print(){cout<<endl;}
template<typename T,typename... Args>
void print(T a, Args... args) {cout<<a<<" ";print(args...);}
lli llipowerp(lli x, lli y, lli p=LLONG_MAX)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli binarySearch(vector<int> arr, int l, int r, int x)
{
    if (r >= l)
    {
        lli mid = l + (r - l) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] > x)
            return binarySearch(arr, l, mid - 1, x);
        return binarySearch(arr, mid + 1, r, x);
    }
    return -1;
}
template <typename T>
inline void printvec(vector<T> inp){
    for(auto it:inp) cout<<it<<" ";
    cout << endl;
}
//---------------------------------------------------------------------------------
int n;
lld dp[310][310][310];
vector<int> a(4);
lld lldivide(int y){
    return (lld)y/((lld)(n));
}

lld fill(int i,int j,int k){
    //print(i,j,k);
    if(i<0 || j<0 ||k<0) return 0;
    if(i+j+k==0) return 0;
    if(dp[i][j][k]!=-1 ) return dp[i][j][k];

    dp[i][j][k] = (k>0)*fill(i, j + 1, k - 1) * ((lld)k / (lld)(i + j + k)) + (i>0)*fill(i - 1, j, k) * ((lld)i / (lld)(i + j + k)) + (j>0)*fill(i + 1, j - 1, k) * ((lld)j / (lld)(i + j + k));
    if(n!=-1){
        dp[i][j][k]+= ((lld)n / (lld)(i + j + k));

    }
    else{
        dp[i][j][k]+=1;
    }
    //dp[i][j][k]+=(lldivide(n-i-j-k))*1;
    return dp[i][j][k];
}

int main()
{   
    cin>>n;
    
    fori(310){
        forj(310){
            for(int k=0;k<310;k++) dp[i][j][k]=-1;
        }
    }
    int x;
    fori(n){
        cin>>x;
        a[x]++;
    }
    dp[0][0][0]=0;    
    // printvec(a);
    // fori(n+1){
    //     forj(n+1){
    //         for(int k=0;k<n+1;k++){
    //             cout<<fill(i,j,k)<<",";
    //         }
    //         cout<<" ";
    //     }
    //     cout<<endl;
    // }
   
    cout<<fixed<<setprecision(12)<<fill(a[1],a[2],a[3])<<endl;
    
}

Measured memory_bytes: 465792
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define maxll 1000000000000000ll
#define maxn 100010
typedef int nlist[maxn<<1];
typedef ll arrll[maxn];
nlist be,next,pt,vst,w,a,b;
arrll sa,sb,samin,sbmin;

typedef struct {
	int x,y,z;
} st;
st p[100010];
int comp1(const void *a, const void *b){
	st *p=(st*)a;
	st *q=(st*)b;
	if (p->x!=q->x){
		return p->x-q->x;
	}
	else {
		return p->y-q->y;
	}
}
int comp2(const void *a, const void *b){
	st *p=(st*)a;
	st *q=(st*)b;
	if (p->y!=q->y){
		return p->y-q->y;
	}
	else {
		return p->x-q->x;
	}
}
int r,c,n;
int row[100010],col[100010];
void addedge(int x, int y, int tw, int id){
	next[id]=be[x];
	pt[id]=y;
	be[x]=id;
	w[id]=tw;
}
ll mins;
int dfs(int flag, ll s[], int now){
	vst[now]=flag;
	if (mins>s[now]) mins=s[now];
	for (int y,i=be[now];i;i=next[i]){
		if (!vst[y=pt[i]]){
			s[y]=s[now]+w[i];
			if (dfs(flag,s,y)) return 1;
		}
		else {
			if (s[y]!=s[now]+w[i]){
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	scanf("%d%d%d",&r,&c,&n);
	for (int i=1;i<=n;i++) be[i]=0;
	for (int i=1;i<=n;i++){
		scanf("%d%d%d",&p[i].x,&p[i].y,&p[i].z);
		a[p[i].x]=1;
		b[p[i].y]=1;
	}
	a[0]=b[0]=0;
	for (int i=1;i<=r;i++) a[i]=a[i-1]+a[i];
	for (int j=1;j<=c;j++) b[j]=b[j-1]+b[j];
	qsort(p+1,n,sizeof(st),comp1);
	for (int i=1;i<=c;i++) vst[i]=be[i]=0;
	for (int i=1,j;i<=n;i=j){
		for (j=i+1;j<=n&&p[i].x==p[j].x;j++){
			addedge(p[j-1].y,p[j].y,p[j].z-p[j-1].z,j);
			addedge(p[j].y,p[j-1].y,p[j-1].z-p[j].z,j+n);
		}
	}
	for (int i=1;i<=c;i++){
		if (b[i]&&!vst[i]){
			mins=maxll;
			sa[i]=0;
			if (dfs(i,sa,i)) {
				printf("No");
				return 0;
			}
			samin[i]=mins;
		}
	}
	for (int i=1;i<=c;i++){
		if (vst[i]){
			samin[i]=samin[vst[i]];
		}
	}
	qsort(p+1,n,sizeof(st),comp2);
	for (int i=1;i<=r;i++) vst[i]=be[i]=0;
	for (int i=1,j;i<=n;i=j){
		for (j=i+1;j<=n&&p[i].y==p[j].y;j++){
			addedge(p[j-1].x,p[j].x,p[j].z-p[j-1].z,j);
			addedge(p[j].x,p[j-1].x,p[j-1].z-p[j].z,j+n);
		}
	}
	for (int i=1;i<=r;i++){
		if (a[i]&&!vst[i]){
			mins=maxll;
			sb[i]=0;
			if (dfs(i,sb,i)) {
				printf("No");
				return 0;
			}
			sbmin[i]=mins;
		}
	}
	for (int i=1;i<=r;i++){
		if (vst[i]){
			sbmin[i]=sbmin[vst[i]];
		}
	}
	/*printf("rows\n");
	for (int i=1;i<=r;i++){
		printf("%lld %lld\n",sb[i],sbmin[i]);
	}
	printf("columns\n");
	for (int i=1;i<=c;i++){
		printf("%lld %lld\n",sa[i],samin[i]);
	}*/
	for (int i=1;i<=n;i++){
		int x=p[i].x;
		int y=p[i].y;
		int z=p[i].z;
		if ((ll)z-sa[y]+samin[y]<0||(ll)z-sb[x]+sbmin[x]<0){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}


Measured memory_bytes: 11880
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner
{
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for ( A&i : a ) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;
/*---------------------------------------------------------------------*/

template<class T, class B, class...V>struct Vec
{
  typedef Vec<T, V...>A; typedef vector<typename A::t>t; t nvec(B a, V...b) { return t(a, A().nvec(b...)); }
};
template<class T, class B>struct Vec<T, B> { typedef vector<T>t; t nvec(B a) { return t(a); } };
template<class T>tuple<T>Init(T t) { return tuple<T>(t); }
template<class T, class C>struct Vec<T, tuple<C>> { using t = T; T nvec(tuple<C> a) { return get<0>(a); } };
template<class T = int, class...B> typename Vec<T, B...>::t nvec(B...b) { return Vec<T, B...>().nvec(b...); }


///<summary>ビットカウント</summary>
        ///<param name="bits">カウントする変数</param>
int BitCount(long bits)
{
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
}
void Calc()
{

  int n, a;
  in, n, a;
  auto x = in.Array(n);
  auto dp = nvec<ll>(n + 1, n + 1, a * n + 10, Init(-1));
  dp[0][0][0] = 1;
  rep(i, n)rrep(j, 0, n + 1)rrep(k, a*n + 1)if ( dp[i][j][k] != -1 )
  {
    if ( k + x[i] <= a*n )
    {
      if ( dp[i + 1][j + 1][k + x[i]] == -1 )
        dp[i + 1][j + 1][k + x[i]] = 0;
      dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
    }

    if ( dp[i + 1][j][k] == -1 )
      dp[i + 1][j][k] = 0;
    dp[i + 1][j][k] += dp[i][j][k];
  }

  ll ans = 0;
  rep(j, 1, n + 1)
  {
    if ( dp[n][j][a*j] >= 0 )
      ans += dp[n][j][a*j];
  }
  cout << (ans) << endl;

}


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

const int N = 505, D = 3900;

int a[N][N];
int main() {
	int n, m, w, h;
	cin >> n >> m >> w >> h;
	long long s = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i % w == 0 && j % h == 0) {
				a[i][j] = -D * (w * h - 1) - 1;
			}
			else {
				a[i][j] = D;
			}
			s += a[i][j];
		}
	}
	if (s <= 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) {
				cout << a[i][j] << " ";
			}
			cout << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=(a);i<(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(a);i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef long double ld;
const ll mod=1000000007;
// head

const ll top=1e18;
const int N=100100;
ll a=1,b=1;
int n;
ll v[N];

int main() {
	scanf("%d",&n);
	rep(i,0,n) scanf("%lld",v+i);
	sort(v,v+n);
	for (int i=0;i<n;i++) {
		b=v[i];
		if (b==0) return puts("0"),0;
		if (a>(top/b)) return puts("-1"),0;
		a*=b;
	}
	printf("%lld",a);
	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n)    FOR(i, 0, n)
#define pb           push_back
#define all(a)       (a).begin(), (a).end()
#define UNIQUE(v)    v.erase(unique(all(v)), v.end());
#define fill(a, x)   memset(a, x, sizeof(a))
#define zero(a)      fill(a, 0)
#define minus(a)     fill(a, -1)
#define dbg(x)       cout << #x "=" << x << endl

// naming rules
// array starts with "ar". for example ar_a
// stack starts with "st". for example st_a
// queue starts with "qu". for example qu_a
// vector starts with "vc". for example vc_a

// int charToInt(char c) {
//   string tmp;
//   tmp += c;
//   int b = atoi(tmp.c_str());
//   return b;
// }

// int stringToInt(string s) {
//   return atoi(s.c_str());
// }

// deletes vec_t[from_index] through vec_t[to_index]
// for example if from_index is 1 and to_index is 3, deletes vec_t[1], vec_t[2]

// void delIndexBetween(vi vec_t, int from_index, int to_index) {
//   vec_t.erase(vec_t.begin() + from_index, vec_t.begin() + to_index);
// }

// void delIndex(vi vec_t, int index) {
//   vec_t.erase(vec_t.begin() + index);
// }

// void del(vi vec_t, int num) {
//   int id = -1;
//   rep(i, vec_a.size()) {
//     if (num == vec_a[i]) {
//       id = i;
//       break;
//     }
//   }
//   if (id != -1) delIndex(id);
// }

int main() {
  // expects input to be like
  /*
     n
     a1 a2 a3 a4 a5 a6..., an
  */

  ios::sync_with_stdio(false);
  int n;
  int c = 0;
  vi vc_a;
  cin >> n;

  // comment out below when input is given in the format n k
  /* n k */

  // int k;
  // cin >> k;

  map<string, bool> mp;
  vector<string> vc_o;

  // receiving input
  while (c < n) {
    string cmd;
    cin >> cmd;

    string tmp;
    cin >> tmp;
    if (cmd == "insert") {
      mp[tmp] = true;
    } else {
      if (mp[tmp]) {
        vc_o.pb("yes");
      } else {
        vc_o.pb("no");
      }
    }

    c++;
  }

  rep(i, vc_o.size()) {
    cout << vc_o[i] << endl;
  }

  // for result output like below
  /*
     p1 500
     p2 1000
     p3 1000
  */

  // rep(i, n) {
  //   cout << vi_a[i].name << " " << vi_a[i].ms << endl;
  // }

  return 0;
}



Measured memory_bytes: 70612
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  cout << (a+b)*c/2 << endl;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  string S;
  cin >> S;
  vector<int> found(26, 0);
  int l = S.length();
  REP(i, l) { ++found.at(S.at(i) - 'a'); }
  REP(i, 26) {
    if (found.at(i) == 0) {
      cout << char('a' + i) << endl;
      return 0;
    }
  }

  cout << "None" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <time.h>
#include <algorithm>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <array>
#include <string>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define F first
#define S second
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ost;

const ll maxN = 1e7;
const ll INF = 1e17;

ll xs[] = {-1, 1, 0, 0};
ll ys[] = {0, 0, -1, 1};

int main(){
	cin.sync_with_stdio(false);
	cin.tie(0);
	ll a,b ,c;
	cin >> a >> b >> c;
	if(a == 5 and b==5 and c == 7)
		puts("YES");
	else if(a == 5 and b==7 and c == 5)
		puts("YES");
	else if(a == 7 and b==5 and c == 5)
		puts("YES");
	else
		puts("NO");
	return 0;
}

Measured memory_bytes: 3620
N = int(input())


def add(a, b, BIGMOD):
    return (a + b) % BIGMOD


def sub(a, b, BIGMOD):
    return (a - b + BIGMOD) % BIGMOD


MOD = 10 ** 9 + 7

D = pow(10, N, MOD)
C = pow(8, N, MOD)
A = pow(9, N, MOD)
B = A

print(sub(D,sub(add(A,B,MOD),C,MOD),MOD))


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

using namespace std;
int main(void)
{
  int input1;
  char input2[10000];

  cin >> input1;
  cin >> input2;

  for (int i = 0; i < strlen(input2); i++) {
    input2[i] = input2[i] + input1;
    if (input2[i] > 'Z') {
      input2[i] = input2[i] - 26;
    }
  }

  cout << input2;
  return 0;
}


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

int main()
{
	string s,ans;
	cin >> s;
	for (int i = 0; i < s.length(); ++i){
		if (s[i] == '1'){ ans += '1'; }
		if (s[i] == '0'){ ans+= '0'; }
		if (s[i] == 'B'){ if(ans.length()>0) ans.pop_back(); }
	}
	cout << ans << endl;
	return 0;
}

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

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

    int n, k;
    cin >> n >> k;
    vector<int> V(n);
    for(int i = 0; i < n; i++){
        cin >> V[i];
    }

    int ans = 0;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n - i; j++){
            if((i + j) > k) continue;
            vector<int> A;
            for(int a = 0; a < i; a++){
                A.push_back(V[a]);
            }
            for(int b = 0; b < j; b++){
                A.push_back(V[n - b - 1]);
            }
            sort(A.begin(), A.end());
            for(int l = 0; l < min(k - (i + j), (int)A.size()); l++){
                if(A[l] < 0) A[l] = 0;
                else break;
            }
            int t = 0;
            for(int l = 0; l < A.size(); l++){
                t += A[l];
            }
            ans = max(ans, t);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
yen = [10, 50, 100, 500]
cnt = 0
while true
  total = gets.to_i
  break if total == 0
  puts if cnt != 0
  coins = gets.split.map(&:to_i)
  back = [0] * 4
  target = 0
  for i in (0..3)
    target += yen[i] * coins[i]
  end
  target -= total
  3.downto(0) do |i|
    back[i] = target / yen[i]
    target %= yen[i]
  end
  for i in (0..3)
    puts "#{yen[i]} #{coins[i] - back[i]}" if coins[i] - back[i] > 0
  end
  cnt += 1
end

Measured memory_bytes: 8856
#include <iostream>
#include <string>
#include <unordered_map>
#include <stdio.h>
#include <list>
#include <vector>
#include <algorithm>
#include <stack>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;

int main()
{
   int a,b;
   cin >> a >>b;
   int now=1;
   int cnt=0;
   while(1)
   {
      //cout<<now<<endl;
      if(now>=b)break;
      now+=a-1;
      cnt++;
   }
   cout<<cnt<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int k=0,a[5],i,z=10;
    for(i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
        if(a[i]%10==0)
            k+=a[i];
        else
        {
            k+=a[i]/10*10+10;
            z=z>a[i]%10?a[i]%10:z;
        }
    }
    printf("%d\n",k-10+z);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();

  if(S.contains("abc") || S.contains("acb") || S.contains("bac") || S.contains("bca") || S.contains("cab") || S.contains("cba")){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

  }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
const int mod = 1e9+7;
//26

signed main(){
	int a, b, s = 0;
	scanf("%lld%lld", &a, &b);
	rrep(i,inf){
		int d = b-a;
		if(d == i){
			printf("%lld\n", ((i-1)*i)/2-a);
			break;
		}
	}
	return 0;
}





Measured memory_bytes: 256
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_4_C&lang=jp
# Swap

from collections import deque
import sys
input = sys.stdin.readline

def main():
    n1 = int(input())
    l1 = list(map(int,input().split()))
    for i in range(int(input())):
        (b,e,t) = map(int,input().split())
        for k in range(e-b):
            l1[k+b],l1[t+k] = l1[t+k] ,l1[k+b]
    print (" ".join(map(str,l1)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 6084
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)


N,M = nm()
used = [0] * N

start = 0
if N % 2 != 0:
    s = (N-1)//2
else:
    s = N//2 - 1 

for i in range(1,M+1):
    q= (i+1)//2
    if i % 2 !=0:
        print(q,N+1-q)
    else:
        print(s+1-q,s+1+q)


Measured memory_bytes: 10204
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  string s; cin>>s;
  int l=s.size();
  ll cnt=0;
  rep(i,l){
    cnt+=s[i]-'0';
  }
  if(cnt%9==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3744
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n,x; cin >> n >> x;
    std::vector<int> l(n); rep(i,n) cin >> l[i];

    int cnt = 0, cur = 0;
    rep(i,n){
        cur += l[i];
        if(cur <= x) cnt++;
    }
    cout << cnt+1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
const ll MAXX = 1e18;  

ll res[1000001];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	vector<ll> hold(n + 2);
	stack<ll> nxt;
	for (ll i = 1; i <= n; i++) {
		cin >> hold[i];
	}
	hold[0] = MAXX;
	ll ma = 1;
	for (ll i = 1; i <= n; i++) {
		if (hold[i] <= hold[i - 1]) {
			res[i] = res[i - 1] + 1;
		}
		else {
			res[i] = 1;
		}
		ma = max(ma, res[i]);
	}
	cout << ma - 1 << '\n';
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define lli long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    a %= mod;
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+5;
int const inf = 1e15;
int fact[N];
int ifact[N];

void pre(){
    fact[0] = 1;
    for(int i = 1;i<N;i++){
        fact[i] = fact[i-1]*i;
        fact[i] %= mod;
    }
    ifact[N-1] = inverse(fact[N-1]);
    for(int i=N-2;i>=0;i--){
        ifact[i] = ifact[i+1]*(i+1);
        ifact[i] %= mod;
    }
}

int ncr(int n,int r){
    if(n == r) return 1;
    if(r > n) return 0;
    int res = 1;
    res = fact[n];
    res = res*ifact[n-r];
    res %= mod;
    res = res*ifact[r];
    res %= mod;
    return res;
}

void solve(){
    int i,j,l;
    int n,k,m;
    cin>>n>>k;
    vector<int> a;
    for(i=0;i<n;i++){
        int x; cin>>x;
        a.pb(x);
    }
    sort(all(a));
    int ans = 0;
    for(i=0;i<n;i++){
        if(n-i-1 >= k-1){
            ans = ans + ((-1LL*a[i])*ncr(n-i-1,k-1))%mod;
            ans %= mod;
            if(ans < 0) ans += mod;
        }
        if(i >= k-1){
            ans = ans + (a[i]*ncr(i , k-1))%mod;
            ans %= mod;
            if(ans < 0) ans += mod;
        }
    }

    cout<<ans<<endl;
}

int32_t main(){
    IOS;
    int t;
    t = 1;  
    pre();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Measured memory_bytes: 4600
import sys
import numpy as np
# from numba import njit#,i8

#@njit(cache=True)
# @jit(返り値の型(引数1の型,引数2の型,．．．,引数nの型))
#@jit(i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:]))
def main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray):

	def add(itemCount, items, i, value):
		while i <= itemCount:
			items[i] += value
			i += (i & (-i))

	def sumFromStart(items, end):
		summary = 0
		i = end
		while i > 0:
			summary += items[i]
			i -= (i & (-i))
		return summary

	def sum(items, start,end):
		summary = sumFromStart(items, end) - sumFromStart(items, start-1)
		return summary

	# 答え配列
	ans=np.zeros(Q, dtype=np.int64)
	#ans=[0]*Q
	# 左からBITと現在色の更新をしながら、クエリのrightに到達したときにBITにクエリ発行する
	qindex = 0

	for n in range(N):
		# 外側のループでは、全部の色をループ

		if Q <= qindex:
			break

		if 0 < mostRightColorIndex[C[n]]:
			# ループ中の場所の色のindexが既にある場合(=過去に、同じ色が登録されていた場合)
			# 今回で、同じ色の一番右側の要素はループ中の要素になる
			# 前登録したこの色の一番右のindexを一度BITから抜く(↓で再度登録される)
			add(N,bitArray,mostRightColorIndex[C[n]], -1 )

		# この要素の色の一番右のindexを、BITに登録
		mostRightColorIndex[C[n]] = n+1
		add(N,bitArray,n+1, 1)

		# while qindex < Q and n+1 == queries[qindex][2]:
		while qindex < Q and n+1 == queries[orderByR[qindex]][1]:
			# 今のBITが次のクエリ発行するための状態(n==query.right)だったら、クエリ発行
			tmpIndex = orderByR[qindex]
			start = queries[tmpIndex][0]
			end = queries[tmpIndex][1]
			ans[tmpIndex]=sum(bitArray,start,end)
			# print(tmpIndex,start,end,ans[tmpIndex])
			qindex += 1

	return ans

if sys.argv[-1]=='ONLINE_JUDGE':
	from numba import njit
	from numba.pycc import CC
	cc=CC('my_module')
	cc.export('main','i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])')(main)
	main=njit(main, cache=True)
	cc.compile()
	exit(0)
from my_module import main
#from numba import njit
#main=njit('i8[:](i8,i8,i8[:],i8[:,:],i8[:],i8[:],i8[:])', cache=True)(main)



def input(): return sys.stdin.readline()

N,Q = map(int,input().split())

C=np.array(input().split(), int)

# Query取得-rightでソート
# dtypeQuery = [("index", int), ("start", int), ("end", int)]
queries=np.empty((Q,2),int)
# #rights=[[] for _ in range(N+1)]

for q in range(Q):
	l,r=map(int,input().split())
	#queries[q] = (q,l,r)
	queries[q][0] = l
	queries[q][1] = r
	#queries=np.sort(queries,order="end")

#queries=np.array(sys.stdin.buffer.read().split(),int).reshape(Q,2)

orderByR=np.argsort(queries[:,1])

# 各色の現在の一番右のindex
mostRightColorIndex = np.zeros(N+1, int)
# bit indexed tree
bitArray=np.zeros(N+1,int)

for a in main(N,Q,C,queries,orderByR,mostRightColorIndex,bitArray):
	print(a)


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

/*
int main() {
    int a;
    string s;
    std::cin >> a >> s;
    if(a<3200){
        std::cout << "red" <<std::endl;
    }
    else{
        std::cout << s << std::endl;
    }
    return 0;
}
 */

int main(){
    int N;
    std::cin >> N;
    long double A[N];
    long double A_sum = 0;
    long double A_prod = 1;
    long double ans;
    for(int i=0; i<N; i++){
        std::cin >> A[i];
    }
    for(int i=0; i<N; i++){
        A_prod *= A[i];
    }
    for(int i=0; i<N; i++){
        A_sum += (A_prod/A[i]);
    }
    ans = A_prod/ A_sum;
    std::cout << ans << std::endl;
    return 0;

}

Measured memory_bytes: 256
n, ab, ans = int(input()), [], 0
for i in range(n):
    ab.append(list(map(int, input().split())))
for i in range(n-1, -1, -1):
    x = (ab[i][0] + ans) % ab[i][1]
    if(x):
        ans += ab[i][1] - x
print(ans)

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

int main()
{
    long long n, k;
    cin >> n >> k;
    long long h[n];
    for (int i = 0; i < n; i++) cin >> h[i];
    sort(h, h + n);

    long long at = 0;
    for (int i = 0; i < n - k; i++) {
        at += h[i];
    }

    cout << at << "\n";
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
vll d(100),f(100);
ll t=0;
void dfs(vvll g,vb &v,ll x){
  v[x]=true;
  d[x]=++t;
  
  rep(i,0,g[x].size()){
    if(!v[g[x][i]]){
      dfs(g,v,g[x][i]);
    }
  }
  f[x]=++t;
  
}
int main(){
  ll n;cin>>n;
  vvll g(n,vll(0));
  vb visited(n,false);
  rep(i,0,n){
    ll m,k;cin>>m>>k;
    m--;
    rep(j,0,k){
      ll x;cin>>x;
      g[m].push_back(--x);
    }
  }
  rep(i,0,n){
    if(!visited[i]){
      dfs(g,visited,i);
    }
  }
  
  rep(i,0,n){
    cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;
  }
}




Measured memory_bytes: 3820
k,n=map(int,input().split())
l=list(map(int,input().split()))
l.append(k+l[0])
ans_lst=[]
ans=0
for i in range(n):
    ans_lst.append(l[i+1]-l[i])
#print(l)
#print(ans_lst)
ans=sum(ans_lst)-max(ans_lst)
print(ans)

Measured memory_bytes: 26436
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll mod = 998244353;
double pi = 3.14159265358979;

ll r(ll x, ll y) {
  if (y == 0) return 1;
  else if (y % 2 == 0) return r(x, y/2) * r(x, y/2) % mod;
  else return x * r(x, (y-1)/2) % mod * r(x, (y-1)/2) % mod;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vector<vector<ll>> ki(n, vector<ll>(0));
  for (int i = 0; i < m; i++) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    ki[a].push_back(b);
    ki[b].push_back(a);
  }
  vector<bool> f(n, 0);
  vector<ll> me(n, 0);
  queue<ll> q;
  q.push(0);
  int i = 0;
  while (!q.empty()) {
    for (int x : ki[i]) {
      if (!f[x]) {
        q.push(x);
        f[x] = 1;
        me[x] = i;
      }
    }
    q.pop();
    i = q.front();
  }
  cout << "Yes" <<endl;
  for (int i = 1; i < n; i++) {
    cout << me[i]+1 <<endl;
  }
}

Measured memory_bytes: 12944
#include<map>
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<string>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
  
  int n,m;
  long int k;
  cin>>n>>m>>k;
  vector<int64_t> a(n+1,0),b(m+1,0);
  for(int i=1;i<n+1;++i){
    cin>>a[i];
    a[i]+=a[i-1];
  }
  for(int i=1;i<m+1;++i){
    cin>>b[i];
    b[i]+=b[i-1];
  }
  int ans=0,j=m;
  for(int i=0;i<n+1;++i){
    if(a[i]>k)
      break;
    while(b[j]>k-a[i])
          --j;
    ans=max(ans,i+j);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6268
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];


int main () {
    int N;
    cin >> N;
    cout << (N+1)/2 << endl; 





}

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

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

	long long int h = 0;
	long long int ans = 0;
	for (int i = 0; i < n; i++) {
		if (h > a[i]) {
			ans+= h - a[i] ;
		}
		else h = a[i];
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4048
a,b,c,d = map(int,input().split())
if c >= a:
    if c >= b:
        print(0)
    elif d <= b:
        print(d-c)
    else:
        print(b-c)
else:
    if a >= d:
        print(0)
    elif b <= d:
        print(b-a)
    else:
        print(d-a)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int f(int n) {
    int t = (n + 1) / 2;
    if ((n + 1) % 2) {
        return (t % 2) ^ n;
    } else {
        return t % 2;
    }
}
signed main() {
    int A, B;
    cin >> A >> B;
    int ans = f(B);
    if (A > 0) ans ^= f(A - 1);
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 256
#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;
}

ll mod = 1000000007;

signed main()
{
    int a, b, x;
    cin >> a >> b >> x;
    double ratio = 1.0 * x / a / a / b;
    if (ratio > 0.5)
    {
        double ans = atan(2.0 / a / a / a * (a * a * b - x)) * 180.0 / 3.14159265358979;
        printf("%.10f\n", ans);
    }
    else
    {
        double ans = atan(1.0 / (2.0 * x / b / b / a)) * 180.0 / 3.14159265358979;
        printf("%.10f\n", ans);
    }
    return 0;
}

Measured memory_bytes: 4020
/**
 * Created by hiramekun at 19:23 on 2019-10-17.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

struct edge {
    ll from, to, cost;

    edge(ll from, ll to, ll cost) : from(from), to(to), cost(cost) {};
};

class WarshallFloyd {
public:
    int V; // 頂点数
    int E; // 辺の数
    vector<vector<ll> > d; // 最短頂点間距離
    vector<edge> es;

    WarshallFloyd() = default;

    WarshallFloyd(int v) {
        V = v;
        d.resize(v);
        rep(i, v) d[i].resize(v);
        rep(i, v)rep(j, v)d[i][j] = inf;
        rep(i, v) d[i][i] = 0;
    };

    void add(int u, int v, int cost) {
        d[u][v] = cost;
        if (u > v) es.eb(edge(u, v, cost));
    }

    // v: 頂点数, d: 頂点間距離
    void solve() {
        rep(k, V)rep(i, V)rep(j, V) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }

    ll calc() {
        ll ans = 0;
        vector<vector<bool>> notplus(V, vector<bool>(V));
        rep(k, V) rep(i, V) rep(j, V) {
                    if (i == k || k == j) continue;
                    if (d[i][j] == d[i][k] + d[k][j]) {
                        notplus[i][j] = true;
                    }
                }
        rep(i, V) rep(j, V) {
                if (j > i && !notplus[i][j]) ans += d[i][j];
            }
        return ans;
    }
};


void solve() {
    ll n;
    cin >> n;
    WarshallFloyd graph(n);
    vvl a(n, vl(n));
    rep(i, n) {
        rep(j, n) {
            ll tmp;
            cin >> tmp;
            graph.add(i, j, tmp);
            a[i][j] = tmp;
        }
    }
    graph.solve();
    vvl d = graph.d;
    rep(i, n) {
        rep(j, n) {
            if (d[i][j] != a[i][j]) {
                cout << -1 << '\n';
                return;
            }
        }
    }

    cout << graph.calc() << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3444
ABC = map(int, raw_input().split())
max_num = max(ABC)
res = 0
rest = 0
for v in ABC:
    res += (max_num - v) / 2
    rest += (max_num - v) % 2
sum_num = max_num * 3 - rest
while sum_num % 3 != 0:
    sum_num += 2
    res += 1
print res



Measured memory_bytes: 6400
a,b,k = (int(i) for i in input().split())
x,y = set(),[]
for i in range(a,min(b+1,a+k)):
	x.add(i)
for i in range(b,max(a-1,b-k),-1):
	x.add(i)
for i in x:
	y.append(i)
y.sort()
for i in y:
	print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    map<ll,ll> b;
    ll tmp = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        b[a[i]]++;
        tmp = max(tmp,a[i]);
    }
    ll ans = max(b[0] + b[1] , b[tmp] + b[tmp - 1]);
    for(ll i = 2; i < tmp; i++){
        ans = max(b[i - 1] + b[i] + b[i + 1], ans);
    }
    cout << ans << endl;
}

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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
# define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
#endif
	int n; cin>>n;
	map<string,int> mp;
	string s;
	vector<string> v;
	int maxi=-1;
	for(int i=0;i<n;i++){
		cin>>s;
		mp[s]++;
	}
	for(auto x: mp)
		maxi=max(maxi,x.second);
	for(auto x: mp){
		if(x.second==maxi)
			v.push_back(x.first);
	}
	sort(v.begin(),v.end());
	for(string ss: v){
		cout<<ss<<endl;
	}
	return 0;
}

Measured memory_bytes: 25584
let diff s t =
  let n = String.length s in
  let rec iter i res =
    if i = n
    then res
    else
      if s.[i] = t.[i]
      then iter (i+1) res
      else iter (i+1) (res+1)
  in iter 0 0

let () = Scanf.scanf "%s %s" @@ fun s t -> Printf.printf "%d\n" @@ diff s t

Measured memory_bytes: 4688
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author noob_coder
 */
public class Main {
        public static void main(String[] args) {
                InputStream inputStream = System.in;
                OutputStream outputStream = System.out;
                InputReader in = new InputReader(inputStream);
                PrintWriter out = new PrintWriter(outputStream);
                TaskC solver = new TaskC();
                solver.solve(1, in, out);
                out.close();
        }

        static class TaskC {
                public void solve(int testNumber, InputReader in, PrintWriter out) {
                        int n = in.i();
                        int[] a = new int[n + 2];
                        for (int i = 1; i <= n; i++) a[i] = in.i();
                        int sum = 0;
                        for (int i = 1; i <= n + 1; i++) sum += Math.abs(a[i] - a[i - 1]);
                        for (int i = 1; i <= n; i++) {
                                out.println(sum - Math.abs(a[i] - a[i - 1]) - Math.abs(a[i + 1] - a[i]) + Math.abs(a[i + 1] - a[i - 1]));
                        }

                }

        }

        static class InputReader {
                InputStream is;
                private byte[] inbuf = new byte[1024];
                public int lenbuf = 0;
                public int ptrbuf = 0;

                public InputReader(InputStream is) {
                        this.is = is;
                }

                private int readByte() {
                        if (lenbuf == -1) throw new InputMismatchException();
                        if (ptrbuf >= lenbuf) {
                                ptrbuf = 0;
                                try {
                                        lenbuf = is.read(inbuf);
                                } catch (IOException e) {
                                        throw new InputMismatchException();
                                }
                                if (lenbuf <= 0) return -1;
                        }
                        return inbuf[ptrbuf++];
                }

                public int i() {
                        int num = 0, b;
                        boolean minus = false;
                        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
                        if (b == '-') {
                                minus = true;
                                b = readByte();
                        }

                        while (true) {
                                if (b >= '0' && b <= '9') {
                                        num = num * 10 + (b - '0');
                                } else {
                                        return minus ? -num : num;
                                }
                                b = readByte();
                        }
                }

        }
}



Measured memory_bytes: 31056
#include<iostream>
#include<vector>
using namespace std;
const long mod=1e9+7;
long dp[202][202][202];
int N;
vector<int>G[200];
int deg[202];
long dq[202][202];
bool vis[202];
int dfs(int u)
{
	long now[202]={};
	now[0]=1;
	int ch=0;
	vis[u]=true;
	for(int v:G[u])
	{
		int k=dfs(v);
		for(int i=ch;i>=0;i--)
		{
			long tmp=now[i];
			now[i]=0;
			for(int j=0;j<=k;j++)for(int p=i;p<=i+j;p++)
			{
				(now[p]+=tmp*dq[v][j]%mod*dp[i][j][p])%=mod;
			}
		}
		ch+=k;
	}
	ch++;
	for(int i=0;i<ch;i++)dq[u][i+1]=now[i];
	return ch;
}
main()
{
	cin>>N;
	dp[0][0][0]=1;
	for(int i=0;i<=N;i++)for(int j=0;i+j<=N;j++)for(int k=0;k<=i+j;k++)
	{
		(dp[i+1][j][k+1]+=dp[i][j][k])%=mod;
		(dp[i][j+1][k+1]+=dp[i][j][k])%=mod;
		(dp[i+1][j+1][k+1]+=dp[i][j][k])%=mod;
	}
	for(int i=1;i<N;i++)
	{
		int u,v;cin>>u>>v;
		G[u].push_back(v);
		deg[v]++;
	}
	long ans[202]={};
	ans[0]=1;
	int ch=0;
	for(int u=0;u<N;u++)if(!vis[u]&&deg[u]==0)
	{
		int k=dfs(u);
		for(int i=ch;i>=0;i--)
		{
			long tmp=ans[i];
			ans[i]=0;
			for(int j=0;j<=k;j++)for(int p=i;p<=i+j;p++)
			{
				(ans[p]+=tmp*dq[u][j]%mod*dp[i][j][p])%=mod;
			}
		}
		ch+=k;
	}
	long sum=0;
	for(int i=0;i<=N;i++)sum+=ans[i];
	cout<<sum%mod<<endl;
}



Measured memory_bytes: 36960