akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl "\n"

int func2(int n, int i, int a[][3]){
  int t[n+1][4];
  // init
  for(int j = 0; j < 4; j++){
    t[0][j] = 0;
  }
  // logic
  for(int i = 1; i <= n; i++){
    for(int j = 0; j <= 3; j++){
      if(j == 0){
        t[i][j] = max(max(a[i-1][0] + t[i-1][1], a[i-1][1] + t[i-1][2]), a[i-1][2] + t[n-1][3]);
      }else if(j == 1){
        t[i][j] = max(a[i-1][1] + t[i-1][2], a[i-1][2] + t[i-1][3]);
      }else if(j == 2){
        t[i][j] = max(a[i-1][0] + t[i-1][1], a[i-1][2] + t[i-1][3]);
      }else{
        t[i][j] = max(a[i-1][0] + t[i-1][1], a[i-1][1] + t[i-1][2]);
      }
    }
  }
  int ans = INT_MIN;
  for(int j = 1; j <= 3; j++){
    ans = max(ans, t[n][j]);
  }
  return ans;
}

void solve() {
  int n; cin >> n;
  int arr[n][3];
  for(int i = 0; i < n; i++){
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  }
  int ans = func2(n, 0, arr);
  cout << ans << endl;
}
int main(){
#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  solve();
  return 0;
}

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

int main(int argc, char const *argv[])
{
  int N,A,b=0,ans=0; // b : ビット和
  cin >> N;

  for (int i = 0; i < N; ++i)
  {
    cin >> A; // A[i]を格納
    b = (A | b); // bはA_1～A_Nのビット和
  }

  while((b&1)==0){ // ビット和の最下位ビットが0である限り
    b = b>>1; // ビット和を右に1ビットシフトして
    ans++; // 操作回数を1回増やす
  }

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

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A[5];
    rep(i, 5) cin >> A[i];
    int ans = 0;
    rep(i, 5) ans += A[i] + (10 - A[i] % 10) % 10;
    int tmp = 0;
    rep(i, 5) tmp = max(tmp, (10 - A[i] % 10) % 10);
    cout << ans - tmp << endl;

    return 0;
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;

#define say(obj) (cout << obj << endl)
#define endline (cout << endl)
#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template <typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const vector<vector<T>>& mat) {
	for (const vector<T>& m : mat) os << m << endl;
	return os;
}

template <typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template <typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

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

	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] == B[i] && B[i] == C[i])
			continue;
		else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i])
			ans++;
		else
			ans += 2;
	}

	say(ans);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)

#define ALL(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

#define UNIQUE(v) do{sort(v.begin(), v.end()); v.erase( unique(v.begin(), v.end()), v.end() );} while(0)


#define y0 y3487465
#define y1 y8687969

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int N;
const int MAX_N = 100;
ll W[MAX_N];

int main(){
  cin >> N;
  REP(i, N) cin >> W[i];

  ll ans = INFi;

  REP(i, N) {
    ll s1 = 0, s2 = 0;
    REP(j, N) {
      if(j < i) {
        s1 += W[j];
      } else {
        s2 += W[j];
      }
    }
    ans = min(ans, abs(s1 - s2));
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	sc.Split(bufio.ScanWords)
	var N int
	N = nextInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	sort.Ints(A)
	ans := A[N/2] - A[N/2-1]
	fmt.Println(ans)

}


Measured memory_bytes: 2048
import java.util.Scanner;

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

        int N = 50;
        long[] list = new long[N];

        for(int i = 0; i < N; i++){
            list[i] = K/N+i;
        }

        for(int i = 0; i < K%N; i++){
            for(int  j = 0; j < N; j++){
                if( i == j){
                    list[j] = list[j] + N;
                }else{
                    list[j]--;
                }
            }
        }
        System.out.println(N);
        for(int i = 0; i < N; i++){
            if(i == N-1){
                System.out.println(list[i]);
            }else{
                System.out.print(list[i] + " ");
            }
        }

    }
}

Measured memory_bytes: 23380
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include <cassert>
#include <functional>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;


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





Measured memory_bytes: 3596
#include<stdio.h>

