akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int H, W;
    cin >> H >> W;
    auto A = make_v<int>(H, W), B = A;
    auto dp = make_v<int>(H, W, 20000);
    for (size_t i = 0; i < H; i++)
    {
        for (size_t j = 0; j < W; j++)
        {
            cin >> A[i][j];
        }
    }
    for (size_t i = 0; i < H; i++)
    {
        for (size_t j = 0; j < W; j++)
        {
            cin >> B[i][j];
        }
    }
    dp[0][0][abs(A[0][0] - B[0][0])] = true;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            for (int k = 0; k < 13000; k++)
            {
                if (i + 1 < H)
                {
                    dp[i + 1][j][abs(k + A[i + 1][j] - B[i + 1][j])] |= dp[i][j][k];
                    dp[i + 1][j][abs(k + B[i + 1][j] - A[i + 1][j])] |= dp[i][j][k];
                }
                if (j + 1 < W)
                {
                    dp[i][j + 1][abs(k + A[i][j + 1] - B[i][j + 1])] |= dp[i][j][k];
                    dp[i][j + 1][abs(k + B[i][j + 1] - A[i][j + 1])] |= dp[i][j][k];
                }
            }
        }
    }
    int ans = INT_MAX;
    for (size_t k = 0; k < 13000; k++)
    {
        if (dp[H - 1][W - 1][k])
        {
            cout << k;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 508928
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		try {
			String input = br.readLine();
			int s;

			s = Integer.parseInt(input);
			
			if (!(s >= 0 && s <= 86400)) {
				throw new IllegalArgumentException();
			}
			
			int hh = s / 3600;
			int mm = (s % 3600) / 60;
			int ss = s % 60;
			
			System.out.println(hh + ":" + mm + ":" + ss);
		
		} catch(NumberFormatException e) {
			e.printStackTrace();
		} catch(IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pii;
typedef priority_queue< int, vector< int >, greater< int > >  minHeap;

#define ones(x) __builtin_popcount(x)
#define onesl(x) __builtin_popcountl(x)
#define onesll(x) __builtin_popcountll(x)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define scn(n) scanf("%d",&n)
#define scnll(n) scanf("%lld",&n)
#define scn2(n,m) scanf("%d%d",&n,&m)
#define scn3(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scn2ll(n,m) scanf("%lld%lld",&n,&m)
#define atoz(v) v.begin(),v.end()
#define ratoz(v) v.rbegin(),v.rend()
#define Fill(a,v) memset(a,v,sizeof(a))
#define fi first
#define se second
#define inf 1e9
#define pi acos(-1.0)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mod 1000000007
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bug(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"

int Set(int N,int pos)
{
    return N=N | (1<<pos);
}
int reset(int N,int pos)
{
    return N = N & ~(1<<pos);
}
bool check(int N,int pos)
{
    return (bool)(N & (1<<pos));
}

inline int addmod(lli x,lli y)
{
    return (x%mod + y%mod)%mod;
}
inline int submod(lli x,lli y)
{
    return (x%mod - y%mod + mod)%mod;
}
inline int mulmod(lli x,lli y)
{
    return (x%mod * y%mod)%mod;
}


inline int nextSubMask(int i, int mask)
{
    return (i-1)&mask;   /// returns next  submask
}

template<typename T>
void we_r_done(T mssg)
{
    cout<<mssg;
    exit(0);
}

const int N = 1e5 + 5;
int parent[N];

int Find(int x){
    if(x == parent[x]) return x;
    return parent[x] = Find(parent[x]);
}
int main()
{
    ///freopen("output.txt","w",stdout);
   // freopen("input.txt","r",stdin);
    FastIO;


    int n,m;
    while(cin>>n>>m){
        for(int i=1; i<=n; i++) parent[i] = i;
        for(int i=1; i<=m; i++){
            int x,y,z;
            cin>>x>>y>>z;
            x = Find(x);
            y = Find(y);
            if(x != y) parent[x] = y;
        }
        set<int>st;
        for(int i=1; i<=n; i++){
            st.insert(Find(i));
        }
        cout<<st.size()<<endl;
    }

    return 0;
}

///sin and cos expect input in radians not degrees. so use , sin(degrees * pi / 180)
///using bs = bitset<MX>; // how many distinct number can be form?
///sort(atoz(v), [](const data x, const data y){return (x.a==y.a?x.b>y.b : x.a<y.a);});


Measured memory_bytes: 5376
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int parent[110];
int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
bool unionSet(int x, int y) {
  x = root(x); y = root(y);
  if (x == y) { return false; }
  if (parent[x] > parent[y]) { swap(x, y); }
  parent[x] += parent[y];
  parent[y] = x;
  return true;
}

struct Edge {
  int from;
  int to;
  int cost;
  Edge() {;}
  Edge(int f, int t, int c) : from(f), to(t), cost(c) {;}
  bool operator<(const Edge &rhs) const { return cost < rhs.cost; }
};

Edge edges[100000];

int main() {
  int n, m;
  while (scanf("%d %d", &n, &m), n|m) {
    REP(i, m) {
      int f, t, c;
      scanf("%d %d %d", &f, &t, &c);
      edges[i] = Edge(f, t, c);
    }
    sort(edges, edges + m);
    int ans = 1 << 30;
    REP(i, m) {
      MEMSET(parent, -1);
      if (i != 0 && edges[i].cost == edges[i - 1].cost) { continue; }
      int sum = 0;
      int j;
      for (j = i; j < m; j++) {
        if (edges[j].cost - edges[i].cost >= ans) { break; }
        if (unionSet(edges[j].from, edges[j].to)) {
          sum++;
          if (sum == n - 1) {
            ans = min(ans, edges[j].cost - edges[i].cost);
            break;
          }
        }
      }
      if (j == m - 1 && sum != n - 1) { break; }
    }
    if (ans == (1 << 30)) { ans = -1; }
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 940
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

// Use g++ compiler for this include to work.
#include <bits/stdc++.h>

using namespace std;

// Constants 
#define INF 1e18
#define EPS 1e-9
#define MOD 1000000007
 
// // for using in pairs
#define F first
#define S second
 
// Macros
#define all(x) begin(x), end(x)
 
// aliases
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ld = long double;

// Temporary macro.
#define int long long

// Operator overloads.
/**
 * The type of element in the vector should have overload for << operator with ostream. 
 */
template<typename T>
ostream& operator<<(ostream &stream, vector<T>& v)
{
	for (const auto &it : v)
		stream << it << " ";
	return stream;
}

/**
 * Both types in the pair should have overload for << operator with ostream. 
 */
template<typename T1, typename T2>
ostream& operator<<(ostream &ostream, pair<T1, T2>& p)
{
	ostream << p.first << " " << p.second;
	return ostream;
}

template<typename T1, typename T2>
istream& operator>>(istream &istream, pair<T1, T2>& p)
{
	istream >> p.first >> p.second;
	return istream;
}

template<typename T>
istream& operator>>(istream &istream, vector<T>& a)
{
	for (auto &it : a)
		istream >> it;
	return istream;
}

// Utility functions.

int GCD(int a, int b)
{
	if (!b)
		return a;
	return GCD(b, a % b);
}

int LCM(int a, int b)
{
	return (a * b) / GCD(a, b);
}

int modpow(int x, int n, int m = MOD)
{
	if (n == 0) return 1 % m;
	long long u = modpow(x, n / 2, m);
	u = (u * u) % m;
	if (n % 2 == 1)
		u = (u * x) % m;
	return u;	
}

//////////////////// START CODE HERE ///////////////////////////

int Q = 998244353;

void solve(int tc)
{
	int n, k;
	cin >> n >> k;
	
	vector<pair<int, int>> intervals(k, {1, 1});
	cin >> intervals;

	sort(all(intervals));

	vector<int> dp(n, 0);
	dp[0] = 1;

	vector<int> D(n + 1, 0);
	D[0] = dp[0];
	D[n] = 0;

    for (int i = 1; i < n; i++) 
        D[i] = dp[i] - dp[i - 1]; 

    // for (auto &it : intervals)
    // 	cout << it.F << " " << it.S << "\n";

    // cout << dp << "\n";
    // cout << D << "\n";
    // cout << "----------------------\n";
	for (int i = 0; i < n; i++)
	{
		if (i)
		{
			dp[i] = D[i] + dp[i - 1];
			if (dp[i] < 0)
				dp[i] += Q;
			dp[i] %= Q;
		}

		if (i == n - 1)
			break;

		for (int j = 0; j < k; j++)
		{
			int l = i + intervals[j].F;
			int r = min(i + intervals[j].S, n - 1);

			if (l >= n)
				break;

			// cout << l << " " << r + 1 << "\n";
			D[l] += dp[i];
			D[r + 1] -= dp[i];
			D[l] %= Q;
			if (D[r + 1] < 0)
				D[r + 1] += Q;
			D[r + 1] %= Q;

			if (r == n - 1)
				break;
		}
		// cout << dp << "\n";
		// cout << D << "\n";
  //  	 	cout << "----------------------\n";

	}

	// cout << "\n" << dp << "\n";
	if (dp[n - 1] < 0)
		dp[n - 1] += Q;
	cout << dp[n - 1] << "\n";
}

int32_t main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t = 1;
	// cin >> t;		
	for (int i = 1; i <= t; i++)
	{
		solve(i);
	}

	return 0;
}


Measured memory_bytes: 6364
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    string s;
    cin >> s;
    int w;
    cin >> w;

    cout << s[0];
    for(int i = 1; i < s.size(); i++){
        if(i % w == 0){
            cout << s[i];
        }
    }
    cout << endl;
}

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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

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

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

bool square(ll n){
  for(ll k=1; k*k<=n; ++k){
    if(k*k == n) return true;
  }
  return false;
}

int main(){
  ll N, D; cin >> N >> D;
  ll v[N][D];
  rep(n, N) rep(d, D) cin >> v[n][d];

  ll ans = 0;
  rep(i, N) rep(j, i){
    ll sum = 0;
    rep(d, D) sum += (v[i][d] - v[j][d]) * (v[i][d] - v[j][d]);
    if(square(sum)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define endl "\n"
#define what_is(x) cout<<#x<<" is "<<x<<endl;
#define F(i,a,b) for(int i = a; i < b; i++)
#define MAX(a,b,c) max(a,max(b,c))
#define MIN(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define inf 1e18
const double pi = 3.141592653589793238460;
#define debug false
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define mod 1000000007 

void solve()
{
    int N;
    cin>>N;
    if(N<=999)
        cout<<"ABC"<<"\n";
    else cout<<"ABD"<<"\n";
}

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
        // freopen("Test.txt","r",stdin);
        // freopen("Output.txt","w",stdout);
    #endif
    
     // if(debug){watch_is();}
    solve();   
    return 0;
}

Measured memory_bytes: 256
n = int(input())
xs = [int(c) for c in input().split()]
ys = [int(c) for c in input().split()]

def dp(x, y, mods):
  if y > x:
    return False
  table = [False] * (x + 1)
  table[x] = True
  mods.sort(reverse=True)
  for mod in mods:
    for i in range(x + 1):
      table[i % mod] = table[i % mod] or table[i]
  return table[y]

def ok(mods):
  return all(dp(x, y, list(mods)) for x, y in zip(xs, ys))

if not ok(range(1, 51)):
  print(-1)
  quit(0)

mods = []
for mod in range(50, 0, -1):
  if not ok(mods + list(range(1, mod))):
    mods.append(mod)

print(sum(2 ** mod for mod in mods))

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

typedef struct POS{
	ll x;
	ll y;
};

ll n;
vector<POS> p(9);

// 階乗
ll factorial(ll k) {
	ll sum = 1;
	for (ll i = 1; i <= k; ++i)
	{
		sum *= i;
	}
	return sum;
}

double sum = 0;
void dfs(ll s, double l, ll map) {
	map |= (1LL << s);

	rep(i, n) {
		if (((map >> i) & 1) == 0) {
			double t = sqrt(pow(p[s].x - p[i].x, 2) + pow(p[s].y - p[i].y, 2));
			dfs(i, l + t, map);
		}
	}

	if (map == ((1 << n) - 1)) {
		sum += l;
	}
	return;
}

void solve_abc145() {
	cin >> n;

	double ans = 0;

	rep(i, n) {
		cin >> p[i].x >> p[i].y;
	}

	double v;
	rep(i, n) {
		dfs(i, 0, 0);
	}

	ans = sum / factorial(n);

	cout << fixed;
	cout << setprecision(10) << ans << "\n";
}

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

	solve_abc145();

	return 0;
}

Measured memory_bytes: 256
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

#define MAXN 200000
typedef long long i64;

int n;

int input() {
	if (scanf("%d", &n) < 0) return 0;
	return 1;
}

void init() {
}

int solve() {
	return n*n;
}

void output(int ans) {
	printf("%d\n", ans);
}

void cleanup() {
}

int main() {
	//precalc();
	//int ca; scanf("%d", &ca);
	while (input()) {
		init();
		output(solve());
		cleanup();
		//break;
	}
}




Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int N, i;
  cin >> N >> i;
  cout << N - i + 1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+7;
int a[25];
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    int ans=0;
    for(int i=1;i<n-1;i++){
        if(a[i]>min(a[i-1],a[i+1])&&a[i]<max(a[i-1],a[i+1])) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(){

 int n,first=1000;
 cin>>n;

 int copys = n;

  if(n<=first){
    cout<<first-n<<endl;
    return 0;
  }

   int cnt=0;
    while(copys)
   {
        int rem = copys%10;
        if(rem != 0)
            cnt++;
         copys = copys/10;
    }

    if(cnt == 1){
        cout<<"0"<<endl;
         return 0; }
   else if(cnt > 1){
    if(n > first)
    {
    while(n > first){
        first += 1000; }
    cout<<first-n<<endl;
     }

    }


 return 0;
}


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

template <typename T>
class BinaryIndexedTree
{
public:
    vector<T> arr;
    long long size;
    T initial_value;

    BinaryIndexedTree(long long N)
    {
        setSize(N);
    }

    BinaryIndexedTree(long long N, T init)
    {
        setSize(N);
        setInitialValue(init);
        initializeArr();
    }

    void setSize(long long N)
    {
        size = N + 1;
    }

    void setInitialValue(T init)
    {
        initial_value = init;
    }

    void initializeArr()
    {
        arr = vector<T>(size, initial_value);
    }

    void initializeArr(T init)
    {
        setInitialValue(init);
        initializeArr();
    }

    T func(T x, T y);

    void update(long long idx, T value)
    {
        while (idx <= size)
        {
            arr[idx] = func(arr[idx], value);
            idx += (idx & -idx);
        }
    }

    T query(long long idx)
    {
        T ret = initial_value;
        while (idx > 0)
        {
            ret = func(ret, arr[idx]);
            idx -= (idx & -idx);
        }
        return ret;
    }
};

template <typename T>
T BinaryIndexedTree<T>::func(T a, T b)
{
    return a + b;
}

long long convert_to_BIT_idx(long long idx, long long n)
{
    return idx + n + 1;
}

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

    vector<long long> a(N);
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
    }

    long long l = 1;
    long long r = 1000000001;
    while (r - l > 1)
    {
        long long c = (l + r) / 2;
        BinaryIndexedTree<long long> bit(2 * N + 1, 0);
        long long current = 0;
        long long count = 0;
        bit.update(convert_to_BIT_idx(current, N), 1);
        for (int i = 0; i < N; i++)
        {
            if (a[i] >= c)
            {
                current++;
            }
            else
            {
                current--;
            }
            count += bit.query(convert_to_BIT_idx(current, N));
            bit.update(convert_to_BIT_idx(current, N), 1);
        }

        if (count * 2 >= N * (N + 1) / 2)
        {
            l = c;
        }
        else
        {
            r = c;
        }
    }
    cout << l << endl;
}


Measured memory_bytes: 2560
import sys
sys.setrecursionlimit(1000000)

N,M = map(int, input().split())

room_and_connecting_room_dict = {i:set() for i in range(1,N+1)}

for i in range(M):
    A,B = map(int, input().split())
    room_and_connecting_room_dict[A].add(B)
    room_and_connecting_room_dict[B].add(A)

def get_child_ans(room_numbers_set): #room_number_list:前の部屋番の子ども全て
    
    next_room_numbers_set = set()
    
    for room_number in room_numbers_set:
        for child_room in room_and_connecting_room_dict[room_number]:
            if child_room not in calculated_room_numbers_set:
                ans_dict[child_room] = room_number #前の部屋番の子供は全て、前の部屋番に回答が確定する
                next_room_numbers_set.add(child_room)
                calculated_room_numbers_set.add(child_room)
 
    #終了判定
    if len(calculated_room_numbers_set) == N: #全部計算済み
        return 1
    elif len(next_room_numbers_set) == 0: #1から繋がる全てを計算したのに未計算がある
        return -1
    else: #孫がいるのでまだやる
        return get_child_ans(next_room_numbers_set)

ans_dict = dict()
ans_dict[1] = 0
calculated_room_numbers_set = set()
calculated_room_numbers_set.add(1)

is_there_ans = get_child_ans(set([1]))  

if is_there_ans == 1:
    print("Yes")
    for i in range(2,N+1):
        print(ans_dict[i])
else:
    print("No")

Measured memory_bytes: 161416
import numpy as np

N, W = map(int, input().split())

w = np.zeros(N+1, dtype = int)
v = np.zeros(N+1, dtype = int)

for i in range(1, N+1):
    w[i], v[i] = map(int, input().split())

max_v = v.sum()

dp = np.ones((N+1, max_v + 1), dtype =int) * 10**9
dp[0,0] = 0

for i in range(1, N+1):
    dp[i, :v[i]] = dp[i-1, :v[i]]
    dp[i, v[i]:] = np.minimum( dp[i-1, v[i]:], dp[i-1, :max_v+1-v[i]] + w[i] )
#    print(dp[i, :])

ans = 0
for i, j in enumerate(dp[N,:]):
    if j <= W:
        ans = i

print(ans)


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

class FirstGrader{
public:
	FirstGrader(int _N);
	~FirstGrader();
	long long int Execute();

private:
	int N;
	int num[100];
	long long int memo[100][21];
	enum PM{Plus, Minus};
	long long int correctEq(int index, int sum);
};

FirstGrader::FirstGrader(int _N) : N(_N){
	for (int i = 0; i < _N; i++){
		cin >> num[i];
	}
	// memoを-1で初期化
	for (int i = 0; i < 100; i++){
		for (int j = 0; j < 21; j++){
			memo[i][j] = -1;
		}
	}
}
FirstGrader::~FirstGrader(){};

long long int FirstGrader::correctEq(int index, int sum){
	if (index == N-2) {
		if (sum == num[N-1]) return 1;
		else return 0;
	}
	if (memo[index][sum] >=0) return memo[index][sum];

	memo[index][sum] = 0;
	if (sum + num[index + 1] <= 20) memo[index][sum] += correctEq(index+1, sum+num[index+1]);
	if (sum - num[index + 1] >= 0)  memo[index][sum] += correctEq(index+1, sum-num[index+1]);

	return memo[index][sum];
}

long long int FirstGrader::Execute(){ return correctEq(0, num[0]); }

int main(){
	int N;
	cin >> N;
	
	FirstGrader* fg = new FirstGrader(N);
	cout << fg->Execute() << endl;
	
	delete fg;
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define rep(i, x) for (ll i = 0; i < (x); i++)

using namespace std;
typedef long long int ll;

ll X, N;
map<ll, bool> mp;

int main(void) {
  cin >> X >> N;
  rep(i, N) {
    ll p;
    cin >> p;
    mp[p] = true;
  }
  ll ans = 100000;
  for (ll p = 101; p > -2; p--) {
    if (abs(p-X) <= abs(ans-X) && !mp[p])
      ans = p;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    int n, l;
    l = s.size();
    n = stoi(s);
    int ans = 0;
    for (int i = 0; i < l; i+=2) {
        if (i==l-1) {
            ans += n - pow(10, i) + 1;
        }
        else {
            ans += pow(10, i+1) - pow(10, i);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
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 <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[304];
    ll x = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 2; i < n; i++){
        x ^= a[i];
    }
    ll s = a[0] + a[1];
    for(ll i = 0; i <= 60; i++){
        if((x >> i) & 1) s -= (1ll << i);
    }
    if(s < 0){
        cout << -1 << endl;
        return 0;
    }
    ll t = 0;
    for(ll i = 60; i >= 0; i--){
        if(((x >> i) & 1) == 0 && s >= (1ll << i) * 2 && t + (1ll << i) <= a[0]){
            s -= (1ll << i) * 2;
            t += (1ll << i);
        }
    }
    if(s){
        cout << -1 << endl;
        return 0;
    }
    ll ans = a[0] - t;
    for(ll i = 60; i >= 0; i--){
        if(((x >> i) & 1) == 1 && (1ll << i) <= ans){
            ans -= (1ll << i);
        }
    }
    if(ans == a[0]) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<functional>

typedef unsigned long long LL;

using namespace std;

int main() {
	int N;
	vector<int>A;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		if(A.size() == 0 || A[A.size()-1] != a)
		A.push_back(a);
	}
	int answer = 1;
	bool isUp = false;
	bool isDet = false;
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	int buffer = A[0];
	for (int i = 1; i < A.size(); i++) {
		if (isDet == false) {
			isDet = true;
			if (buffer < A[i]) {
				isUp = true;
			}
			else {
				isUp = false;
			}
		}
		else {
			if (isUp && buffer > A[i] || !isUp && buffer < A[i]) {
				answer++;
				isDet = false;
			}
		}
		buffer = A[i];
	}
	cout << answer << endl;
}

Measured memory_bytes: 892
xy = list(map(int,input().split()))

x3 = xy[2] - (xy[3]-xy[1])
y3 = xy[3] - (xy[0]-xy[2])
x4 = xy[0] - (xy[3]-xy[1])
y4 = xy[1] - (xy[0]-xy[2])

print(x3,y3,x4,y4)


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

int main(){
	int n; cin >> n;
  	vector<unsigned long long> A(n);
  	unsigned long long ans=1;
  	unsigned long long a=pow(10,18);
  	bool zero = false;
  	bool out=false;
  	unsigned long long limit = a;
  	double t1, t2;
  	for(int i=0 ;i<n; i++){
    	cin >> A.at(i);
      	if(A.at(i) ==0){zero=true;}
     
    }
  	if(zero){cout << 0 << endl;}
  	else{
      for(int i=0 ; i<n ; i++){
        t1=log10(A[i]);
        t2=log10(ans);
        if(t1+t2>18){out = true; break;}        
      	ans*=A.at(i);
        
      }
      if(out || ans>a){cout << -1 << endl;}
      else{cout << ans << endl;}
      
    
    }
  	
}


Measured memory_bytes: 3956
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>

#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

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




int main(void) {

  int n, x;
  pair<int,int> a[100100];
  cin >> n;
  rep(i, n) {
    cin >> x;
    a[i].first = x;
    a[i].second = i;
  }

  sort(a, a + n);

  int ans = 0;
  rep(i, n) {
    if ((i-a[i].second)%2 != 0) ans++;
  }

  cout << ans/2 << endl;

  return 0;

}

  


Measured memory_bytes: 1024
def main():
    N = input()
    t = 0
    l = []
    for i in N:
        t += int(i)
        l.append(t)
    n = len(N)
    for i, v in enumerate(N):
        if int(v) > 0:
            t = max(l[i] - 1 + 9*(n - i - 1), t)
    return t
print(main())


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, s.size()) {
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3852
#include "bits/stdc++.h"

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

using namespace std;
const long long INF = 1LL << 61;

int main() {
	int N; cin >> N;
	vector<int> a(N);
	rep(i, N)cin >> a[i];

	vector<int> box(N, 0);
	rep(i, N) {
		int num = N / (N - i);
		int total = 0;
		rep(j, num - 1)total += box[(j + 2) * (N - i) - 1];
		if (total % 2 == 0) {
			if (a[N - i - 1] == 0)box[N - i - 1] = 0;
			else box[N - i - 1] = 1;
		}
		else {
			if (a[N - i - 1] == 0)box[N - i - 1] = 1;
			else box[N - i - 1] = 0;
		}
	}
	int M = accumulate(box.begin(), box.end(), 0);
	//if (M%2==box[0]) {
	cout << M << endl;
	rep(i, N) {
		if (box[i] == 1)cout << i + 1 << " ";
		}
	//}
	//else cout << -1;
}

Measured memory_bytes: 2432
n = int(input())
a = [int(input()) for i in range(n)]
a_s = sorted(a, reverse=True)
a_max = a_s[0]
a_sec = a_s[1]
for i in range(n):
    if a[i] == a_max:
        print(a_sec)
    else:
        print(a_max)

Measured memory_bytes: 14088
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct A
{
    int person;
    int isHonest;
};

int solve()
{
    int n;
    cin >> n;

    vector<vector<A>> testimonies(n, vector<A>());

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

        for (int j = 0; j < a; ++j)
        {
            A testimony;
            cin >> testimony.person;
            testimony.person--;
            cin >> testimony.isHonest;

            testimonies[i].push_back(testimony);
        }
    }

    int res = 0;

    for (int bits = 1; bits < (1 << n); ++bits)
    {
        bool ok = true;

        for (int t = 0; t < n; ++t)
        {
            if ((bits & (1 << t)) == 0) continue;

            for (int j = 0; j < testimonies[t].size(); ++j)
            {
                if (((bits >> testimonies[t][j].person) & 1) ^ testimonies[t][j].isHonest)
                    ok = false;
            }
        }

        if (ok)
            res = std::max(res, static_cast<int>(__builtin_popcount(bits)));
    }

    cout << res << endl;

    return 0;
}

int main()
{
    solve();

    return 0;
}

Measured memory_bytes: 256
K, N = map(int, input().rstrip().split())
dist_list = list(map(int, input().rstrip().split()))

maxdist = 0
for i in range(N - 1):
  dist = dist_list[i + 1] - dist_list[i]
  maxdist = max(maxdist, dist)
else:
  dist = (dist_list[0] + K) - dist_list[-1]
  maxdist = max(maxdist, dist)

print(K - maxdist)


Measured memory_bytes: 26444
#include <iostream>
#include <vector>
#include <atcoder/convolution>

int main()
{
    int N, M;
    std::cin >> N >> M;

    std::vector<int> A(N), B(M);
    for (auto& a : A) {
        std::cin >> a;
    }
    for (auto& b : B) {
        std::cin >> b;
    }

    const auto C = atcoder::convolution(A, B);
    for (const auto c : C) {
        std::cout << c << ' ';
    }
    std::cout << '\n';
}

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

using namespace std;

int main()
{
  int N, P[100000];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> P[i];
    --P[i];
  }

  int ret = 0;
  for(int i = 1; i < N; i++) {
    if(P[i - 1] == i - 1 && P[i] == i) swap(P[i - 1], P[i]), ++ret;
  }

  for(int i = 0; i + 1 < N; i++) {
    if(P[i] == i) swap(P[i], P[i + 1]), ++ret;
  }

  for(int i = N - 1; i > 0; i--) {
    if(P[i] == i) swap(P[i], P[i - 1]), ++ret;
  }

  cout << ret << endl;

}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int n = sc.nextInt();
		sc.nextLine();
		int[] ps = new int[102];
		int nearest = 0;
		for (int i = 0; i < n; i++) {
			ps[sc.nextInt()] = 1;
		}
		
		for (int i = 0; i < 102; i++) {
			if (ps[i] == 1) {
				continue;
			}
			if (x - nearest > Math.abs(x - i)) {
				nearest = i;
			}
		}
		System.out.println(nearest);
	}
}


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	string s,t,r;
	cin >> s >> t >> r;

	if(s[(int)s.size()-1] == t[0] && t[(int)t.size()-1] == r[0])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;

//+- isn't important because +D -D.
//longest dist = kD, next (k-2)D, (k-4)D....
//times = x/D

int main(){
  ll x, k, d;
  cin >> x >> k >> d;
  x = abs(x);
  
  ll times = x/d;
  ll ans = 0;
  if(k <= times){
    ans =  abs(x - d*k);
  }

  else {
    ll dist = abs(x-d*times);
    ll dist2 = abs(x-d*times - d);
    if(dist <= dist2){
      ll left = k - times;
      if(left%2 == 0) ans = dist;
      else ans = abs(dist-d);
    }
    else{
      ll left2 = k - times -1;
      if(left2%2 == 0) ans = dist2;
      else ans = abs(dist2-d);
    }

  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  string s;
  cin>>s;
  int N=s.size();
  if(N%2!=0) {
      cout<<"No"<<endl;
      return 0;
  }
  rep(i,N) {
      if(i%2==0&&s[i]!='h') {
          cout<<"No"<<endl;
          return 0;
      }
      else if(i%2==1&&s[i]!='i') {
          cout<<"No"<<endl;
          return 0;
      }
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int N;
long A[1<<17];
int B[1<<17][60];
main()
{
	cin>>N;
	long X=0;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		X^=A[i];
	}
	long Y=((1LL<<60)-1)^X;
	for(int i=0;i<N;i++)A[i]&=Y;
	for(int i=0;i<N;i++)
	{
		for(int j=0;j<60;j++)
		{
			B[i][j]=(A[i]>>59-j)&1;
		}
	}
	int id=0;
	for(int i=0;i<60;i++)
	{
		int t=id;
		while(t<N&&B[t][i]==0)t++;
		if(t==N)continue;
		if(t>id)
		{
			for(int j=0;j<60;j++)swap(B[id][j],B[t][j]);
		}
		for(int j=0;j<N;j++)
		{
			if(j==id||B[j][i]==0)continue;
			for(int k=0;k<60;k++)B[j][k]^=B[id][k];
		}
		id++;
	}
	long ans=0;
	for(int i=0;i<60;i++)
	{
		long t=0;
		for(int j=0;j<N;j++)t^=B[j][i];
		ans+=t<<59-i;
	}
	cout<<ans+(X^ans)<<endl;
}


Measured memory_bytes: 25600
#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))

int main(void){
	int a[300];
	rep(i, 300) a[i] = 0;
	string s;
	cin >> s;

	rep(i, s.size()) a[s[i]]++;
	
	if(a['N']!=0 && a['S']==0 || a['N']==0 && a['S']!=0 || a['W']==0 && a['E']!=0 || a['W']!=0 && a['E']==0) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  int ans = 0, sum = 0;
  rep(i, s.size())
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      sum++;
      ans = max(ans, sum);
    } else
      sum = 0;      
  cout << ans << endl;
}

Measured memory_bytes: 256
s = gets.chomp.split("")
ln = s.length

rcnt = Array.new(ln,1)
id = ln-2
while id >= 0
  if s[id] == s[id+1]
    rcnt[id] = rcnt[id+1]+1
  end
  id -= 1
end

ans = 0
id = 0
flag = 0
cnt = 0
while id <= ln-(2*(ans+1))
  if s[id] == "J"
    flag = 1
    cnt += 1
  elsif flag == 1
    if s[id] == "O"
      for i in (ans+1)..cnt
        lv = cnt-i+ans+1
        if id-1+2*lv < ln
          idi = id+lv 
          if s[idi] == "I" && rcnt[id] == lv && rcnt[idi] >= lv
            ans = lv
            break
          end
        end
      end
    end
    flag = 0
    cnt = 0
  end
  id += 1
end
puts ans


Measured memory_bytes: 97384
#include <cstdio>
#include <iostream>
#include <string>

int main() {
    int w, h, n;
    scanf("%d%d%d", &w, &h, &n);
    int xmax = w, xmin = 0, ymax = h, ymin = 0;
    for (int i = 0; i < n; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        if (a == 1) {
            xmin = std::max(x, xmin);
        }
        else if (a == 2) {
            xmax = std::min(x, xmax);
        }
        else if (a == 3) {
            ymin = std::max(y, ymin);
        }
        else if (a == 4) {
            ymax = std::min(y, ymax);
        }
    }
    if (xmax <= xmin || ymax <= ymin) {
        puts("0");
    }
    else {
        printf("%d\n", (xmax - xmin) * (ymax - ymin));
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] arges) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] k = line.split(" ");
		int[] v = new int[k.length];
		for (int i = 0; i < v.length; i++) {
			v[i] = Integer.parseInt(k[i]);
		}
		if (v[2] - v[4] < 0 || v[2] + v[4] > v[0] || v[3] - v[4] < 0
				|| v[3] + v[4] > v[1]) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 26180
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

const int kLim = 55;

struct Item {
  Item(int a, int b, int c) {
    V[0] = a;
    V[1] = b;
    V[2] = c;
  }
  
  int V[3];
};

int dp[kLim][kLim][kLim];


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int A, B, C;
  cin >> A >> B >> C;
  
  memset(dp, -1, sizeof(dp));
  dp[A][B][C] = 0;
  queue<Item> Q;
  Q.push(Item{A, B, C});
  
  while (!Q.empty()) {
    int V[3];
    V[0] = Q.front().V[0];
    V[1] = Q.front().V[1];
    V[2] = Q.front().V[2];
    Q.pop();

    if (V[0] == V[1] && V[1] == V[2]) {
      break;
    }

    int dist = dp[V[0]][V[1]][V[2]] + 1;
    
    for (int i = 0; i < 3; ++i) {
      for (int j = i + 1; j < 3; ++j) {
        int k = 0;
        while (k == i || k == j) {
          ++k;
        }
        
        if (max(V[i], V[j]) + 1 < kLim) {
          if (dp[V[i] + 1][V[j] + 1][V[k]] == -1) {
            dp[V[i] + 1][V[j] + 1][V[k]] = dist;
            Q.push(Item{V[i] + 1, V[j] + 1, V[k]});
          }
        }
      }
    }
    
    for (int i = 0; i < 3; ++i) {
      if (V[i] + 2 >= kLim) {
        continue;
      }
      
      int j = (i + 1) % 3;
      int k = (i + 2) % 3;
      
      if (dp[V[i] + 2][V[j]][V[k]] == -1) {
        Q.push(Item{V[i] + 2, V[j], V[k]});
        dp[V[i] + 2][V[j]][V[k]] = dist;
      }
    }
  }
  
  int result = numeric_limits<int>::max();
  
  for (int i = 0; i < kLim; ++i) {
    if (dp[i][i][i] != -1) {
      result = min(result, dp[i][i][i]);
    }
  }
  
  cout << result << '\n';
  
  return 0;
}


Measured memory_bytes: 896
package main

import(
    "fmt"
)



func main() {
    var a,b,k int
    fmt.Scan(&a,&b,&k)
    cnt:=0
    for i:=min32(a,b); i>0; i--{
        if a%i == 0 && b%i == 0{
            cnt++
        }
        if cnt==k{
            fmt.Println(i)
            break
        }
    }
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cctype>
const long long MAXN=10000000000001;
using namespace std;
int main()
{
    string s;
    cin>>s;
    const int slen = s.length();
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < slen; i++)
    {
        if (s[i] == '0') cnt1++;
        else cnt2++;
    }

    cout << min(cnt1, cnt2)*2 << endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;

namespace AOJ.Volume0
{
    public class StrangeMathematicalExpression
    {
        public static int Main()
        {
            while (true)
            {
                var input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }

                var data = input.Split(' ');
                // ?????????????????¨???
                var st = new Stack<decimal>();
                // ??????
                foreach(var d in data)
                {
                    // ??°??????????????????????????????????????????
                    // ?????????????????????????????????????????????2???????????????????¨????
                    decimal dec;
                    if(decimal.TryParse(d,out dec)) { st.Push(dec); }
                    else
                    {
                        decimal a = st.Pop();
                        decimal b = st.Pop();

                        switch (d)
                        {
                            case "+": { dec = b + a; break; }
                            case "-": { dec = b - a; break; }
                            case "*": { dec = b * a; break; }
                            case "/": { dec = b / a; break; }
                        }
                        // ?¨??????????????????????????????????
                        st.Push(dec);
                    }
                }

                // ????????????????????????
                Console.WriteLine(st.Pop());
            }

            return 0;
        }
    }
}

Measured memory_bytes: 10448
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();

		if(Math.floor((double)(B/A))>C) {
			System.out.println(C);
		}else {
			System.out.println((int)(Math.floor((double)(B/A))));
		}

	}
}


Measured memory_bytes: 23764
#pragma region head
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main() {
    int m, k;
    cin >> m >> k;
    ll mx = 1;
    rep(i, m) {
        mx <<= 1;
    }
    vll ans;
    if (k == 0) {
        rep(i, mx) {
            ans.emplace_back(i);
            ans.emplace_back(i);
        }
    } else if (m > 1 && k < mx) {
        rrep(i, mx) {
            if (i != k) {
                ans.emplace_back(i);
            }
        }
        ans.emplace_back(k);
        rep(i, mx) {
            if (i != k) {
                ans.emplace_back(i);
            }
        }
        ans.emplace_back(k);
    } else {
        cout << -1 << '\n';
        return 0;
    }

    for (auto &_a : ans) {
        cout << _a;
        if (&_a != &ans.back()) cout << ' ';
    }
    cout << '\n';
}


Measured memory_bytes: 5328