akhauriyash/Code-Regression huggingface dataset:
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}
ll sx, sy, tx, ty;
const int FACT_MAX = 3000005;
ll fact[FACT_MAX], fact_inv[FACT_MAX];

ll MODpow(ll a, ll n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%MOD) * (MODpow(a, n-1)%MOD)) % MOD;
	}
	else{
		return MODpow((a*a)%MOD, n/2) % MOD;
	}
}

void make_fact()
{
	ll val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= MOD;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = MODpow(fact[FACT_MAX-1], MOD-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % MOD;
	}
}

ll comb(ll n, ll k)
{
	ll ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= MOD;
	ret *= fact_inv[n-k], ret %= MOD;
	return ret;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	make_fact();
	
	cin >> sx >> sy >> tx >> ty;
	
	ll ans = 0;
	for(int i = sx; i <= tx; i++){
		ans += comb(i+ty+1, ty), ans %= MOD;
		ans += MOD - comb(i+(sy-1)+1, sy-1), ans %= MOD;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 47104
#define TEST_MODE true

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long

#ifdef LOCAL_ENV

#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << endl
#else
const bool test = false;
#define dump(x) 
#endif

#else
const bool test = false;
#define dump(x) 
#endif

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep))
    {
        v.push_back(buffer);
    }
    return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
    return accumulate(begin, end, 0ll);
}

void solve();

class Solver {
public:
    int A, B;

    void solve() {
        cin >> A >> B;
        int c[] = {A, B, A+B};
        bool ok = [&](){
            rep(i, 3) {
                if (c[i] % 3 == 0) return true;
            }
            return false;
        }();
        cout << (ok ? "Possible" : "Impossible") << endl;
    }
};

signed main()
{
    cout << fixed << setprecision(20);
    auto ptr = new Solver();
    ptr->solve();
    delete ptr;
    // while (true) {    
    //     auto ptr = new Solver();
    //     ptr->solve();
    //     delete ptr;
    // }
    return 0;
}

// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'




Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final long MOD = 1_000_000_007;
    private int sum = 0;

    public void main(Scanner sc) {
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();

        int cnt[] = new int[w + 1];
        init(w, cnt);

        long dp[][] = new long[h + 1][w];
        dp[0][0] = 1;
        for (int i = 1; i <= h; i++) {
            for (int j = 0; j < w; j++) {
                // 左
                if (j > 0) {
                    dp[i][j - 1] += cnt[j] * dp[i - 1][j];
                    dp[i][j - 1] %= MOD;
                }

                // 中
                dp[i][j] += (sum - cnt[j] - cnt[j + 1]) * dp[i - 1][j];
                dp[i][j] %= MOD;

                // 右
                if (j + 1 < w) {
                    dp[i][j + 1] += cnt[j + 1] * dp[i - 1][j];
                    dp[i][j + 1] %= MOD;
                }
            }
        }

        System.out.println(dp[h][k - 1]);
    }

    private void init(int w, int cnt[]) {
        for (int n = 0; n < (1 << (w - 1)); n++) {
            int tmp = n;
            int bi[] = new int[w];
            boolean ok = true;
            for (int i = 0; i < w - 1; i++) {
                bi[i + 1] = tmp % 2;
                if (bi[i] * bi[i + 1] == 1) {
                    ok = false;
                    break;
                }
                tmp /= 2;
            }

            if (ok) {
                sum++;
                for (int i = 1; i < w; i++) {
                    cnt[i] += bi[i];
                }
            }
        }
    }

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            new Main().main(sc);
        } catch (Exception e) {
            throw e;
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

const int MAX = 3000;    //  ここのサイズ選びめっちゃ注意。5*10^5とかにしてたら余裕でTLEこく。

LL fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
LL COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// n-1 C m-1
int count_7(int n, int m){
    if(n < m) return 0;
    // 前処理
    COMinit();
    return COM(n-1,m-1);
}



int main(){
    int N,K;cin >> N >> K;
    COMinit();

    vector<LL> ans(K+1);
    ans[0] = 0;
    ans[1] = N-K+1;  // N-K+1 C 1

    for(int i = 2;i <= K;++i){
        LL tmp = count_7(K,i) % MOD;    // blue
        LL lr_n = count_7(N-K,i-1) % MOD;
        LL l = count_7(N-K,i) % MOD;
        LL r = count_7(N-K,i) % MOD;
        LL lr =  count_7(N-K,i+1) % MOD;
        ans[i] = tmp * (lr_n + l + r + lr) % MOD;
    }

    for(int i = 1;i <= K;++i)cout << ans[i] << endl;
}


// 

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

map<string,bool> mp;
int main()
{
	ios::sync_with_stdio(false);
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		string a;
		cin>>a;
		if(!mp[a]) ans++,mp[a]=true;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 19236
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007
#define pi atan(1) * 4

int main()
{
	int n;
	cin >> n;
	vector<vector<long long int> >  abc(3);
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < n; j++){
			long long int tmp;
			cin >> tmp;
			abc[i].push_back(tmp);
		}
		sort(abc[i].begin(), abc[i].end());
	}
	long long int result1[100002] = {};
	long long int cnt = 0;
	for(int i = 0; i < n; i++){
		while(cnt < n && abc[2][cnt] <= abc[1][i]) cnt++;
		result1[i] = n - cnt;
		// cout << result1[i] << endl;
	}
	for(int i = n - 2; i >= 0; i--){
		result1[i] += result1[i + 1];
	}
	long long int ans = 0;
	cnt = 0;
	for(int i = 0; i < n; i++){
		while(cnt < n && abc[1][cnt] <= abc[0][i]) cnt++;
		ans += result1[cnt];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3444
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}
 
fn main() {
  let c: String = read();

  let ans = match &*c {
    "a" | "e" | "i" | "u" | "o" => "vowel",
    _ => "consonant"
  };

  println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<queue>
#define eps 1e-9
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;

const int n=1000000+10;
const int maxn=1000000+10;
int prime[maxn],vis[maxn];
int init()
{
    int c=0,m;
    memset(vis,0,sizeof(vis));
    m=sqrt(n+0.5);
    for(int i=2;i<=m;i++)
    {
       if(!vis[i])
       {
           for(int j=i*i;j<=n;j+=i)
              vis[j]=1;
       }
    }
    for(int i=2;i<=n;i++)
    {
        if(!vis[i])
            prime[c++]=i;
    }
    return c;
}


int main()
{
    int N;
    int k=init();
    while(~scanf("%d",&N))
    {
        int ans=upper_bound(prime,prime+k,N)-prime;
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 7336
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;

/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main() {

    ////////////////////////////////////////
    /* 入力受け取り */
    ////////////////////////////////////////

    /* 縦と横の長さ */
    int height, width;
    cin >> height >> width;

    /* 盤面 */
    vector<string> field(height);
    for (int h = 0; h < height; ++h) cin >> field[h];

    /* スタート地点とゴール地点 */
    int sx, sy, gx, gy;
    sx = 0;
    sy = 0;
    gx = height-1;
    gy = width-1;

    ////////////////////////////////////////
    /* 幅優先探索の初期設定 */
    ////////////////////////////////////////

    // 各セルの最短距離 (訪れていないところは -1 としておく)
    vector<vector<int> > dist(height, vector<int>(width, -1)); 
    dist[sx][sy] = 0; // スタートを 0 に

    // 探索中に各マスはどのマスから来たのかを表す配列 (最短経路長を知るだけなら、これは不要)
    vector<vector<int> > prev_x(height, vector<int>(width, -1));
    vector<vector<int> > prev_y(height, vector<int>(width, -1));

    // 「一度見た頂点」のうち「まだ訪れていない頂点」を表すキュー
    queue<pair<int, int> > que; 
    que.push(make_pair(sx, sy)); // スタートを push


    ////////////////////////////////////////
    /* 幅優先探索を実施 */
    ////////////////////////////////////////    

    /* キューが空になるまで */
    while (!que.empty()) {
        pair<int, int> current_pos = que.front(); // キューの先頭を見る (C++ ではこれをしても pop しない)
        int x = current_pos.first;
        int y = current_pos.second;
        que.pop(); // キューから pop を忘れずに

        // 隣接頂点を探索
        for (int direction = 0; direction < 4; ++direction) {
            int next_x = x + dx[direction];
            int next_y = y + dy[direction];
            if (next_x < 0 || next_x >= height || next_y < 0 || next_y >= width) continue; // 場外アウトならダメ
            if (field[next_x][next_y] == '#') continue; // 壁はダメ

            // まだ見ていない頂点なら push
            if (dist[next_x][next_y] == -1) {
                que.push(make_pair(next_x, next_y));
                dist[next_x][next_y] = dist[x][y] + 1; // (next_x, next_y) の距離も更新
                prev_x[next_x][next_y] = x;  // どの頂点から情報が伝播して来たか、縦方向の座標をメモ
                prev_y[next_x][next_y] = y;  // どの頂点から情報が伝播して来たか、横方向の座標をメモ
            }
        }
    }


    ////////////////////////////////////////
    /* 結果出力 */
    //ゴールしてない場合は0を出力する
    if(dist[gx][gy]==-1){
        cout << -1 << endl;
        return 0;
    }

    /* ゴールに至るまでの最短経路を復元してみる */
    int x = gx, y = gy;
    while (x != -1 && y != -1) {
        field[x][y] = 'o'; // 通過したことを示す

        // 前の頂点へ行く
        int px = prev_x[x][y];
        int py = prev_y[x][y];
        x = px, y = py;
    }
    int cnt =0;
    for(int i=0;i<height;i++){
        for (int j=0;j<width;j++){
            if(field[i][j]=='.')
                cnt++;
        }
    }
    cout << cnt << endl;
}


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

int main(void){
	int n;
	cin>>n;

	while(n--){
		int out = 0;
		int first=0,second=0,third=0,score=0;
		while(out < 3){
			string s;
			cin>>s;
			if(s == "HIT"){
				score += third;
				third = second;
				second = first;
				first = 1;
			}
			else if(s == "HOMERUN"){
				score += third + second + first + 1;
				third = second = first = 0;
			}
			else{
				out++;
			}
		}
		cout<<score<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int search(int *A,int n,int key){
  int i=0;
  A[n]=key;
  while(A[i] !=key)i++;
  return i !=n;
}

int main(){
  int i,n,A[10001],q,key,sum=0;

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

  scanf("%d",&q);

  for(i=0;i<q;i++){
    scanf("%d",&key);

    if(search(A,n,key))sum++;
  }

  printf("%d\n",sum);

  return 0;
}



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

string Change(string Letter){
	for(int i = 0; i < Letter.size(); i++){
		if('a' <= Letter[i] && Letter[i] <= 'z') Letter[i] += 'A' - 'a';
	}
	return Letter;	
}	

string Transition(string Word){
	Word = Change(Word);
	return Word;
}

vector<string> ReadWords(){
//	?????????????????????????????????END_OF_TEXT??§???????????°??§???????????´?????????????????????????????????
	vector<string> Sentence;
	while(1){
		string Go;
		cin >> Go;
		if(Go == "END_OF_TEXT") break;
		Go = Change(Go);
		Sentence.push_back(Go);
	}
	return Sentence;
}

int Count(string Word, vector<string> Sentence){
//	?????????????????????????????????????????????????????°?????????
	int C = 0;
	for(int i = 0; i < Sentence.size(); i++){
		if(Sentence[i] == Word) C++;
	}
	return C;
}

int main(){
//	??????????????????????????§???????????´??????
	string Word;
	cin >> Word;
	Word = Transition(Word);
//	????????????????????????	
	vector<string> Sentence = ReadWords();
//	?????????????????????????????????????????°??????????????????
	int X = Count(Word, Sentence);
	cout << X << endl;
	
//	system("pause");
	return 0;
}

Measured memory_bytes: 1212
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    V<int> road(n, 0);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        road[a]++;
        road[b]++;
    }
    for (int i = 0; i < n; i++) cout << road[i] << '\n';
    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++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  rep(i, s.size()){
    if(i%2 == 1) continue;
    cout << s[i];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 512
import sys
import math
from functools import reduce

n,k=map(int,input().split())
x=list(map(int,input().split()))

l=[]

for i in x:
        b=abs(i-k)
        l.append(b)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans=(gcd_list(l))

print(ans)

Measured memory_bytes: 20504
import java.util.Scanner;

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

        if (n ==1) {
            System.out.println("Hello World");
        }
        else {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            System.out.println(a+b);
        }
    }
}

Measured memory_bytes: 21332
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        if (n == 1)
        {
            Console.WriteLine(1);
            return;
        }
        var balls = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).Select(x => new Vector(x[0], x[1])).ToArray();
        var res = n - balls.SelectMany(x => balls.Select(y => x - y)).GroupBy(x => x).OrderByDescending(x => x.Count()).Skip(1).First().Count();
        Console.WriteLine(res);
    }
}


struct Vector
{
    public int x;
    public int y;
    public int this[int index]
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { if (index == 0) return x; else return y; }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        set { if (index == 0) x = value; else y = value; }
    }
    public int Length => x * x + y * y;
    public double SqrtLength => Math.Sqrt(Length);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public Vector(int x, int y) { this.x = x; this.y = y; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public Vector RotateVector(double radian) => new Vector((int)(x * Math.Cos(radian) - y * Math.Sin(radian)), (int)(x * Math.Sin(radian) + y * Math.Cos(radian)));
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static public int CrossProduct(Vector a, Vector b) => a.x * b.y - a.y * b.x;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static public int InnerProduct(Vector a, Vector b) => a.x * b.x + a.y * b.y;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static Vector operator +(Vector a, Vector b) => new Vector(a.x + b.x, a.y + b.y);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static Vector operator -(Vector a, Vector b) => new Vector(a.x - b.x, a.y - b.y);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool operator ==(Vector a, Vector b) => a.x == b.x && a.y == b.y;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool operator !=(Vector a, Vector b) => a.x != b.x || a.y != b.y;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override bool Equals(object obj) => this == (Vector)obj;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override int GetHashCode() => x.GetHashCode() * 1000000007 + y.GetHashCode();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override string ToString() => $"({x},{y})";
}


Measured memory_bytes: 13920
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
  
        int t = sc.nextInt();
        
        int h = t / 3600;
        int m = t % 3600 / 60;
        int s = t % 3600 % 60;
        
        System.out.println(h + ":" + m + ":" + s);
    }
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int m, d;
    int a[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string w[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
    while (cin >> m >> d, m)
    {
        int s = 0;
        rep(i, m - 1) s += a[i];
        cout << w[(s + d) % 7] << endl;
    }
}


Measured memory_bytes: 3180
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main(){
  int n, x;

  cin >> n >> x;

  int minm = INF;

  for(int i=0;i<n;i++){
    int m;
    cin >> m;
    minm = min(minm, m);
    x -= m;
  }

  cout << x / minm + n << endl;


  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int X = sc.nextInt();
    if (500*K >= X){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }      
  }
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int N, u, v;

vector<int> dijkstra(int s, vector<vector<int>> adj) {
    vector<bool> visit(N);
    vector<int> dist(N, 1e9), par(N);
    priority_queue<pair<int, int>> q;
    dist[s] = 0; q.push(make_pair(0, s)); visit[s] = true;
    while (!q.empty()) {
        pair<int, int> tmp = q.top(); q.pop();
        int t = tmp.second; visit[t] = true;
        if (dist[t] < tmp.first * (-1) ) continue;  //別のルートでdist[t]が更新されていれば無視
        for (int i = 0; i < adj[t].size(); i++) {
            int next = adj[t][i];
            if (visit[next]) continue;
            if (dist[next] > dist[t] + 1) {
                dist[next] = dist[t] + 1;
                par[next] = t;
                q.push(make_pair(dist[next] * (-1), next));
            }
        }
    }
    return dist;
}

int main() {
    cin >> N >> u >> v;
    u--; v--;
    vector<vector<int>> adj(N, vector<int>());
    int a, b;
    for (int i = 0; i < N - 1; i++) {
        cin >> a >> b; a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    vector<int> distT = dijkstra(u, adj);
    vector<int> distA = dijkstra(v, adj);
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (distT[i] < distA[i]) {
            ans = max(distA[i], ans);
        }
    }
    cout << ans - 1 << endl;
}


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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

signed main(){
     ll a,b,c,k; cin >> a >> b >> c >> k;
     ll ans = a-b;
    ans *= ((k&1) == 1) ? -1: 1;
        cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define reverse(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)



priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

void solve(){
    llint n,d;
    cin >> n >> d;
    int ans=0;
    rep(i,0,n){
        llint x,y;
        cin >> x >> y;
        if(x*x+y*y<=d*d)ans++;
    }
    cout << ans << endl;
}

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





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

int gcd(int a,int b){
  if(b==0){
    return a;
  }
  return gcd(b,a%b);
}
int main(){
  int x,y;
  cin>>x>>y;
  int g=gcd(x,y);
  cout<<x+y-g+1<<endl;
}


Measured memory_bytes: 3100
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int[] bit = new int[10];
		ArrayList<String> result = new ArrayList<String>();
		Scanner sc = new Scanner(System.in);
		
		try{
			while(true){
				result.add(getBit(checkBit(sc.nextInt())));
			}
		}catch(NoSuchElementException e){
			//何もしない
		}
		
		for(int i = 0; i < result.size(); i++){
			System.out.println(result.get(i));
		}
	}
	
	private static String getBit(int[] bit){
		StringBuffer str = new StringBuffer();
		for(int i = 0; i < bit.length; i++){
			if(bit[i] == 1){
				double n = Math.pow(2, i);
				str.append((int)n);
				str.append(" ");
			}
		}
		str.deleteCharAt(str.length() - 1);
		return str.toString();
	}
	
	private static int[] checkBit(int n){
		int[] bit = new int[10];
		int tmp = n;
		for(int i = 0; i < 10; i++){
			int amari = tmp % 2;
			if(amari == 1){
				bit[i] = 1;
			}
			else{
				bit[i] = 0;
			}
			tmp = tmp / 2;
		}
		return bit;
	}
}