int main(void)
{
  int n;
  scanf("%d",&n);

  int i,v[n],c[n];
  for(i=0;i<n;i++)
    scanf("%d",&v[i]);
  for(i=0;i<n;i++)
    scanf("%d",&c[i]);

  int ans=0;
  for(i=0;i<n;i++)
    if(v[i]-c[i]>0)
      ans += v[i]-c[i];

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

Measured memory_bytes: 128
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
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);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}



Measured memory_bytes: 3640
N,A,B,C,D= map(int,input().split())
S = input()


ans = "Yes"
f = 0
if C>D:
    f = 1


if f == 0:
    now = S[A-1]
    count = 0
    for i in range(A-1,C):
        if S[i]=='#':
            count += 1
        else:
            count = 0
        if count == 2:
            ans = "No"
            break
  
    count = 0
    for i in range(B-1,D):
        if S[i]=='#':
            count += 1
        else:
            count = 0
        if count == 2:
            ans = "No"
            break
       


if f == 1:
    now = S[A-1]
    count = 0
    count_space = 0
    space_flag = False

    for i in range(B-2,D+1):
        if S[i]=='#':
            count_space = 0
        else:
            count_space += 1
        if count_space == 3:
            space_flag = True

    if not space_flag:
        ans = "No"
    
    for i in range(A-1,C):
        if S[i]=='#':
            count += 1
        else:
            count = 0
        if count == 2:
            ans = "No"
            break

    
    
    count = 0
    for i in range(B-1,D):
        if S[i]=='#':
            count += 1
        else:
            count = 0
        if count == 2:
            ans = "No"
            break

print(ans)


        

            
        





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

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << "Line " << __LINE__ << ": " <<  #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()

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

template<typename T> using V = vector<T>;
template<typename T> using P = pair<T, T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){os << "(" << v.first << ", " << v.second << ")"; return os;}
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<vector<T>> &v){ for(auto &e : v){os << e << "\n";} return os;}
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

template <class T> void UNIQUE(vector<T> &x) {sort(ALL(x));x.erase(unique(ALL(x)), x.end());}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
void fail() { cout << -1 << '\n'; exit(0); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<"\n";}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<"\n";};

