akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//詳細:https://drken1215.hatenablog.com/entry/2018/06/08/210000
const int MAX = 5100000;
const int MOD = 1000000007;
vector<ll>fac(MAX);
vector<ll>finv(MAX);
vector<ll>inv(MAX);
// テーブルを作る前処理
void COMinit() {
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i = 2; i < MAX; i++) {
		fac.at(i) = fac.at(i - 1) * i % MOD;
		inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
		finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
	}
}
// 二項係数計算
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac.at(n) * (finv.at(k) * finv.at(n - k) % MOD) % MOD;
}

int main() {
	COMinit();
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		ll ans = COM(k - 1, i - 1) * COM(n - k + 1, i);
		ans %= MOD;
		cout << ans << endl;
	}
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N,T; cin >> N >> T;
    int ans = INT_INF;
    REP(i,N){
        int c,t; cin >> c >> t;
        if(t <= T) chmin(ans, c);
    }
    cout << (ans==INT_INF ? "TLE" : toString(ans)) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		
		int x,y;
		List<Integer> list = new ArrayList<Integer>();
		
		boolean flg1,flg2;
		flg1 =false;
		flg2 = false;
		
		//??????0??§????????????
		while(true){
			x = scan.nextInt();
			y = scan.nextInt();
			//x???0?????´??????true?????????
			if (x == 0){flg1= true;}
			//y???0?????´??????true?????????
			if (y == 0){flg2 = true;}
			//x??¨y???0?????´????????????????????????
			if ((flg1 == true) & (flg2 == true)){break;}
			
			//????????????????????????????????????????????????????????????
			list.add(x);
			list.add(y);
			
			Collections.sort(list);
			
			sb.append(list.get(0));
			sb.append(" ");
			sb.append(list.get(1));
			sb.append("\n");
			
			//???????????????????????????
			list.clear();
			
			//x??¨y????????????????????????0?????´????????????????¶??¶????????????????flg???false?????????
			flg1 = false;
			flg2 = false;
			
		}
		
		System.out.print(new String(sb));
		
		
	}
}

Measured memory_bytes: 36148
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
l = P[:X] + Q[:Y] + R
l.sort(reverse=True)
print(sum(l[:(X+Y)]))



Measured memory_bytes: 100904
n=int(input())
b=[0]*3;s=o=0
while n:
    e=input()
    if len(e)>3:s+=sum(b)+1;b=[0]*3
    elif e[0]=='H':
        if b.pop():s+=1
        b=[1]+b
    else:
        o+=1
        if o==3:n-=1;b=[0]*3;print(s);o=s=0

Measured memory_bytes: 7564
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
//  char *buf=(char*)malloc(sizeof(char) * 20000);
char buf[100100];

scanf("%[^\n]", buf);
char* cur = buf;
int length = strlen(buf);

char l1[] = "dream";
char l2[] = "dreamer";
char l3[] = "erase";
char l4[] = "eraser";
int a1 = 5;
int a2 = 7;
int a3 = 5;
int a4 = 6;

while (length > 0) {
  if (strstr(cur, l4) == cur) {
    length -= a4;
    if (length <= 0) {
      break;
    }
    cur = cur + a4;
  } else if (strstr(cur, l3) == cur) {
    length -= a3;
    if (length <= 0) {
      break;
    }
    cur = cur + a3;
  } else if (strstr(cur, "dreamerase") == cur) {
    length -= a1;
    if (length <= 0) {
      break;
    }
    cur = cur + a1;
  } else if (strstr(cur, l2) == cur) {
    length -= a2;
    if (length <= 0) {
      break;
    }
    cur = cur + a2;
  } else if (strstr(cur, l1) == cur) {
    length -= a1;
    if (length <= 0) {
      break;
    }
    cur = cur + a1;
  } else {
    break;
  }
  }

  if (length == 0) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [10000] * n
dp[0] = 0
for i in range(1, n):
    s = max(i-k,0)
    dp[i] = min([(_dp + abs(h[i] - _h)) for _dp,_h in zip(dp[s:i],h[s:i])])
print(dp[n - 1])

Measured memory_bytes: 13928
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fst first
#define snd second
typedef long long ll;
inline void Fail(){printf("0");exit(0);}

const int maxn=1005;
const int mod=1e9+7;
inline int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
inline int mult(int x,int y){return 1LL*x*y%mod;}
int n,a,b,c,d;
int inv[maxn],g[maxn][maxn],ways[maxn][maxn];

class segtree{
public:
	int t[maxn*4],leaf[maxn];
	void build(int v,int l,int r){
		if(l==r){
			leaf[l]=v;
			return;
		}
		int mid=(l+r)>>1;
		build(v<<1,l,mid);
		build(v<<1|1,mid+1,r);
	}
	void update(int v,int l,int r,int vl,int vr,int val){
		if(l>vr||r<vl)return;
		if(l>=vl&&r<=vr){
//			cout<<l<<" "<<r<<" "<<val<<endl;
			t[v]=add(t[v],val);
			return;
		}
		int mid=(l+r)>>1;
		update(v<<1,l,mid,vl,vr,val);
		update(v<<1|1,mid+1,r,vl,vr,val);
	}
	int query(int v){
//		cout<<v<<" "<<leaf[v]<<endl;
		v=leaf[v];int res=0;
		for(;v;v>>=1)res=add(res,t[v]);
		return res;
	}
}T[maxn];
 
