akhauriyash/Code-Regression huggingface dataset:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, m = ns()

    if n > 2 and m > 2:
        ans = (n - 2) * (m - 2)
    elif n == 2 or m == 2:
        ans = 0
    elif n == 1 or m == 1:
        if n == 1 and m == 1:
            ans = 1
        else:
            ans = max(n - 2, m - 2)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5072
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=((int)(b));i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
#define iter(v,ite) for(auto ite=(v).begin();ite!=(v).end();ite++)
#define mimunum(v,x) distance((v).begin(),lower_bound((v).begin(),(v).end(),x))


lli dat[100005];
int main(void){
	int n;
	lli a,b;
	scanf("%d%lld%lld",&n,&a,&b);
	rep(i,n)scanf("%lld",&dat[i]);
	
	lli l=0,r=1000000005LL;
	while(l+1<r){
		lli m=(l+r)/2;
		lli c=0;
		rep(i,n){
			c+=max(0LL,(dat[i]-m*b+a-b-1)/(a-b));
		}
		//printf("%lld %lld\n",m,c);
		if(c<=m)r=m;
		else l=m;
	}
	printf("%lld\n",r);
	return 0;
}






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

int main()
{
	int n,W;
	cin >> n >> W;
	int w[n],v[n],cum[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> w[i] >> v[i];
	}
	long long dp[n][W+1];
	for(int i=0 ; i<n ; i++)
	{
		dp[i][0]=0;
	}
	for(int i=0;i<=W;i++)
	{
		if(w[0]<=i)
			dp[0][i]=v[0];
		else
			dp[0][i]=0;
	}
	for(int i=1;i<=W;i++)
	{
		for(int j=1;j<n;j++)
		{
			if(i-w[j]>=0)
			dp[j][i]=max(dp[j-1][i],v[j]+dp[j-1][i-w[j]]);
			else
			dp[j][i]=dp[j-1][i];

		}
	}
	cout<<dp[n-1][W]<<endl;

}

Measured memory_bytes: 78336
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int a[n][m], b[m], c[n];
    for ( int i = 0; i < n; i++ ){
        for ( int j = 0; j < m; j++ ){
            cin >> a[i][j];
        }
    }
    for ( int j = 0; j < m; j++ ){
            cin >> b[j];
    }
    for ( int i = 0; i < n; i++ ){
        c[i] = 0;
        for ( int j = 0; j < m; j++ ){
            c[i] += a[i][j] * b[j];
        }
        cout << c[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3120
import java.lang.Math

data class Point(val x: Double, val y: Double) {
    companion object {
        // 外積
        fun cross(a: Point, b: Point) = a.x * b.y - a.y * b.x
    }

    operator fun unaryMinus() = Point(-x, -y)
    operator fun inc() = Point(x + 1.0, y + 1.0)
    operator fun dec() = Point(x - 1.0, y - 1.0)
    operator fun plus(inc: Point) = Point(x + inc.x, y + inc.y)
    operator fun minus(dec: Point) = Point(x - dec.x, y - dec.y)
    operator fun times(mul: Double) = Point(x * mul, y * mul)
    operator fun div(div: Double) = Point(x / div, y / div)

    // ノルム(≒絶対値の2乗)
    fun norm() = x * x + y * y

    // 絶対値
    fun abs() = Math.sqrt(norm())
}
operator fun Double.times(p: Point) = Point(toDouble() * p.x, toDouble() * p.y)

fun main(args: Array<String>) {
    val N = readInputLine().toInt()

    val p = Array<Point>(N) { val (x, y) = readInputLine().split(" ").map { it.toDouble() }; Point(x, y)}

    val c = getMinCircle(p)

    println(Math.sqrt(c.second))
}

fun readInputLine(): String {
    return readLine()!!
}

// 最小包含円を求める関数
// 中心座標と半径の*2乗*のペアを返す
// https://tubo28.me/compprog/algorithm/minball/
fun getMinCircle(points: Array<Point>): Pair<Point, Double> {
    val eps = 1e-10

    if (points.isEmpty()) {
        return Pair(Point(0.0, 0.0), 0.0)
    }

    if (points.size == 1) {
        return Pair(points[0], 0.0)
    }

    fun makeCircle2(a: Point, b: Point): Pair<Point, Double> {
        val c = (a + b) / 2.0
        val r = (a - c).norm()
        return Pair(c, r)
    }

    fun makeCircle3(a: Point, b: Point, c: Point): Pair<Point, Double> {
        val A = (b - c).norm()
        val B = (c - a).norm()
        val C = (a - b).norm()
        val S = Point.cross(b - a, c - a)
        val p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4.0 * S * S)
        val r = (p - a).norm()
        return Pair(p, r)
    }

    fun isInCircle(a: Point, c: Pair<Point, Double>): Boolean {
        return (a - c.first).norm() <= c.second + eps
    }

    var c = makeCircle2(points[0], points[1])

    for (i in 2 until points.size) {
        if (!isInCircle(points[i], c)) {
            c = makeCircle2(points[0], points[i])
            for (j in 1 until i) {
                if (!isInCircle(points[j], c)) {
                    c = makeCircle2(points[i], points[j])
                    for (k in 0 until j) {
                        if (!isInCircle(points[k], c)) {
                            c = makeCircle3(points[i], points[j], points[k])
                        }
                    }
                }
            }
        }
    }

    return c
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, k;
string s, t;

// <------------- Implement Functions Here ----------> //

ll par[200000] = {}, cou[200000] = {};
ll ans[200000] = {};
ll u[200000] = {}, v[200000] = {};

ll find(ll x) {
	if (x == par[x]) return x;
	par[x] = find(par[x]);
	return par[x];
}

ll Union(ll x, ll y) {
	ll X = find(x);
	ll Y = find(y);

	par[Y] = X;

	ll val = cou[X] * cou[Y];

	cou[X] += cou[Y];
	cou[Y]  = cou[X];

	return val;
}

void print_par() {
	for (ll i = 1; i <= n; i++) {
		printf("%-2lld ", i);
	}
	printf("\n");
	for (ll i = 1; i <= n; i++) {
		printf("%-2lld ", par[i]);
	}
	printf("\n");
	for (ll i = 1; i <= n; i++) {
		printf("%-2lld ", cou[i]);
	}
	printf("\n\n");
}

// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n >> m;
	for (ll i = 1; i <= n; i++) par[i] = i, cou[i] = 1;
	for (ll i = 1; i <= m; i++) {
		cin >> u[i] >> v[i];
	}

	ans[m] = n * (n - 1) / 2;
	for (ll i = m; i > 1; i--) {
		//print_par();
		if (find(u[i]) != find(v[i])) {
			ll val = Union(u[i], v[i]);
			ans[i - 1] = max(0ll, ans[i] - val);
		}
		else ans[i-1] = ans[i];
	}
	//print_par();

	for (ll i = 1; i <= m; i++) cout << ans[i] << "\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 7584
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = input[0];
            int K = input[1];
            var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long ans = 0;
            if (N == 1) { ans = Math.Abs(x[0]); }
            else
            {
                int r = 0;
                int l = K - 1;
                List<int> dif = new List<int>();
                while (l < N)
                {
                    dif.Add(Math.Abs(x[r]) + Math.Abs(x[l] - x[r]));
                    dif.Add(Math.Abs(x[l]) + Math.Abs(x[l] - x[r]));
                    l++;
                    r++;
                }
                ans = dif.Min();
            }
            Console.WriteLine(ans);

            Console.Out.Flush();
        }
    }



    public class Calculation
    {

    }

    public class Graph
    {

    }
}
    