const ll INF = (1ll<<62);
// const ld EPS   = 1e-10;
// const ld PI    = acos(-1.0);
const ll mod = (int)1e9 + 7;
//const ll mod = 998244353;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(){

    ll N;
    cin >> N;

    auto div = divisor(2*N);

    ll ans = INF;
    for(auto x: div){
        ll y = (2*N)/x;
        V<ll> r = {0, y-1};
        V<ll> m = {x, y};
        auto res = crt(r, m);
        if(res.first!=0){
            chmin(ans, res.first);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;
using vecint = vector<int>;
using ll = int64_t;
constexpr int64_t INF = 1000000000;

int main()
{
  int n;
  cin>>n;
  vector<int64_t> a(n);
  REP(i,n) cin>>a[i];
  int64_t mni, mn = INF;
  int64_t mxi, mx = -INF;
  REP(i,n) {
    if (a[i] < mn) {
      mni = i;
      mn = a[i];
    }
    if (a[i] > mx) {
      mxi = i;
      mx = a[i];
    }
  }
  cout << (2*n-2) << endl;
  if (-mn > mx) {
    REP(i,n) {
      if (i==mni) continue;
      cout << (mni+1) << ' ' << (i+1) << endl;
    }
    for (int i = n-1; i>0; --i) {
      cout << (i+1) << ' ' << i << endl;
    }
  } else {
    REP(i,n) {
      if (i==mxi) continue;
      cout << (mxi+1) << ' ' << (i+1) << endl;
    }
    FOR(i,1,n) {
      cout << i << ' ' << (i+1) << endl;
    }
  }
  return 0;
}


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

#define SPEED cin.tie(0);ios::sync_with_stdio(false);
template <class T> void chmax(T& a, const T b){a=max(a,b);}

int main() {
    SPEED
    int N; cin >> N;
    constexpr int N_max = 1<<18;
    array<int,N_max> V,W;
    for(int i = 1; i <= N; ++i) cin >> V[i] >> W[i];

    //O(Q)
    constexpr int nl = 1<<10,nr=1<<8,L_max=100001;
    array<int,nl> msb;
    for(int i = 1; i < nl; ++i) msb[i]=31-__builtin_clz(i);

    array<int,nl> bit_w_dp;
    array<int,nl> bit_v_dp;
    vector<vector<int>> dp(nl,vector<int>(L_max,0));
    //前計算
    int m = min(nl,N+1);
    for(int n = 1; n < m; ++n) {
        int k = 2*n;
        vector<int> l;
        while(k/=2) l.push_back(k);
        int sz=l.size();
        //bit全探索
        for(int i = 1; i < (1<<sz); ++i) {
            bit_w_dp[i]=bit_w_dp[i^(1<<msb[i])]+W[l[msb[i]]];
            bit_v_dp[i]=bit_v_dp[i^(1<<msb[i])]+V[l[msb[i]]];
            if(bit_w_dp[i]<=L_max) chmax(dp[n][bit_w_dp[i]],bit_v_dp[i]);
        }
        //累積max
        for(int i = 1; i < L_max; ++i) {
            chmax(dp[n][i],dp[n][i-1]);
        }
    }

    int Q; cin >> Q;
    string ans_str="";

    //クエリ
    while(Q--) {
        int p,L,l_idx=0;; cin >> p >> L;
        vector<int> r;
        p *= 2;
        while(p/=2) {
            if(p<nl) chmax(l_idx,p);
            else r.push_back(p);
        }
        int sz = r.size(),ans=dp[l_idx][L];
        //bit全探索
        for(int i = 1; i < (1<<sz); ++i) {
            bit_w_dp[i]=bit_w_dp[i^(1<<msb[i])]+W[r[msb[i]]];
            bit_v_dp[i]=bit_v_dp[i^(1<<msb[i])]+V[r[msb[i]]];
            if(bit_w_dp[i]<=L) chmax(ans,dp[l_idx][L - bit_w_dp[i]]+bit_v_dp[i]);
        }
        ans_str += to_string(ans)+"\n";
    }
    cout << ans_str;

    return 0;
}


Measured memory_bytes: 408228
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<usize>();
    let a = scan.readn::<i64>(n);
    let mut ret = a[0] - 1;
    let mut x = 2;
    for i in 1..n {
        if a[i] < x {continue;}
        if a[i] == x {
            x += 1;
            continue;
        }
        ret += (a[i] - 1) / x;
    }
    println!("{}", ret);
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var NP = Sarray();
            var N = NP[0];
            var P = NP[1];
            if (1 == N)
            {
                WriteLine(P);
                return;
            }
            var ans = 1L;
            for (var i = 2L; ; ++i)
            {
                var clc = 1L;
                for (var j = 0; j < N; ++j)
                {
                    clc = clc * i;
                    if (P < clc)
                    {
                        WriteLine(ans);
                        return;
                    }
                }
                if (P == clc)
                {
                    WriteLine(i);
                    return;
                }
                if (P % clc == 0)
                    ans = i;
            }
            //Out.Flush();
        }

    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define fi        first
#define se        second
#define PI        acos(-1)
#define LC(a)     ((a<<1))
#define RC(a)     ((a<<1)+1)
#define MID(a,b)  ((a+b)>>1)
#define mem(a, b) memset(a, b, sizeof(a))
#define IOS()     std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<ll,ll>   PLL;
typedef pair<ll,int>  PLI;
const int INF = 0X3F3F3F3F;
const int MIN = -(1<<30);
const ll N = 1e5+7;
int main()
{
	IOS();
	
	
	int a,b;
	cin>>a>>b;
	cout<<(a==b?"Yes":"No");
	
	
	
	
	
	
	
	
	

	
	
	return 0;
}



Measured memory_bytes: 256
n,k = map(int,input().split())
w = [int(input()) for i in range(n)]
def f(x):
    i = 0
    for j in range(k):
        s = 0
        while s+w[i] <= x:
            s += w[i]
            i+=1
            if i == n:
                return n
    return i

def bin_search(left,right):
    while right - left > 1:
        mid = (left + right) // 2
        if f(mid) == n:
            right = mid
        else:
            left = mid
    return right

print(bin_search(0,10**9))


Measured memory_bytes: 9576
#include <stdio.h>

#define DEBUG	(0)
#define ZEI_8	(12.5)		//1/0.08 = 12.5
#define ZEI_10	(10)		//1/0.1 = 10

int main(void)
{
  int input_a, input_b = 0;
  double a_min,a_max,b_min,b_max = 0;
  int a_min_seisu,b_min_seisu = 0;
  int resultnum = 0;
  
  scanf("%d %d",&input_a, &input_b);
//  scanf("%lu %lu %lu\n",&N, &blue, &red);
  a_min = input_a * ZEI_8;
  a_max = a_min + ZEI_8;
  b_min = input_b * ZEI_10;
  b_max = b_min + ZEI_10;

  a_min_seisu = a_min;
  b_min_seisu = b_min;
  
  if((double)a_min_seisu < a_min){a_min_seisu = a_min_seisu +1;}
  if((double)b_min_seisu < b_min){ b_min_seisu = b_min_seisu +1;}
  
#if DEBUG
  printf("%d %d \n",input_a, input_b);
  printf("%f %f %f %f\n",a_min, a_max, b_min, b_max);
  printf("%d %d \n",a_min_seisu, b_min_seisu);
#endif
  
  //a,bの範囲が被っていない時はNG
  if(a_max < b_min){
    printf("-1\n");
    return 0;
  }
  if(b_max < a_min){
    printf("-1\n");
    return 0;
  }
  
  while(1){
   if(b_min <= (double)a_min_seisu && (double)a_min_seisu < b_max) {
     resultnum = a_min_seisu;
     break;
   }else{
     a_min_seisu++;
     if((double)a_min_seisu < a_max){
       //continue
     }else{
       resultnum = -1;
       break;
     }
   }
    
  }
  
  printf("%d\n",resultnum);
  
}

Measured memory_bytes: 128
use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    let mut stdin = stdin.lock();

    let s = {
        let mut input = String::new();
        stdin.read_line(&mut input).unwrap();
        input.trim().to_string()
    };

    let vec = {
        let mut vec = Vec::with_capacity(100_000);
    
        let mut state = 'R';
        let mut counter: i32 = 0;
    
        for c in s.chars() {
            if c == state {
                counter += 1;
            } else {
                vec.push(counter);
                counter = 1;
                state = if state == 'R' { 'L' } else { 'R' };
            }
        }
        vec.push( counter );
        
        vec
    };

    
    for i in 0..vec.len()/2 {
        let i = 2*i;
        let x = (vec[i]+1)/2 + vec[i+1]/2;
        let y = vec[i]/2 + (vec[i+1]+1)/2;

        let xp: Vec<u8> = (0..2*vec[i]-2).map(|i| if i%2 == 0 { 48 } else { 32 }).collect();
        let yp: Vec<u8> = (0..2*vec[i+1]-2).map(|i| if i%2 == 0 { 48 } else { 32 }).collect();
        
        print!("{}{} {} {}",
               String::from_utf8(xp).unwrap(),
               x, y,
               String::from_utf8(yp).unwrap(),
        );
    }

    print!("\n");
}


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

