akhauriyash/Code-Regression huggingface dataset:
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！
  //未定義動作に気を付ける！！
  //DPや二分探索の範囲に気をつける！！

  int a,b,c;
  cin >> a >> b >> c;

  cout << min(c,b/a) << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int H, W, K;
		cin >> H >> W >> K;

		vector<string> c( H );
		int bl = 0;
		for( int i = 0; i < H; ++i ) {
			cin >> c[i];
			bl += (int)count( c[i].begin(), c[i].end(), '#' );
		}

		int ans = 0;
		for( int i = 0; i < (1<<H); ++i ) {
			for( int j = 0; j < (1<<W); ++j ) {
				int cnt = 0;

				for( int y = 0; y < H; ++y ) {
					for( int x = 0; x < W; ++x ) {
						if( (i & (1<<y)) || (j & (1<<x)) ) {
							cnt += c[y][x] == '#';
						}
					}
				}

				if( bl-cnt == K ) { ans += 1; }
			}
		}
		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <list>
#include <cstdint>
#include <bits/stdc++.h>
#include <queue>
#include <set>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for (int i = n - 1; i >= 0; i--)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template <class T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
  if (b < a)
  {
    a = b;
    return 1;
  }
  return 0;
}

using namespace std;
using uif = uint_fast64_t;
using ll = long long int;

int qp(int a, ll b)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mod;
    a = 1ll * a * a % mod;
  } while (b >>= 1);
  return ans;
}
int qp(int a, ll b, int mo)
{
  int ans = 1;
  do
  {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll, ll);
ll mod_add(ll, ll);
ll mod_mul(ll, ll);
ll mod_div(ll, ll);
void make_fact(ll);
void make_invfact(ll);

int main(void)
{

  ll n, m;
  cin >> n >> m;
  string s;
  cin >> s;

  vector<ll> vec(n + 1, INT_MAX);
  vec[0] = n;
  ll path = 1;
  ll bp = n;
  ll flagEn = false;
  while (bp > 0)
  {
    for (ll i = 1; i <= m; i++)
    {
      if (bp - i >= 0 && s[bp - i] != '1' && vec[path] > bp - i)
      {
        vec[path] = bp - i;
        if (bp - i == 0)
        {
          flagEn = true;
          break;
        }
      }
    }
    if (flagEn)
      break;
    bp = vec[path++];
    if (bp == INT_MAX)
    {
      cout << -1 << endl;
      return 0;
    }
    //cout << bp << endl;
  }
  /*
  for (ll i = 0; i < path + 1; i++)
  {
    cout << vec[i] << endl;
  }
  */
  for (ll i = path - 1; i >= 0; i--)
  {
    cout << vec[i] - vec[i + 1] << " ";
  }
  cout << endl;

  return 0;
}

ll mod_pow(ll x, ll r)
{
  if (r == 0)
    return 1;
  else if (r == 1)
    return x % mod;
  else if (r % 2 == 0)
  {
    ll t = mod_pow(x, r / 2) % mod;
    return t * t % mod;
  }
  else
  {
    ll t = mod_pow(x, r / 2) % mod;
    ll k = t * t % mod;
    return k * x % mod;
  }
}
ll mod_add(ll a, ll b)
{
  return (a + b) % mod;
}

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

ll mod_div(ll a, ll b)
{
  return mod_mul(a, mod_pow(b, mod - 2));
}

void make_fact(ll n)
{
  fac[0] = 1;
  rep(i, n)
  {
    fac[i + 1] = mod_mul(fac[i], i + 1);
  }
}

void make_invfact(ll n)
{
  invfac[n] = mod_pow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; i--)
  {
    invfac[i] = mod_mul(invfac[i + 1], i + 1);
  }
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>

bool solve() {
    int n;
    std::cin >> n;
    if (n == 0) return false;

    std::vector<std::pair<int, int>> segs{{0, n}};

    int q, l, r, m;
    std::cin >> q >> l >> r >> m;

    std::vector<std::pair<int, int>> front, mid;
    while (q--) {
        int x, y;
        std::cin >> x >> y;
        y -= x;

        int it = 0;
        while (x > 0) {
            auto& p = segs[it];
            int len = p.second - p.first;

            if (len <= x) {
                x -= len;
                front.push_back(p);
                ++it;
            } else {
                front.emplace_back(p.first, p.first + x);
                p.first += x;
                x = 0;
            }
        }

        while (y > 0) {
            auto& p = segs[it];
            int len = p.second - p.first;

            if (len <= y) {
                y -= len;
                mid.push_back(p);
                ++it;
            } else {
                mid.emplace_back(p.first, p.first + y);
                p.first += y;
                y = 0;
            }
        }

        segs.erase(segs.begin(), segs.begin() + it);
        std::copy(mid.begin(), mid.end(), std::back_inserter(segs));
        std::copy(front.begin(), front.end(), std::back_inserter(segs));

        mid.clear();
        front.clear();
    }

    int it = 0;
    --l, --m;
    r -= l;

    while (l > 0) {
        auto& p = segs[it];
        int len = p.second - p.first;

        if (len <= l) {
            l -= len;
            ++it;
        } else {
            p.first += l;
            l = 0;
        }
    }

    while (r > 0) {
        auto& p = segs[it];
        int len = p.second - p.first;

        if (len <= r) {
            r -= len;
            mid.push_back(p);
            ++it;
        } else {
            mid.emplace_back(p.first, p.first + r);
            p.first += r;
            r = 0;
        }
    }

    int ans = 0;
    for (auto p : mid) {
        p.second = std::min(p.second, m + 1);
        ans += std::max(0, p.second - p.first);
    }
    std::cout << ans << "\n";

    return true;
}

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

    while (solve()) {}

    return 0;
}