Measured memory_bytes: 21728
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    LL n,k;
    cin >> n >> k;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    VI f(200000+1,-1), l(200000+1,-1);
    VI ne(n);
    REP(i,0,n) {
        ne[i] = i;
        if (f[a[i]] == -1) {
            f[a[i]] = l[a[i]] = i;
        } else {
            ne[l[a[i]]] = i;
            l[a[i]] = i;
        }
    }
    REP(i,0,200000+1) if (l[i] > -1) ne[l[i]] = f[i];
    int index = 0, cnt = 1;
    while (true) {
        //dump(index);
        int next = ne[index];
        if (next <= index) ++cnt;
        index = (next + 1) % n;
        if (index == 0) break;
    }
    //cout << cnt << endl;
    k %= cnt;
    {
        int index = 0, cnt = 0;
        while (cnt < k - 1) {
            int next = ne[index];
            if (next <= index) ++cnt;
            index = (next + 1) % n;
            if (index == 0) break;
        }
        VI ans;
        while (index < n) {
            if (ne[index] <= index) {
                ans.push_back(a[index]);
                ++index;
            } else index = ne[index] + 1;
        }
        REP(i,0,ans.size()) {
            if (i) cout << " ";
            cout << ans[i];
        }
        cout << endl;
    }
}

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

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

int main() {
  long long  h;
  cin >> h;
  
  long long n_count = 1;
  long long a_count = 0;
  while (h) {
    a_count += 1 * n_count;
    n_count *= 2;
    h /= 2;
  }
  
  cout << a_count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define reverse(x) reverse(x.begin(), x.end())
#define sort(x) sort(x.begin(), x.end())
#define pb push_back
#define pii pair<int, int>
#define pll pair<long long,long long>
#define f first
#define s second
typedef long long ll;
const ll mod = 1e9+7;
using namespace std;

ll modpow(ll a, ll b, ll m) {
	ll p = 1, q = a;
	for (int i=0;i<32;i++) {
		if((b / (1LL << i)) % 2 == 1) { p *= q; p %= m; }
		q *= q; q %= m;
	}
	return p;
}

ll Div(ll a, ll b, ll m) {
	return (a * modpow(b, m - 2, m)) % m;
}

ll ncr(ll n, ll r) {
	if (n < r || r < 0) return 0;
	ll rem = 1;
	for (ll i = n - r + 1; i <= n; i++) { rem *= i; rem %= mod; }
	for (int i = 1; i <= r; i++) rem = Div(rem, i, mod);
	return rem;
}

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

	ll V1 = modpow(2, N, mod); V1 = (V1 + mod - 1LL) % mod;
	ll V2 = ncr(N, A);
	ll V3 = ncr(N, B);
	cout << (V1 - V2 - V3 + mod * mod) % mod << endl;
	return 0;

}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

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