int main() {
	string S;cin >> S;
	int ans = 0;
	for(int i = 0 ; i < S.size() ; i++){
		if(i%2 == 0){
			if(S[i] == '1') ans++;
		}
		if(i%2 == 1){
			if(S[i] == '0') ans++;
		}
	}
	cout << min(ans,(int)S.size()-ans) << endl;
}

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

int main() {
  int k,g[100000],x,total = 0,f,rank,rankswitch = 0;
  int order[100000] = {1};
  while(scanf("%d,%d",&k,&f) == 2) {
    g[k] = f;
    total++;
    if((k == 0) && (f == 0))
      break;
  }
  rank = 1;
  for(int j=0;j<31;j++) {
    for (int i=1;i<total;i++){
      if(g[i] == 30 - j) {
        order[i] = rank;
        rankswitch = 1;
      }
      if((rankswitch == 1) && (i == total-1)) {
        rank++;
        rankswitch = 0;
      }
    }

  }

  while(scanf("%d",&x) == 1) {
    cout << order[x] << endl;
  }

}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <bitset>  
using namespace std;

//======================================================
#define for1(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for2(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define forr1(i,n)  for (int i = n - 1 ;i <= 0; --i)
#define forr2(i,n)  for (int i = n  ;i < 0; --i)
#define all(v)	   ((v).begin()), ((v).end())
#define allr(v)	   ((v).rbegin()), ((v).rend())
#define clr(v,d)   memset(v, d, sizeof(v))
#define ull        unsigned long long
#define MP(a,b)	   make_pair(a,b)
#define S          second
#define F          first
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define bgn        begin
#define N          100000+5
#define	MOD        1e9+7
#define inf        1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;
}
//======================================================
/**----------------------Graph Moves----------------* /
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/


//
//int depth[30+9];
//int quantity[30 + 9];
//int n , w , airbottle;
//int dp[30+ 9][10000+9];
//int backtrack[30+ 9][10000+9];
//int  dividingForGold(int index , int rmBottle)
//{
//	if (index == n)
//		return 0;
//	if (dp[index][rmBottle] != -1)
//	{
//		return dp[index][rmBottle];
//	}
//	int leave = dividingForGold(index + 1, rmBottle);
//	int take = 0;
//	if (rmBottle >=  depth[index])
//	{
//		take = dividingForGold(index + 1, rmBottle - (depth[index])) + quantity[index];
//	}
//	if (take > leave)
//		backtrack[index][rmBottle] = 1;
//	return dp[index][rmBottle] = max(leave, take);
//
//}


long long grid[1000 + 9][1000 + 9];
char paths[1000 + 9][1000 + 9];
int main()
{
	int h , w;
	cin >> h >> w;
	for (int r = 0; r < h; r++)
	{
		for (int c = 0; c < w; c++)
		{
			char a;
			cin >> a;

			if (a == '#')
				grid[r][c] = 0;
			else if (r == 0 && c == 0)
			{
				grid[r][c] = 1;
			}
			else if (r == 0)
			{
				grid[r][c] = grid[r][c-1] ;
			}
			else if (c == 0)
			{
				grid[r][c] = grid[r -1][c];

			}
			else
			{
				grid[r][c] = grid[r-1][c] % (1000000000 + 7) + grid[r][c - 1] % (1000000000 + 7);
			}
			grid[r][c] %= 1000000000 + 7;

		}
	}
	cout << grid[h - 1][w - 1] ;

}


Measured memory_bytes: 10956
/*
*******************
2018-10-27 Sat
*******************
*/
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;
#define PI 3.14159265359
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
const int INF = 1<<29;
typedef unsigned long long ull;
typedef long long ll;
typedef long long int LL;