int main(){
	rep(i,1001)g[i][0]=1;
	REP(i,1000)REP(j,1000)g[i][j]=add(g[i-1][j],g[i-1][j-1]);
	inv[1]=1;
	for(int i=2;i<=1000;i++)inv[i]=(mod-mult(mod/i,inv[mod%i])+mod)%mod;
	for(int i=2;i<=1000;i++)inv[i]=mult(inv[i-1],inv[i]);
	scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
	REP(i,n)REP(j,i)if(i%j==0){
		int res=1,cur=i;
		while(cur){
			res=mult(res,g[cur][j]);
			cur-=j;
		}
		ways[i][j]=mult(res,inv[i/j]);
//		cout<<i<<" "<<j<<" "<<ways[i][j]<<endl;
	}
	rep(i,n+1)T[i].build(1,a,b+1);
	T[0].update(1,a,b,a,b+1,1);
	rep(i,n)for(int j=a;j<=b;j++){
		int cur=T[i].query(j);
//		cout<<i<<" "<<j<<" "<<cur<<endl;
		for(int k=c;k<=d;k++){
			if(k*j>n-i)break;
			T[i+k*j].update(1,a,b+1,j+1,b+1,mult(g[n-i][k*j],mult(cur,ways[k*j][j])));
//			if(i+k*j==n)cout<<mult(g[n-i][k*j],mult(cur,ways[k*j][j]))<<endl;
		}
	}
	int ans=0;
	ans=add(ans,T[n].query(b+1));
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 27008
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string>
#include <cmath>
using namespace std;
const long double PI=3.14159265358979323846;

int main(){
    long double A,B,H,M;
    cin >> A >> B >> H >> M;
    long double radA,radB,rad,a,b;
    a=H*2*PI/12;
    b=(2*PI/12)*M/60;
    radA = H*2*PI/12+(2*PI/12)*M/60;
    radB = M*2*PI/60;
    if(radA>=radB){
        rad=min(radA-radB,2*PI-(radA-radB));
    }else{
        rad=min(radB-radA,2*PI-(radB-radA));
    }

    long double ans2 = A*A + B*B - 2*A*B*cos(rad);
    long double ans = sqrtl(ans2);
    printf("%.10Lf\n",ans);
    return 0;
} 



Measured memory_bytes: 4156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

struct LowestCommonAncestor {
    int n, sn;
    vector<int> id, vs, depth;
    vector<pair<int, int>> node;
    LowestCommonAncestor(vector<vector<int>> g)
        : n(sz(g)), id(n), vs(n * 2 - 1), depth(n * 2 - 1) {
        int k = 0;
        dfs(0, -1, 0, k, g);
        sn = 1;
        while (sn < sz(depth)) {
            sn *= 2;
        }
        node.assign(2 * sn - 1, make_pair(INF, INF));
        for (int i = 0; i < sz(depth); i++) {
            node[sn + i - 1] = make_pair(depth[i], i);
        }
        for (int i = sn - 1; i >= 1; i--) {
            node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
        }
    }
    void dfs(int now, int pre, int dep, int &k, const vector<vector<int>> &g) {
        id[now] = k;
        vs[k] = now;
        depth[k++] = dep;
        for (int nxt : g[now]) {
            if (nxt == pre) continue;
            dfs(nxt, now, dep + 1, k, g);
            vs[k] = now;
            depth[k++] = dep;
        }
    }
    pair<int, int> query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = sn;
        if (r <= a || b <= l) return make_pair(INF, INF);
        if (a <= l && r <= b) return node[k];
        auto vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        auto vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
    int get(int u, int v) {
        int l = min(id[u], id[v]);
        int r = max(id[u], id[v]) + 1;
        return vs[query(l, r).second];
    }
};

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    rep(i, n) {
        int k;
        cin >> k;
        while (k--) {
            int c;
            cin >> c;
            g[i].push_back(c);
            g[c].push_back(i);
        }
    }
    LowestCommonAncestor lca(g);

    int q;
    cin >> q;
    while (q--) {
        int u, v;
        cin >> u >> v;
        cout << lca.get(u, v) << endl;
    }
}


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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);

	string s, t; cin >> s >> t;
	int n = s.size(), m = t.size();
	vector<vector<int>> dp(n, vector<int>(m));
	vector<vector<int>> parent(n, vector<int>(m));
	dp[0][0] = (s[0] == t[0] ? 1 : 0);
	if (dp[0][0] == 1) {
		parent[0][0] = 1;
	}
	for (int i = 1; i < n; ++i) {
		if (s[i] == t[0]) {
			dp[i][0] = 1;
			parent[i][0] = 1;
		} else if (dp[i - 1][0] == 1) {
			dp[i][0] = 1;
			parent[i][0] = 3;
		}
	}
	for (int i = 1; i < m; ++i) {
		if (s[0] == t[i]) {
			dp[0][i] = 1;
			parent[0][i] = 1;
		} else if (dp[0][i - 1] == 1) {
			dp[0][i] = 1;
			parent[0][i] = 2;
		}
	}
	for (int i = 1; i < n; ++i) {
		for (int j = 1; j < m; ++j) {
			if (s[i] == t[j]) {
				dp[i][j] = 1 + dp[i - 1][j - 1];
				parent[i][j] = 1;
			} else {
				if (dp[i - 1][j] > dp[i][j - 1]) {
					dp[i][j] = dp[i - 1][j];
					parent[i][j] = 3;
				} else {
					dp[i][j] = dp[i][j - 1];
					parent[i][j] = 2;
				}
			}
		}
	}
	int i = n - 1, j = m - 1;
	deque<char> lcs;
	while (i >= 0 && j >= 0 && parent[i][j] != 0) {
		if (parent[i][j] == 1) {
			lcs.push_front(s[i]);
			--i; --j;
		} else if (parent[i][j] == 2) {
			--j;
		} else {
			--i;
		}
	}
	while (!lcs.empty()) {
		cout << lcs.front();
		lcs.pop_front();
	}
	cout << endl;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 200011;