Measured memory_bytes: 11000
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int cnt = 0;
    int prev = 0;
    for (int i = 0; i < N; i++) {
      int h = scanner.nextInt();
      if (h < prev) cnt += prev - h;
      prev = h;
    }
    cnt += prev;
    System.out.println(cnt);
  }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
inline int read(){
    int x(0),w(1); char c = getchar();
    while(c^'-' && (c<'0'||c>'9')) c = getchar(); if(c == '-') w = -1, c = getchar();
    while(c>='0' && c<='9') x = (x<<3) + (x<<1) + c - '0', c = getchar();
	return x*w;
}
struct Crd{
	int x,y,stp;
}q[1000010];
int n,m,ans,h,t,cnt;
char s[1010];
int a[1010][1010],d[1010][1010],vis[1010][1010];
inline void push(int x, int y, int k){
	if(x<1||x>n||y<1||y>m) return;
	if(vis[x][y]) return;
	vis[x][y] = 1;
	d[x][y] = k;
//	printf("d[%d][%d] = %d\n",x,y,k);
	++t;
	q[t].x = x, q[t].y = y, q[t].stp = k;
}
inline void BFS(){
	int X,Y,K;
	h = 1;
	while(h <= t){
		X = q[h].x, Y = q[h].y, K = q[h].stp;
//		printf("(%d,%d)  %d\n",X,Y);
		++h;
		push(X+1,Y,K+1);
		push(X-1,Y,K+1);
		push(X,Y+1,K+1);
		push(X,Y-1,K+1);
	}
}
int main(){
//	freopen(".in","r",stdin);
	scanf("%d%d",&n,&m);
	for(int i = 1; i <= n; ++i){
		scanf("%s",s);
		for(int j = 1; j <= m; ++j){
			if(s[j-1] == '#'){
				a[i][j] = 1;
				push(i,j,0); 
			}
		}
	}
	BFS();
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= m; ++j){
			ans = max(ans,d[i][j]);
//			printf("%d ",d[i][j]);
		}
