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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
typedef pair<int,int> point;
typedef pair<int,point> state;
priority_queue<state> q_s;
int visited[100][100] = {0} ;
int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int H, W; cin >> H >> W;
    vector<string> board;
    REP(i, H) {
        string tmp; cin >> tmp;
        board.push_back(tmp);
    }
    REP(i, H) {
        REP(j, W) {
            visited[i][j] = -1000;
        }
    }
    point goal = make_pair(H-1,W-1);
    q_s.push(make_pair(-(board[goal.first][goal.second] == '#'),goal)); visited[goal.first][goal.second] = 0;
    while (!q_s.empty()){
        state cur_s = q_s.top(); q_s.pop();
        point cur_p = cur_s.second;
        if (cur_p.first == 0 && cur_p.second == 0) {
            cout << -cur_s.first << endl;
            break;
        }
        if (board[cur_p.first][cur_p.second] == '#') {
            if (cur_p.first != 0) {
                point up = make_pair(cur_p.first - 1, cur_p.second);
                if (visited[up.first][up.second] < cur_s.first) {
                    q_s.push(make_pair(cur_s.first, up));//ここが重い
                    visited[up.first][up.second] = cur_s.first;
                }
            }
            if (cur_p.second != 0) {
                point left = make_pair(cur_p.first, cur_p.second - 1);
                if (visited[left.first][left.second] < cur_s.first) {
                    q_s.push(make_pair(cur_s.first, left));//ここが重い
                    visited[left.first][left.second] = cur_s.first;
                }
            }
        }
        else if (board[cur_p.first][cur_p.second] == '.'){
            if (cur_p.first != 0) {
                point up = make_pair(cur_p.first - 1, cur_p.second);
                if (visited[up.first][up.second] < cur_s.first - (board[up.first][up.second] == '#')) {
                    q_s.push(make_pair(cur_s.first - (board[up.first][up.second] == '#'), up));//ここが重い
                    visited[up.first][up.second] = cur_s.first - (board[up.first][up.second] == '#');
                }
            }
            if (cur_p.second != 0) {
                point left = make_pair(cur_p.first, cur_p.second - 1);
                if (visited[left.first][left.second] < cur_s.first - (board[left.first][left.second] == '#')) {       
                    q_s.push(make_pair(cur_s.first - (board[left.first][left.second] == '#'), left));//ここが重い
                    visited[left.first][left.second] = cur_s.first - (board[left.first][left.second] == '#');
                }
            }           
        }
    }
    
    return 0;

}


Measured memory_bytes: 384
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int bm = 200200;
int BIT[bm], BIT2[bm];
void add(int A, int B) {
	while (A > 0) {
		BIT[A] = max(BIT[A], B);
		A -= A & -A;
	}
}
int query(int A) {
	int kotae = 0;
	while (A < bm) {
		kotae = max(BIT[A], kotae);
		A += A & -A;
	}
	return kotae;
}
void add2(int A, int B) {
	while (A > 0) {
		BIT2[A] = max(BIT2[A], B);
		A -= A & -A;
	}
}
int query2(int A) {
	int kotae = 0;
	while (A < bm) {
		kotae = max(BIT2[A], kotae);
		A += A & -A;
	}
	return kotae;
}

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


	int N, Q;
	cin >> N >> Q;

	ll kotae = ll(N - 2) * (N - 2);

	rep(i, Q) {
		int q, x;
		cin >> q >> x;
		if (q == 1) {
			int tmp = query(x);
			kotae -= N - tmp - 2;
			add2(N - tmp - 1, N - x);
		}
		else {
			int tmp = query2(x);
			kotae -= N - tmp - 2;
			add(N - tmp - 1, N - x);
		}
	}
	co(kotae);


	Would you please return 0;
}

Measured memory_bytes: 4388
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int N, M, Q;
int sumh[2020][2020], sumw[2020][2020], sum[2020][2020];
int dat[2020][2020];

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

	
	cin >> N >> M >> Q;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		for (int j = 0; j < M; j++)dat[i][j] = S[j] - '0';
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + dat[i][j];
			sumh[i + 1][j + 1] = sumh[i + 1][j] + sumh[i][j + 1] - sumh[i][j];
			sumw[i + 1][j + 1] = sumw[i + 1][j] + sumw[i][j + 1] - sumw[i][j];
			if (i > 0 && dat[i - 1][j] && dat[i][j])sumh[i + 1][j + 1]++;
			if (j > 0 && dat[i][j - 1] && dat[i][j])sumw[i + 1][j + 1]++;
		}
	}

	for (int i = 0; i < Q; i++) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		x1--, y1--, x2--, y2--;
		ll v = sum[x2 + 1][y2 + 1] - sum[x1][y2 + 1] - sum[x2 + 1][y1] + sum[x1][y1];
		ll e = (sumh[x2+1][y2+1] - sumh[x1+1][y2+1] - sumh[x2+1][y1] + sumh[x1+1][y1]) + (sumw[x2+1][y2+1] - sumw[x1][y2+1] - sumw[x2+1][y1+1] + sumw[x1][y1+1]);
		puts(v-e);
	}


	return 0;
}