Measured memory_bytes: 3260
import java.util.Scanner;
public class Main{
	int x;
	
	public void solve(){
		Scanner sc = new Scanner(System.in);
		x=sc.nextInt();
		System.out.println(x*x*x);
		
	}
	public static void main(String[] args){
		Main obj = new Main();
		obj.solve();
	}
}

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

/*
a*3+b*3+c*3+d*4
(a+b+c+d)*3+d
(a+b+c)*3+d*4
*/

int main(void){
	vector<int>alp(30,0);
	int N;
	cin >> N;
	char in;
	for(int i = 0; i < N; ++i){
		cin >> in;
		if(i%2==0)	alp[in-'a']++;
	}
	int count = 0;
	for(int i = 9; i >= 2; --i){
		int temp = 0;
		for(int j = 0; j < 26; ++j){
			if(alp[j]==i){
				temp++;
			}
		}
		if(temp == 0)	continue;
		if(temp == 1){
			count += 4;
		}else{
			count += temp * 2 + 4;
		}
	}
	int temp = 0;
	for(int j = 0; j < 26; ++j){
		if(alp[j]==1){
			temp++;
		}
	}
	count += temp * 2;

	cout << count-1 << endl;
	return 0;
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<math.h>

int main(void){
  int i,j,x,max=1;
  
  scanf("%d",&x);
  
  for(i=2;i<x/2;i++){
    for(j=1;(int)pow(i,j)<=x;j++){
      if(max<(int)pow(i,j)){
        max = (int)pow(i,j);
      }
    }
  }
  
  printf("%d\n",max);
  
  return 0;
}

Measured memory_bytes: 384
import java.io.*
import java.util.*
import kotlin.math.*

fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	var (r,g,b) = f.readLine().split(" ").map{it.toInt()}
	val n = f.readLine().toInt()
	var answer = 0

	while(g <= r){
		answer++
		g*=2
	}

	while(b <= g){
		answer++
		b*=2
	}

	if(answer <= n) println("Yes")
	else println("No")
}


Measured memory_bytes: 36348
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int count_pair(vector<ll> &u) {
    map<int, int> m;
    for (ll t : u) m[t]++;

    int ans = 0;
    for (auto e : m) {
        ans += (e.second) / 2;
    }
    return ans;

}

int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    vector<vector<ll>> u(m);
    rep(i, n) {
        ll s = v[i];
        ll t = (s % m);
        u[t].push_back(s);
    }

    int ans = 0;
    rep(i, m) {
        int j = m - i;
        if (i > j) continue;
        if (i == j || i == 0) {
            int now = u[i].size() / 2;
            ans += now;
        } else {
            int uis = u[i].size();
            int ujs = u[j].size();
            if (uis > ujs) {
                int p = count_pair(u[i]);
                int sp = min((uis - ujs) / 2, p);

                int now = sp + ujs;
                ans += now;
            } else {
                int p = count_pair(u[j]);
                int sp = min((ujs - uis) / 2, p);

                int now = sp + uis;
                ans += now;
            }

        }
    }

    cout << ans << endl;
}


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

using namespace std;
#define FOR(i,a,b) for(int i= a ; i < b; i++)
#define SZ(a) (int)a.size()