//		printf("\n");
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 23808
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) vc<vc<T>> xs(n, vc<T>(m)); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, x);
    
    int ans = 1e9;
    for(int p = 1; p <= 100; p ++){
        int tmp = 0;
        For(i, n) tmp += Sq(x[i] - p);
        Mini(ans, tmp);
    }
    Cout(ans);
}


Measured memory_bytes: 256
def main():
    n, wn = map(int, input().split())
    w = [0 for _ in range(n)]
    v = w[:]
    for i in range(n):
        w[i], v[i] = map(int, input().split())
    dp = [[0 for _ in range(wn + 1)] for _ in range(n)]  # dp[n][wn + 1]を定義
    for i in range(w[0], wn + 1):
        dp[0][i] = v[0]
    for i in range(1, n):
        for j in range(wn + 1):
            if j < w[i]:
                dp[i][j] = dp[i - 1][j]
            else:
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i])
    print(max(dp[n - 1]))


if __name__ == '__main__':
    main()


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

using namespace std;

#define MAX_N 1000

struct State{
  string s;
  int next,l;
  State(string s,int next,int l) 
    : s(s),next(next),l(l) {}
};

int idx[MAX_N],len[MAX_N];
vector<State> G[MAX_N];

void solve(int x){
  if(len[x] == idx[x]){
    return;
  }
  for(int i = 0 ; i < len[x] ; i++){
    cout << string(G[x][idx[x]].l,'.') + G[x][idx[x]].s << endl;
    solve(G[x][idx[x]++].next);
  }
}

