akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iterator>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(v) begin(v), end(v)
#define rreps(i, a, n) for (ll i = (a); i <= (ll)(n); ++i)
#define rrep(i, n) rreps(i, 0, n)
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define each(i, n) for (auto&& i : n)
#define fill(x, y) memset(x,y,sizeof(x))
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
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 <typename T> inline void print(const T& x) {cout << x << '\n';}

signed main()
{ 
  int a, b; cin>>a>>b;
  print(max(a+b,max(a-b, a*b)));

  return 0;
}


Measured memory_bytes: 256
N, K = map(int,input().split())
from itertools import accumulate
p = list(map(lambda x:(int(x)+1)/2,input().split()))
S = sum(p[:K])
M = S
for i in range(N - K):
    S -= p[i]
    S += p[i + K]
    M = max(M,S)
print(M)






Measured memory_bytes: 72176
import numpy as np

H = int(input())

if H == 1:
  print("1")
else:
  c = 0
  h = H
  while(h>1):
    h //= 2
    c += 1
  
  p = 1
  q = 0
  for i in range(c+1):
    q += p
    p *= 2
  print(q)

Measured memory_bytes: 21404
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define num(a) a-'0'
#define maxself(a,b) if(b>a)a=b
#define minself(a,b) if(b<a)a=b;
#define debug(x) cout<<#x<<":"<<x<<" "
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define vl vector<long long int>
#define v vector
#define p pair
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define ln "\n"	
typedef long long int ll;
typedef long double ld;
typedef double d;
using namespace std;
ll modF=1e9+7;
ll INF=1e11;

void solve(){
	int n;
	cin>>n;
	vi a(n);
	rep(i,0,n){
		cin>>a[i];
	}
	sort(all(a));
	ld ans=a[0];
	rep(i,1,n){
		ans=(ans+a[i])/2;
	}
	cout<<ans<<ln;
}

int main(){
	boost_io;
	solve();
	return 0;
}

Measured memory_bytes: 3844
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a) memset((a),0,sizeof(a))
#define MCLR(a) memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


struct edge {
    LL to, cost;
    edge(LL _to, LL _cost) {to = _to; cost=_cost;}
};
typedef pair<LL, LL> P;

int f_cost[100000];
int s_cost[100000];
vector<VI> G;

int main(){
    int N;
    cin >> N;
    REP(i, N){
        VI x;
        G.PB(x);
    }

    REP(i, N-1){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].PB(b);
        G[b].PB(a);
    }

    f_cost[0] = 1;
    f_cost[N-1] = -1;
    s_cost[0] = -1;
    s_cost[N-1] = 1;

    VI f_move, s_move;
    f_move.PB(0);
    s_move.PB(N-1);
    while(!f_move.empty() || !s_move.empty()){
        VI f_next_move;
        REP(i, f_move.size()){
            REP(j, G[f_move[i]].size()){
                int idx = G[f_move[i]][j];
                if(f_cost[idx] != 0 || s_cost[idx] != 0){
                    continue;
                }
                f_cost[idx] = f_cost[f_move[i]] + 1;
                f_next_move.PB(idx);
            }
        }
        f_move = f_next_move;

        VI s_next_move;
        REP(i, s_move.size()){
            REP(j, G[s_move[i]].size()){
                int idx = G[s_move[i]][j];
                if(f_cost[idx] != 0 || s_cost[idx] != 0){
                    continue;
                }
                s_cost[idx] = s_cost[s_move[i]] + 1;
                s_next_move.PB(idx);
            }
        }
        s_move = s_next_move;
    }

    int f_cnt = 0;
    int s_cnt = 0;
    REP(i, N){
        if(s_cost[i] <= f_cost[i]) f_cnt++;
        if(f_cost[i] < s_cost[i]) s_cnt++;
    }
    cout << (f_cnt <= s_cnt ? "Snuke" : "Fennec") << endl;
}


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

#define ll long long

inline ll read() {
    ll x = 0, f = 1; char ch = getchar();
    for(; ch < '0' || ch>'9'; ch = getchar())
        if(ch == '-') f = -f;
    for(; ch >= '0' && ch <= '9'; ch = getchar())
        x = x * 10 + ch - '0';
    return x * f;
}

inline void chkmin( int &a, int b ) { if(a > b) a = b; }

inline void chkmax( int &a, int b ) { if(a < b) a = b; }

#define _ read()

#define ln endl