using PII = pair<int, int>;
using LL = long long;
const int INF = 1e9;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;

int main(){
  char a,b;cin>>a>>b;
  if(a==b)puts("=");
  else if(a>b)puts(">");
  else puts("<");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin>>a[i];
    int ans=INF;
    for(int i=-100;i<101;i++){
        int tmp=0;
        REP(j,n){
            tmp += (a[j] - i) * (a[j] - i);
        }
        ans = min(ans,tmp);
    }
    cout << ans << endl;
}


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


#-------------------------------------------------------------------------
#白から黒に変えていく

def search() :
    H,W=map(int,input().split())
    pos=deque([])

    D= [[True]*(W+2)]                                  #True True True True
    D+=[[True]+[False]*W+[True] for i in range(H)]     #True FalseFalseTrue
    D.append([True]*(W+2))                             #True True True True

    for i in range(H) :
        maze=input()
        for j in range(W) :
            if maze[j]=="#" :
                pos.append([i+1,j+1,0])
                D[i+1][j+1]=True
 
    while len(pos)>0 :
        h,w,depth=pos.popleft()
        if not D[h+1][w] :
            pos.append([h+1,w,depth+1])
            D[h+1][w]=True

        if not D[h-1][w] :
            pos.append([h-1,w,depth+1])
            D[h-1][w]=True

        if not D[h][w+1] :
            pos.append([h,w+1,depth+1])
            D[h][w+1]=True

        if not D[h][w-1] :
            pos.append([h,w-1,depth+1])
            D[h][w-1]=True

    return depth            

print(search())


Measured memory_bytes: 168340
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//cout<<setprecision(20)
//cin.tie(0);
//ios::sync_with_stdio(false);
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
int UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint A,B,C,K;cin>>A>>B>>C>>K;
	if(K%2==0){cout<<A-B<<endl;}else{cout<<B-A<<endl;}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main() {
    cin>>N>>A>>B;
    if(A >= B){
        S = "delicious";
    }else if(A + N >= B){
        S = "safe";
    }else{
        S = "dangerous";
    }
    cout<<S<<endl;
}

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

using namespace std;

int main(){
        vector<int> v[1005];
        bool used[1005];
        int dis[1005];
        memset(used, 0, sizeof(used));
        memset(dis, -1, sizeof(dis));
        int N ; cin >> N;
        for(int j = 0; j < N; j++){
            int id, t, tmp; cin >> id >> t;
            for (int i = 0; i < t; i++){
                cin >> tmp;
                v[id].push_back(tmp);
                //v[tmp].push_back(id);
            }
        }
        queue<int> q;
        q.push(1);
        used[1] = 1;
        dis[1] = 0;
        while(!q.empty()){
            int k = q.front();
            q.pop();
            for (int x : v[k]){
                if(!used[x]){
                    q.push(x);
                    dis[x] = dis[k] + 1;
                    used[x] = 1;
                }
            }
        }
        for (int i = 1; i <= N; i++)
            cout << i << " " << dis[i] << '\n';

}



Measured memory_bytes: 3160
import Data.Fixed

main = 
    interact (calc . words)

calc :: [String] -> String
calc (a:b:_) = 
    d ++ " " ++ r ++ " " ++ f ++ "\n"
    where
        x = (read::String->Int) a
        y = (read::String->Int) b
        d = show $ x `div` y
        r = show $ x `mod` y
        s = (read::String->Pico) a
        t = (read::String->Pico) b
        f = show $ s / t


Measured memory_bytes: 4176
import Data.Array.ST (STUArray, runSTUArray, newArray, writeArray, getBounds)
import Data.Array.Unboxed
import Data.Ix (range)
import Control.Monad.ST (ST,runST)
import Control.Monad
import Control.Applicative

type PosXY = (Int,Int) 
type Box = UArray PosXY Char
type STBox s = ST s (STUArray s PosXY Char)

readDigits = map read <$> words <$> getLine :: IO [Int]
readDigits' = map read <$> lines <$> getContents :: IO [Int]

mkBox :: Int -> Int -> Box
mkBox w h =
    let dirs = [(1,0), (0,1), (-1,0), (0,-1)] in
    runSTUArray $ do
        box <- newArray ((1,1),(w,h)) '.' :: STBox s 
        go box (1,1) dirs
    where
    go :: (STUArray s PosXY Char) -> PosXY -> [PosXY] -> STBox s 
    go box _ [] = return box
    go box xy dxdys@(dxy:nextdxys) = do
        rng <- getBounds box
        writeArray box xy '#' 
        let nxy = (\(x1,y1) (x2,y2) -> (x1+x2, y1+y2)) xy dxy
        if (inRange rng nxy) then
            go box nxy dxdys
        else
            go box xy nextdxys