string s;

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(NULL);
    cout.tie(NULL);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);	

    cin >> s;
    int n=(int)s.length();

    if(n==2)
        cout << s << endl;
    else{
        reverse(s.begin(),s.end());
        cout << s << endl;
    }

    return 0;
}


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

int main() {
	long long n,m,d;cin>>n>>m>>d;
	double ans=0;
	if(d==0){
		ans=double(m-1)/n;
	}else{
		ans=double(2*(m-1)*(n-d))/double(n*n);
	}
	cout<<setprecision(20)<<ans<<endl;
	return 0;
}


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

const int INF = 100000000;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> adj_list[N];
    map<P, int> weight;
    rep(i, M)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        adj_list[a].push_back(b);
        adj_list[b].push_back(a);
        weight[make_pair(a, b)] = c;
        weight[make_pair(b, a)] = c;
    }

    set<P> used;
    rep(i, N)
    {
        // cout << ' ' << endl;
        int distance[N];
        rep(j, N) distance[j] = -1;
        distance[i] = 0;

        priority_queue<T, vector<T>, greater<T>> pque;
        // distance, now, before
        pque.push(make_tuple(0, i, -1));
        while (pque.size() > 0)
        {

            T elem = pque.top();
            pque.pop();

            int d, now, before;
            tie(d, now, before) = elem;
            
            if (before == -1) {}
            else if(distance[now] == -1 or d == distance[now])
            {
                distance[now] = d;
                used.insert(make_pair(now, before));
                used.insert(make_pair(before, now));
            }
            else
                continue;
            // cout << pque.size() << ' ' << now << ' '<< before << endl;

            for (auto next: adj_list[now])
            {
                // cout << next << ' ' << now << endl;
                pque.push(
                    make_tuple(
                        d + weight[make_pair(now, next)], 
                        next, 
                        now)
                    );
            }
        }
    }
    // cout << used.size() / 2 << endl;
    int ans = M - used.size() / 2;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>