Measured memory_bytes: 65408
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int solve_testcase() {
    int R, N; scanf("%d%d", &R, &N);
    if(R == 0 and N == 0) return 1;
    
    vector<int> HL(50), HR(50);
    for(int i=0; i<N; i++) {
        int xl, xr, h; scanf("%d%d%d", &xl, &xr, &h);
        xl += 20, xr += 20;
        for(int x=xl; x<xr; x++) {
            chmax(HL[x], h);
        }
        for(int x=xl+1; x<=xr; x++) {
            chmax(HR[x], h);
        }
    }

    double ans = INF;
    for(int i=0; i<45; i++) {
        int dist = abs(i - 20);
        if(dist >= R) continue;
        if(dist == 0) {
            double y = min(HL[i], HR[i]);
            chmin(ans, y);
            continue;
        }
        {
            double x = i - 20;
            double y = sqrt(R*R - x*x);
            y = min(HL[i], HR[i]) - y;
            double t = y + R;
            chmin(ans, t);
        }
    }
    printf("%.12f\n", ans);
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int d[305][305][305];

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  string s;
  int k;
  cin >> s >> k;
  int n = s.size();
  if (k == n) {
    cout << n << endl; return 0;
  }
  for (int i = 0; i < n; ++i) {
    d[i][i][0] = 1;
  }
  int res = 0;
  for (int l = 2; l <= n; ++l) {
    for (int i = 0; i + l <= n; ++i) {
      int j = i + l - 1;
      for (int t = 0; t <= k; ++t) {
        d[i][j][t] = max(d[i+1][j][t], d[i][j-1][t]);
        if (s[i] == s[j]) d[i][j][t] = max(d[i][j][t], d[i+1][j-1][t] + 2);
        if (t) {
          d[i][j][t] = max(max(d[i][j][t], d[i+1][j-1][t-1] + 2), d[i][j][t-1]);
        }
        res = max(res, d[i][j][t]);
      }
    }
  }
  cout << max(1, res) << endl;
  return 0;
}

Measured memory_bytes: 110848
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug(Head head,Tail... tail){
    cerr<<" "<<to_string(head);
    debug(tail...);
}

bool is_palin(int n){
    string s=to_string(n);
    bool f=1;
    FOR(i,s.size()){
        if(s[i]!=s[s.size()-i-1]){
            f=0;
        }
    }
    return f;
}

int main(){
    int A,B;
    cin>>A>>B;
    int c=0;
    for(int i=A;i<=B;++i){
        if(is_palin(i))++c;
    }
    cout<<c<<endl;
    return 0;
}

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

using namespace std;

int main() {
    double x1, y1, x2, y2;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

    double dx=x2-x1, dy=y2-y1;

    printf("%.12f\n", sqrt(dx*dx+dy*dy));
    return 0;
}

Measured memory_bytes: 2716
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

l,r=mp()
if l//2019 != r//2019:
    print(0)
    exit()
ans=10000
for i in range(l,r):
    for k in range(i+1,r+1):
        ans=min(ans,(i*k)%2019)