main :: IO ()
main = 
    loop
    where
    loop = do
        [h,w] <- readDigits
        unless (h == 0 && w == 0) $ do
            let box = mkBox w h
            let ((sx,sy), (ex,ey)) = bounds box
            putStrLn $ unlines [[box!(x,y) | x<-[sx..ex]] | y<-[sy..ey]]
            loop

Measured memory_bytes: 5024
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;
typedef long long LL;

int main(){
    LL N, M;
    cin >> N >> M;
    vector<LL> delta(M+2);
    for(int i = 0; i < N; ++i){
        LL l, r;
        cin >> l >> r;
        LL w = r+1 - l;
        delta[0] += 1;
        delta[w] -= 1;
        LL div = w+1;
        LL rest = 0;
        while(div <= M){
            //cerr << "div=" << div << " l=" << l << endl;
            LL v = (l + div-1) / div;
            if(v <= 0) break;
            LL div2 = r / v;
            //cerr << "div2=" << div << endl;
            if(div2 >= div){
                delta[div-1] += 1;
                delta[div2] -= 1;
            }
            if(v <= 1) break;
            div = max(div2+1, (l + (v-1)-1) / (v-1));
        }
    }
    LL ans = 0;
    for(int i = 0; i < M; ++i){
        ans += delta[i];
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
unsigned long long a[N]={0},s[N],b[N]={0},n,n2,maxi,sum,flag=0;
int main()
{
	scanf("%llu",&n);
	for(unsigned long long i=0;i<=n;i++)
		scanf("%llu",&a[i]);
	s[0]=a[0];
	if(n==0)
		if(a[0]==1)
		{
			printf("1");
			return 0;
		}
		else
		{
			flag=-1;
			printf("-1");
			return 0;	
		}
	for(unsigned long long i=1;i<=n;i++)
			s[i]=a[i]+s[i-1];	
	{
		n2=1;
		if(a[0]!=0)
		{
			for(unsigned long long i=1;i<=n;i++)
			{
				if(a[i]!=0)
				{
					flag=-1;
					printf("-1");
					return 0;
				}
			}
			b[0]=n2;
		}
		else
		{
			if(n==0)
			{
				flag=-1;
				printf("-1");
				return 0;
			}
			else
				b[0]=n2;
		}
	}
	for(unsigned long long i=1;i<=n;i++)
	{
		if(flag == 0)
		{
			n2=n2*2;
			if(a[i]>n2)
			{
				flag=-1;
				printf("-1");
				return 0;	
			}
			else
			{
				maxi=s[n]-s[i-1];
				if(maxi<=n2)
				{
					flag=1;
					n2=maxi;
					b[i]=n2;
					n2=n2-a[i];
				}
				else
				{
							b[i]=n2;
							n2= n2 - a[i];
				}
			}		
		}
		else
		{
			b[i]=n2;
			n2=n2-a[i];
		}
	}
	for(unsigned long long i=0;i<=n;i++)
		sum+=b[i];
	printf("%llu",sum);
	return 0;
}

Measured memory_bytes: 6172
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

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

    ll ret = 0;
    for (int i = 0; i < 60; i++) {
        int count = 0;
        for (int j = 0; j < n; j++) {
            if (a[j] & (1LL << i))count++;
        }

        ll now = (1LL << i) % MOD;
        now *= count, now %= MOD;
        now *= n - count, now %= MOD;
        ret += now, ret %= MOD;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
class Main {
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        
        if (a < b && b < c){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 26412
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    string s;
    cin >> s;
    int n = s.size();
    ll ans = 0;

    for(int bit=0;bit<(1<<(n-1));bit++){
        string cur;
        cur = s[0];
        for(int i=0;i<n-1;i++){
            if(! (bit & (1<<i))) cur += s[i+1];
            else{
                ans += stoll(cur);
                cur = s[i+1];
            }
        }
        ans += stoll(cur);
    }

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



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

using namespace std;

using Int = long long;
using P = pair<int, int>;

const long long MOD = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-9;


int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  map<int, int> m;
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
    m[v[i]]++;
  }
  int ans = 1;
  for (int i = 0; i < N; ++i) {
    int X = v[i];
    int n = m[X - 1] + m[X] + m[X + 1];
    ans = max(ans, n);
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  string s; cin >> s;
  int n = s.size();
  bool first = true;
  if (n & 1) { first = (s[0] != s[n - 1]); }
  else { first = (s[0] == s[n - 1]); }
  printf("%s\n", first ? "First" : "Second");
  return 0;
}


Measured memory_bytes: 512
from math import sqrt,gcd,ceil 
def ii():return int(input())
def mi():return map(int,input().split())
def li():return list(mi())
def si():return input()

n=ii()
a=li()
s=1
if 0 in a:
    print(0)
    exit(0)
for i in a:
    s*=i
    if(s>1e18):
        break
if(s>1e18):
    s=-1
print(s)

Measured memory_bytes: 84684
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){

  string S;
  cin >> S;

  int ans = 0;

  vector<int> dp, temp;
  for(int i=0; i<2019; i++){
    dp.push_back(0);
    temp.push_back(0);
  }
  for(int i = 0; i < S.size(); i++){
    int d = S[i] - '0';
    for(int j = 0; j < 2019; j++){
      int next_j = (10 * j + d) % 2019;
      temp[next_j] += dp[j];
    }
    temp[d]++;
    ans += temp[0];
    for(int j = 0; j < 2019; j++){
      dp[j] = temp[j];
      temp[j] = 0;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3724
def mod_comb(n,k,mod):
    result = 1
    for i in range(n-k+1,n+1):
        result *= i
        result %= mod
    for i in range(1,k+1):
        result *= pow(i,mod-2,mod)
        result %= mod
    return result


def main():
    n,a,b = map(int,input().split())
    mod = 10**9+7
    ans = pow(2,n,mod)-1
    ans = (ans - mod_comb(n,a,mod))%mod
    ans = (ans - mod_comb(n,b,mod))%mod
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38896
//#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
//#define int long long
#define double long double
#define vec vector
#define vi vector<int>
#define FZ(n) memset((n),0,sizeof(n))
#define FMO(n) memset((n),-1,sizeof(n))
#define unset unordered_set
#define ii pair<int, int>
#define vii vector<ii>
#define F first
#define S second
#define PB push_back
#define ALL(x) begin(x),end(x)
#define SZ(x) ((int)(x).size())
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first, l.second+r.second};
} 
typedef void (*callback_function)(void); // type for conciseness
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

void FILEIO() {  freopen("in.txt", "r", stdin);  freopen("out.txt", "w", stdout); }
// Init variables here

void input() {
	
}

class Graph { 
    int V; 
    list<int>* adj; 
    void DFSUtil(int v, bool visited[]); 
public: 
    Graph(int V); 
    void addEdge(int v, int w); 
    int NumberOfconnectedComponents(); 
}; 
  
int Graph::NumberOfconnectedComponents() 
{ 
    bool* visited = new bool[V]; 
    int count = 0; 
    for (int v = 0; v < V; v++) 
        visited[v] = false; 
    for (int v = 0; v < V; v++) { 
        if (visited[v] == false) { 
            DFSUtil(v, visited); 
            count += 1; 
        } 
    } 
    return count; 
} 
  
void Graph::DFSUtil(int v, bool visited[]) 
{ 
    visited[v] = true; 
    list<int>::iterator i; 
    for (i = adj[v].begin(); i != adj[v].end(); ++i) 
        if (!visited[*i]) 
            DFSUtil(*i, visited); 
} 
  
Graph::Graph(int V) 
{ 
    this->V = V; 
    adj = new list<int>[V]; 
} 
  
void Graph::addEdge(int v, int w) 
{ 
    adj[v].push_back(w); 
    adj[w].push_back(v); 
} 


void solve() {
	int n, m; cin >> n >> m;
	Graph g(n);
	FOR(i, 0, m) {
		int x, y, z; cin >> x >> y >> z;
		g.addEdge(x-1, y-1);
	}
	cout << g.NumberOfconnectedComponents() << endl;
}

//#undef int
int main() {
//#define int long long
  ios_base::sync_with_stdio(false); cin.tie();
 // FILEIO();
//auto beginProgram = chrono::steady_clock::now();

  //int t; cin >> t;
  //while (t--) 
  {
    input();
    solve();
  }

  //auto endProgram = chrono::steady_clock::now();

  return 0;
}



Measured memory_bytes: 12800
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Long n = sc.nextLong();
        String[] nd = String.valueOf(n).split("");
        int sn = 0;
        for (int i = 0; i < nd.length; i++) {
            sn += Integer.parseInt(nd[i]);
        }
        if (n % sn == 0) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }

}


Measured memory_bytes: 23380
// AOJ Volume 0 Problem 0032

#include <stdio.h>

int main(void)
{
	int l1, l2, diag;
	int rect, lozen;
	
	rect = lozen = 0;
    while (scanf("%d,%d,%d", &l1, &l2, &diag) != EOF){
		if (l1 * l1 + l2 * l2 == diag * diag){
			rect++;
		}
		else {
			if (l1 == l2){
				lozen++;
			}
		}
    }

	printf("%d\n%d\n", rect, lozen);
	
    return (0);
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long K = scan.nextLong();
        List<Long> A = new ArrayList<>();
        List<Long> F = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(scan.nextLong());
        }
        for (int i = 0; i < N; i++) {
            F.add(scan.nextLong());
        }
        A.sort(Comparator.naturalOrder());
        F.sort(Comparator.reverseOrder());
        long r = 0;
        for (int i = 0; i < N; i++) {
            r += A.get(i) * F.get(i);
        }
        long l = -1;
        while (l + 1 < r) {
            long m = (l + r) / 2;
            long count = 0;
            for (int i = 0; i < N; i++) {
                count += Math.max(A.get(i) - m / F.get(i), 0);
            }
            if (count <= K) {
                r = m;
            } else {
                l = m;
            }
        }
        System.out.println(r);
    }
}