int main(){
  int N,K,size[MAX_N] = {0};
  string start,in;
  cin >> N >> size[0] >> start;
  for(int i = 1 ; i < N ; i++){
    cin >> K >> in;
    size[i] = size[K-1]+1;
    G[K-1].push_back(State(in,i,size[i]));
  }
  cout << start << endl;
  for(int i = 0 ; i < N ; i++){
    len[i] = G[i].size();
  }
  solve(0);
  return 0;
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std; using ll = long long;
using ull = unsigned long long; using P = pair<int, int>;
const int INF = 1e9; const int MOD = 1000000007;
const int dx[] = {-1,0,1,0}; const int dy[] = {0,-1,0,1};
//const int dx[] = {-1,-1,-1, 0, 0, 1, 1, 1}; const int dy[] = {-1, 0, 1,-1, 1,-1, 0, 1};
#define PI 3.14159265358979323846264338327950L //setprecision(15)
#define MAX_N 1000
int par[MAX_N];  // 親
int rnk[MAX_N];  // 木の深さ
// n要素で初期化
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rnk[i] = 0;
	}
}
// 木の根を求める
int find(int x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}
// xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x); y = find(y);
	if (x == y) return;
	if (rnk[x] < rnk[y]) par[x] = y;
	else {
		par[y] = x;
		if (rnk[x] ==rnk[y]) rnk[x]++;
	}
}
// xとyが同じ集合に属するか否か
bool same(int x, int y) {
	return find(x) == find(y);
}