using namespace std;

inline long long read()
{
  long long x=0,f=1;char ch=getchar();
  while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
  while (isdigit(ch)) {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  return x*f;
}

const int maxn = 2e5+1e2;

long long  a[maxn];
int n;
long long ans;

int main()
{
  cin>>n;
  for (int i=1;i<=n;i++) a[i]=read(),a[i]=a[i]-i;
  sort(a+1,a+1+n);
  long long b;
  if (n&1)
  {
  	b = a[(n+1)/2]; 
  }
  else
  {
  	b=(a[n/2]+a[n/2+1])/2;
  }
  for (int i=1;i<=n;i++) ans=ans+abs(a[i]-b);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

// #define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int N;
  cin >> N;

  int ans = INF;
  for (int piv = 0; piv <= N; piv++) {
    int a = 0;

    int x = piv;
    while (x > 0) {
      a += x % 6;
      x /= 6;
    }

    int y = N - piv;
    while (y > 0) {
      a += y % 9;
      y /= 9;
    }

    ans = min(ans, a);
  }

  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

class magic {
public:
  i64 damage;
  i64 mp;

  friend std::istream& operator>>(std::istream& is, magic& self) {
    return is >> self.damage >> self.mp;
  }
};

int main() {
  i64 H, N;
  std::cin >> H >> N;
  std::vector<magic> magics;
  tools::read(magics, N);

  // 敵の残りHPがh時点での最小消費MPをdp[h]とする。
  std::vector<i64> dp(H + 1, std::numeric_limits<i64>::max());
  dp[H] = 0;

  for (i64 h = H; h > 0; --h) {
    if (dp[h] < std::numeric_limits<i64>::max()) {
      for (const magic& magic : magics) {
        const i64 left_hp = std::max<i64>(0, h - magic.damage);
        dp[left_hp] = std::min(dp[left_hp], dp[h] + magic.mp);
      }
    }
  }

  std::cout << dp[0] << std::endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#pragma comment(linker, "/STACK:400000000")

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(it=X.begin();it!=X.end();it++)
#define iss istringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sst stringstream
#define sz size()
#define vc vector
typedef vc<int> vi;
typedef vc<ll> vl;
typedef vc<string> vs;

int N;
string mark[10010];
int used[10010],nex[10010];
map<string,int> M;
vi ans;

void read(int cur){
	if(used[cur])return;
	ans.pb(cur);
	used[cur]=1;
	if(nex[cur]!=-1)read(nex[cur]);
}

int main(){
	while(cin>>N && N){
		rep(i,N)cin>>mark[i];
		fill(used,used+10010,0);
		fill(nex,nex+10010,-1);
		M.clear();
		ans.clear();
		if(M.sz || ans.sz)return 0;
		
		rep(i,N){
			if(mark[i]=="-"){
				read(i);
			}else if(mark[i]=="v"){
				nex[i+1]=i;
			}else{
				string type;
				int number=0;
				int x=0;
				while(islower(mark[i][x])){
					type+=mark[i][x];
					x++;
				}
				while(x<mark[i].sz && isdigit(mark[i][x])){
					number=number*10+mark[i][x]-'0';
					x++;
				}
				if(M.find(type)!=M.end()){
					nex[i]=M[type];
				}
				if(number>1)M[type]=i;
				else M.erase(type);
				if(x<mark[i].sz)nex[i+1]=i;
				else if(number==1)read(i);
			}
		}
		
		rep(i,N)cout<<ans[i]+1<<endl;
	}
}

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

using namespace std;

int main () {
    string s = "", t = "";
    cin >> s >> t;
    for (int i=0; i<s.size(); i++) {
        char buf = s.front();
        s.erase(s.begin());
        s.push_back(buf);
        if (s == t) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;    
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

int main(void){
    int n;
    bool isprime[1000001];
    vector<int> primes;

    //sieve
    memset(isprime, true, sizeof(isprime));
    for(int i=2;i<=1000000;i++){
        if(isprime[i] == true){
            primes.push_back(i);
            for(int j=2;i*j<=1000000;j++){
                isprime[i*j] = false;
            }
        }
    }

    int prize,ret,p,m;
    while(cin >> n && n){
        ret = 0;
        prize = 0;
        for(int i=0;i<n;i++){
            cin >> p >> m;
            prize = upper_bound(primes.begin(), primes.end(),p+m) - 
                lower_bound(primes.begin(),primes.end(),p-m);
            
            if(prize == 0){
                ret -= 1;
            }else{
                ret += prize-1;
            }
        }
        if(ret <= 0){
            cout << 0 << endl;
        }else{
            cout << ret << endl;
        }
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>

struct LR{
    int l, r;
}lr[200000];

bool comp(LR x, LR y){
    if(x.l == y.l){
        return x.r < y.r;
    }
    return x.l < y.l;
}

int main()
{
    using namespace std;
    
    int n, m, q, pq[100000][2], ps[501][501] = {{0}};
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++){
        cin >> lr[i].l >> lr[i].r;
    }
    sort(lr, lr + m, comp);
    for(int i = 0; i < m; i++){
        ps[lr[i].l][lr[i].r]++;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            ps[j][i] += ps[j - 1][i];
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            ps[i][j] += ps[i][j - 1];
        }
    }
    for(int i = 0; i < q; i++){
        cin >> pq[i][0] >> pq[i][1];
        cout << ps[pq[i][1]][pq[i][1]] - ps[pq[i][0] - 1][pq[i][1]] << endl;
    }
    return 0;
}


Measured memory_bytes: 6920
#include <iostream>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);

    for(int i=0;i<n;i++) {
        cin >> a[i];
        cin >> b[i];
    }
    ll mi = a[0],  score = b[0];
    for(int i=0;i<n;i++) {
        if(mi < a[i]) {
            mi = a[i];
            score = b[i];
        }
    }
    cout << mi + score << endl;


}


Measured memory_bytes: 1792
// 倍增 - AT2039 [ARC060C] 高橋君とホテル  Tak and Hotels.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
using namespace std;

int N, L, Q;
int x[100010];
int t[100010][18];
int p[20];

int main()
{
    //cin >> N;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++) {
        //cin >> x[i];
        scanf("%d", &x[i]);
    }
    //cin >> L >> Q;
    scanf("%d%d", &L, &Q);
    int si=1, se=1;
    while (se < N) {
        if (x[se + 1] - x[si] <= L) {
            se++;
        }
        else {
            t[si][0] = se;
            si++;
        }
    }
    for (int i = si; i <= N; i++) {
        t[i][0] = N;
    }

    int k = int(log(N-1) / log(2));
    int temp = 1;
    for (int i = 1; i <= k; i++) {
        p[i - 1] = temp;
        for (int j = 1; j <= N; j++) {
            t[j][i] = t[t[j][i - 1]][i-1];
        }
        temp *= 2;
    }
    p[k] = temp;
    /*
    for (int i = 1; i <= N; i++) {
        cout << setw(4) << i << setw(4) << x[i];
        for (int j = 0; j <= k; j++) {
            cout << setw(4) << t[i][j];
        }
        cout << endl;
    }*/
    
    int a, b, c;
    for (int i = 1; i <= Q; i++) {
        //cin >> a >> b;
        scanf("%d%d", &a, &b);
        if (a > b) {
            temp = a;
            a = b;
            b = temp;
        }
        temp = a;
        c = 0;
        int minC = 1e10;
        for (int j = k; j >= 0; j--) {
            if (b < t[temp][j]) {
                minC = min(minC, c + p[j]);
                continue;
            }
			else if (b > t[temp][j]) {
				temp = t[temp][j];
				c += p[j];
			}
            else if (b == t[temp][j]) {
                //c += p[j];
                minC = min(minC, c + p[j]);
            }
        }
        //cout << c << endl;
        printf("%d\n", minC);
    }

    return 0;
}

/*
32
1 3 6 13 15 18 19 29 31 35 42 52 61 63 65 71 74 77 79 83 93 103 113 123 133 143 153 163 167 170 178 180
10
10
2 31
1 32
1 8
7 3
6 7
8 5
1 17
3 29
4 15
16 24
*/


Measured memory_bytes: 8192
k = int(input())

if k <= 2 * 10**16:
    n = 2
    if k % 2 == 0:
        a = [k // 2 + 1, k // 2 + 1]
    else:
        a = [k // 2 + 3, k // 2]
else:
    n = 50
    a = [k // n + n - 1 for _ in range(50)]
    for i in range(k % n):
        for j in range(n):
            if j == i:
                a[j] += n
            else:
                a[j] -= 1
print(n)
print(' '.join(map(str, a)))

Measured memory_bytes: 39024
import java.io.*;
import java.util.*;


 class Main {

    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        
     int a=Reader.nextInt();
     int b=Reader.nextInt();
     int c=Reader.nextInt();
     
     long k=Reader.nextInt();
     
     if(k%2==0)
         pw.println(a-b);
     
     else {
     long ans=(long)(b+c)-(long)(a+c);
             if(Math.abs(ans)>=1e18)
                 pw.println("Unfair");
             else pw.println(ans);
     
     
     
     }
     pw.close();
        
  
    }
}//end class

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    public static int pars(String x) {
        int num = 0;
        int i = 0;
        if (x.charAt(0) == '-') {
            i = 1;
        }
        for (; i < x.length(); i++) {
            num = num * 10 + (x.charAt(i) - '0');
        }

        if (x.charAt(0) == '-') {
            return -num;
        }

        return num;
    }

    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static void init(FileReader input) {
        reader = new BufferedReader(input);
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return pars(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}

class pair implements Comparable<pair> {

    long first, second;

    pair() {
    }

    pair(long a, long b) {
        first = a;
        second = b;
    }

    public int compareTo(pair q) {
        if (first > q.first) {
            return 1;
        } else if (first < q.first) {
            return -1;
        }
        if (second > q.second) {
            return -1;
        } else if (second < q.second) {
            return 1;
        }
        return 0;
    }
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, l;
string s[100];

int main() {
	cin >> n >> l;
	rep(i,n) cin >> s[i];
	
	sort(s, s+n);
	rep(i,n) cout << s[i];
	cout << ln;
}

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

int main(){
    int w;
    int n;

    int a1, a2;
    int tmp;


    cin >> w >> n;

    vector<int> a(w);

    for(int i=0; i<w; i++){
        a[i] = i+1;
    }

    for(int i=1; i<=n; i++){
        scanf("%d,%d", &a1, &a2);
        tmp = a[a1-1];
        a[a1-1] = a[a2-1];
        a[a2-1] = tmp;
    }

    for(int i=0; i<w; i++){
        cout << a[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 0
#include <iostream>

using namespace std;
int n,a[100005];

int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;++i)scanf("%d",a+i);
    int last = a[0];
    for(int i=1;i<n;++i)
    {
        last = a[i]-last;
    }
    printf("%d",last);
    for(int i=0;i<n-1;++i)
    {
        last = 2*(a[i] - last/2);
        printf(" %d",last);
    }
    printf("\n");
    return 0;
}


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) { cin >> v[i]; }
  vector<int> a(v);
  sort(v.rbegin(), v.rend());

  for (int i = 0; i < n; i++) {
    if (a[i] == v[0]) {
      cout << v[1] << endl;
    } else {
      cout << v[0] << endl;
    }
  }
}


Measured memory_bytes: 3200
object Main extends App {
  import scala.io.StdIn._

  val Array(a, b) = readLine.trim.split(' ').map(_.toLong)
  println(
    (0 until 63).filter(d ⇒ countUntil(a, 1L << d) % 2  != countUntil(b + 1, 1L << d) % 2).map(1L << _).sum
  )
  def countUntil(x: Long, digit: Long): Long = {//digit == 1 << d
    if (x < digit) 0
    else {
      //0 until x のうち、1 << d　が1である物の数
      val h = x / (digit * 2) * digit
      if (x / digit % 2 == 0) {
        h
      }else {
        h + (x % digit)
      }
    }
  }
}

Measured memory_bytes: 27196