print(ans)


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

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  Int n,m;
  cin>>n>>m;
  
  vector<string> s(n);
  for(Int i=1;i<n;i++) cin>>s[i];
  
  using P = pair<Int, Int>;
  vector<vector<Int> > G(n);
  for(Int i=1;i<n;i++){
    Int u,v;
    cin>>u>>v;
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }

  vector<Int> c(n,0);
  {
    Int x=0b011;
    Int y=0b101;
    vector<Int> w({0,x&y,(x|y)^y,x,(x|y)^x,y,x^y,x|y});
    int cnt=0;
    function<void(Int,Int)> dfs=[&](Int v,Int p){
      cnt++;
      for(Int u:G[v]){
	if(u==p) continue;
	if(s[u]=="T=T&X") c[u]=c[v]&x;
	if(s[u]=="T=T&Y") c[u]=c[v]&y;
	if(s[u]=="T=T|X") c[u]=c[v]|x;
	if(s[u]=="T=T|Y") c[u]=c[v]|y;
	if(s[u]=="T=T^X") c[u]=c[v]^x;
	if(s[u]=="T=T^Y") c[u]=c[v]^y;
	dfs(u,v);
      }
    };
    dfs(0,-1);
    assert(cnt==n);
  }
  
  map<vector<Int>, Int> ans;
  
  for(Int i=0;i<m;i++){
    Int x,y;
    cin>>x>>y;
    vector<Int> w({0,x&y,(x|y)^y,x,(x|y)^x,y,x^y,x|y});
    function<Int(Int,Int,Int)> dfs=[&](Int v,Int p,Int d){
      Int res=-1;
      for(Int u:G[v]){
	if(u==p) continue;
	{
	  if(s[u]=="T=T&X") assert(w[c[u]]==(w[c[v]]&x));
	  if(s[u]=="T=T&Y") assert(w[c[u]]==(w[c[v]]&y));
	  if(s[u]=="T=T|X") assert(w[c[u]]==(w[c[v]]|x));
	  if(s[u]=="T=T|Y") assert(w[c[u]]==(w[c[v]]|y));
	  if(s[u]=="T=T^X") assert(w[c[u]]==(w[c[v]]^x));
	  if(s[u]=="T=T^Y") assert(w[c[u]]==(w[c[v]]^y));
	}
	Int e=dfs(u,v,!d);
	if(res<0) res=e;
	if(!d&&(w[e]>w[res]||(w[e]==w[res]&&e>res))) res=e;
	if( d&&(w[e]<w[res]||(w[e]==w[res]&&e<res))) res=e;
      }
      if(res<0) res=c[v];
      return res;
    };
    
    vector<P> v;
    for(Int i=0;i<8;i++) v.emplace_back(w[i],i);
    sort(v.begin(),v.end());
    vector<Int> u(8);
    for(Int i=0;i<8;i++) u[i]=v[i].second;
    //for(int a:u) cout<<a<<" ";cout<<endl;
    if(!ans.count(u)) ans[u]=dfs(0,-1,0);
    cout<<w[ans[u]]<<endl;
  }
  return 0;
}



Measured memory_bytes: 27116
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  string s, t;
  cin >> s >> t;

  int N = s.size();
  int M = t.size();
  vector<set<int>> set(26);

  REP(i, N) set[s[i]-'a'].insert(i);
  REP(i, 26) set[i].insert(INF);

  REP(i, M){
    if(*set[t[i]-'a'].upper_bound(-1) == INF){
      cout << -1 << endl;
      return 0;
    }
  }

  int now = -1;
  int cnt = 0;
  REP(i, M){
    // 今の場所がnowでt[i]の場所を探したい
    now = *set[t[i]-'a'].upper_bound(now);
    if(now == INF){
      now = *set[t[i]-'a'].upper_bound(-1);
      cnt++;
    }
  }

  cout << cnt*N+now+1 << endl;

  return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
#define rep(X,A,B) for(int X=A;X<=B;X++)
#define tep(X,A,B) for(int X=A;X>=B;X--)
#define LL long long
#define DB double
const int N=200010;
const int M=12000010;
const LL MOD=998244353;
using namespace std;

int n;
char s[N];
int b[N],d[N],cnt=0;
LL c[N];

void READ(){
	scanf("%d",&n);
	scanf("%s",s+1);
	rep(i,1,n)b[i]=s[i]-'0';
}

void GETK(){
	for(int i=1;i*i<=n;i++){
		if(n%i)continue;
		if(i&1)d[++cnt]=n/i;
		if(i*i==n)continue;
		if((n/i)&1)d[++cnt]=i;	
	}
	sort(d+1,d+cnt+1);
}

LL GET(int x){
	LL now=0;
	rep(i,1,x){
		now=now*2%MOD+b[i];
		now%=MOD;
	}
	int pos=0,flg=1,val;
	rep(i,1,n){
		pos=pos%x+1;
		if(pos==1)flg^=1;
		val=b[pos]^flg;
		if(val<b[i])return (now+1)%MOD;
		if(val>b[i])return now;
	}
	return (now+1)%MOD;
}

void SOLVE(){
	LL ans=0;
	rep(i,1,cnt){
		c[i]=GET(d[i]);
		rep(j,1,i-1)if(d[i]%d[j]==0)c[i]=(c[i]-c[j]+MOD)%MOD;
		ans+=c[i]*d[i]%MOD*2%MOD;ans%=MOD;
	}
	printf("%lld\n",ans);
}

int main(){
	READ();
	GETK();
	SOLVE();
	return 0;
}

Measured memory_bytes: 1280
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)>
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"
#define ret return
#define F first
#define S second

/*##################################################################################*/