int main() {
	int N, M; cin >> N >> M;
	int v[2500][2];
	rep(i, M) {
		cin >> v[i][0] >> v[i][1];
		v[i][0]--; v[i][1]--;
	}
	int ans = 0;
	rep(i, M) {
		init(N);
		rep(j, M) {
			if (j == i) continue;
			unite(v[j][0], v[j][1]);
		}
		rep(j, N-1) {
			bool tmp = same(j, j+1);
			if (tmp == 0) {
				ans++; break;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3608
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		
		int max = 0;
		for (int i = 1; i < n - 1; i++) {
			String x = s.substring(0, i);
			String y = s.substring(i);
			
			Set<Character> setX = new HashSet<>();			
			Set<Character> setY = new HashSet<>();			
			
			for (int j = 0; j < x.length(); j++) {
				setX.add(x.charAt(j));
			}
			
			for (int j = 0; j < y.length(); j++) {
				setY.add(y.charAt(j));
			}
			
			int cnt = 0;
			for (char c : setX) {
				if (setY.contains(c)) cnt++;
			}
			
			max = Math.max(max, cnt);
		}
		
		System.out.println(max);
		
		sc.close();
	}
}




Measured memory_bytes: 28348
w=input()
ans=[]
for i in range(len(w)):
    count = 0
    for j in range(len(w)):
        if w[i]==w[j]:
            count+=1
    if count%2==1:
        ans.append(count)
if ans == []:
    print("Yes")
else:
    print("No")
    

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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int mul(int x,int y)
{
    return ((x % MOD) * (y % MOD)) % MOD;
}

int add(int x,int y)
{
    return ((x % MOD) + (y % MOD)) % MOD;
}

int sub(int x,int y)
{
    int ret = ((x % MOD) - (y % MOD)) % MOD;
    if (ret < 0)
        ret += MOD;
    return ret;
}

int modpow(int x,int y)
{
    if (!y) return 1;
    int z = modpow(x,y / 2);
    z = mul(z,z);
    if (y & 1) z = mul(z,x);
    return z;
}

int inv(int x)
{
    return modpow(x,MOD - 2);
}

int bagi(int x,int y)
{
    return mul(x,inv(y));
}

int dp[1000010][7];
int n;

int rec(int index,int mask)
{
    if (index > n) return (mask == 3);
    if (dp[index][mask] != -1) return dp[index][mask];
    int ret = rec(index + 1,mask | 1);
    ret = add(ret,rec(index + 1,mask | 2));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    ret = add(ret,rec(index + 1,mask));
    return dp[index][mask] = ret;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    memset(dp,-1,sizeof(dp));
    cin >> n;
    int ans = rec(1,0);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 124604
// Code by Denverjin.
#include <bits/stdc++.h>
using namespace std;

using ld = double;
using ll = long long;
using ull = unsigned long long;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;

const int SZ = 1 << 13;
char buff[SZ], *pos = buff + SZ - 1;
#define getchar() (++ pos == buff + SZ ? fread(pos = buff, 1, SZ, stdin), *pos : *pos)

inline ll read() {
	ll x = 0; int f = 1, c = getchar();
	for (;!isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x<<3) + (x<<1) + (c^48);
	return x * f;
}

const int N = 1 << 20;
int L;
int A[N];
ll ans = LINF;

ll sumpre[N], sumsuf[N];
ll pre[N], suf[N], suff[N], sufff[N];

void solve() {
	for (int i = 1; i <= L; ++ i) sumpre[i] = sumpre[i - 1] + A[i];
	for (int i = L; i >= 1; -- i) sumsuf[i] = sumsuf[i + 1] + A[i];
	for (int i = 1; i <= L; ++ i) pre[i] = min(pre[i - 1] + (A[i] < 2 ? 2 - A[i] : A[i] % 2), sumpre[i]);
	for (int i = L; i >= 0; -- i) suff[i] = min(suff[i + 1] + (A[i + 1] < 2 ? 2 - A[i + 1] : A[i + 1] % 2), sumsuf[i + 1]);
	for (int i = L; i >= 0; -- i) sufff[i] = min(sufff[i + 1] + (A[i + 1] < 3 ? 3 - A[i + 1] : !(A[i + 1] % 2)), suff[i]);
	for (int i = L; i >= 0; -- i) suf[i] = min(suf[i + 1] + !(A[i + 1] % 2), suff[i]);
	for (int i = 0; i <= L; ++ i) ans = min(ans, pre[i] + suf[i]);
}

int main() {
	L = read();
	for (int i = 1; i <= L; ++ i) {
		A[i] = read();
	}
	solve();
	reverse(A + 1, A + 1 + L);
	solve();
	printf("%lld\n", ans);
	return 0;
}


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

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

const long long MOD = 1000000007;

int main(){
  set<int> num;
  rep(i,3){
    int a;
    cin >> a;
    num.insert(a);
  }
  if(num.size()==2) cout << "Yes" << endl;
  else cout << "No" << endl;
      
}


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

int main(){
    long long n, h;
    cin >> n >> h;

    vector<long long> a(n), b(n);

    long long a_max = 0;
    for(long long i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        a_max = max(a_max, a[i]);
    }

    vector<long long> throw_sord;

    for(long long i = 0; i < n; i++){
        if(b[i] >= a_max){
            throw_sord.push_back(b[i]);
        }
    }

    sort(throw_sord.begin(), throw_sord.end(), greater<long long>());

    long long count = 0;
    long long j = 0;
    while(j < throw_sord.size()){
        if(h <= 0){
            break;
        }
        h -= throw_sord[j];
        count++;
        j++;
    }
    
    if(h <= 0){
        printf("%lld\n", count);
    }
    else{
        count += (h + a_max - 1)/a_max;
        printf("%lld\n", count);
    }

    return 0;
}

Measured memory_bytes: 2936
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

const double pi = acos(-1);

int main() {
	double r;
	cin >> r;
	
	double surface = r * r * pi;
	double circumference = 2.0 * r * pi;
	
	cout << fixed << setprecision(6);
	cout << surface << ' ' << circumference << '\n';
	
	return 0;
}


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


def plus1(num_list :list) ->(list,int):
    num_list.sort()
    count = 0
    
    diff_1 = num_list[2] - num_list[1]
    count += diff_1
    num_list[0]+= diff_1
    num_list[1]+= diff_1
    
    return num_list,count

#----------
num_list = list(map(int, input().rstrip().split()))

# count up +1
num_list,count = plus1(num_list)

# count up +2
num_2times = (num_list[1] - num_list[0]) // 2
num_list[0] += num_2times *2
count += num_2times

# count up +2 and +1
if (num_list[1] - num_list[0]) % 2 != 0:
    num_list[0] += 2
    count += 1
    
    num_list,c = plus1(num_list)
    count += c
    
print(count)


Measured memory_bytes: 3064
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 05/05/2018 14:31:12
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	ll a, b, c, k;
	cin>>a>>b>>c>>k;
	ll d = max(a, max(b, c));
	ll sum = a + b + c - d;
	d *= pow(2, k);
	cout<<sum + d<<endl;
	return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

int n, m, f[110][110], deg[110];
vector< int > cand, sel;

int calc() {
	int res = 0;
	for_(i,0,size_of(sel)) {
		int mn = 1e9;
		for_(j,0,size_of(sel)) if (j != i) mn = min(mn, f[sel[i]][sel[j]]);
		res += mn;
	}
	return res;
}

int rec(int i, int s, int k) {
	if (s == k) return calc();
	if (i == size_of(cand)) return 0;
	
	int res = rec(i+1, s, k);
	
	sel.push_back(cand[i]);
	res = max(res, rec(i+1, s+1, k));
	sel.pop_back();
	
	return res;
}

int main() {
	cin >> n >> m;
	
	minit(f,0);
	minit(deg,0);
	
	for_(i,0,m) {
		int u, v, p; cin >> u >> v >> p;
		--u; --v;
		f[v][u] = f[u][v] = p;
		++deg[u]; ++deg[v];
	}
	
	int ans = 0;
	for_(i,2,15) {
		cand.clear();
		for_(j,0,n) if (deg[j] >= i - 1) cand.push_back(j);
		ans = max(ans, rec(0, 0, i));
	}
	
	cout << ans << endl;
	
	return 0;
}

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


def main():
    from collections import defaultdict
    from collections import deque
    import sys

    n = int(input())
    graph = [defaultdict(int) for _ in range(n)]
    visited = [False for _ in range(n)]
    dist = [float('inf') for _ in range(n)]
    lines = sys.stdin.readlines()

    for i in range(n - 1):
        ai, bi, ci = map(int, lines[i].split())
        ai -= 1
        bi -= 1
        graph[ai][bi] = ci
        graph[bi][ai] = ci

    q, k = map(int, lines[n - 1].split())
    k -= 1
    dist[k] = 0
    d = deque()
    d.append(k)

    while d:
        di = d.popleft()
        visited[di] = True

        for bi, ci in graph[di].items():
            if visited[bi]:
                continue

            dist[bi] = dist[di] + ci
            d.append(bi)

    ans = [0 for _ in range(q)]

    for j in range(q):
        xi, yi = map(int, lines[n + j].split())
        xi -= 1
        yi -= 1
        ans[j] = dist[xi] + dist[yi]

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 79844
#include<cstdio>
int n,m,d[114514];
long long ans,A[233333];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
	scanf("%d",d+i);
	for(int i=1;i<n;++i){
		int l=d[i],r=d[i+1];
		if(l>r)r+=m;
		ans+=r-l;
		++A[l+2],--A[r+1];
		A[r+1]-=r-l-1,A[r+2]+=r-l-1;
	}
	for(int i=1;i<=m*2;++i)A[i]+=A[i-1];
	for(int i=1;i<=m*2;++i)A[i]+=A[i-1];
	for(int i=1;i<=m;++i)A[i]+=A[i+m];
	long long mx=0;
	for(int i=1;i<=m;++i)if(mx<A[i])mx=A[i];
	printf("%lld\n",ans-mx);
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    ll n, k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> cnt(n, 0);
    vector<int> root;
    vector<int> root_debug;

    int now = 0;
    int initroop = 0;
    bool flagloop = false;

    while(1) {
        int next = a[now] - 1;
        if(cnt[next] != 2) {
            if(cnt[next] == 1) {
                flagloop = true;
                root.push_back(next);
            }
            cnt[next]++;
            if(!flagloop) {
                initroop++;
                root_debug.push_back(next);
            }
            now = next;
        }else {
            break;
        }
    }
    if(k <= initroop) {
        cout << root_debug[k-1] + 1<< endl;
    }else {
        k -= initroop;
        int index = k % root.size();
        index--;
        if(index == -1) index = root.size() -1;
        cout << root[index] + 1<< endl;
    }

    return 0;
}


Measured memory_bytes: 6940
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);


int main(){
  int n;
  cin >> n;
  vector<pair<string, int>> rest(n);
  vector<pair<string, int>> rest_s(n);
  REP(i,n){
    string s;
    int p;
    cin >> s >> p;
    rest[i].first = s;
    rest[i].second = -p;
    rest_s[i].first = s;
    rest_s[i].second = -p;
  }

  sort(ALL(rest_s));

  //REP(j,n) cout <<j + 1<< ": "<< rest_s[j].first << rest_s[j].second  << endl;


  REP(i,n){
    REP(j,n){
      if(rest[j] == rest_s[i]){
        cout << j + 1 << endl;
        break;
      }
    }
  }

  //mapの内部ではKEYが昇順になるようにsortされている

  return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <map>
#include <vector> 
using namespace std;

const int INF = 1e9;
int n, m, x;
int c[15], a[15][15];
int algo[15];
int ans = INF, cost;

bool ok() {
    for (int i = 0; i < m; i++)
        if (algo[i] < x) return false;
    return true;
}

void dfs(int i) {
    if (i == n) {
        if (ok()) ans = min(ans, cost);
        return;
    }
    cost += c[i];
    for (int j = 0; j < m; j++) algo[j] += a[i][j];
    dfs(i + 1);
    cost -= c[i];
    for (int j = 0; j < m; j++) algo[j] -= a[i][j];
    dfs(i + 1);
}

int main() {
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) cin >> a[i][j];
    }
    dfs(0);
    cout << (ans == INF ? -1 : ans);
}


Measured memory_bytes: 3148
#include <bits/stdc++.h> 
using namespace std; 
int gi() { 
	int res = 0, w = 1; 
	char ch = getchar(); 
	while (ch != '-' && !isdigit(ch)) ch = getchar(); 
	if (ch == '-') w = -1, ch = getchar(); 
	while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar(); 
	return res * w; 
} 
int N, cnt[2]; 
int main () {
#ifndef ONLINE_JUDGE 
    freopen("cpp.in", "r", stdin); 
#endif 
	N = gi(); 
	for (int i = 1; i <= N; i++) { 
		int x = gi() & 1; 
		if (x) { 
			if (cnt[x]) ++cnt[x ^ 1], --cnt[x]; 
			else ++cnt[x]; 
		} else ++cnt[x]; 
	} 
	if (cnt[0] && cnt[1]) puts("NO"); 
	else puts("YES"); 
    return 0; 
} 

Measured memory_bytes: 3588
#include"bits/stdc++.h"
using namespace std;
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	if(a-b>=0)cout<<"delicious"<<endl;
	else if(-(a-b)<=x)cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
	return 0;
}

Measured memory_bytes: 256