template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_mset;

#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'


ll a, b, k;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	//ifstream cin("/Users/konwoo/input.txt");
	//ofstream cout("/Users/konwoo/output.txt");

	cin >> a >> b >> k;
	if (k < a) cout << a - k << " " << b << newl;
	else if (k >= a && k < a + b) cout << 0 << " " << b + a - k << newl;
	else cout << 0 << " " << 0 << newl;

















	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;

int main() {
  int N;
  ll x;
  cin >> N >> x;
  vector<ll> a(N);
  for (int i=0; i<N; i++) cin >> a[i];
  ll res = 0;
  if (a[0]>x) {
    res += a[0]-x;
    a[0] = x;
  }
  for (int i=0; i<N-1; i++) {
    if (a[i]+a[i+1]>x) {
      res += a[i]+a[i+1]-x;
      a[i+1] = x-a[i];
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 4056
#include<stdio.h>
#include<string.h>
int a[4][12];
int main()
{
	int n,i,j,v;
	char c;
	scanf("%d",&n);
	while(n--)
	{
		memset(a,0,192);
		for(i=0;i<9;++i)scanf("%d",&a[0][i]);
		for(i=0;i<9;++i)
		{
			v=a[0][i];
			scanf(" %c",&c);
			if(c=='R')a[1][v]++;
			if(c=='G')a[2][v]++;
			if(c=='B')a[3][v]++;
		}
		v=1;
		for(i=1;i<4;++i)
		{
			for(j=1;j<=9;)
			{
				if(a[i][j]&&a[i][j+1]&&a[i][j+2])a[i][j]--,a[i][j+1]--,a[i][j+2]--;
				else if(a[i][j]>2)a[i][j]-=3;
				else ++j;
			}
			for(j=1;j<=9;++j)if(a[i][j])v=0;
		}
		printf("%d\n",v);
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int q;
    cin >> q;

    vector<pair<ll, ll>> re;

    vector<ll> v;

    bool be = false;

    ll di = 0;

    ll res = 0;

    REP(i, q)
    {
        int qu;
        cin >> qu;
        if (qu == 1)
        {
            ll a, b;
            cin >> a >> b;

            res += b;

            if (!be)
            {
                v.push_back(a);
                ll di = 0;
                be = true;
                continue;
            }

            ll prem = v[(v.size() / 2) - ((v.size() + 1) % 2)];

            int l = -1;
            int r = v.size();
            while (r - l > 1)
            {
                int mid = (r + l) / 2;
                if (v[mid] > a)
                    r = mid;
                else
                    l = mid;
            }

            v.insert(v.begin() + l + 1, a);
            ll curm = v[(v.size() / 2) - ((v.size() + 1) % 2)];

            res += abs(prem - a);

            di = curm - prem;

            //t += abs(medi - a);

            if (di > 0)
            {
                res += di * ((v.size() / 2)); //- (v.size() + 1) % 2);
                res -= di * (v.size() / 2 + (v.size() % 2));
            }
            else
            {
                res += di * ((v.size() / 2) + (v.size() % 2)); //- (v.size() + 1) % 2);
                res -= di * (v.size() / 2);
            }
            continue;
        }
        else
        {
            pair<ll, ll> r;

            r.first = v[((v.size() / 2) - (v.size() + 1) % 2)];
            r.second = res;

            re.push_back(r);
        }
    }

    for (auto i : re)
    {
        cout << i.first << " " << i.second << endl;
    }

    return 0;
}

Measured memory_bytes: 5488
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

const int MAX_N = 1e5;
int N;
int a[MAX_N];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	map<int, int> m;
	rep(i, 0, N) {
		cin >> a[i];
		m[a[i]]++;
	}

	if(N == 1) {
		cout << 1 << endl;
		return 0;
	}

	if(N == 2) {
		if(abs(a[0] - a[1]) <= 2) cout << 2 << endl;
		else cout << 1 << endl;
		return 0;
	}

	int max_v = 0;
	rep(i, 0, N - 2) {
		int tmp = m[i] + m[i + 1] + m[i + 2];
		max_v = max(max_v, tmp);
	}

	cout << max_v << endl;
}


Measured memory_bytes: 5376
n,k,q = map(int,input().split())
a = []
for i in range(q):
    a.append(int(input()))
    
players = []
for j in range(n):
    players.append(k-q)
    
for j in a:
    players[j-1] += 1

for l in players:
    if l > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 11784
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> //fixed << setprecision(10)

using namespace std;

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

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

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

int main(){
    ll a, b;
    cin >> a >> b;
    ll ans = a*b/gcd(a, b);
    cout << ans << endl;
    return 0;
}

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

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

Measured memory_bytes: 256
unittest
{
	assert( [ "5 2 2", "1 2 3 4 5" ].parse.expand.solve == "4.500000\n1" );
	assert( [ "4 2 3", "10 20 10 10" ].parse.expand.solve == "15.000000\n3" );
	assert( [ "5 1 5", "1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996" ].parse.expand.solve == "1000000000000000.000000\n1" );
	assert( [ "50 1 50", "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" ].parse.expand.solve == "1.000000\n1125899906842623" );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	input.popFront;
	auto vs = input.front.split.to!( long[] );
	return tuple( nab[ 1 ], nab[ 2 ], vs );
}

auto solve( long a, long b, long[] vs )
{
	auto m = 0.0L;
	auto p = 0L;
	auto t = 0.0L;
	auto c = 1L;
	LOOP: foreach( g; vs.sort!( ( x, y ) => y < x ).group )
	{
		for( auto i = 1L; i <= g[ 1 ] && c <= b; i++, c++ )
		{
			t += g[ 0 ];
			if( c < a ) continue;
			
			auto mm = t / c;
			auto pp = g[ 1 ].combination( i );
			if( mm < m ) break LOOP;
			
			if( m == mm ) p += pp;
			else          p  = pp;
			m = mm;
		}
	}
	return format( "%0.6f\n%s", m, p );
}

// 組み合わせ数
auto combination( long n, long k )
{
	auto r = 1L;
	for( auto d = 1L; d <= k; d++, n-- )
	{
		r *= n;
		r /= d;
	}
	return r;
}


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

int main(){
    char c;
    int n; cin >> n;
    for(int i=0;i<n;i++){
        cin >> c;
        if(c=='Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque

H,W=map(int, raw_input().split() )
S=[ raw_input() for i in range(H) ] 


D=[ (1,0), (-1,0), (0,1), (0,-1) ] 


V=[ [ 0 for i in range(W) ] for j in range(H) ]


def dfs(x,y,current):
	bc=0	#black count
	wc=0	#white count
	q = deque([]) 
	V[x][y]=1
	q.append( (x,y,current) )

	while q:
		x,y,current=q.popleft()

		if current == "#":	  bc+=1
		else:  wc+=1

		for dx,dy in D:
			if 0<=x+dx<H and 0<=y+dy<W:
				next=S[x+dx][y+dy] 
				if V[x+dx][y+dy]==0 and current !=next:
						V[x+dx][y+dy]=1
						q.append( (x+dx, y+dy,next) )

	return bc*wc




ans=0
for x in range(H):
	for y in range(W):
		if S[x][y]=="#" and V[x][y]==0:
			ans+=dfs(x,y, "#")

print ans


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

using namespace std;

long long S;
const int e9 = 1e9;
const long long e18 = 1LL * e9 * e9;

void print (long long x1, long long y1, long long x2, long long y2)
{
    long long x0 = 0, y0 = 0;
    assert (1LL * x1 * y2 - 1LL * x2 * y1 == S);
    if (y1 < 0) y2 -= y1, y0 -= y1, y1 = 0;
    if (y2 < 0) y1 -= y2, y0 -= y2, y2 = 0;

    if (x1 < 0) x2 -= x1, x0 -= x1, x1 = 0;
    if (x2 < 0) x1 -= x2, x0 -= x2, x2 = 0;
    printf ("%lld %lld %lld %lld %lld %lld\n", x0, y0, x1, y1, x2, y2);
    exit (0);
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%lld", &S);
//printf ("%lld\n", e18);
long long p = 0, u = e9, mij, ras;
while (p <= u)
{
    mij = (p + u) / 2LL;
    if (1LL * mij * mij <= S) ras = mij, p = mij + 1;
    else u = mij - 1;
}
if (S == 1LL * ras * ras)
    print (ras, 0, 0, ras);
///ras^2<S<(ras+1)^2
long long df = S - 1LL * ras * ras, df2 = 1LL * (ras + 1) * (ras + 1) - S;
if (df < e9)
    print (ras, -1, df, ras);
assert (df2 <= e9);
print (ras + 1, 1, df2, ras + 1);
return 0;
}


Measured memory_bytes: 764
// ARC100-C Or Plus Max

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

typedef pair<long long, long long> pll;
const long long INF = 1LL << 60;

void chmax(pll &a, pll b);

signed main() {
    int N;
    cin >> N;

    vector<long long> A(1<<N);
    vector<pll> dp(1<<N);

    for(int bit = 0; bit < (1<<N); bit++ ) {
        cin >> A[bit];
        dp[bit] = {A[bit], -INF};
    }

    for(int i = 0; i < N; i++ ) {
        for(int bit = 0; bit < (1<<N) ;bit++ ) {
            if(bit & (1<<i) ) {
                chmax(dp[bit], dp[bit^(1<<i)] );
            }
        }
    }

    long long res = -INF;

    for(int bit = 0; bit < (1<<N); bit++ ) {
        long long tmp = dp[bit].first + dp[bit].second;
        res = max(res, tmp);

        if(bit) {
            cout << res << '\n';
        }
    }

    return (0);
} 

void chmax(pll &a, pll b) {
    if(a.first < b.first) {
        a.second = max(a.first, b.second);
        a.first = b.first;
    } 
    else {
        a.second = max(a.second, b.first);
    }

    return ;
}

Measured memory_bytes: 9432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(void) {
  int H, R;
  cin >> H >> R;
  if (H + R < 0) {
    cout << -1 << endl;
  } else if (H + R == 0) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
  return 0;
}



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

using namespace std;

int main(int argc, char* argv[])
{
	int  n, x, t;
	cin >>n >> x>> t;
	int ret = 0;
	while(n > 0)
	{
		ret += t;
		n -= x;
	}		
	cout << ret;
  return 0;
}

Measured memory_bytes: 3616
//In the name of ALLAH
#include <bits/stdc++.h>
using namespace std;

#define int int64_t


int32_t main() {
	int n;
	string s,t;
	cin>>n;
	cin>>s>>t;
	for(int i=0;i<n;i++) {
		cout<<s[i]<<t[i];
	}
	cout<<"\n";
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
int MOD = 1e9+7;

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

    int a,b;
    cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    return 0;
}


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

int main (){
	int x,y,s;
	while(cin>>x>>y>>s && x){
		int ans=0;
		for(int i=1;i<s;i++){
			for(int j=1;j<s;j++){
				int a=i;
				int b=j;
				if(a*(100+x)/100+b*(100+x)/100==s){
					ans=max(ans,a*(100+y)/100+b*(100+y)/100);
				}
			}
		}
		cout<<ans<<endl;
	}
}

/*
5 8 105
8 5 105
1 2 24
99 98 24
12 13 26
1 22 23
1 13 201
13 16 112
2 24 50
1 82 61
1 84 125
1 99 999
99 1 999
98 99 999
1 99 11
99 1 12
0 0 0
*/


Measured memory_bytes: 3040
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        a[0] = sc.nextInt();
        a[1] = sc.nextInt();
        a[2] = sc.nextInt();
        int max = Math.max(Math.max(a[0], a[1]), a[2]);
        int el1 = Math.min(Math.min(a[0], a[1]), a[2]);
        int el2 = a[0] + a[1] + a[2] - max - el1;
        int ans;
        if(a[0] % 2 == a[1] % 2 && a[1] % 2 == a[2] % 2)
            ans = (max * 3 - a[0] - a[1] - a[2]) / 2;
        else{
            if((max - el1) % 2 == (max - el2) % 2)
                ans = (2 * max - el1 - el2) / 2;
            else{
                ans = (max - el1 + 1) / 2 + (max - el2 + 1) / 2 + 1;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21204
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll M, D;
  cin >> M >> D;
  ll ans = 0;
  for (int i = 1; i <= M; i++) {
    for (int j = 22; j <= D; j++) {
      string d = to_string(j);
      if (d[1] - '0' > 1 && i == (d[0] - '0') * (d[1] - '0')) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt(), n = sc.nextInt();
		int sum=0,count=0,flag=0,max=-999999,min=99999;
		//String[] array = new String[N];
		//String s=sc.next(),t=sc.next(),buff="";
		if(d==0) {
			if(n!=100)System.out.println(n);
			else System.out.println(n+1);
		}else if(d==1) {
			if(n!=100)System.out.println(n*100);
			else System.out.println((n+1)*100);
		}else {
			if(n!=100)System.out.println(n*10000);
			else System.out.println((n+1)*10000);
		}
		/*if(Integer.parseInt(s)%sum==0) {
			System.out.println("Yes");//Yes or YES注意
		}else {
			System.out.println("No");
		}*/

		//System.out.println("No");

	}
	public static int sample(int n) {
		return n;
	}

}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n;cin >>n;
    vector<ll>d(n);
    for (int i = 0; i < n; ++i) {
        cin >>d[i];
    }
    sort(all(d));
    ll pre=0;ll ans=0;
    for (int i = 0; i < n; ++i) {
        if(d[i]>pre){
            pre=d[i];
            ans++;
        }
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    long int a,b,x;
    scanf("%ld",&x);
    for(a=-200;a<=200;a++){
        for(b=-200;b<=a;b++){
            if(pow(a,5)-pow(b,5)==x){
                break;
            }
        }
        if(pow(a,5)-pow(b,5)==x){
            break;
        }
    }
    printf("%ld %ld",a,b);
    return 0;
}

Measured memory_bytes: 2616
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type Abbreviation ---------- */
using ll = long long;

/* ---------- Constants ---------- */
const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

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

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

int main() {
    string S;
    int K;
    cin >> S >> K;

    int N = S.size();

    vector<string> vec;

    for (int i = 0; i < 26; i++) {
        if (vec.size() > K) break;

        char al = (char) (i + (int)'a');

        for (int j = 0; j < N; j++) {
            for (int k = 1; k <= K && j + k <= N; k++) {
                string str = S.substr(j, k);
                if (find(vec.begin(), vec.end(), str) != vec.end()) continue;
                vec.push_back(str);
            }
        }
    }

    sort(vec.begin(), vec.end());

    cout << vec[K-1] << endl;

    return 0;
}

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

using lli = long long int;
using Vint = vector<int>;
using Vlli = vector<lli>;
using Wint = vector<Vint>;
using Wlli = vector<Vlli>;
using pii = pair<int, int>;
using pll = pair<lli, lli>;

const int MOD = 1e9 + 7;
const int INFi = 2e9 + 1;
const lli INFl = (lli)(9e18) + 1;
// const vector<pii> DXDY = {make_pair(1, 0), make_pair(-1, 0), make_pair(0, 1), make_pair(0, -1)};

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); (i)++)
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); i--)
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(i, vec) for(auto (i) = (vec).begin(); (i) != (vec).end(); (i)++)
#define vrREP(i, vec) for(auto (i) = (vec).end()-1;(i) != (vec).begin()-1;(i)--)

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

string fir = "First\n", sec = "Second\n";

int main(void){
  string s; cin >> s;
  /* s_head == s_tail => aba, ababa,... => 2k - 1
  *  s_head != s_tail => ab, abab, ... => 2k
  */
  if(s.at(0) == s.at(s.size() - 1)) cout << ((s.size() % 2 == 0) ? fir : sec);
  else cout << ((s.size() % 2 == 0) ? sec : fir);
  return 0;
}

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

int main(){
  int s;
  cin >> s;
  int a = s/1000;  s %= 1000;
  int b = s/100;  s %= 100;
  int c = s/10;  s%= 10;
  int d = s;
  string op[3];
  for(int bit=0; bit < (1<<3); ++bit){
    int ans = a;
    if(bit&(1<<2)){
      ans += b; op[2] = '+';
    }
    else{
      ans -= b; op[2] = '-';
    }
    if(bit&(1<<1)){
      ans += c; op[1] = '+';
    }
    else{
      ans -= c; op[1] = '-';
    }
    if(bit&(1<<0)){
      ans += d; op[0] = '+';
    }
    else{
      ans -= d; op[0] = '-';
    }
    if(ans == 7){
      cout << a << op[2] << b << op[1] << c << op[0] << d << '=' << 7 << "\n";
      return 0;
    }
   }
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i,k,n) for(int i = k; i < n; i++)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define argmax max_element
#define argmin min_element
#define ALL(x) (x).begin(), (x).end()

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

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

template<class T = ll> T in() {
    T _in;
    cin >> _in;
    return _in;
}

int num[4];
string ans = "null";
//
// bool DFS(int sum, bool op, int k, string res) {
//     if(k == 3) {
//         if(op)
//             if (sum+num[3] == 7) {
//                 ans = res + "+" + to_string(num[3]);
//                 return true;
//             } else return false;
//         else
//             if (sum-num[3] == 7) {
//                 ans = res + "-" + to_string(num[3]);
//                 return true;
//             } else return false;
//     }
//
//     if(DFS(sum+num[k], true, k+1, res+"+"+to_string(num[k])))
//         return true;
//     if(DFS(sum-num[k], false, k+1, res+"-"+to_string(num[k])))
//         return true;
//
//     return false; // 念のため
// }

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

    string ABCD;
    cin >> ABCD;

    // rep(i, 4) {
    //     num[i] = ABCD[i] - '0';
    // }
    int a=ABCD[0] - '0';
    int b=ABCD[1] - '0';
    int c=ABCD[2] - '0';
    int d=ABCD[3] - '0';

    // if(!DFS(num[0], true, 1, to_string(num[0])))
    //     DFS(num[0], false, 1, to_string(num[0]));

    // たかだか8通りしかない
    bool op[3];
    if(a+b+c+d == 7) {
        op[0] = op[1] = op[2] = true;
    } else if(a+b+c-d == 7) {
        op[0] = op[1] = true;
        op[2] = false;
    } else if(a+b-c+d == 7) {
        op[0] = op[2] = true;
        op[1] = false;
    } else if(a+b-c-d == 7) {
        op[0] = true;
        op[1] = op[2] = false;
    } else if(a-b+c+d == 7) {
        op[0] = false;
        op[1] = op[2] = true;
    } else if(a-b+c-d == 7) {
        op[1] = true;
        op[0] = op[2] = false;
    } else if(a-b-c+d == 7) {
        op[0] = op[1] = false;
        op[2] = true;
    } else if(a-b-c-d == 7) {
        op[0] = op[1] = op[2] = false;
    }

    ans = ABCD[0];
    rep(i, 3) {
        if(op[i]) {
            ans += "+";
        } else {
            ans += "-";
        }
        ans += ABCD[i+1];
    }

    cout << ans << "=7" << endl;

    return 0;
}


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

int main(){
    int X;
    cin >> X;
    if(X == 3 || X == 5) {
        cout << "YES" << endl;
    }
    else if(X == 7){
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int n = scanner.nextInt();
        int r = scanner.nextInt();

        if (n >= 10) {
            System.out.println(r);
        } else {
            System.out.println(r + 100 * (10 - n));
        }
    }
}

Measured memory_bytes: 21716
import itertools
H, W, K = map(int,input().split())
S = [list(map(int,list(input()))) for _ in range(H)]
def check(k):
    if k <= K:
        return(True)
    else:
        return(False)
        
noans = 0
def make_lst(i):
    global noans, lst, havelst
    temp = S[0][i]
    for h in range(H-1):
        if y[h]:
            lst.append(temp)
            temp = S[h+1][i]
        else:
            temp += S[h+1][i]
    lst.append(temp)
    if check(max(lst)):
        havelst = 1
    else:
        noans = 1
#    print(y,i,lst, "makelst")
               
def nocut(i):
    global cutnum, lst, havelst, noans
    prelst = []
    temp = S[0][i]
    if i == W-1:
        if not check(temp):
            noans = 1
    j = 0
    for h in range(H-1):            
        if y[h]:
            lst[j] += temp
            prelst.append(temp)
            j += 1
            temp = S[h+1][i]
        else:
            temp += S[h+1][i]
        if i == W-1:
            if not check(temp):
                noans = 1
    prelst.append(temp)
    lst[-1] += temp
    if check(max(lst)):
#        print(y,i,lst,"nocut", "cutnum = ",cutnum)
        return(True)
    else:
        cutnum += 1
        lst = prelst        
#        print(y,i,lst,"cut","cutnum =",cutnum)
        
                 
ans = float("inf")    
for y in itertools.product((0, 1), repeat=H-1):
    havelst = 0
    lst = []
    cutnum = sum(y)
    for x in range(W):
        if noans:
            break
        if havelst:
            nocut(x)
        else:
            make_lst(x)
#    print(y,cutnum)
    if noans:
        noans = 0
        continue
    else:
        ans = min(cutnum, ans)
print(ans)

Measured memory_bytes: 3188
#include <cstdio>
#include <algorithm>
#include <bitset>
using namespace std;
const int SIZEN = 10000 + 10;
bitset <SIZEN> b;
int N,K,a[SIZEN] = {0},n = 0;

bool Judge(int x){
	for(int i = 0;i <= K;i++)b[i] = 0;
	b |= 1;
	for(int i = 1;i <= n;i++)if(i!=x){
		b |= (b<<a[i]);
	}
	for(int i = 1;i < K;i++)if(b[i]){
		if(i + a[x] >= K)return false;
	}
	return true;
}

void work(){
	for(int i = 1;i <= N;i++){
		if(a[i] >= K)continue;
		a[++n] = a[i];
	} 
	sort(a+1,a+1+n);
	int l = 1,r = n,mid;
	while(l <= r){
		mid = (l+r)>>1;
		if(Judge(mid))l = mid+1;
		else r = mid-1;
	}
	printf("%d\n",r);
	return; 
}
int main(){ 
	scanf("%d%d",&N,&K);
	for(int i = 1;i <= N;i++)scanf("%d",&a[i]);
	work();
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;cin>>h>>w;
    vector<string> s(h);
    rep(i,h){cin>>s.at(i);}
    vector<vector<ll> > dp(h,vector<ll>(w,0));
    dp.at(0).at(0)=1;
    rep(i,h){
        rep(j,w){
            if(s.at(i).at(j)=='#'){continue;}
            if(j!=w-1){
                dp.at(i).at(j+1) += dp[i][j];
                dp[i][j+1] %= MOD;
            }
            if(i!=h-1){
                dp.at(i+1).at(j) += dp[i][j];
                dp[i+1][j] %= MOD;
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
    return 0;
}


Measured memory_bytes: 9216
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>



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

using namespace std;
int n;

int main(){
  cin >> n;
  int ans = 0;
  REP(i,1e9){
    if(i*i>n){
      cout << ans << endl;
      return 0;
    }
    ans = i*i;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<(a-c)*(b-d)<<endl;
    return 0;
}

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

typedef long long ll;

#define rep(var,n) for(int var=0;var<(n);++var)
const ll MOD = 1e9+7;

ll fct[2001],inv[2001],fill[2000];

inline ll ModPow(ll base,ll exp,ll mod){
  ll ret = 1;
  base %= mod;
  while(exp>0){
    if(exp&1) ret = (ret*base)%mod;
    base = (base*base)%mod;
    exp >>= 1;
  }
  return ret;
}

inline void Fct(ll N){
  fct[0] = fct[1] = 1;
  for(ll i=2; i<=N; fct[i]%=MOD,i++)
    fct[i] = fct[i-1]*(i%MOD);
}

inline void ModInv(ll N){
  Fct(N);
  inv[N] = ModPow(fct[N],MOD-2,MOD);
  for(ll i=N-1; i>=0; inv[i]%=MOD,i--)
    inv[i] = inv[i+1]*(i+1);
}

inline ll Comb(ll n, ll r){
  return fct[n]*(inv[r]*inv[n-r]%MOD)%MOD;
}

int main(){
  ll n,k; cin >> n >> k;
  ModInv(n);
  rep(i,k) cout << (Comb(k-1,i)*Comb(n-k+1,i+1))%MOD << endl;
  return 0;
}

Measured memory_bytes: 256
void solve();

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

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <vector>
#include <string>
using namespace std;

vector<long long> dp[2];   //dp[0]:未確定 dp[1]:確定
vector<long long> L;
string S;
int MOD = 1e9 + 7;

void solve() {
	cin >> S;
	L.resize(S.size());
	for (int n = 0; n < S.size(); n++) L[n] = S[n] - '0';
	dp[0].resize(S.size());
	dp[1].resize(S.size());
	dp[0][0] = 2;
	dp[1][0] = 1;
	for (int n = 1; n < S.size(); n++) {
		dp[0][n] = (dp[0][n - 1] * (L[n] + 1)) % MOD;
		dp[1][n] = (3*dp[1][n-1]+L[n]*dp[0][n-1]) % MOD;
	}
	cout << (dp[0].back()+dp[1].back()) % MOD << endl;
	return;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main()
{

   int n,T,cost[1000],time[1000],mx=1000000,cnt=0;
//   pair<int> p=make_pair();
   cin>>n>>T;
   for(int i=1;i<=n;i++)
   {
      cin>>cost[i]>>time[i];
      if(T>=time[i])
      {
          if(cost[i]<=mx) {
               mx=cost[i];
                cnt++;
          }

      }
    //p.push_back(make_pair(c[i],t[i]));

   }
   if(cnt==0) cout<<"TLE"<<endl;
   else
      cout<<mx<<endl;



    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            long N = sc.nextLong();
            long A = sc.nextLong();
            long B = sc.nextLong();

            long ans;

            if ((B - A) % 2 == 0) {
                ans = (B - A) / 2;
            } else {
                long ans1 = (N - B) + 1 + (B - A - 1) / 2;
                long ans2 = (A - 1) + 1 + (B - A - 1) / 2;
                ans = Math.min(ans1, ans2);
            }

            System.out.println(ans);
        }
    }

}


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

int main(){
    int n;
    cin >> n;
    double money,total=0.0;
    string type;
    for(int i=0; i<n; i++) {
        cin >> money >> type;
        if(type == "JPY") total += money;
        else {
            total += (money*380000.0);
        }
    }
    cout << total << endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int n,x,sum,c;
    cin>>n>>x;
    int m[x];
    sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>m[i];
        sum+=m[i];
    }
    int min=m[0];
    for(int i=1;i<n;i++)
    {
        if(m[i]<min)
            min=m[i];
    }    
    int left=x-sum;
    c=n;
    c+=left/min;
    cout<<c;
    return 0;

}


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

#define LL long long
#define VI vector<int>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

using namespace std;

template <class T> int find_index(T x, const std::vector<T> &v) {
    auto it = std::find(v.begin(), v.end(), x);
    if (it != v.end()) { return (int)std::distance(v.begin(), it); }
    return -1;
}
template<class T> T ceil(T a, T b) { return (a + b - 1) / b; }

template <class T> void print(T x) {
    std::cout << x << std::endl;
}
// 4近傍（右, 下, 左, 上）
const vector<int> dy = { 0, -1, 0, 1 };
const vector<int> dx = { 1, 0, -1, 0 };



void solve(long long N, vector<int> A){

    map<LL, LL> height_count;
    map<int, int> height_leftidx;
    FOR(i, 0, N) {
        LL h = A[i];
        if (height_count[h] == 0) {
            height_leftidx[h] = i;
        }
        height_count[h]++;
    }
    height_count[0] = 1;

    vector<int> height;
    FOE(p, height_count) {
        height.push_back((int)p.first);
    }
    sort(RALL(height));

    int min_idx = height_leftidx[height[0]];
    vector<LL> ans(N);
    FOR(i, 0, height.size() - 1) {
        int h1 = height[i];
        int h2 = height[i + 1];

        min_idx = min(min_idx, height_leftidx[h1]);

        ans[min_idx] += height_count[h1] * (h1 - h2);
        height_count[h2] += height_count[h1];
    }

    FOR(i, 0, N) {
        cout << ans[i] << endl;
    }
}

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

    long long N;
    cin >> N;
    vector<int> A(N);
    FOR(i, 0, N) {
        cin >> A[i];
    }
    solve(N, A);
    return 0;
}



Measured memory_bytes: 15740
from collections import deque
import sys
input = sys.stdin.readline


def bfs(i1, j1) -> list:
    U, D, L, R = 0, 1, 2, 3
    INF = 10 ** 18
    dist = [[INF] * w for _ in range(h)]
    dist[i1][j1] = 0
    q = deque([(0, i1, j1)])
    while q:
        d, i, j = q.popleft()
        #if dist[i][j] < d:
        #    continue
        for di, dj in ((-1, 0), (1, 0), (0, -1), (0, 1)):
            for length in range(1, k + 1):
                nxt_i = i + di * length
                nxt_j = j + dj * length
                if not(0 <= nxt_i < h and 0 <= nxt_j < w):
                    break
                if c[nxt_i][nxt_j] == "@":
                    break
                if dist[i][j] + 1 > dist[nxt_i][nxt_j]:
                    break
                if dist[i][j] + 1 < dist[nxt_i][nxt_j]:
                    dist[nxt_i][nxt_j] = dist[i][j] + 1
                    q.append((dist[nxt_i][nxt_j], nxt_i, nxt_j))
    return dist


h, w, k = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
c = [input() for i in range(h)]


x1 -= 1
y1 -= 1
x2 -= 1
y2 -= 1
dist = bfs(x1, y1)
ans = dist[x2][y2]

if ans == 10 ** 18:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 145928