const ll INF = 5e16;

namespace IO {

    inline char gc() {
        static char buf[100000], *p1 = buf, *p2 = buf;
        return (p1 == p2) && (p2 = (p1 = buf) +
            fread(buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
    }

    #define dd ch = getchar()
    inline ll read() {
        R ll x = 0; R int f = 0; R char dd;
        for (; !isdigit(ch); dd) f ^= (ch == '-');
        for (; isdigit(ch); dd)  x = x * 10 + (ch ^ 48);
        return f? -x: x;
    }
    #undef dd

    inline void write ( ll x ) {
        if (x < 0) x = -x, putchar('-');
        if (x > 9) write(x / 10); putchar(x % 10 | 48);
    }

    inline void wrn ( ll x ) { write(x), putchar(' '); }

    inline void wln ( ll x ) { write(x), putchar('\n'); }

    inline void wlnn ( ll x, ll y ) { wrn(x), wln(y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	/*
		尽量输出 NO .
		 
		必败态是： 
		1. 只剩下一个敌人。
		2. 只剩下一堆，且一堆中敌人数量为偶数。 
		3. 每堆只有一个人，且堆数是偶数。

		2, 3 都可以转移到 1
		什么可以转移到 2, 3 ?
		
		你肯定想最终你操作完为情况 2 ，你的 
		队友不想就这么 gg ，所以肯定会阻止 
		你的操作，即你取到最后两堆奇偶性相 
		同时，如果有奇他会留下奇数堆，如果 
		全部是偶数他就输了。 
		因为如果全都是偶数的话，不管他怎么 
		取，他削减我就取掉，他取掉他还是输。
		所以其实我只需要最后能留出两个偶数 
		堆我就赢了。 
		
		先转化到最接近边界的点，然后判断这个点的状态。 
		如果这个点无论向上还是向右其走道的状态注定是 
		必败状态，他就是必败的，反之必胜。  
	*/
	
	ll T, a[N];
	
	inline bool cmp ( ll a, ll b ) { return a > b; }
	
namespace Subtask {
	
	inline void Solve ( ll n ) {
		For ( i, 1, n ) if (i >= a[i + 1]) {
			ll x = 0;
			for (int j = i + 1; a[j] == i; ++j) x += a[j] == i;
			puts(!(a[i] - i & 1) && !(x & 1)? "Second": "First"); 
			return ;
		}
	}
	
}
	
	int main() {
		ll n = read();
		For ( i, 1, n ) a[i] = read();
		
		sort(a + 1, a + n + 1, cmp); 
		return Subtask :: Solve(n), 0;
	}
	
}

int main()
{
//	freopen("t1.in", "r", stdin);
//	freopen("t1.out", "w", stdout);

	return Cesare :: main();
}

/*
1
5
5 8 4 4 9 
*/







Measured memory_bytes: 1024
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

H,W = li()
h,w = li()
print(H*W - h*W - H*w + h*w)

Measured memory_bytes: 3064
#include<stdio.h>
 int n,A[20];
  
 int func(int,int );
 int main()
 {
   int m[200],q,i,result[200];

     scanf("%d",&n);
   for(i = 0 ; i < n ; i++)scanf("%d",&A[i]);
   
   scanf("%d",&q);
   for(i = 0 ; i<q; i++)scanf("%d",&m[i]);
   
   //printf("\n");
   for(i = 0 ; i<q ; i++)
     {
       result[i] = func(0,m[i]);
       if(result[i] == 0) printf("no\n");
       else printf("yes\n");
     }
 }


int func(int i, int m)
{
  //printf("i = %d , m = %d\n",i,m);
  if(m == 0) return 1;//mからAの要素を繰返し引いていき、mの値が0になったばあい、Aの要素を足し合せてmを作ることができるから1(true)を返す
  if( i  >= n) return 0;//再帰の回数がn回以上になったら、Aの要素を足し合せてmを作れないということなので0(false)を返す
  
  int result = func(i+1,m) || func(i+1,m-A[i]);//関数の戻値が0,1でも1,0でも1,1でも func(i+1,m) || func(i+1,m-A[i])の結果は1
  //これは、res = func(1+i,m) + func(i+1,m-A[i]) ,if(res == 2) res = 1 でも同じ。
  
  return result;
  

}



Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc079/tasks/abc079_c

string ABCD;
string OP;

static bool dfs(int sum, string op) {
    if (op.length() == 3) {
        OP = op;
        return sum == 7;
    }

    if (dfs(sum + (ABCD[op.length()+1]-'0'), op+"+")) return true;
    if (dfs(sum - (ABCD[op.length()+1]-'0'), op+"-")) return true;
    return false;
}

int main() {
    cin >> ABCD;
    if (dfs(ABCD[0] - '0', "")) {
        printf("%c%c%c%c%c%c%c=7\n", ABCD[0], OP[0], ABCD[1], OP[1], ABCD[2], OP[2], ABCD[3]);
    }

    return 0;
}

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

int main(){
	int N;
	cin >> N;
	int sum = 0;
	rep(i, N){
		int a, b;
		cin >> a >> b;
		sum += (b - a + 1);
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
import itertools
import sys
def main():
    n,k = map(int, input().split())
    ds =  list(map(int, input().split()))
    for i in range(n, 10**6):
        s = str(i)
        for d in ds:
            if str(d) in s:
                f = False
                break
            else:
                f = True
        if f:
            print(i)
            sys.exit()
if __name__ == "__main__":
    main()

Measured memory_bytes: 40816
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,-1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<int> cnt(N,0);
    for(int i=0; i<N*(N-1)/2; i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        a--;b--;
        if(c < d){
            cnt[b] += 3;
        }else if(c > d){
            cnt[a] += 3;
        }else{
            cnt[a]++;
            cnt[b]++;
        }
    }
    vector<P> suzu(N);
    for(int i=0; i<N; i++){
        suzu[i] = P(cnt[i],i);
    }
    sort(suzu.begin(),suzu.end(),greater<P>());
    vector<int> id(N);
    id[suzu[0].second] = 1;
    for(int i=1; i<N; i++){
        if(suzu[i].first == suzu[i-1].first){
            id[suzu[i].second] = id[suzu[i-1].second];
        }else{
            id[suzu[i].second] = i+1;
        }
    }
    for(int i=0; i<N; i++){
        cout << id[i] << enld;
    }
    return 0;
}


Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int N;
  cin>>N;
  set<int>k;
  for(int i=0;i<N;i++){
      int a;
      cin>>a;
      k.insert(a);
  }
  cout<<k.size()<<endl;
  return 0;  
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {    	
		int M1,D1,M2,D2;
    	cin >> M1 >> D1 >> M2 >>D2;
    	
    	if (M1 == M2){
    		cout << 0 << endl;
    	}
    	else {
    		cout << 1 << endl;
    	}
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int len,jcou=0,icou=0;
  string s1[1],s2[1];
  while(cin >> s1[0]){
    s2[0]=s1[0];
    jcou=0;
    icou=0;
    while(1){
      if(s1[0].find("JOI") == string::npos) break;
      if(s1[0].find("JOI") != string::npos){
	jcou++;
	len=s1[0].find("JOI");
	s1[0][len]='Q';
	s1[0][len+1]='Q';
	s1[0][len-1]='Q';
      }
    }
    s1[0]=s2[0];
    while(1){
      if(s1[0].find("IOI") == string::npos ) break;
      if(s1[0].find("IOI") != string::npos){
	icou++;
	len=s1[0].find("IOI");
	s1[0][len]='Q';
	s1[0][len-1]='Q';
	s1[0][len+1]='Q';
      }
    }
    cout << jcou << endl;
    cout << icou << endl;
  }
  return 0;
}

Measured memory_bytes: 3168
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int n;
int num[100005];
int main()
{
  while(1){
  vector<P> vec;
  vec.resize(0);
  scanf("%d",&n);
  if(!n) break;
  for(int i=1;i<=n;i++)
    {
      scanf("%d",&num[i]);
    }
  int st=1;
  for(int i=1;i<n;i++)
    {
      if(num[i]!=num[i+1])
    {
      vec.push_back(make_pair(num[i],st));
      st=i+1;
    }
    }
  vec.push_back(make_pair(num[n],st));
  for(int i=0;i<vec.size();i++)
    {
      if(vec[i].second%2==0)
    {
      int w=i;
      while(w>0)
        {
          w--;
          if(vec[w].first!=vec[i].first)
	    {
          vec[w].first=1-vec[w].first;
	    }else
	    {
	      break;
	    }
        }
    }
    }
  int ans=0;
  for(int i=0;i<vec.size();i++)
    {
      if(vec[i].first==0)
    {
      if(i!=vec.size()-1)
        {
          ans+=(vec[i+1].second-vec[i].second);
        }
      else
        {
          ans+=(n+1-vec[i].second);
        }
    }
    }
  printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1932
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define endl "\n";
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;
int32_t main()
{
    IOS;
    int x,y;
    cin>>x>>y;
    for(int i=0;i<=100;i++)
    {
        for(int j=0;j<=100;j++)
        {
            if(i*4+j*2==y&&i+j==x)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    
}

Measured memory_bytes: 3664
while True:
    n, x = map(int, input().split())
    count = 0
    if n == 0 and x == 0:
        break
    else:
        for i in range(1,n):
            for j in range(i, n):
                if j <= i:
                    continue
                k=x-(i+j)
                if k>j and k<=n:
                    count+=1

        print(count)


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int m = cin.Int();
			Tuple<int, int, int>[] ipy = new Tuple<int, int, int>[m];
			for (int i = 0; i < m; i++) {
				ipy[i] = new Tuple<int, int, int>(i, cin.Int(), cin.Int());
			}

			var ipy2 = ipy.OrderBy(x => x.Item3).ToArray();
			int[] cnt = new int[n + 1];
			Tuple<int, string>[] numbers = new Tuple<int, string>[m];
			for (int i = 0; i < m; i++) {
				cnt[ipy2[i].Item2] += 1;
				string number = $"{ipy2[i].Item2.ToString("d6")}{cnt[ipy2[i].Item2].ToString("d6")}";
				numbers[i] = new Tuple<int, string>(ipy2[i].Item1, number);
			}

			var ans = numbers.OrderBy(x => x.Item1).ToArray();
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < m; i++) {
				sb.AppendLine(ans[i].Item2);
			}

			Console.WriteLine(sb.ToString());
		}	
	}

	public class Scanner
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private string[] buf_;
		private int index_;
		
		public Scanner()
		{
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = Console.ReadLine();
			while (st == "") {
				st = Console.ReadLine();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 45848
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

const mod = 998244353
const facNum = 300001
const INF = 2 << 31

func main() {
	sc := newScanner(os.Stdin)
	N := sc.i()

	ans := ""
	for N > 0 {
		N--
		s := 'a' + (N)%26
		ans = string(s) + ans
		N /= 26
	}
	fmt.Println(ans)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//------------------------------

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


Measured memory_bytes: 1776
#include<iostream>
#include<string>
using namespace std;
#define rep(a,b) for(int a=0;a<(b);a++)
int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;
	int r=0,g=0,b=0,exception=0;
	rep(i,N){
		if(S[i]=='R'){
			r++;
		}else if(S[i]=='G'){
			g++;
		}else if(S[i]=='B'){
			b++;
		}
	}
	for(int i=0;i<N-1;i++){
		for(int j=i+1;j<N;j++){
			if(S[i]!=S[j]){
				int cursor=j+j-i;
				if(cursor<N&&S[cursor]!=S[i]&&S[cursor]!=S[j]){
					exception++;
				}
			}
		}
	}
	cout <<(long long)r*g*b-exception << endl;
	return 0;
}


Measured memory_bytes: 3632
line1 = gets.split(' ')
line2 = gets.split(' ')

newline2 = line2.sort {|a, b| b.to_i <=> a.to_i } 
counter = 0
h = 0

while h <= line1[0].to_i - 2
  i = 1
  while i <= line1[0].to_i - 2
    j = 1
    while i + j <= line1[0].to_i - 1
      if newline2[h].to_i >= newline2[i].to_i + newline2[i+j].to_i || h > i || h > i+j
      else
        if newline2[h].to_i == newline2[i].to_i || newline2[h].to_i == newline2[i+j].to_i || newline2[i].to_i == newline2[i+j].to_i
        else
          counter += 1
        end
      end
      j += 1
    end
    i += 1
  end
  h += 1
end


p counter

Measured memory_bytes: 14308
#include <algorithm>
#include <array>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <set>
#include <string>
#include <utility>

using namespace std;

int main() {
  for (int i = 0; i < 5; i++) {
    int tmp;
    cin >> tmp;

    if (tmp == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }

  return 0;
}


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

int main(){
	int N, A, B, K, sum;
	int res = 0;
	cin >> N >> A >> B;
	
	for(int i = 1; i <= N; i++){
		K = i;
		sum = 0;
		while(true){
			sum += K % 10;
			K = K / 10; 
			if(K < 1) break;
		}
		if (sum >= A && sum <= B) res+=i;
	}
	cout << res << endl;
}


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

using namespace std;

char field[100][100];
int used[100][100];
char str;
int H, W;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
char fruit;
int ans = 0;

void dfs(int x, int y){
    used[y][x] = 1;
    for(int i=0; i<4; i++){
        int nx = x + dx[i], ny = y + dy[i];
        if(0<=nx && nx<W && 0<=ny && ny<H && used[ny][nx]==0 && fruit==field[ny][nx])
        dfs(nx, ny);
    }
}

int main(){
    while(1){
        ans = 0;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                used[i][j] = 0;
            }
        }
        
        cin >> H >> W;
        if(H==0 && W==0) break;
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                cin >> field[i][j];
            }
        }

        for(int y=0; y<H; y++){
            for(int x=0; x<W; x++){
                if(used[y][x]==0){
                    fruit = field[y][x];
                    dfs(x,y);
                    ans++;
                }
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


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

using namespace std;

int main() {

    int n;
    string w[40];
    int lens[] = {5, 7, 5, 7, 7};

    while(cin >> n, n) {

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

        for(int i = 0; i < n; ++i) {

            int len = 0, phrase = 0;

            for(int j = i; j < n; ++j) {

                len += w[j].size();

                if(len == lens[phrase]) {
                    len = 0;
                    ++phrase;
                    if(phrase == 5) {
                        cout << i + 1 << endl;
                        break;
                    }
                }
            }

            if(phrase == 5) {
                break;
            }

        }

    }

}

Measured memory_bytes: 1208
using System;
using System.Linq;
using System.Collections.Generic;

public class BinarySearch
{
    public static void Main()
    {
        Console.ReadLine();
        var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        Console.ReadLine();
        var t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    
//        "SearchWithHashSet".Measure(() => 
//        {
//            SearchWithHashSet(s, t);
//        });
//        "SearchWithBinarySearch".Measure(() => 
//        {
            SearchWithBinarySearch(s, t);
//        });
    }
    
    private static void SearchWithHashSet(int[] s, int[] t)
    {
//        ThreadPool.SetMinThreads(32, 32);
        var hashSet = new HashSet<int>(s);
        var c = t.Count(x => hashSet.Contains(x));
        Console.WriteLine(c);
    }
    
    private static void SearchWithBinarySearch(int[] s, int[] t)
    {
        var c = t.Count(x => BinarySearchCore(s, x) > 0);
        Console.WriteLine(c);
    }
    
    private static int BinarySearchCore(int[] s, int key)
    {
        var left = 0;
        var right = s.Count();
        
        while (left < right)
        {
            var mid = (left + right) / 2;
            if (s[mid] == key)
                return mid;
            if (key < s[mid])
                right = mid;
            else
                left = mid + 1;
        }
        
        return -1;
    }
    
}
// Define other methods and classes here

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

using ll = long long;

class Mod {
    private:
    int mod;

    public:
    Mod(int n) { mod = n; }

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

    ll mul(ll a, ll b) { return (a * b) % mod; }

    ll pow(ll a, ll n) {
        ll ret;
        if (n == 0)
            ret = 1;
        else if (n == 1)
            ret = a;
        else {
            ll sq = pow(a, n / 2);
            ret = mul(sq, sq);
            if (n % 2 != 0) ret = mul(ret, a);
        }
        return ret % mod;
    }

    ll div(ll a, ll b) { return mul(a, pow(b, mod - 2)); }
};

int n, k;
Mod mod(1e9 + 7);

int calc(int i) {
    if (n - k < i - 1) {
        return 0;
    } else {
        ll a = 1;
        for (int j = 1; j <= k - 1; ++j)
            a = mod.mul(a, j);
        for (int j = 1; j <= n - k + 1; ++j)
            a = mod.mul(a, j);

        ll b = 1;
        for (int j = 1; j <= k - i; ++j)
            b = mod.mul(b, j);
        for (int j = 1; j <= i - 1; ++j)
            b = mod.mul(b, j);
        for (int j = 1; j <= i; ++j)
            b = mod.mul(b, j);
        for (int j = 1; j <= n - k - i + 1; ++j)
            b = mod.mul(b, j);

        return mod.div(a, b);
    }
}

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

    cin >> n >> k;

    for (int i = 1; i <= k; ++i) {
        cout << calc(i) << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
#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;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 100'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  cin >> n;
  int ans = 0;
  for (int i = n; i; --i) {
    ans += to_string(i).size() & 1;
  }
  cout << ans << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


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

#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define Fin freopen("input.txt","r",stdin)
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define Fout freopen("output.txt","w",stdout)
#define rep(i,a,b) for(i=a;i<=b;i++)
#define EPS 0.00000001
#define INF INT_MAX
#define PI 2*acos(0.0)
#define P1(XX) cout<<"db1: "<<XX<<endl
#define P2(XX,YY) cout<<"db2: "<<XX<<" "<<YY<<endl
#define P3(XX,YY,ZZ) cout<<"db3: "<<XX<<" "<<YY<<" "<<ZZ<<endl
#define set(XX,POS) XX|=(1<<POS)
#define reset(XX,POS) XX&=(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define SORT(v) sort(v.begin(),v.end())
#define REVERSE(V) reverse(v.begin(),v.end())
#define VALID(X,Y,R,C) X>=0 && X<R && Y>=0 && Y<C
#define SIZE(ARRAY) sizeof(ARRAY)/sizeof(ARRAY[0])
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>


using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
typedef tree< pair<int,int> , null_type, less< pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> odrst;

#define MOD 1000000007LL
#define MX 200005


/*------------------------------Graph Moves----------------------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

ll m, n;
ll a[MX];
int main()
{
    int test, tc=0, i, j;
    ll b,k,ans=0;
    //scanf("%d", &test);
    test=1;
    while(test--)
    {
       cin>>n;
       stack<char>s;
       if(n==1){cout<<'a'<<endl; continue;}
       while(n)
       {
           b='a'+(n%26)-1;
           if(b=='a'-1)b='z';
            s.push(b);
            n=(n-1)/26;

       }
       while(!s.empty()){cout<<s.top();s.pop();}
       cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3628
<?php

while ($tmp = rtrim(fgets(STDIN)) and $tmp != "END_OF_TEXT") {
    $text[] = strtolower($tmp);
}

$search = array_shift($text);
$words = array();
foreach ($text as $line) {
    $words = array_merge($words, explode(" ", $line));
}

$words_count = array_count_values($words);
echo $words_count[$search] . PHP_EOL;


Measured memory_bytes: 9324
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  
  cout << B/100 - A/100 + (B/1000%10*10 + B/10000 <= B%100) - (A/1000%10*10 + A/10000 < A%100);
}

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d],
        t: [usize; d],
    }

    let mut last_d = vec![0; 26];

    let mut tdi = 0;
    for di in 0..d {
        last_d[t[di] - 1] = di + 1;
        tdi += s[di][t[di] - 1];
        for i in 0..26 {
            tdi -= c[i] * ((di + 1 - last_d[i]) as i64);
        }
        println!("{}", tdi);
    }
}


Measured memory_bytes: 2332
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;
  cin >> n;
  int m = (n+1)/2;
  double res = (double)m/n;
  printf("%.7f\n", res);
  return 0;
}


Measured memory_bytes: 256
#!/bin/usr/env python3

n,k = map(int,input().split())

s = input()

a = []
for i in s:
    a.append(i)

if a[k-1] =="A":
    a[k-1] = "a"

elif a[k-1] =="B":
    a[k-1] = "b"

elif a[k-1] =="C":
    a[k-1] = "c"

for i in range(len(a)):
    print(a[i], end = "")


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int h,w;
    cin >> h >> w;
    int n;
    cin >> n;
    int a[n];
    rep(i,n){
        cin >> a[i];
    }
    int ans[h][w];
    int cnt = 0;
    int jj = 0;
    int flag = 1;
    rep(i,h){
        while(jj>=0&&jj<w){
            if(a[cnt]==0) cnt++;
            ans[i][jj]=cnt+1;
            //cout << i << " " << jj << endl;
            a[cnt]--;
            jj+=flag;
        }
        flag*=(-1);
        if(jj==-1) jj=0;
        else jj = w-1;
    }
    rep(i,h){
        rep(j,w){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
    cout << endl;
}

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

int main(){

  int n;
  vector<int> v;
  int ans = INT_MIN;
  int small;

  cin >> n;

  for(int i = 0; i < n; i++){
    int j;

    cin >> j;
    v.push_back(j);
  }

  small = v[0];

  for(int i = 1; i < n; i++){
    small = min(small,v[i-1]);
    // int x = v[i] - min_element(v[0],v[i-1]);
    ans = max(ans,v[i]-small);
  }

  cout << ans << endl;


}

Measured memory_bytes: 2064
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <climits>

#define rep(i,n) for(int i=0; i<n; i++)

#define int long long

using namespace std;

int N, K, L;
int p, q;
int r, s;

int par1[200010];
int rank1[200010];

void init(int n) {
    for (int i=0; i<n; i++) {
        par1[i] = i;
        rank1[i] = 0;
    }
}

int find(int x) {
    if (par1[x] == x) {
        return x;
    } else {
        return par1[x] = find(par1[x]);
    }
}

void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rank1[x] < rank1[y]) {
        par1[x] = y;
    } else {
        par1[y] = x;
        if (rank1[x] == rank1[y]) rank1[x]++;
    }
}

bool same(int x, int y) {
    return find(x) == find(y);
}

int par2[200010];
int rank2[200010];

void init2(int n) {
    for (int i=0; i<n; i++) {
        par2[i] = i;
        rank2[i] = 0;
    }
}

int find2(int x) {
    if (par2[x] == x) {
        return x;
    } else {
        return par2[x] = find2(par2[x]);
    }
}

void unite2(int x, int y) {
    x = find2(x);
    y = find2(y);
    if (x == y) return;

    if (rank2[x] < rank2[y]) {
        par2[x] = y;
    } else {
        par2[y] = x;
        if (rank2[x] == rank2[y]) rank2[x]++;
    }
}

bool same2(int x, int y) {
    return find2(x) == find2(y);
}

map<pair<int, int>, int> cnt;

signed main()
{
#ifdef LOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    cin >> N >> K >> L;

    init(N);
    init2(N);

    rep(i,K) {
        cin >> p >> q;
        p--; q--;
        unite(p, q);
    }

    rep(i,L) {
        cin >> r >> s;
        r--; s--;
        unite2(r, s);
    }

    rep(i,N) {
        cnt[make_pair(find(par1[i]), find2(par2[i]))]++;
    }

    rep(i,N) {
        if (i == 0) {
            cout << cnt[make_pair(find(par1[i]), find2(par2[i]))];
        } else {
            cout << " " << cnt[make_pair(find(par1[i]), find2(par2[i]))];
        }
    }
    cout << endl;
}


Measured memory_bytes: 18176
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

void
solve() {
  ll n, k;
  cin>>n>>k;

  vector<ll> a(n+1, 0);
  vector<ll> index(n + 1, 0);
  for (int i=1; i<=n; i++) {
    cin>>a[i];
    index[i] = -1;
  }

  ll temp = k;
  ll now = 1;
  ll step = 0;
  bool good = false;
  while (1) {
    now = a[now];
    step++;
    temp--;

    if (index[now] == -1) 
      index[now] = step;
    else if (!good)
      temp %= (step - index[now]);
    else
      good = true;

    if (temp == 0) {
      cout<<now<<endl;
      break;
    }
  }
}

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

  int t = 1;
  //cin>>t;

  while (t > 0) {
    t--;
    solve();
  }

  return 0;
}



Measured memory_bytes: 6376
from collections import namedtuple, defaultdict
Point = namedtuple("Point", ["x", "y"])

def main():
    while True:
        n = input()
        if n == 0:
            break
        bldgs = {}
        for _ in xrange(n):
            b, x, y = map(int, raw_input().split())
            bldgs[b] = Point(x, y)
        graph = make_graph(bldgs)
        for _ in xrange(input()):
            sb, gb = map(int, raw_input().split())
            res = dijkstra(graph, sb, gb)
            if res is None:
                print "NA"
            else:
                print " ".join(map(str, res))
        
def make_graph(bldgs):
    graph = defaultdict(list)
    for b1, p1 in bldgs.items():
        for b2, p2 in bldgs.items():
            if b1 == b2:
                continue
            weight = (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
            if weight > 2500:
                continue
            graph[b1].append((weight**0.5, b2,))
    return graph

def dijkstra(graph, start, goal):
    import heapq
    hq = [(w, b, start) for w, b in graph[start]]
    heapq.heapify(hq)
    pre = dict((k, None) for k in graph.keys())
    while len(hq) > 0:
        w, cb, pb = heapq.heappop(hq)
        if pre[cb] is not None:
            continue
        pre[cb] = pb
        if cb == goal:
            break
        for nw, nb in graph[cb]:
            heapq.heappush(hq, (nw+w, nb, cb))
    else:
        return None
    ret = [goal]
    while ret[-1] != start:
        ret.append(pre[ret[-1]])    
    return list(reversed(ret))

if __name__ == "__main__":
    main()

Measured memory_bytes: 4840
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    char tbl[256];
    int n;
    char str[1024];
    
    while (1){
        
        for (n = 0; n < 256; n++){
            tbl[n] = n;
        }
        
        scanf("%[^\n]", str);
        n = atoi(str);
        getchar();
        
        if (n == 0){
            break;
        }
        
        while (n-- != 0){
            scanf("%[^\n]", str);
            getchar();
            tbl[str[0]] = str[2];
        }
        
        scanf("%[^\n]", str);
        n = atoi(str);
        getchar();
        
        while (n-- != 0){
            scanf("%[^\n]", str);
            getchar();
            printf("%c", tbl[str[0]]);
        }
        printf("\n");
        
    }
    
    return (0);
}

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

using namespace std;

int main() {
	int x, y;
	vector<int> X, Y;
	while (cin >> x >> y) {
		if (x == 0 && y == 0)break;
		if (x >= y) {
			Y.push_back(x);
			X.push_back(y);
		}
		else {
			X.push_back(x);
			Y.push_back(y);
		}
	}
	for (int i = 0; i < X.size(); i++) {
		cout << X[i] << " " << Y[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <cmath>
#include <limits.h>
#include <utility>
#include <map>
#include <algorithm>
#include <set>
using namespace std;
using P = pair<int,int>;
using ll = long long;
constexpr int MOD=998244353;
constexpr int MAX=510000;
int main(){
    char c;
    cin>>c;
    if(c<='Z')cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

Measured memory_bytes: 3620