/*
int prime[100000] ;
vector < int > pr;
void calculateprime()
{
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; i <= 100000 ; i++)
    {
        if(prime[i] == 0)
        {
            pr.pb(i);
            for(ll j = i*2 ; j <= 100000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/


void customrun(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

bool isprime(ll n)
{
    for(ll i = 2 ; (ll) i*i <= n ; i++)
    {
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

ll fib(int n)
{
    ll a = 0, b = 1, c, i;
    if( n == 0)
        return a;
    for (i = 2; i <= n; i++)
    {
        c = (a + b);
        a = b;
        b = c;
    }
    return b;
}


ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll extendedgcd(ll a, ll b, ll& x, ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extendedgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

ll findgrouplcm(vector<int> &arr, int n)
{
    ll ans = arr[0];

    for (ll i = 1; i < n; i++)
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));

    return ans;
}


ll powerwithmod(ll x, unsigned ll y, ll p)
{
    ll res = 1;

    x = x % p;

    if (x == 0) return 0;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;

        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}


bool comp(const pair < long,long > &a, const pair < long ,long > &b){
    if(a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

void solve();

int main() {
    clock_t begin = clock();

    fast();
    customrun();
    ll t = 1;
    //cin>>t;
    //calculateprime();
    mfor(i,1,t+1,1)
    {
        //cout<<"Case #"<<i<<": \n";
        solve();
    }
    clock_t end = clock();
    double time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
    //cout<<"\ntime spent is "<<time_spent;
    return 0;
}


void solve(){
    string str;
    in(str);

    ll sum = 0;
    f(i,str.size()){
        sum += (str[i]-'0');
    }

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

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

int main(){
    double a;
    while(cin>>a){
        if(a<=48)
            cout<<"light fly"<<endl;
        else if(a<=51)
            cout<<"fly"<<endl;
        else if(a<=54)
            cout<<"bantam"<<endl;
        else if(a<=57)
            cout<<"feather"<<endl;
        else if(a<=60)
            cout<<"light"<<endl;
        else if(a<=64)
            cout<<"light welter"<<endl;
        else if(a<=69)
            cout<<"welter"<<endl;
        else if(a<=75)
            cout<<"light middle"<<endl;
        else if(a<=81)
            cout<<"middle"<<endl;
        else if(a<=91)
            cout<<"light heavy"<<endl;
        else
            cout<<"heavy"<<endl;
    }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) cin >> A[i];
  vector<int> check(N+1);
  for (int i:A) check[i]++;
  if (N%2 == 0){
    for (int i=1; i<N; i+=2){
      if (check[i] != 2){
        cout << 0 << endl;
        return 0;
      }
    }
  }else{
    for (int i=0; i<N; i+=2){
      if ((i == 0) && (check[i] != 1)){
        cout << 0 << endl;
        return 0;
      }
      else if ((i != 0) && (check[i] != 2)){
        cout << 0 << endl;
        return 0;
      }
    }
  }
  long long ans = 1;
  for (int i=0; i<N/2; i++){
    ans *= 2;
    ans = ans % (1000000000+7);
  }
  cout << ans << endl;
}


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

int main(){
  int a;
  bool flag=false;
  cin>>a;
  for(int i=0;i<a;i++){
    char x;
    cin>>x;
    if(x=='Y'){
      flag=true;
    }
  }
 if(flag){
  cout<<"Four"<<endl;
    }
 else{
   cout<<"Three"<<endl;
 }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);

int main() {
	int h, w;
	ll ans = 0LL;
	cin >> h >> w;
	vector<string> s(h);
	cin >> s;
	vector<vector<bool>> has(h, vector<bool>(w, false));
	P box = mp(0LL, 0LL);
	deque<pair<int, int>> q;
	Pi at;
	rep(i, h) {
		rep(j, w) {
			if (has[i][j]) continue;
			has[i][j] = true;
			q.push_front(mp(i, j));
			box = mp(0LL, 0LL);
			while (!q.empty()) {
				at = q.front();
				q.pop_front();

				if (s[at.F][at.S] == '#') {
					box.F++;
				} else {
					box.S++;
				}

				for (int ni = max(0, at.F - 1); ni < min(at.F + 2, h); ni++) {
					for (int nj = max(0, at.S - 1); nj < min(at.S + 2, w); nj++) {
						if (((ni == at.F) xor (nj == at.S)) and (s[at.F][at.S] != s[ni][nj]) and !has[ni][nj]) {
							q.push_front(mp(ni, nj));
							has[ni][nj] = true;
						}
					}
				}
			}
			//	clog << i << " " << j << " :" << box << endl;
			ans += box.F * box.S;
		}
	}
	cout << ans << endl;
}
/*
連結内は到達可能
UFで紅白を保持する?
*/

Measured memory_bytes: 4436
MAX=114514