int main()
{
	int k = _;
	string s;
	cin>>s;
	int n = s.size();
	for( int i = 0; i < n; i++ ) 
		putchar((s[i] - 'A' + k) % 26 + 'A');
}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    vector<int> a(N);
    for ( int i=0; i<N; i++ ) {
        cin >> a.at(i);
    }

    deque<int> b;
    for ( int i=0; i<N; i++ ) {
        if ( i % 2 == 0 ) {
            b.push_back(a.at(i));
        }
        else {
            b.push_front(a.at(i));
        }
    }

    if ( N % 2 == 0 ) {
        for ( int i=0; i<N; i++ ) {
            cout << b.at(i);
            if ( i != N - 1 )
                cout << " ";
        }
    }
    else {
        for ( int i=N-1; i>=0; i-- ) {
            cout << b.at(i);
            if ( i != 0 )
                cout << " ";
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i=0; i<n; ++i)
#define all(obj) (obj).begin(),(obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x%y) : x; }

int main(){
    ll L, R;
    cin >> L >> R;
    ll ans = 2019;
    if(R-L+1>2019){
        cout << 0 << endl;
        return 0;
    }
    else{
        for(ll i=L; i<R; ++i){
            for(ll j=i+1; j<=R; ++j){
                ans = min(ans, (i*j)%2019);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long int ll;

int main()
{
    ll k, a, b, ans = 1;
    cin >> k >> a >> b;
    if(b - a <= 2){
        ans += k;
    }
    else{
        if(k < a){
            ans += k;
        }
        else{
            k -= a - 1;
            ans = a;
            ans += k / 2 * (b - a);
            ans += k % 2;
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

N,M = map(int,input().split())
L = [0]*M
R = [0]*M
#Li,Ri = map(int,input().split())

for i in range(1,M+1):
    L[i-1],R[i-1] = map(int,input().split())

validID = min(R)-max(L)+1

if (validID>0):
    print(validID)
else:
    print("0")
    

Measured memory_bytes: 11012
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef long long LL;
const int N  = 2e3+5;
const int INF = 0x3f3f3f3f;
const LL mod = 1e9+7;
typedef pair<int ,int >pii;
struct Edge{
  int v,next;
}edge[N<<1];
int head[N],tot,n,k;
void add(int u,int v){
  edge[tot].v=v;
  edge[tot].next=head[u];
  head[u]=tot++;
}
bool vis[N];
int d[N];
void bfs(int s,int f){
  queue<int>q;
  while(!q.empty())q.pop();
  d[s]=0;vis[s]=true;
  q.push(s);
  while(!q.empty()){
     int u=q.front();
     q.pop();
     for(int i = head[u];~i;i=edge[i].next){
      int v=edge[i].v;
      if(vis[v]||v==f)continue;
      d[v]=d[u]+1;
      vis[v]=true;
      q.push(v);
     }
  }
}
int solveodd(int u,int v){
   memset(d,INF,sizeof(d));
   memset(vis,0,sizeof(vis));
   bfs(u,v);bfs(v,u);
   int ret=0;
   for(int i=1;i<=n;++i)
    if(d[i]>k)++ret;
   return ret;
}
int solveeven(int u){
   memset(d,INF,sizeof(d));
   memset(vis,0,sizeof(vis));
   bfs(u,0);
   int ret=0;
   for(int i=1;i<=n;++i)
    if(d[i]>k)++ret;
   return ret;
}
int main(){
  scanf("%d%d",&n,&k);
  memset(head,-1,sizeof(head));
  for(int i=1;i<=n-1;++i){
    int u,v;
    scanf("%d%d",&u,&v);
    add(u,v);add(v,u);
  }
  int ret=INF;
  if(k&1){
    k>>=1;
    for(int i=0;i<tot;i+=2)
      ret=min(ret,solveodd(edge[i].v,edge[i+1].v));
  }{
    k>>=1;
    for(int i=1;i<=n;++i)
      ret=min(ret,solveeven(i));
  }
  printf("%d\n",ret);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define X first
#define Y second
using namespace std;
typedef long long ll;

const int MOD = 1e9 + 7;

int n;
string s;
int dp[100002][15];

int rek(int x, int r) {
	if (x == n) {
		if (r == 5) return 1;
		return 0;
	}
	
	int &ret = dp[x][r];
	if (ret != -1) return ret;
	ret = 0;
	
	if (s[x] == '?') {
		for (int i = 0; i < 10; i ++) {
			ret += rek(x+1, (r*10+i) % 13);
			ret %= MOD;
		}
	}
	else {
		ret = rek(x+1, (r*10+s[x]-'0') % 13);
	}
	
	return ret;
}

int main () {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> s;
	n = s.size();
	memset(dp, -1, sizeof dp);
	cout << rek(0, 0);

	return 0;
}

Measured memory_bytes: 12624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(), (c).end());
const long long MOD = 1e9 + 7;
typedef long long ll;

int main(){
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	string ans = "No War";
	vector<int> X_city(N + 1);
	vector<int> Y_city(M + 1);
	X_city[N] = X;
	Y_city[M] = Y;
	rep(i, N)cin >> X_city[i];
	rep(i, M)cin >> Y_city[i];
	SORT(X_city);
	SORT(Y_city);
	if(X_city[N] >= Y_city[0])ans = "War";
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

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

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, ll D, vector<ll> &d, ll Q, vector<ll> &q) {
  vector<ll> vec;
  vec.push_back(1);
  reverse(ALL(d));
  for (ll i: d) {
    ll t = vec.back();
    if (t * 2 <= i) vec.push_back(t);
    else vec.push_back(t + i);
  }
  reverse(ALL(d));
  reverse(ALL(vec));
  vector<int> res;
  ll rest = D;
  REP(i,N) {
    res.push_back(rest >= vec[i + 1]);
    rest = min(rest, abs(rest - d[i]));
  }
  for (ll i: q) {
    cout << bool(res[i - 1]) << endl;
  }
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll Q;
	ll D;
	ll N;
	scanf("%lld", &N);
	vector<ll> d(N-1+1);
	scanf("%lld", &D);
	for (int i = 0 ; i <= N-1 ; i++) {
	  scanf("%lld", &d[i]);
	}
	scanf("%lld", &Q);
	vector<ll> q(Q-1+1);
	for (int i = 0 ; i <= Q-1 ; i++) {
	  scanf("%lld", &q[i]);
	}
	solve(N, D, d, Q, q);
	return 0;
}


Measured memory_bytes: 18540
h,w=map(int,input().split())
cost=[]
ans=[0]*10
for _ in range(10):
	x=list(map(int,input().split()))
	cost.append(x)
for _ in range(h):
	x=list(map(int,input().split()))
	for j in range(10):
		ans[j]+=x.count(j)

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    n=10
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
p=0
for i in range(10):
	p+=ans[i]*warshall_floyd(cost)[i][1]
print(p)




Measured memory_bytes: 3064
# ABC122-C
N, Q = map(int, input().split())
S = input()
lr = [list(map(int, input().split())) for _ in range(Q)]
cnt_list = [0] * N
tmp = 0
for i in range(N-1):
    cnt_list[i] = tmp
    if S[i] == "A" and S[i+1] == "C":
        tmp += 1
cnt_list[N-1] = tmp
##print(cnt_list)
for i in range(Q):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    print(cnt_list[r] - cnt_list[l])

Measured memory_bytes: 30768
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion


//ABC  059-A 

int main(void) {
	char s[11],c;
	
	for (int i = 0; i < 3; i++){
		scanf("%s", s);
	    printf("%c",s[0]-32);
    }
	printf("\n");
	return 0;
	
}





Measured memory_bytes: 2032
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  

  string s;
  cin >> s;
  if(s=="ABC"){
    cout << "ARC" << endl;
  }
  else {
    cout << "ABC" << endl;
  }



return 0;
}
///....


Measured memory_bytes: 3584
<?php
  declare(strict_types=1);

  const MOD = 1e9 + 7;

  fscanf(STDIN, "%i", $n);
  $xs = explode(" ", trim(fgets(STDIN)));

  $bucket = [];
  foreach ($xs as $i => $x)
  {
      if (isset($bucket[$x]))
      {
          $dup_l = $bucket[$x];
          $dup_r = $i;
          break;
      }
      $bucket[$x] = $i;
  }
  
  $inverse = function($x)
  {
      $t = 1;
      $p = MOD - 2;
      while ($p > 0)
      {
          if ($p & 1)
          {
              $t = $t * $x % MOD;
          }

          $x = $x * $x % MOD;
          $p >>= 1;
      }
      return $t;
  };

  $frac = [0 => 1];
  for ($i = 0; $i < $n + 1; ++$i)
  {
      $frac[$i + 1] = $frac[$i] * ($i + 1) % MOD;
  }

  $combination = function($n, $r) use ($inverse, $frac)
  {
      if ($n < $r)
      {
          return 0;
      }
      
      return $frac[$n] * $inverse($frac[$r] * $frac[$n - $r] % MOD) % MOD;
  };

  $t = $dup_l + $n - $dup_r;
  for ($k = 1; $k <= $n + 1; ++$k)
  {
      echo ($combination($n + 1, $k) - $combination($t, $k - 1) + MOD) % MOD, PHP_EOL;
  }


Measured memory_bytes: 23028
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n,k;
    cin >> n >>k;
    vector<int>h(n);
    rep(i,n)cin >> h[i];
    sort(h.begin(),h.end());
    int ans = 1000000000;
    rep(i,n){
        if(i+k-1==n)break;
        ans = min(ans,h[i+k-1]-h[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 768
//Atcoder
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int n = sc.nextInt(), m = sc.nextInt();
        int[] food = new int[m];

        for(int i=0;i<n;i++) {
            int a = sc.nextInt();
            for(int j=0;j<a;j++) {
                food[sc.nextInt()-1]++;
            }
        }

        int cnt = 0;
        for(int i=0;i<m;i++) {
            if(food[i] == n) cnt++;
        }

        pw.println(cnt);
        pw.close();
    }
}


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

int main(void) {
	int N;
	scanf("%d", &N);
	long long luca[100];
	luca[0] = 2;
	luca[1] = 1;
	for (int i = 2; i <= N; i++) {
		luca[i] = luca[i - 1] + luca[i - 2];
	}
	printf("%lld\n", luca[N]);
	return 0;
}


Measured memory_bytes: 3804
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>


using namespace std;

int main(){
 
    int n;
    
    cin >> n;
    
    int ans = 1;
    int wk;
    for(int i = 2; i * i <= n;i++){
        wk = i;
        
        while(true){
            wk *= i;
            
            if(wk > n)break;
            
            if(wk > ans)ans = wk;
            
        }
    }
 
    cout << ans << endl;
    
    return 0;
    
    
}

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

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

    if (A < C && C < B)
        cout << "Yes" << endl;
    else if (B < C && C < A)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
// a,b,cの最大値、最小値をそれぞれminimumの参照先、maximumの参照先に代入する

int64_t fibonacci (int n) {
 int64_t num1 = 2,num2=1,tmp =1;
 for (int i =1; i <n; i++)
 {
     tmp = num1+num2;
     num1=num2;
     num2=tmp;
 }
 return tmp;
 
}

int main() {
    int n ;
    cin >>n;
    cout << fibonacci(n)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long P=998244353;
const long long N=1e6;
long long a[N],ans=1,n,maxx,first,flag;
long long ksm(long long a,long long b)
{
	long long ans=1;
	while(b)
	{
		if(b&1)ans=(ans*a)%P;
		a=(a*a)%P;
		b=b>>1;
	}
	return ans;
}
int main()
{
	cin>>n;
	for(long long i=1;i<=n;i++)
	{
		long long w;
		cin>>w;
		if(i==1)first=w;
		else if(first>=w)flag=1; 
		a[w]++;
		maxx=max(maxx,w);
	}
	for(long long i=1;i<=maxx;i++)
	{
		ans=(ans*ksm(a[i-1],a[i]))%P;
	}
	if(flag)cout<<"0"<<endl;
	else cout<<ans;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <set>

#include <regex>
#include <locale>
#include <iomanip>

using namespace std;
using ll = long long;

#define OVERLOAD3(_1,_2,_3,name,...) name
#define REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a),i##_Len=int(b);i<i##_Len;++i)
#define rep(...) OVERLOAD3(__VA_ARGS__,REPI,REP,)(__VA_ARGS__)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())

int main () {
  string s; cin >> s;
  s.replace(s.begin(), s.begin() + 4, "2018");
  cout << s << endl;
}

Measured memory_bytes: 3076
import std.stdio,std.conv,std.algorithm,std.string;alias L=long;L M=998244353;L[]X;L[L]C;L h(L m,L[]U){L f;foreach(u;U[0..m])f=f*2%M+u;foreach(i,u;U)if(i/m&1^U[i%m]^u)return f+u;return f+1;}void main(){L n=readln.chomp.to!L,b=n*2;foreach(c;readln.chomp)X~=c-'0';for(L d=n|1;d>2;d-=2)if(n%d<1){L c=h(n/d,X);foreach(e,q;C)e%d||(c+=M-q);C[d]=c%M;}n=h(n,X)*b;foreach(d,c;C)n+=M-c*(b-b/d)%M;writeln(n%M);}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
#define sz size
#define pb push_back
#define mper make_pair
#define PI 3.14159
#define F first
#define S second
#define ll long long
//#define forik(i, a, b) for(ll i = a; i <= b; ++i)
#define vl vector<ll>
#define pll pair<ll, ll>
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll a, b, c;

int main() {

mal

cin >> a >> b >> c;

if(a % 2ll == 0 || b % 2ll == 0 || c % 2ll == 0) {

    cout << 0;

}

else {

    ll erba_karama = max(max(a, b), c);
    ll erba_lox_45 = min(min(a, b), c);

    ll mid = (a + b + c) - erba_karama - erba_lox_45;

    cout << erba_lox_45 * mid;

}


return 0;
}


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

#define int long long

using namespace std;

 main () {   
 	string s;
 	cin >> s;
 	int t = 0;
 	int sum = 0;
 	int a = 0;
 	for (int i = 0;i < s.size ();i ++) {
 		t *= 10;
 		int x = 0;
 		if (i == 0) x = (s[0] - '0');
 		else x = 9;
 		t += x;
 		sum += x;
 		a *= 10;
 		a += (s[i] - '0');
 	}
 	if (a == t) cout << sum;
 	else cout << sum - 1;
    return 0;           		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

template <class T = int>
class UF {
    T *par;

    public:
    UF(T n) : par(new T[n]) {
        for (T i = 0; i < n; i++) {
            par[i] = i;
        }
    }
    ~UF() { delete[] par; }

    T root(T x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    bool same(T x, T y) {
        return root(x) == root(y);
    }

    void unite(T x, T y) {
        x = root(x);
        y = root(y);
        if (x != y) {
            par[x] = y;
        }
    }
};

int main() {
    int n, m;
    std::cin >> n >> m;
    std::vector<i64> w(n);
    for (int i = 0; i < n; i++) {
        std::cin >> w[i];
    }

    std::vector<std::pair<i64, std::pair<int, int>>> es;
    for (int i = 0; i < m; i++) {
        int a, b;
        i64 y;
        std::cin >> a >> b >> y;
        a--; b--;
        es.push_back({ y, { a, b }});
    }

    std::sort(es.begin(), es.end());
    UF<> uft(n);
    std::vector<bool> cand(m), done(m);
    std::vector<std::deque<std::pair<int, int>>> g(n);
    for (int i = 0; i < m; i++) {
        auto a = es[i].second.first, b = es[i].second.second;
        auto y = es[i].first;
        auto xx = w[uft.root(a)] + (uft.same(a, b) ? 0 : w[uft.root(b)]);
        uft.unite(a, b);
        w[uft.root(a)] = xx;
        if (y <= xx) {
            cand[i] = true;
        }
        g[a].emplace_back(b, i);
        g[b].emplace_back(a, i);
    }

    int ret = 0;
    for (int i = m - 1; i >= 0; i--) {
        if (done[i]) continue;
        if (!cand[i]) { ret++; continue; }
        std::deque<int> q { es[i].second.first, es[i].second.second };
        while (!q.empty()) {
            auto v = q.front();
            q.pop_front();
            for (auto el : g[v]) {
                if (!done[el.second] && es[el.second].first <= es[i].first) {
                    q.push_back(el.first);
                    done[el.second] = true;
                }
            }
        }
    }

    std::cout << ret << std::endl;

    return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 4005*4005;

/* ...o(^-^)o... */

int main(){
    string s; cin>>s;
    int n = s.size();

    if(s[n-1]=='1'){
        out(-1); return 0;
    }
    if(s[0]=='0'){
        out(-1); return 0;
    }

    vector<int> v;
    rep(k, n/2){
        if(s[k]!=s[n-k-2]){
            out(-1); return 0;
        }
        if(k>0 && s[k]=='1') v.push_back(k+1);
    }
    v.push_back(n);
    reverse(all(v));

    int x = 1, y = 2;
    rep(i, v.size()-1){
        int s = v[i], t = v[i+1];
        rep(j, s-t-1){
            cout<<x<<" "<<y<<endl;
            y++;
        }
        cout<<x<<" "<<y<<endl;
        x = y; y++;
    }
    while(y <= n){
        cout<<x<<" "<<y<<endl;
        y++;
    }
}

Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>

#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vstr vector<string>

using namespace std;

int main()
{
	ll n, k;
	cin >> n >> k;
	vll arr(n);
	for (ll i = 0; i < n; i++) cin >> arr[i];
	
	for (ll i = k; i < n; i++)
	{
		if (arr[i] > arr[i - k]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

}

Measured memory_bytes: 4468
#include <iostream>
#include <string>
#include <map>

int main() {
    std::multimap<std::string, int> mp;
    int Q;
    std::cin >> Q;

    for (int q = 0; q < Q; ++q) {
        int t;
        std::cin >> t;
        if (t == 0) {
            std::string k;
            int x;
            std::cin >> k >> x;
            mp.emplace(k, x);
        } else if (t == 1) {
            std::string k;
            std::cin >> k;
            auto p = mp.equal_range(k);
            for (auto itr = p.first; itr != p.second; ++itr) {
                std::cout << itr->second << std::endl;
            }
        } else if (t == 2) {
            std::string k;
            std::cin >> k;
            mp.erase(k);
        } else {
            std::string l, r;
            std::cin >> l >> r;
            auto e = mp.upper_bound(r);
            for (auto itr = mp.lower_bound(l); itr != e; ++itr) {
                std::cout << itr->first << " " << itr->second << std::endl;
            }
        }
    }
}


Measured memory_bytes: 24816
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <cstdio>

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

constexpr i64 MOD = 1000000007;

template<u64 N>
class T
{
	public:
		constexpr T() : data()
		{
			for (i64 i = 0; i <= (i64)N; ++i)
			{
				data[i] = i;
			}
			for (i64 i = 2; i <= (i64)N; ++i)
			{
				if (data[i] != i) continue;
				for (i64 j = i; j <= (i64)N; j += i)
				{
					data[j] = data[j] / i * (i - 1);
				}
			}
			for (i64 i = 1; i <= (i64)N; ++i)
			{
				data[i] = (data[i] + data[i - 1]) % MOD;
			}
		}

		i32 data[N + 1];
};


template<typename T>
constexpr T pow_mod(T a, T b, T m)
{
	T r = 1;
	while (b > 0)
	{
		if ((b & 1) != 0) r = (r * a) % m;
		a = (a * a) % m;
		b >>= 1;
	}
	return r;
}

constexpr T<100000> t;

int main()
{
	i64 n, k;
	scanf("%lld%lld", &n, &k);
	i64 ans = 0;
	for (i64 i = 1; i <= k;)
	{
		i64 j = k / (k / i);
		ans = (ans + pow_mod(k / i, n, MOD) * (t.data[j] + MOD - t.data[i - 1])) % MOD;
		i = j + 1;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 1980
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	map<string, int> vt;
	int n;
	cin >> n;
	string s;
	REP(i, n){
		cin >> s;
		vt[s]++;
	}
	int ma = 0;
	for(auto it = vt.begin(); it != vt.end(); it ++){
		ma = max(ma, it->second);
	}
	vector<string> ac;
	for(auto it = vt.begin(); it != vt.end(); it ++){
		if(it->second == ma) ac.push_back(it->first);
	}
	sort(ac.begin(), ac.end());
	REP(i, ac.size())cout << ac[i] << endl;
}

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

void trace(int A[],int N) {
    for(int i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void insertionSort(int A[],int N){
    int j,i,v;
    for(i=1;i<N;i++) {
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A,N);
    }
}

int main() {
    int N,i,j;
    int A[100];

    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    trace(A,N);
    insertionSort(A,N);

    return 0;
}

Measured memory_bytes: 3212
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <cmath>
#include <algorithm>
#include <unordered_set>
using namespace std;

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

  int32_t N;
  cin >> N;
  vector<int64_t> min_vect(N);
  vector<int64_t> max_vect(N);
  for (int i = 0; i < N; i++) {
    cin >> min_vect[i] >> max_vect[i];
  }
  sort(min_vect.begin(), min_vect.end());
  sort(max_vect.begin(), max_vect.end(), greater<int64_t>());
  int64_t res = 0;

  if (N % 2 == 0) {
    int idx = N / 2;
    int64_t min1 = min_vect[idx-1];
    int64_t min2 = min_vect[idx];
    int64_t max1 = max_vect[idx];
    int64_t max2 = max_vect[idx-1];
    //cout << min1 << "," << min2 << "," << max1 <<"," << max2 << endl;
    res = (max1 + max2 - min1 - min2) + 1;
  } else {
    int idx = N / 2 + 1;
    int64_t min = min_vect[idx -1];
    int64_t max = max_vect[idx -1];
    res = max - min + 1;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 6376
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,a[101];
    int i=0,j=0,q=0;
    int p=0,t;
    scanf("%d",&n);
        for(q=0;q<n;q++)
        {
            scanf("%d",&a[q]);
        }
        for(i=0;i<n;i++)
        {
            for(j=0;j<n-i-1;j++)
            {
                if(a[j]>a[j+1])
                {
                    t=a[j];
                    a[j]=a[j+1];
                    a[j+1]=t;
                    p=p+1;
                }
            }
        }
        for(int i = 0;i<n;i++)
             {
               if(i<n-1)
                 printf("%d ",a[i]);
               else printf("%d",a[i]);
             }
        printf("\n");
        printf("%d\n",p);
    return 0;
}


Measured memory_bytes: 2104
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
# include <unordered_map>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 

int main()
{
	int n; cin >> n;
	bool f = false;
	while (n--)
	{
		if (f)cout << endl;
		f = true;
		int a[9][9];
		bool b[9][9];
		for (int i = 0; i < 9; i++)
		{
			for (int j = 0; j < 9; j++)
			{
				cin >> a[i][j];
				b[i][j] = false;
			}
		}
		for (int i = 0; i < 9; i++)
		{
			for (int j = 0; j < 9; j++)
			{


				for (int k = 0; k < 9; k++)
				{
					if (k == j)continue;
					if (a[i][j] == a[i][k])
					{
						b[i][j] = true;
						b[i][k] = true;
					}
					if (a[j][i] == a[k][i])
					{
						b[j][i] = true;
						b[k][i] = true;
					}
				}
				if (i % 3 == 0 && j % 3 == 0)
				{
					for (int k = 0; k < 9; k++)
					{
						for (int l = 0; l < 9; l++)
						{
							if (i + k % 3 == i + l % 3 || j + k / 3 == j + l / 3)continue;
							if (a[i + k % 3][j + k / 3] == a[i + l % 3][j + l / 3])
							{
								b[i + k % 3][j + k / 3] = true;
								b[i + l % 3][j + l / 3] = true;
							}
						}
					}
				}

			}
		}

		for (int i = 0; i < 9; i++)
		{
			for (int j = 0; j < 9; j++)
			{
				cout << (b[i][j] ? '*' : ' ');
				cout << a[i][j];
			}
			cout << endl;
		}
	}


}

Measured memory_bytes: 3024
# editorialを参考にした

N = int(input())
A = [int(x) for x in input().split()]
A_prime = [0]*N
for i in range(N):
    A_prime[i] = A[i] - i-1
A_prime = sorted(A_prime)
center = A_prime[N//2]

ans = 0
for k in range(N):
    ans += abs(A[k] - (center + k + 1))
print(ans)


Measured memory_bytes: 25200
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> S(H, vector<char>(W));
    rep(i, H) rep(j, W) cin >> S[i][j];
    
    int ans = 100100100;
    rep(bit, 1 << (H - 1)) {
        vector<int> num(H, 0), sum(H, 0);
        rep(i, H - 1) {
            if (bit & (1 << i)) num[i + 1] = num[i] + 1;
            else num[i + 1] = num[i];
        }
        vector<int> cut;
        bool cannot = false;
        rep(i, W) {
            vector<int> s(H, 0);
            rep(j, H) s[num[j]] += S[j][i] - '0';
            bool over = false;
            rep(i, H) {
                if (sum[i] + s[i] > K) over = true;
            }
            if (over) {
                cut.push_back(i - 1);
                rep(i, H) sum[i] = s[i];
                rep(i, H) {
                    if (sum[i] > K) cannot = true;
                }
            } else {
                rep(i, H) sum[i] += s[i];
            }
        }
        if (cannot) continue;
        ans = min(num[H - 1] + (int)cut.size(), ans);
    }
    cout << ans << endl;
}


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

int gcd(int x, int y) {
    if(x>=y) {
        if(y==0)
            return x;
        else
            return gcd(x%y, y);
    }
    else {
        if(x==0)
            return y;
        else
            return gcd(x, y%x);
    }
}

int main() {
    int x, y;

    cin >> x >> y;
    cout << gcd(x, y) << endl;

    return 0;
}

Measured memory_bytes: 3080
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		 Scanner in = new Scanner(System.in);
	        String s = in.nextLine();
	       
	        int m=0;
	        int k=0;
	        boolean flag=false;
	        boolean flag1=false;
	        for(int i=0;i<s.length();i++)
	        {
	        	if(flag==false &&s.charAt(i)=='C')
	        	{
	        		flag=true;
	        		m=i;
	        	}
	        	if(i>m&&s.charAt(i)=='F'&&flag==true)
	        	{
	        		System.out.println("Yes");
	        		flag1=true;
	        		break;
	        	}
	        }
	        if(flag1==false)
	        System.out.println("No");
	      
	    }

	 
}




Measured memory_bytes: 10192
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

#define mod 1000000007

long int extGCD(long int a, long int b, long int *x, long int *y) {
    if (b == 0) {
        *x = 1;
        *y = 0;
        return a;
    }
    long int d = extGCD(b, a%b, y, x);
    *y -= a / b * (*x);
    return d;
}

long int comb_mod(long int n, long int r) {
    long int deno = 1;
    long int mole = 1;
    long int r_change = (r <= n / 2) ? r : n - r;
    for (int i=1; i<=r_change; i++) {
        mole = mole * i % mod;
    }
    for (int i=n-r_change+1; i<=n; i++) {
        deno = deno * i % mod;
    }
    long int x = 0, mole_inv = 0;
    extGCD(mod, mole%mod, &x, &mole_inv);
    mole_inv = mole_inv % mod;
    return (deno * mole_inv) % mod;
}

int main() {
    long int h = 0, w = 0, koma = 0;
    scanf("%ld %ld %ld", &h, &w, &koma);
    long int sum_x = 0;
    long int com = comb_mod(h*w-2, koma-2);
    if (com < 0) {
        com += mod;
    }
    for (int i=1; i<w; i++) {
        long int num = (h * h) % mod;
        long int hoge = (w - i) % mod;
        sum_x += (((((com * num) % mod) * hoge) % mod) * i) % mod;
        sum_x = sum_x % mod;
    }
    long int sum_y = 0;
    for (int i=1; i<h; i++) {
        long int num = (w * w) % mod;
        long int hoge = (h - i) % mod;
        sum_y += (((((com * num) % mod) * hoge) % mod) * i) % mod;
        sum_y = sum_y % mod;
    }
    long int ans = sum_x + sum_y;
    printf("%ld\n", ans%mod);
    return 0;
}


Measured memory_bytes: 128
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

struct Edge {
	ll from;
	ll to;
	ll vec;
};

bool visit(const vector<vector<Edge>>& graph, ll cur, 
			vector<bool>& visited, vector<ll>& pos) {
	visited[cur] = true;
	for (Edge e : graph[cur]) {
		if (visited[e.to]) {
			if (pos[e.to] - pos[e.from] != e.vec) {
				return false;
			}
		} else {
			pos[e.to] = pos[e.from] + e.vec;
			visit(graph, e.to, visited, pos);
		}
	}
	return true;
}

int main() {
	ll N, M;
	cin >> N >> M;
	vector<vector<Edge>> graph(N);
	rep(i,0,M) {
		ll L, R, D;
		cin >> L >> R >> D;
		L--;
		R--;
		graph[L].push_back({L, R, D});
		graph[R].push_back({R, L, -D});
	}
	vector<bool> visited(N);
	vector<ll> pos(N);
	rep(i,0,N) {
		if (!visit(graph, i, visited, pos)) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}


Measured memory_bytes: 21632
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #ここにコード
    #input
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    #output
    #ループしたらそのループの周期でKを割る。

    loop = {i:-1 for i in range(N)}
    loop[0] = 0
    position = 0

    for i in range(N+1):
        position = A[position] - 1
        if loop[position] != -1:
            ini = loop[position]
            cycle = i+1 - ini
            break
        else:
            loop[position] = i+1

    M = (K-ini) % cycle

    answer = 0
    root = min(K, M+ini)
    for j in range(root):
        answer = A[answer] -1

    answer += 1
    print(answer)

if __name__ == "__main__":
    main()

Measured memory_bytes: 42116
<?php
fscanf(STDIN, "%d %d", $pref_max, $city_max);

for( $i=0; $i<$city_max; $i++ )
{
  fscanf(STDIN, "%d %d", $pref, $city);
  $dispList[] = array( "pref"=>$pref, "city"=>$city );
  $list[$pref][$i] = $city;
}

foreach( $list as $pref => $cities )
{
  sort( $cities );
  $num = 1;
  foreach( $cities as $city )
  {
 	 $idList[$pref][$city] = $num;
     $num++;
  }
}

foreach( $dispList as $disp )
{
  $pref_id = sprintf( "%06d", $disp['pref'] );
  $city_id = sprintf( "%06d", $idList[$disp['pref']][$disp['city']] );
  echo $pref_id.$city_id."\n";
}


Measured memory_bytes: 129140
#include <stdio.h>

int main() {
	int a[5], b, c, d, e;
	char s[100];
	for (int i = 0; i < 5; i++)scanf("%d", &a[i]);
	for (int i = 0; i < 5; i++) {
		if (a[i] == 0){
			printf("%d", i + 1);
			return 0;
		}
	
	}
	return 0;
}

Measured memory_bytes: 1684
program sample
	implicit none
    integer ::a,b,c
    integer ::x(3)
    
    read(*,*) a,b,c
    
    x(1) = a+b
    x(2) = a+c
    x(3) = b+c
    
    write(*,*) minval(x)
    
    stop
end program sample

Measured memory_bytes: 2872
str_input = list(input())
for i in range(2**3):
    ope = ['-'] * 3
    siki = ''
    for j in range(3):
        if(i>>j)&1:
            ope[j] = '+'
    for moji, op in zip(str_input, ope+['']):
        siki +=(moji+op)
    ans = eval(siki)
    if ans == 7:
        print(siki + '=7')
        break


Measured memory_bytes: 3060
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# N <= 10^5
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
B = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

for i in range(N):
    if A[i] > B[i]:
        ans += B[i]
    else:
        B[i] -= A[i]
        ans += A[i]
        if A[i+1] > B[i]:
            ans += B[i]
            A[i+1] -= B[i]
        else:
            ans += A[i+1]
            A[i+1] = 0

print(ans)

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for (int i=1; i<=N; i++){
    if (i % 2 == 0) continue;
    int y = 0;
    for (int j=1; j<=i; j++) {
      if (i % j == 0) y++;
    }
    if (y == 8) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
n = len(s)

def dfs(i,t):
  if i == n-1:
    return sum(list(map(int,t.split(chr(43)))))
  return dfs(i+1,t+s[i+1]) + dfs(i+1,t+chr(43)+s[i+1])

print(dfs(0,s[0]))

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

int main(){
    int n,x;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i%3==0)cout<<" "<<i;
        else{
            x=i;
            while(x){
                if(x%10==3){
                    cout<<" "<<i;
                    break;
                }
                x/=10;
            }
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3108
N=int(input())
task=[]
for _ in range(N):
  a, b=map(int, input().split())
  task.append([a,b])
task.sort(key=lambda x:x[1])

cula=0
for a, b in task:
  cula+=a
  if cula>b:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 40712