Measured memory_bytes: 109580
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18

int main() {
    // input(sunippets: inpv, inpn, inps)
    ll A, B, C;
    cin >> A >> B >> C;
    
    // calculation
    cout << (A*B)/2 << "\n";
    
    return 0;
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second

typedef pair<lint, lint> P;
const lint MOD = 1e9+7;
const lint INF = MOD * MOD;
const int MAX = 100005;

int main(){
    int n; cin >> n;
    string s1, s2; cin >> s1 >> s2;
    vector<int> pattern; pattern.push_back(-1);
    rep(i, n){
        if(s1[i] == s2[i]) pattern.push_back(1);
        else{
            pattern.push_back(0);
            i++;
        }
    }
    lint ans = 1;
    rep(i, pattern.size() - 1){
        int x = pattern[i], y = pattern[i + 1];
        if(x == -1){
            if(y == 0) ans *= 6;
            else ans *= 3;
        }
        if(x == 0){
            if(y == 0) ans *= 3;
            else ans *= 1;
        }
        if(x == 1){
            if(y == 0) ans *= 2;
            else ans *= 2;
        }
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
// #define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb() push_back()
#define mod 100000007
#define elif else if
#define str string

signed main(){
  int A,B,M,O,P,count=0,count2=0,Amax=0,imin=0,Amin=0;
  double d;
  char c;
  string S;
  cin>>A>>B;
  vector <int>N(3);
  N={1,2,3};
  rep(0,3)if(A!=N[i]&&B!=N[i])cout<<N[i]<<endl;
}


Measured memory_bytes: 256
/*
 * atcoder/abc130/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int A[5], K;

void input() {
  loop(n,0,5) cin >> A[n];
  cin >> K;
}

void solve() {
  for (int len=2; len<=5; len++) {
    for (int l=0; l+len<=5; l++) {
      int r=l+len;
      if (abs(A[l]-A[r-1]) > K) {
        cout << ":(" << endl;
        return;
      }
    }
  }
  
  cout << "Yay!" << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


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

// 計算量(V+E)
const int maxv = 101010;
// 頂点数，辺数
int v, e;
vector<int> g[maxv];
bool used[maxv];
// トポロジカルソートされた数列
vector<int> ans;

void dfs(int u) {
    if (used[u]) return;
    used[u] = true;
    for (auto& i : g[u]) dfs(i);
    // 帰りがけ順で追加
    ans.push_back(u);
}

void tsort() {
    for (int i=0; i<v; ++i) dfs(i);
    reverse(ans.begin(), ans.end());
}

int dp[101010];


int main() {
    cin >> v >> e;
    rep(i, e) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
    }

    tsort();
    reverse(ans.begin(), ans.end());

    int ret = 0;
    for (int i : ans) {
        for (int u : g[i]) {
            dp[i] = max(dp[i], dp[u] + 1);
        }
        ret = max(ret, dp[i]);
    }

    cout << ret << endl;
}


Measured memory_bytes: 8824
n,m = map(int, input().split())
pyl = [ [] for _ in range(n+1) ]

for i in range(m):
    p,y = map(int, input().split())
    pyl[p].append((y,i))

ans = ['']*m
for p, yil in enumerate(pyl):
    top = str(p).zfill(6)
    yil.sort()
    for order,(y,i) in enumerate(yil):
        bottom = order+1
        bottom = str(bottom).zfill(6)
        ans[i] = top+bottom

for a in ans:
    print(a)

Measured memory_bytes: 39000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const ll mod=1e9+7;
ll mu(ll a,ll b){
  return (ll)a*b%mod;
}
ll ad(ll a,ll b){
  if((a+=b)>=mod)a-=mod;
  return a;
}
ll pw(ll a,ll b,ll c=1LL){
  for(;b;b>>=1,a=mu(a,a))if(b&1)c=mu(c,a);
  return c;
}
ll dv(ll a,ll b){
  return mu(a,pw(b,mod-2));
}


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

  vector<int> cou_o(63);
  vector<int> cou_z(63);
  rep(i,63) cou_o[i]=cou_z[i]=0;
  int n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];

    //  rep(i,60){
  rep(j,n){
    //    bool st=false;
    for(int i=62; i>=0;i--){
      //      if((1LL<<i)&a[j]) st=true;
      //      if(st){
	if((1LL<<i)&a[j]) cou_o[i]++;
	else cou_z[i]++;
	//      }
    }
  }
  
  //  rep(i,62) cout << cou_o[i];
  //  cout << ""<<endl;
  //  rep(i,62) cout << cou_z[i];
  //  cout << ""<<endl;
  ll ans=0;
  
  rep(i,n){
    bool st=false;
    rep(j,62){
      //if((1LL<<j)&a[i]) st=true;
      //      if(st){
	if((1LL<<j)&a[i]) ans = ad(ans, mu(pw(2LL,j),cou_z[j]));
	else ans = ad(ans, mu(pw(2,j),cou_o[j]));
	//	cout << cou_o[i] << " " << mu(pw(2,j),cou_o[j]) << endl;
	//	cout << ans << endl;
	//      }
    }
  }
  cout << dv(ans,2LL) << endl;
  
  return 0;
    

}


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

int main(){

    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;i++)
        cin >> A[i];
    int Q;
    cin >> Q;
    vector<int> B(Q),C(Q);
    for(int i=0;i<Q;i++)
        cin >> B[i] >> C[i];

    int D[100001] = {0};
    for(int i=0;i<N;i++){
        D[A[i]]++;
    }

    ll sum = 0;
    for(int i=0;i<N;i++)
        sum += A[i];

    for(int i=0;i<Q;i++){
        if(D[B[i]] > 0){
            sum += (C[i] - B[i]) * D[B[i]];
            D[C[i]] += D[B[i]];
            D[B[i]] = 0;
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 4820
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
//V,P(大文字)使用不可
//乗算の際にオーバーフローに注意せよ！！（適切にmodをとれ）
//制約をよく読め！

const ll INF=1e18;

signed main(){
    ll a,b,c;
    cin>>a>>b>>c;
    bool ok=1;
    if(c-a-b<=0) ok=0;
    if(ok){
        ll x=4*a*b;
        ll z=(c-a-b)*(c-a-b);
        if(x>=z) ok=0;
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007
#define pb push_back

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
int main() {
	while(1){
		
		//cout << "n start" << endl;
		int n; cin >> n;
		if (n == 0) break;
		//cout << "n end" << endl;
		
		//cout << "init start" << endl;
		vector<string> str(n);
		for(int i = 0; i < n; i++) {
			cin >> str[i];
		}
		//cout << "init end" << endl;	
		
		//cout << "for i start" << endl;
		int ans = 0;
		for(int i = 0; i < n; i++) {
			int idx = 0;
			ans = i;	
			vi check = {5,7,5,7,7};
			for (int j = i; j < n; j++) {
					if(check[idx] <= 0) {
						idx++;
					}
					if (idx == 6){
						break;
					}
					check[idx] -= str[j].size();
					
			}
			int sum = 0;
			for (int k = 0; k < 5; k++) {
				sum += check[k];
			}
			if (sum == 0){
				break;
			}

		}
		////cout << "for i end" << endl;
		cout << ans + 1 << endl;
		//cout << "end" << endl;
	}
	return 0;
}

Measured memory_bytes: 3216
import sys
sys.setrecursionlimit(10 ** 7)
h, w = map(int, input().split())
s = [input() for i in range(h)]
t = [[None] * w for i in range(h)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
def dfs(i, j, bw):
    global h, w
    if not (0 <= i < h and 0 <= j < w) or s[i][j] == bw or t[i][j]:
        return 0, 0
    t[i][j] = True
    W, b = 0, 0
    if s[i][j] == "#":
        b += 1
    else:
        W += 1
    for k in d:
        n, m = dfs(i + k[0], j + k[1], s[i][j])
        W += n
        b += m
    return W, b
ans = 0
for i in range(h):
    for j in range(w):
        X, Y = dfs(i, j, "u shi ta pu ni chi a ku n wara")
        ans += X * Y
print(ans)

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

int main() {
  int64_t n,k;
  cin >> n >> k;
  
  int64_t di = n / k;
  int64_t result = n - di * k;
  if (abs(result - k) < result) {
   cout << abs(result - k);}
  else {
  cout << n % k;
  }
  
}


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

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main() {
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
	off;
	int x,a;
	cin>>x>>a;
	if(x<a)
		cout<<0;
	else
		cout<<10;

  	return 0;
}

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

int main() {
	string s;
	string s_tem;
	string s_fini;
	cin >> s;

	int num;
	num = s.size();
	for (int i = 0; i < num; i++) {
		
		s_tem = s.substr(i, 1);
		if (s_tem == "0") {
			s_fini.push_back('0');
		}
		else if (s_tem == "1") {
			s_fini.push_back('1');

		}
		else if (s_tem == "B") {
			if (s_fini.size() == 0) {
				s_fini.push_back('0');
			}
			s_fini.pop_back();
		}
		

	}
	cout << s_fini << endl;

	
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int D = sc.nextInt();
      int T = sc.nextInt();
      int S = sc.nextInt();
      if(D <= T*S){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}

Measured memory_bytes: 35820
#include<stdio.h>
int main(void){
	int N,T;
	scanf("%d%d",&N,&T);
	int a;
	int c,t;
	int min=1001;
	for(a=0;a<N;a++){
		scanf("%d%d",&c,&t);
		if(t<=T){
			if(c<min){
				min=c;
			}
		}
	}
	if(min==1001){
		printf("TLE");
	}else{
		printf("%d",min);
	}
return 0;
}

Measured memory_bytes: 128
fun main (args:Array<String>) {
    var (allBalls, bBall, rBall) = readLine()!!.split(" ").map(String::toLong)
    val brBall = bBall + rBall

    if(brBall == allBalls){
        print(bBall)
        return
    }
    if(brBall > allBalls){
        if(bBall <= allBalls){
            print(bBall)
            return
        }
        else{
            print(allBalls)
            return
        }
    }
    if(bBall == 0L){
        print(0L)
        return
    }
    if(brBall < allBalls){
        if(allBalls % brBall == 0L){
            print(allBalls / brBall * bBall)
        }
        else{
            if(allBalls % brBall > bBall){
                print((allBalls / brBall * bBall) + bBall)
            }
            else {
                print((allBalls / brBall * bBall) + (allBalls % brBall))
            }
        }
    }
}

Measured memory_bytes: 36416
#include <iostream>
#include <vector>
#include <cmath>

int main() {
    int N, K;
    std::cin >> N >> K;
    std::vector<int> hs(N);
    std::vector<int> dp_table(N);
    for (int i=0; i<N; ++i) {
        std::cin >> hs[i];
        dp_table[i] = INT32_MAX;
    }
    dp_table[0] = 0;
    for (int i=0; i<N; ++i) {
        for (int j=1; j<=K; ++j)
            dp_table[i+j] = std::min(
                    dp_table[i+j],
                    dp_table[i] + std::abs(hs[i+j] - hs[i]));
    }
    std::cout << dp_table[N-1] << std::endl;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner s = new Scanner(System.in);
        int i = s.nextInt();
        int n[] = new int[i];
        for (int j = 0; j < i; j++) {
            n[j] = s.nextInt();
        }
        int c = 0;
        while (true) {
            boolean f = false;
            for (int ni: n) {
                if ((ni % 2) != 0) {
                    f = true;
                }
            }
            if (f) break;
            for (int k = 0; k < i; k++) {
                n[k] = n[k] / 2;
            }
            c++;
        }
        System.out.println(c);
    }
}

Measured memory_bytes: 23124