v = [0]*MAX
p = [1]*MAX
p[0] = p[1] = 0

for i in range(int(MAX**0.5)+1):
	if p[i] == 1:
		n = i + i
		while n < MAX:
			p[n] = 0
			n += i

for i in range(1, MAX):
	v[i] = v[i-1]
	if p[i] == 1:
		v[i] += p[(i+1)//2]

for _ in range(int(input())):
	l,r = map(int, input().split())
	print(v[r] - v[l-1])


Measured memory_bytes: 5412
#include <iostream>
#include <cstdio>
#include <map>

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

using namespace std;

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

int main(){
	ll H,W,N;
	cin >> H >> W >> N;
	map<pii,ll> num;

	rep(i,N){
		int x,y;
		cin >> y >> x;
		y--;
		x--;
		int dx[] = {1,-1,0};
		int dy[] = {1,-1,0};
		rep(k,3){
			rep(j,3){
				int nx = x + dx[k];
				int ny = y + dy[j];
				if(nx<1||nx>=W-1||ny<1||ny>=H-1){
					continue;
				}
				num[pii(ny,nx)]++;
			}
		}
	}
	ll cou[10] = {0};
	cou[0] = (W-2)*(H-2);
	map<pii,ll>::iterator it = num.begin();
	while(it!=num.end()){
		cou[it->second]++;
		cou[0]--;
		it++;
	}
	rep(i,10){
		cout << cou[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 56448
a,b,c,K= map(int, input().split())
x=K-a
y=x-b
if a>=K:
    i=1*K
    print(i)
if a<K:
    i=1*a
    if y<=0:
        print(i)
    if y>0:
        i=i-y
        print(i)

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

int main() {
  int N;
  cin >> N;
  
  vector<int> bb_nums(N);
  for (int i = 0; i < N; i++)
    cin >> bb_nums.at(i);
  
  int count = 0;
  bool is_dividable = true;
  while (is_dividable) {
    for (int i = 0; i < N; i++) {
      if (bb_nums.at(i) % 2 != 0)
        is_dividable = false;
      bb_nums.at(i) /= 2;
    }
    count++;
  }
  cout << count - 1 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public void solve(){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int men = a*b;
        int syu = (a*2)+(b*2);
        System.out.println(men+" "+syu);
    }
    public static void main(String[] args){
        Main obj = new Main();
        obj.solve();
    }
}

        

Measured memory_bytes: 17216
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

int num[5] = {};
bool prohibited[10] = {};

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

  int N, K;
  cin >> N >> K;
  REP(i, K) {
    int x;
    cin >> x;
    prohibited[x] = true;
  }
  for (int i = N; i < 100000; i++) {
    int x = i;
    bool ok = true;
    while (x > 0) {
      if (prohibited[x % 10]) ok = false;
      x /= 10;
    }
    if (ok) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


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

n = input()
a = map(int, raw_input().split())

l, r = a[0], sum(a[1:])
min_diff = abs(l-r)
for i in range(1,n-1):
    l += a[i]
    r -= a[i]
    diff = abs(l-r)
    min_diff = min(min_diff,diff)
print(min_diff)
    
    


Measured memory_bytes: 18440
def main():
    n,t = map(int,input().split())
    t+=1
    T = [0]*t
    for _ in range(n):
        l,r = map(int,input().split())
        T[l]+=1
        T[r]-=1
    num = 0
    res = 0
    for i in range(t):
        num += T[i]
        res = max(num,res)
    print (res)

if __name__ == '__main__':
    main()




Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  int ans=0;
  cin>>n;
  
  for(int i=0;i<n.size();i++){
    if(n[i]=='1'){
      ans=ans+1;
    }
  }
  
  cout<<ans<<endl;
}

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


   class Program
   {
       static void Main(string[] args)
       {
           var suretu = "1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51";
           int num = int.Parse(Console.ReadLine());
           string[] line = suretu.Split(',');
         Console.WriteLine(line[num - 1]);
       }
   }


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007


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

int mp[26];

int main()
{
	string str;
	cin >> str;
	REP(i,str.size()){
		mp[str[i]-'a']++;
	}
	REP(i,26){
		if(mp[i] % 2 != 0){
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

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

        int r = sc.nextInt();

        System.out.println(solve(r));

        sc.close();
    }

    static int solve(int r) {
        return 3 * r * r;
    }
}

Measured memory_bytes: 35664
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;



class Bit
{
  public:
  ll size;
  vector<ll> data;
  Bit(ll n)
  {
    data.resize(n+1);
    REP(i,n+1)
      data[i]=0;
    size=n;
  }
  //(1-i)までの合計を返す
  ll Sum(ll i){
    ll s = 0;
    while (i > 0){
        s += data[i];
        i -= i & -i;
    }
    return s;
  }
  //Add
  void Add(ll i,ll x){
    while (i <= size){
      data[i] += x;
      i += i & -i;
    }
  }
};


int bbit(int ii,int t){
  return (ii>>t)%2;
}

vector<int> nmn(18);
vector<pair<int, int>> nm(18);
vector<pair<int, int>> ki(18);
vector<pair<int, int>> gu(18);


int solve(vector<int> &v,vi &a,vi &b)
{
  int wki=0;
  int wgu=0;
  for(int i=0;i<n;i++){
    if ((v[i]+i%2)%2==0){
      if (v[i]==0){
        gu[wgu].first=a[i];
        nmn[i]=a[i];
      }else{
        gu[wgu].first=b[i];
        nmn[i]=b[i];
      }
      gu[wgu].second=i;
      wgu++;
      
    }else{
      if (v[i]==1){
        ki[wki].first=b[i];
        nmn[i]=b[i];
      }else{
        ki[wki].first=a[i];
        nmn[i]=a[i];
      }
      ki[wki].second=i;
      wki++;
    }
  }
  if (wki!=(n/2)) 
    return -1;



  int an=0;
  
  sort(gu.begin(), gu.begin()+wgu);
  sort(ki.begin(), ki.begin()+wki);
  int tmp=0,flag=0,ttmp=0;
  for(int i=0;i<n;i++){
    if (i%2==0){
      if (tmp>gu[i/2].first)flag=1;
      tmp=gu[i/2].first;
      ttmp=gu[i/2].second;
    }else{
      if (tmp>ki[i/2].first)flag=1;
      tmp=ki[i/2].first;
      ttmp=ki[i/2].second;
    }
    nm[i].first=tmp;
    nm[i].second=ttmp;
  }
  if (flag==1)return -1;
  

  Bit bit(64);
  for(int i=0;i<n;i++){
    bit.Add(nmn[i],1);
    an+=i+1-bit.Sum(nmn[i]);
  }
  
  


  /*
  REP(i,n){
    tmp=nm[i].first;

    for(int j=0;j<n;j++){
      if (nmn[j]==tmp){
        //an+=j-i;
        //an+=nm[i].second-i;
        //cout<<"!>"<<j<<"!"<<i<<"<!";
        for(int k=j-1;k>=0;k--){
          nmn[k+1]=nmn[k];
        }
        nmn[0]=-1;
        break;
      }
    }

  }
  */
 an=0;
  REP(i,n){
    an+=nm[i].second-i;
    for(int j=i+1;j<n;j++){
      if (nm[j].second<nm[i].second)nm[j].second++;
    }
  }

  /*
  REP(i,n){
    cout<<nm[i].first<<" ";
  }
  cout<<"    "<<an<<endl;
  */


  return an;
}


int main(){
  int ans=(1<<19)+1;
  cin >> n ;
  vi a(n),b(n);
  REP(i,n){
    cin>>a[i];
  }
  
  REP(i,n){
    cin>>b[i];
  }
  



  ll nn=1<<n;
  vector<int> v(n);
  int sm=0;
  int tmpans=0;
  //裏が1
  for(int i=0;i<nn;i++){
    sm=0;
    for(int j=0;j<n;j++){
      v[j]=bbit(i,j);
      sm+=v[j];
    }
    if (sm%2==1)continue;


    tmpans=solve(v,a,b);
    if (tmpans!=-1){
      ans=min(ans,tmpans);
    }
  }



  if (ans!=((1<<19)+1)){
    cout<<ans<<endl;
  }else{
    cout<<-1<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
const int N = 1e5;
#define int long long int
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define MAX 1e15+1
#define pi  pair<int,int>

int dp[102][N];

signed main(){
	fast;
	int n,k,x,y;
	cin>>n>>k;
	vector<pi>v;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		v.pb({x,y});

	}
	int w,vl;
	sort(v.begin(),v.end());
	for(int j=1;j<=n;j++){
		for(int i=1;i<=k;i++){
			w=v[j-1].first,vl=v[j-1].second;
			if(w<=i){
				
				dp[j][i]=max(vl+dp[j-1][i-w],dp[j-1][i]);
			}
			else
				dp[j][i]=dp[j-1][i];
		}
	}
	// for(int j=0;j<=n;j++){
	// 	for(int i=0;i<=k;i++){
	// 		cout<<dp[j][i]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	cout<<dp[n][k];
		


}

 


Measured memory_bytes: 78336
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.util.ArrayList;


class Main {
	public static void main(String[] args) throws IOException {
		DecimalFormat df1 = new DecimalFormat("0.000000");
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = new String(in.readLine());
		s = new String(in.readLine());
		String[] ss = s.split(" ");
		ArrayList<Integer> is = new ArrayList<Integer>();
		for(int i = 0; i< ss.length;i++){
			is.add(Integer.parseInt(ss[i]));
		}
		int max = -1000000;
		for(Integer i:is){
			if(i > max){
				max = i;
			}
			
		}
		int min = 1000000;
		for(Integer i:is){
			if(i < min){
				min = i;
			}
		}
		long sum = 0;
		for(Integer i:is){
			sum = sum + i;
			
		}
		System.out.println(min+" "+max+" "+sum);
		
	}

}

Measured memory_bytes: 25628
using System;
class p
{
  static void Main()
  {
    string[] ipt = Console.ReadLine().Split(' ');
    int N = int.Parse(ipt[0]);
    int A = int.Parse(ipt[1]);
    int B = int.Parse(ipt[2]);
    
    int sum = 0;
    for (int i = 1; i <= N; i++) {
      int k1 = i % 10;
      int k2 = i % 100 / 10;
      int k3 = i % 1000 / 100;
      int k4 = i % 10000 / 1000;
      int k5 = i / 10000;
      int ksum = k1 + k2 + k3 + k4 + k5;
      if (A <= ksum && ksum <= B) {
        sum += i;
      }
    }
    Console.WriteLine(sum);
  }
}

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

int main() 
{
    int n, m;
    cin >> n >> m;

    map<int, vector<int>> mp;
    rep(i,n) {
        int a, b;
        cin >> a >> b;
        
        mp[m-a].push_back(b);
    }

    ll ans = 0;
    priority_queue<int> que;
    for(int i = m-1; i>=0; i--) {
        for(auto v : mp[i]) que.push(v);
        if(!que.empty()) {
            ll x = que.top(); que.pop();
            ans += x;
        }
    }

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


Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,ans=0,memo=0;
    cin>>n;
    init_fact(n);
    for(int k=1;k<=n-1;k++){
        if(k-1<n-1-k)continue;
        int c=comb(k-1,n-1-k)*kaijo[k]%mod*kaijo[n-1-k]%mod;
        ans+=k*(c-memo+mod)%mod;
        memo=c;
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 18760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;

int x, y, z, k;
long long a[1001], b[1001], c[1001], tmp[3001], ans[3001];
int ta[3001];


int main()
{
	long long maxx;
	int pos, t;
	
	scanf("%d%d%d%d", &x, &y, &z, &k);
	for (int i = 1; i <= x; ++i)
		scanf("%lld", a + i);
	for (int i = 1; i <= y; ++i)
		scanf("%lld", b + i);
	for (int i = 1; i <= z; ++i)
		scanf("%lld", c + i);
	sort(a + 1, a + x + 1, greater<long long>());
	sort(b + 1, b + y + 1, greater<long long>());
	sort(c + 1, c + z + 1, greater<long long>());
	for (int i = 1; i <= x; ++i)
		ta[i] = 1;
	t = min(k, x * y);
	for (int i = 1; i <= t; ++i) {
		maxx = 0ll;
		for (int j = 1; j <= x; ++j)
			if (ta[j] <= y && maxx < a[j] + b[ta[j]]) {
				maxx = a[j] + b[ta[j]];
				pos = j;
			}
		tmp[i] = maxx;
		++ta[pos];
	}
	for (int i = 1; i <= t; ++i)
		ta[i] = 1;
	for (int i = 1; i <= k; ++i) {
		maxx = 0ll;
		for (int j = 1; j <= t; ++j)
			if (ta[j] <= z && maxx < tmp[j] + c[ta[j]]) {
				maxx = tmp[j] + c[ta[j]];
				pos = j;
			}
		ans[i] = maxx;
		++ta[pos];
	}
	for (int i = 1; i <= k; ++i)
		printf("%lld\n", ans[i]);
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
#define lli long long int
#define fop(i,m,n) for (int i=(m);i<(n);i++)
#define FOP(i,m,n) for (int i=(m)-1;i>=(n);--i)
#define test(x) cout << #x << ' ' << x << endl;
#define printv(a) {\
    for (auto i : a) cout << i << ' ';\
    cout << '\n';\
}
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define ld long double
#define pll pair<lli,lli>
#define tiii tuple<int,int,int>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define X first
#define Y second
#define oset tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update>
auto SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);

// AC automaton will help me get AC!
struct AC {
    vector <vector <int>> ch;
    vector <int> cnt, f;
    AC () {extend();}
    void extend() {
        ch.pb(vector <int>(26, 0));
        cnt.pb(0);
    }
    int next(int u, int v) {
        if (!ch[u][v]) {
            ch[u][v] = ch.size();
            extend();
        }
        return ch[u][v];
    }
    void insert(string &s) {
        int now = 0;
        for (char c : s) {
            now = next(now, c - 'a');
        }
        cnt[now]++;
    }
    void build_fail() {
        f.assign(ch.size(), 0);
        queue <int> q;
        for (int i = 0; i < 26; ++i) if (ch[0][i]) q.push(ch[0][i]);
        while (q.size()) {
            int v = q.front(); q.pop();
            for (int i = 0; i < 26; ++i) if (ch[v][i]) {
                    int k = f[v];
                    while (k && !ch[k][i]) k = f[k];
                    if (ch[k][i]) k = ch[k][i];
                    f[ch[v][i]] = k;
                    cnt[ch[v][i]] += cnt[k];
                    q.push(ch[v][i]);
                }
        }
    }
    int match(string &s) {
        int k = 0, ans = 0;
        for (char c : s) {
            while (k && !ch[k][c - 'a']) k = f[k];
            if (ch[k][c - 'a']) k = ch[k][c - 'a'];
            ans += cnt[k];
        }
        return ans;
    }
};

const int mod = 1e9 + 7, x = 864197532, N = 1000087, logN = 17;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = 1 << 30;
    fop (i,0,s.length()) {
        if (i + t.length() > s.length()) break;
        int tmp = 0;
        fop (j,0,t.length()) {
            if (s[i + j] != t[j]) tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3664
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll r, d, x2000; cin >> r >> d >> x2000;

    ll x = x2000;
    RANGE(i, 1, 10) {
        x = x * r - d;
        cout << x << endl;
    }
    
}

Measured memory_bytes: 256
n, a = gets.to_s.split.map{|t|t.to_i}
x    = gets.to_s.split.map{|t|t.to_i}

x.map!{|t|t-a}
x.sort!
x.reverse!
# p x
h = Hash.new(0)
h[0] = 1
x.each do |t|
  s = h.dup
  h.keys.each do |k|
    next if k+t < 0
    # p h
    s[k+t] += h[k]
    # p [t, k,h[k]] if k + t == 0
  end
  h = s.dup
end

# p h

puts h[0] - 1

Measured memory_bytes: 4860
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;  
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
#define setbits __builtin_popcount
#define endl '\n'
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
int main()
{
    fastIO;
    ll n,a,b;
    cin>>n>>a>>b;
    ll x,y,val,val1;
    x=a+b;
    y=n/x;
    val=n%x;
    ll ans=0;
    if(b==0)
    {
        ans+=n;
    }
    else
    if(a!=0)
    {
        if(b==0)
        {
            ans+=val;
        }
        else
        {
            val1=val-a;
            if(val1>=0)
            {
                ans+=a;
            }
            else
            {
                ans+=val;
            }
        }
        ans+=a*y;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
S = input()
ans = 0
if S == 'SUN':
    ans = 7
elif S == 'MON':
    ans = 6
elif S == 'TUE':
    ans = 5
elif S == 'WED':
    ans = 4
elif S == 'THU':
    ans = 3
elif S == 'FRI':
    ans = 2
elif S == 'SAT':
    ans = 1

print(ans)

Measured memory_bytes: 3060
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[N];
        int[] b = new int[N];
        int[] c = new int[M];
        int[] d = new int[M];
        int min = 0;
        int[] num = new int[N];
        
        for(int i=0; i<N; i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        for(int i=0; i<M; i++){
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
        }
        for(int i=0; i<N; i++){
            for(int j=0; j<M; j++){
                int l = (int)Math.abs(a[i]-c[j])+(int)Math.abs(b[i]-d[j]);
                if(j==0){
                    min = l;
                    num[i] = j+1;
                }
                if(min > l){
                    min = l;
                    num[i] = j+1;
                }
            }
        }
        for(int i=0; i<N; i++){
            System.out.println(num[i]);
        }
    }
}

Measured memory_bytes: 35852
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int x;
   cin >> x;

   int y = x;
   while (true) {
      bool ok = true;
      for (int i = 2; i * i <= y; i++) {
         if (y % i == 0) ok = false;
      }
      if (ok) {
         cout << y << endl;
         return 0;
      }
      y++;
   }
   return 0;
}

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;
int a[N];
int main() {
	ios_base::sync_with_stdio(0);

	int n,m;
	cin >> n >> m;
	forn(i,2 * m){
		int x;
		cin >> x;
		a[x]++;
	}
	
	forn(i,n) cout << a[i + 1] << endl;
  	return 0;
}




Measured memory_bytes: 256