akhauriyash/Code-Regression huggingface dataset:
use std::io;

fn bubble_sort(vec : &mut Vec<i64>) -> usize {
    let mut to_be_sorted = true;
    let mut count = 0;

    while to_be_sorted {
        to_be_sorted = false;

        for n in (1 .. vec.len()).rev() {
            if vec[n] < vec[n - 1] {
                vec.swap(n - 1, n);
                count += 1;
                to_be_sorted = true;
            }
        }
    }

    return count;
}

fn show_answer(vec : &Vec<i64>, count : usize) {
    println!("{}\n{}",
             vec.iter()
             .map(|x| x.to_string())
             .collect::<Vec<String>>()
             .join(" "),
             count);
}

fn main () {
    let mut s = String::new();
    let stdin = io::stdin();

    let _ = stdin.read_line(&mut s);
    let n = s.trim()
        .parse::<usize>().unwrap_or(0);

    s.clear();

    let _ = stdin.read_line(&mut s);
    let mut vec : Vec<i64> = s.split_whitespace()
        .take(n)
        .map(|s| s.parse().unwrap_or(0)).collect();
    //let mut vec = vec![5i64,3,2,4,1];
    let answer = bubble_sort(&mut vec);

    show_answer(&vec, answer);
    
}



Measured memory_bytes: 5040
#include<stdio.h>

int main ()
{
    int a = 0;
    char s[11];
    
    scanf("%d",&a);
    scanf("%s",&s);
    
    if(a >= 3200)
    {
        printf("%s",s);
    }
    else
    {
        printf("red");
    }

    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n, m; cin>>n>>m;
    vector<vi> adj(n+1);
    rep(i, m){
        int a, b; cin>>a>>b;
        adj[a].pb(b);
    }

    vi ans;
    rep(i, n){
        queue<int> que;
        que.push(i+1);
        vi prev(n+1, -1);
        bool loop = false;
        while(que.size() && loop==false){
            int node = que.front(); que.pop();
            for(auto e:adj[node]){
                if (prev[e] == -1){
                    prev[e] = node;
                    if (e == i+1){
                        loop = true;
                        break;
                    }
                    que.push(e);
                }
            }
        }
        if (loop){
            vi temp;
            for(int j=prev[i+1]; j!=i+1; j=prev[j]){
                temp.pb(j);
            }
            temp.pb(i+1);
            if (ans.size() > temp.size() || ans.empty()) ans = temp;
        }
    }
    if (ans.size()){
        cout << ans.size() << "\n";
        for(auto e:ans){
            cout << e << "\n";
        }
    }else{
        cout << "-1\n";
    }
	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a>b){
		cout<<b*c+(a-b)*d<<endl;
	}else{
		cout<<a*c<<endl;
	}
}

Measured memory_bytes: 256
mod = 10**9+7
h,w,k = map(int,input().split())
dp =[[0]*w for _ in range(h+1)]
dp[0][0]=1
fibo=[1]*10
for i in range(2,10):
        fibo[i] = fibo[i-2]+fibo[i-1]
for i in range(1,h+1):
        for j in range(w):
                dp[i][j] = dp[i-1][j]*fibo[j]*fibo[w-j-1]%mod
                if(j>0):
                        dp[i][j] += dp[i-1][j-1]*fibo[j-1]*fibo[w-j-1]%mod
                        dp[i][j] %= mod
                if(j<w-1):
                        dp[i][j] += dp[i-1][j+1]*fibo[j]*fibo[w-j-2]%mod
                        dp[i][j]%=mod
print(dp[h][k-1])

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

long get_GCD(long a, long b) {
	long r;
	if (a < b) {
		swap(a, b);
	}
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}

long get_LCM(long a, long b, long gcd) {
	return (a * b) / gcd;
}

int main(int argc, char *argv[]) {
	long a, b, c, d;
	cin >> a >> b >> c >> d;
	
	long gcd = get_GCD(c, d);
	long lcm = get_LCM(c, d, gcd);
	
	long b_count = b - (b / c + b / d) + b / lcm;
	long a_count = (a - 1) - ((a - 1) / c + (a - 1) / d) + (a - 1) / lcm;
	long count = b_count - a_count;
	
	cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;
static const double EPS = 1e-10;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define SS stringstream
#define DBG1(a) rep(_X,sz(a)){printf("%d ",a[_X]);}puts("");
#define DBG2(a) rep(_X,sz(a)){rep(_Y,sz(a[_X]))printf("%d ",a[_X][_Y]);puts("");}
#define bitcount(b) __builtin_popcount(b)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)

#define delete(a,n) a.erase(remove(all(a),n),a.end())
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
template<typename T> void operator>>(vector<T>& a, int b) {while(b--)if(!a.empty())a.pop_back();}
bool isprime(int n){ if(n<2)return false;  for(int i=2;i*i<=n;i++)if(n%i==0)return false;  return true;} 
ll b_pow(ll x,ll n){return n ? b_pow(x*x,n/2)*(n%2?x:1) : 1ll;}
string itos(int n){stringstream ss;ss << n;return ss.str();}

typedef unsigned int uint;
int in() {
    int x = 0, c;
    for (; (uint)((c = getchar()) - '0') >= 10; ) { if (c == '-') return -in(); if (!~c) throw ~0; }
    do { x = (x << 3) + (x << 1) + (c - '0'); } while ((uint)((c = getchar()) - '0') < 10);
    return x;
}

int main(){
	map<string,int> w;
	int n = in();
	vector< pair< pair<int,string> , int > > v;
	for(int i = 0 ; i < n ; i++){
		string s;int b;
		cin >> s >> b;
		w[s]+=b;
	}
	EACH(it,w){
		v.push_back(mp(mp(it->first.size(),it->first),it->second));
	}
	sort(v.begin(),v.end());
	rep(i,v.size()) cout << v[i].first.second << " " << v[i].second << endl;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef pair <int,int> pii;
typedef vector <pii> vpii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef long long int lli;
typedef vector <lli> vlli;
typedef vector <vlli> vvlli;
typedef vector <string> vs;
typedef vector <bool> vb;

#define rep(i, n) for( i = 0; i < (n); ++i)
#define repA(i, a, n) for( i = a; i <= (n); ++i)
#define repD(i, a, n) for( i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sortr(x) sort(x.begin(),x.end(),greater <int> ())
#define mod 1000000007
#define ff first
#define ss second
#define fill(a,c)  memset(a, c, sizeof (a))
#define formap(i,v) for(auto &i: v)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; formap(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.first<<" , "<<it.second<<endl;} cerr<<endl
#define PI  3.14159265358979323846
#define pb push_back





int main() {
	cin.sync_with_stdio(0);cin.tie(0);
    cin.exceptions(cin.failbit);
    
    lli i,j,k,n,ans;
    cin>>n;
    vlli a(n);
    rep(i,n)cin>>a[i];
    sortr(a);
    ans=a[0];
    j=3,i=1;
    for (i=1;j<n;i++,j+=2){
        ans+=2*a[i];
    }
    
    if (j==n)ans+=a[i];
    cout<<ans<<endl;
    
    
    
    
    
    
    
   
   
   
	return 0;
}


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

int main(){
	int mini = 114514;
	int P[3];
	int J[2];
	
	for (int i = 0; i < 3; i++) cin >> P[i];
	for (int i = 0; i < 2; i++) cin >> J[i];
	
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 2; j++) mini = min(mini, P[i] + J[j]);
	}
	cout << mini - 50 << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define F first
#define S second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;

int main()
{
  string s ;
  cin >> s ;
  int n = s.size() ;
  int count = 0 ;
  int cou = 0 ;
  int a, b, c ;
  
  if(s.at(0)=='A'){
    a = 1 ;
  }
  else{
    a = 0 ;
  }
  
  FOR(i,2,n-1){
    if(s.at(i)=='C'){
      count++ ;
    }
  }
  if(count==1){
    b = 1 ;
  }
  else{
    b = 0 ;
  }
  REP(i,n){
    if(s.at(i)-'a'<0){
      cou++ ;
    }
  }
  if(cou==2){
    c = 1 ;
  }
  else{
    c = 0 ;
  }
  if(a==1 && b==1 && c==1){
    cout <<"AC"<<endl ;
  }
  else{
    cout <<"WA"<<endl ;
  }
    

  return 0 ;
}




Measured memory_bytes: 256
# mを法とするaの乗法的逆元
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    MOD = 10**9 + 7

    # もしN = K なら全部選択しないといけないので、
    # 全部掛け算して返す
    if N == K:
        ans = 1
        for a in A:
            ans = (ans * a) % MOD
        print(ans)
        return

    Ap = [] # 正の数だけ入っている
    Am = [] # 負の数だけ入っている.値は絶対値で入れる
    has0 = False # 0がAの中にあるか
    for a in A:
        if a == 0:
            has0 = True
        elif a > 0:
            Ap.append(a)
        else:
            Am.append(-a)

    # それぞれを絶対値の大きい順に並べる
    Ap.sort(reverse=True)
    Am.sort(reverse=True)

    ip = 0
    im = 0
    lp = len(Ap)
    lm = len(Am)

    # もし0でない数がK個未満しかない場合、0を必ず選ばないといけないので
    # 答えは0になる
    if lp + lm < K:
        print(0)
        return

    # # 正の数+負の数=K かつ負の数が奇数のとき、0を選んだほうがマシなので、
    # # 答えは0になる
    # if lp + lm == K and lm % 2 == 1:
    #     print(0)
    #     return
    # もしKが奇数のときで、かつ正の数が1個もない時
    if K % 2 == 1 and lp == 0:
        # 0があるなら0にする
        if has0:
            print(0)
            return
        # 0がない場合は、負の数の中から絶対値の小さいものを選ぶ
        else:
            ans = 1
            for a in Am[-K:]:
                ans = (ans * a) % MOD
            print(MOD - ans)
            return

    # 戦略: Aの中から絶対値の大きい順に選んでいく
    ans = 1
    for i in range(K):
        x = None
        if ip == lp: # 正の数をこれ以上選べないのであれば負の数を選ぶ
            x = Am[im]
            im += 1
        elif im == lm: # 負の数をこれ以上選べないのであれば正の数を選ぶ
            x = Ap[ip]
            ip += 1
        # 正の数、負の数どちらも選べるのであれば、絶対値の大きいほうを選ぶ
        elif Am[im] < Ap[ip]:
            x = Ap[ip]
            ip += 1
        else:
            x = Am[im]
            im += 1
        # print(x)
        ans = ans * x % MOD

    # もし絶対値の大きい順で選んで、負の数を奇数個選んでいたとき
    if im % 2 == 1:
        # 選んだ中で一番小さい負の数を外して、まだ選んでない中で最も大きい正の数を入れるか、
        # 選んだ中で一番小さい正の数を外して、まだ選んでない中で最も（絶対値が）大きい負の数を入れるか選ぶ

        # これ以上0でない数がない場合は、0を選択して答えを0にするのが最大値になる
        if ip == lp and im == lm:
            print(0)
            return
        # 正の数をこれ以上選べない場合は負の数から選ぶ
        elif ip == lp:
            ans = ans * modinv(Ap[ip-1]) % MOD
            ans = ans * Am[im] % MOD
        # 負の数をこれ以上選べない場合は正の数から選ぶ
        # 正の数を1つも選んでないときも正の数から選ぶ
        elif im == lm or ip == 0:
            ans = ans * modinv(Am[im-1]) % MOD
            ans = ans * Ap[ip] % MOD
        # 正、負ともまだ選ぶ余裕がある場合
        else:
            # 一旦、選んだ中で一番小さい負の数と、選んだ中で一番小さい正の数を戻す（再度選べるようにする）
            ip -= 1
            ans = ans * modinv(Ap[ip]) % MOD
            im -= 1
            ans = ans * modinv(Am[im]) % MOD
            
            # 正、負のリストから、まだ選んでない中で絶対値が大きいもの2つを選び、その積の大きいほうを選ぶ
            a = Ap[ip] * Ap[ip+1]
            b = Am[im] * Am[im+1]
            # print(a, b)

            ans = ans * max(a, b) % MOD

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 107284
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char c[150];
int main()
{
    scanf("%s",c);
    if(c[1]<='Z'&&c[1]>='A')
	{
	printf("WA");
	return 0;
    }
    
    int len=strlen(c),tot=0;
    
    if(c[len-1]<='Z'&&c[len-1]>='A')
	{
	printf("WA");
	return 0;
    }
	
	for(int i=2;i<len-1;++i)
	{
		if(c[i]=='C')tot++;
		if(c[i]<='Z'&&c[i]>='A'&&c[i]!='C')
	   {
	   printf("WA");
	   return 0;
       }
	}
	if(tot>1||!tot)
	{
	    printf("WA");
	    return 0;
	}
	if((c[0]=='A')&&(tot==1))
	{
	printf("AC");
    return 0;
	}
	printf("WA");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

struct Edge{
    int to, capacity, revIndex;
};

vector<bool> used;

int findPass(vector<vector<Edge>>& edge, int node, int t, int flow){
    if(node == t){
        return flow;
    }
    used[node] = true;
    for(Edge& e: edge[node]){
        if(!used[e.to] && e.capacity > 0){
            int f = findPass(edge, e.to, t, min(flow, e.capacity));
            if(f > 0){
                e.capacity -= f;
                edge[e.to][e.revIndex].capacity += f;
                return f;
            }
        }
    }

    return 0;
} 

int main(){

    int V, E;
    cin >> V >> E;
    vector<vector<Edge>> edge(V);

    int u, v, c;
    for(int i = 0; i < E; i++){
        cin >> u >> v >> c;
        edge[u].emplace_back((Edge){v, c, (int)edge[v].size()});
        edge[v].emplace_back((Edge){u, 0, (int)edge[u].size() - 1});
    }

    int ans = 0;
    while(true){
        used = vector<bool>(V, false);
        int flow = findPass(edge, 0, V - 1, 20000);
        if(flow == 0){
            break;
        }
        ans += flow;
    }
    
    cout << ans << endl;

    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int32 N;
	cin >> N;
	vector<string> s(N*2);
	REP(i, N){
		cin >> s[i];
		s[i] += s[i];
		s[N+i] = s[i];
	}
	vector<vector<int32>> r(2*N, vector<int32>(2*N, 0));
	REP(i, 2*N){
		REP(j, 2*N){
			int32 cnt = 0;
			for(int32 k = 0;i+k < 2*N && j+k < 2*N;k++){
				if(s[i][j+k] == s[i+k][j]) cnt++;
				else break;
			}
			r[i][j] = cnt;
		}
	}
	int64 res = 0;
	REP(i, N){
		REP(j, N){
//			deque<PLL> deq;
//			deq.push_front(PLL(0, 2*N-max(i, j)));
			int64 mini = INF;
			for(int32 k = N-1;k >= 0;k--){
				int64 x = r[i+k][j+k];
				mini = min(mini, x+(int64)k);
				/*
				while(deq.size() && deq.front().sc-k > N-1) deq.pop_front();
				while(deq.size() && deq.back().fs+(deq.back().sc-k) > x) deq.pop_back();
				deq.push_back(PLL(x, k));
				cout << "(" << deq.front().fs << " " << deq.front().sc << " " << k << ") ";
				if(deq.front().fs+deq.front().sc-k >= N) res++;
				*/
			}
			if(mini >= N) res++;
		}
	}
	cout << res << endl;
}


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

int main(){
  char a,b;
  cin>>a>>b;
  int a1=0,b1=0;
  
  if(a=='A') a1=0;
  if(a=='B') a1=1;
  if(a=='C') a1=2;
  if(a=='D') a1=3;
  if(a=='E') a1=4;
  if(a=='F') a1=5;
  if(b=='A') b1=0;
  if(b=='B') b1=1;
  if(b=='C') b1=2;
  if(b=='D') b1=3;
  if(b=='E') b1=4;
  if(b=='F') b1=5;
  
  
  if(a1==b1) cout<<"="<<endl;
  if(a1>b1) cout<<">"<<endl;
  if(a1<b1) cout<<"<"<<endl;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<hash_map>
#include<bitset>

using namespace std;

int a;
int b;
int h;

int main(){
	cin>>a>>b>>h;
	cout<<(a+b)*h/2<<endl;
	return 0; 
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
// ==================================================
using i64 = int64_t; using u64 = uint64_t;
#define rep(i,a,b) for(i64 i=(i64)(a),i_max=(i64)(b);i<i_max;i++)
#define repn(i,n) rep(i,0,n)
#define din(t, ...) t __VA_ARGS__;_din(__VA_ARGS__)
#define stlv(t,n) vector<t> n
#define stls(t,n) set<t> n
void _din() {} void dout() { cout << endl; }
template <typename T, typename ... Args> inline void _din(T& head, Args& ... rest) { cin >> head; _din(rest...); }
template <typename T, typename ... Args> inline void dout(T head, Args ... rest) { cout << head; if (sizeof...(rest)) cout << ' '; dout(rest...); }
template <typename T>inline void vsortg(vector<T>& v) { sort(v.begin(), v.end(), greater<T>()); }
template <typename T>inline void vsortl(vector<T>& v) { sort(v.begin(), v.end(), less<T>()); }
template <typename T> inline T nmax(T f1, T f2) { return max(f1, f2); }
template <typename T, typename ... Args> inline T nmax(T first, Args ... rest) { return nmax(first, nmax(rest...)); }
template <typename T> inline T nmin(T f1, T f2) { return min(f1, f2); }
template <typename T, typename ... Args> inline T nmin(T first, Args ... rest) { return nmin(first, nmin(rest...)); }

int main()
{
	din(string, s);
	i64 i = 0, c = 0;
	for (auto ch : s)
	{
		if (ch == 'A' || ch == 'T' || ch == 'C' || ch == 'G') c++;
		else
		{
			if (c > i) i = c;
			c = 0;
		}
	}
  	i=nmax(i,c);
	dout(i);
	return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))



#print(len(bin(10**12)))

cnt=[0]*len(str(bin(k))[2:])

#print(cnt)

for item in a:
    for j in range(min(len(str(bin(item))[2:]),len(str(bin(k))[2:]))):
        if item>>j &1:
            cnt[j]+=1

cnt=cnt[::-1]
result=0
for index,item in enumerate(cnt):
    #print(item)
    if item%2==0 and item==n//2:
        result+=0*(2**(len(cnt)-index-1))
    elif item<=n//2 and result+2**(len(cnt)-index-1)<=k:
        result+=2**(len(cnt)-index-1)
    else:
        result+=0*(2**(len(cnt)-index-1))
    #print(result)

ans=0
for item in a:
    #print(item,result,item^result)
    ans=ans+(item^result)
    #print(ans)
print(ans)





"""
001(1)
100(4)
101(5)

110(6)
100(4)
010(2)

011(3)
100(4)
111(7)
"""


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

 int main(){

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

  int ans;
  if(a < 0) ans = -a *c + d + b * e;
  if(a > 0)  ans = (b-a)*e;
  cout<<ans<<endl;

  return 0;
  }



Measured memory_bytes: 3080
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {
    char s;
    cin >> s;
    cout << char(s + 1) << endl;

    return 0;
}

Measured memory_bytes: 256
import kotlin.math.max

fun main() {
  val (n, m, k) = readLine()!!.split(' ').map { it.toInt() }
  val a = (listOf(0L) + readLine()!!.split(' ').map { it.toLong() }).toLongArray()
  val b = (listOf(0L) + readLine()!!.split(' ').map { it.toLong() }).toLongArray()
  for (i in 1 .. n) {
    a[i] += a[i - 1]
  }
  for (i in 1 .. m) {
    b[i] += b[i - 1]
  }
  var answer = 0
  var i = 0
  var j = m
  while (i <= n && a[i] <= k) {
    while (a[i] + b[j] > k) {
      j--
    }
    answer = max(answer, i + j)
    i++
  }
  println(answer)
}

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

public class Main{
  public static void main(String[] args){
    MyScanner sc = new MyScanner();
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    System.out.println(a * b / 2);
  }
  
  public static PrintWriter out;
  
  public static class MyScanner{
    BufferedReader br;
    StringTokenizer st;
    
    public MyScanner(){
      br = new BufferedReader(new InputStreamReader(System.in));
    }
    
    String next(){
      while(st == null || !st.hasMoreElements()){
        try{
          st = new StringTokenizer(br.readLine());
        }catch(IOException e){
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }
    
    int nextInt(){
      return Integer.parseInt(next());
    }
    
    String nextLine(){
      String str = "";
      try{
        str = br.readLine();
      }catch(IOException e){
        e.printStackTrace();
      }
      return str;
    }
  }
}

Measured memory_bytes: 21072
#include <stdio.h>

int main(){

    int a,b,c;
    int num;
    scanf("%d %d %d",&a,&b,&c);

    if(a<1 || 10000<a){
        return -1;
    }else{
        if(b<1 || 10000<b){
            return -1;
        }else{
            if(c<1 || 10000<c){
                return -1;
            }else{
                
                if(a>c){
                    num = c;
                    c = a;
                    a = num;
                }
                if(b>c){
                    num = c;
                    c = b;
                    b = num;
                }
                if(a>b){
                    num = b;
                    b = a;
                    a = num;
                }
                    printf("%d %d %d\n",a,b,c);
            }
        }
    }
    return 0;
}

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



int main() {
	int n, k, q; cin >> n >> k >> q;
	int p[100000] = {};

	for (int i = 0; i < q; i++) {
		int a; cin >> a;
		p[a - 1] ++;
	}

	for (int i = 0; i < n; i++) {
		int j = k - q + p[i];
		cout << (j > 0 ? "Yes" : "No") << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

const int N=200005;


void solve()
{
    
    int x,y;
    cin>>x>>y;
    if(y>=(2*x)&&(!(y%2))&&(y<=4*x))
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
    
    
}



int32_t main()
{
    IOS;
    
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
const ll LINF = 1001001001001001001ll;

// 引数が(l,r)ではなくなったので注意
bool f(ll trial);
template <class T>
T bin_search(T ok, T ng) {
  T c;
  while (abs(ok - ng) > 1) {
    c = (ok + ng) / 2;
    if (f(c)) {
      ok = c;
    } else {
      ng = c;
    }
  }

  return ok;
}

/*
https://atcoder.jp/contests/abc144/tasks/abc144_e
*/
ll N, K;
vector<ll> A;
vector<ll> F;

bool f(ll trial) {
  ll shugyo = 0;
  rep(i, N) {
    ll multi = A[i] * F[i];
    if (multi <= trial)
      continue;
    multi -= trial;
    multi = (multi + F[i] - 1) / F[i];
    shugyo += multi;
  }
  return (shugyo <= K);
}

int main() {
  cin >> N >> K;
  A = vector<ll>(N);
  F = vector<ll>(N);
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> F[i];

  sort(all(A));
  sort(all(F), greater<ll>());

  cout << bin_search(LINF, -1ll) << endl;
}


Measured memory_bytes: 3328
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import  Counter
def resolve():
    N,=pin()
    C=input()
    X=Counter(C)
    a=(min(X["R"],X["W"]))#すべての色を変えにしてしまったらいい時
    c=list(C)


    rightlimit_R=-1
    for i in range(1,N):
        if c[-i]=="R":
            rightlimit_R=N-i
            break
    cnt=0

    for i in range(N):

        if c[i]=="W":

            for j in range(rightlimit_R-1,0,-1):
                if c[j]=="R":

                    
                    rightlimit_R=j
                    break

            cnt+=1
        if rightlimit_R<=i:
            
            break


    print(min(a,cnt))
    
#%%submit!
resolve()

Measured memory_bytes: 77960
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}


use input::*;

fn main() {
    let (k, x): (isize, isize);
    input!(k, x);
    let left = x - k + 1;
    let right = x + k - 1;
    for z in left..right + 1 {
        print!("{} ", z);
    }
    println!("");
}

Measured memory_bytes: 4352
from collections import Counter
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
Tcount = Counter(T)
Dcount = Counter(D)
flag = 'YES'
for n,c in Tcount.items():
    if n not in Dcount or c > Dcount[n]:
        flag = 'NO'
        break
print(flag)


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

int main() {
  int t[5], tt[5], max = 0;
  cin >> t[0] >> t[1] >> t[2] >> t[3] >> t[4]; //それぞれA, B, C, D, E
  for (int i = 0; i < 5; i++) {
    if (t[i] % 10 != 0)
      tt[i] = (t[i] / 10) * 10 + 10;
    else
      tt[i] = t[i];
  }
  
  for (int i = 0; i < 5; i++) {
    if (max < tt[i] - t[i] && tt[i] - t[i] != 0)
      max = tt[i] - t[i];
  }
  
  cout << tt[0] + tt[1] + tt[2] + tt[3] + tt[4] - max;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    int N, X, T;
    cin >> N >> X >> T;

    int cnt = (N + X-1)/X;

    cout << cnt * T << endl;

    return 0;
}



Measured memory_bytes: 3588
import java.util.*;
import java.math.*;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int n = reader.nextInt(), m = reader.nextInt();
		HashMap<Integer, HashSet<Integer>> adj = new HashMap<Integer, HashSet<Integer>>();
		for (int i = 0; i < n; i++) {
			adj.put(i, new HashSet<Integer>());
		}
		for (int i = 0; i < m; i++) {
			int e1 = reader.nextInt() - 1, e2 = reader.nextInt() - 1;
			adj.get(e1).add(e2);
			adj.get(e2).add(e1);
		}
		int[] visited = new int[n];
		int maxSize = 0;
		for (int i = 0; i < n; i++) {
			if (visited[i] == 0) {
				maxSize = Math.max(maxSize, dfs(i, visited, adj));
			}
		}
		System.out.println(maxSize);
		reader.close();
	}
	
	public static int dfs(int i, int[] visited, HashMap<Integer, HashSet<Integer>> adj) {
		int count = 1;
		visited[i] = 1;
		for (int neighbor: adj.get(i)) {
			if (visited[neighbor] == 0) {
				count += dfs(neighbor, visited, adj);
			}
		}
		return count;
	}
	
	
}


Measured memory_bytes: 168388
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private Scanner sc;

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

		int[] seats = {4, 1, 4, 1, 2, 1, 2, 1};
		
		while (sc.hasNextLine()) {
			String[] nico = sc.nextLine().split(" ");
			
			int[] guests = new int[nico.length];
			for (int i = 0; i < nico.length; i++) {
				guests[i] = Integer.parseInt(nico[i]);
			}
			
			int[] sum = new int[seats.length];
			for (int i = 0; i < sum.length; i++) {
				sum[i] = 0;
			}
			
			int max = 0;
			for (int j = 0; j < seats.length; j++) {
				sum[j] = 0;
				for (int i = 0; i < seats.length; i++) {
					int index = (i + j) % seats.length;
					sum[j] = sum[j] + Math.min(seats[index], guests[i]);
				}
				
				if (max < sum[j]) max = sum[j];
			}

			int[] ans = new int[sum.length];
			for (int i = 0; i < ans.length; i++) {
				ans[i] = 0;
			}
			
			for (int i = 0; i < sum.length; i++) {
				if (sum[i] == max) {
					for (int j = 0; j < seats.length; j++) {
						int index = (i + j) % seats.length;
						ans[i] = ans[i] * 10 + seats[index];
					}
				}
			}
			Arrays.sort(ans);
			
			String s = "";
			for (int i = 0; i < ans.length; i++) {
				if (ans[i] != 0) {
					s = s + (ans[i] % 10);
					for (int j = 1; j < seats.length; j++) {
						ans[i] = ans[i] / 10;
						s = (ans[i] % 10) + " " + s;
					}
					break;
				}
			}
			
			System.out.println(s);
		}
	}
}

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

#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;
using namespace std;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
const int N=50+5, mxN=(1<<22);
int mod=1e9+7;


int main()
{
        FIO
       int n;
       cin>>n;
       int ans=1e9;
       for(int i=0;i<n;i++)
       {
           int co=0;
           int x;
           cin>>x;
           while(x%2==0)
           {
               x/=2;
               co++;

           }
           ans=min(ans,co);

       }
       cout<<ans;
    return 0;

}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const int INF = 1e9+10;
const ll mod = 998244353;
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; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N)cin >> A[i];
    ll y = 1000, s = 0;
    rep(i, N - 1){
        if (A[i] < A[i + 1]){
            ll n = y/A[i];
            s += n;
            y -= A[i] * n;
        } else if (A[i] > A[i + 1]){
            y += A[i] * s;
            s = 0;
        }
    }
    cout << y + A[N - 1] * s;
    return 0;
 
}


Measured memory_bytes: 3620
s = input()
q = int(input())
for line in range(q):
    op = input().split()
    st, ed = map(int, op[1:3])
    if op[0] == 'print':
        print(s[st:ed + 1])
    elif op[0] == 'reverse':
        if st == 0: 
            s = s[ed:0:-1] + s[0] + s[ed + 1:]
        else: 
            s = s[:st] + s[ed: st-1 :-1] + s[ed + 1:]
    elif op[0] == 'replace':
        s = s[:st] + op[3] + s[ed + 1:]



Measured memory_bytes: 5608
#include<bits/stdc++.h>
typedef long long ll;
const int N=2e5+1;
ll n,a[N];
ll ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	if(a[1]!=0){
		puts("-1");
		return 0;
	}
	for(int i=2;i<=n;i++){
		if(a[i]>a[i-1]+1){
			puts("-1");
			return 0;
		}
		if(a[i]==a[i-1]+1) continue;
		else ans+=a[i-1];
	}
	printf("%lld",ans+a[n]);
	return 0;
} 

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max

int main ()  {
    cout << fixed << setprecision(18);

    int n,k;cin>>n>>k;

    ll a[20];
    rep(i,n) {
        cin>>a[i];
    }

    ll ans=99999999999999999;
    for (int bit=0;bit<(1<<(n-1));bit++) {
        int cnt=0;
        ll m=a[0];
        ll sum=0;
        rep(i,n-1) {
            if (bit & (1<<i)) {
                cnt++;
                if (a[i+1]-m<=0) {
                    sum+=m-a[i+1]+1;
                    m++;
                }
                else {
                    m=a[i+1];
                }
            }
            else {
                m=max(m,a[i+1]);
            }
        }
        if (cnt>=k-1) {
            ans=min(ans,sum);
        }
    }

    cout<<ans<<endl;

}


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

int main()
{
  ll n,k,s=0;
  cin>>n>>k;
  vector<ll>a(n);
  for(ll i=0;i<n;i++) cin>>a[i];
  sort(a.begin(), a.end());
  for(ll i=0;i<k && (n-i-1)>=0;i++)
    a[n-i-1]=0;
    
  for(ll i=0;i<n;i++)
    s+=a[i];
  cout<<s;
  return 0;
}


Measured memory_bytes: 1792
import heapq

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.append([m+1,0])
ab = sorted(ab, key=lambda x:x[0])



max_values = [0 for _ in range(m)]
hq = []

possible_days = 0

for now in range(n+1):
    # if necessary day exceed the (now_day), extract the most valuable work
    while possible_days <= ab[now][0]:
        if len(hq) < 1:
            pass
        else:
            max_values[possible_days-2] = -heapq.heappop(hq)
        possible_days += 1
    if possible_days-2 > m-1:
        break
    heapq.heappush(hq, -ab[now][1])
print(sum(max_values))

Measured memory_bytes: 78424
#include<iostream>
using namespace std;
int main(){
    int d,a,b,s,sum;
    while(cin>>d){
        sum=0;
        a=600/d;
        for(int i=0;i<a;i++){
            b=d*d*i*i;
            s=b*d;
            sum+=s;
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  int n;
  cin>>n;
  if(n==1) cout << "Hello World" << endl;
  else {
    int a,b;
    cin>>a>>b;
    cout << a+b << endl;
  }

  return 0;
}


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

typedef long long lli;

const lli MAXQ = 1001;
lli N, M, Q;
lli S[MAXQ];
string B[MAXQ];

lli builtin_popcount(lli x) {
  lli res = 0;
  while(x) {
    res += x & 1;
    x >>= 1;
  }
  return res;
}

int main() {
  while(cin >> N >> M >> Q && (N|M|Q)) {
    for(lli i = 0; i < Q; ++i) {
      string s;
      cin >> s >> B[i];
      S[i] = 0;
      for(lli j = 0; j < s.size(); ++j) {
        S[i] |= (lli)(s[j]-'0') << (lli)j;
      }
      if(i) S[i] ^= S[i-1];
    }
    for(lli k = 0; k < M; ++k) {
      lli sum = (1LL<<N) - 1;
      for(lli i = 0; i < Q; ++i) {
        if(B[i][k] == '1') sum &= S[i];
        else sum &= ~S[i];
      }
      if(builtin_popcount(sum) == 1) {
        lli num = -1;
        while(sum) sum >>= 1LL, ++num;
        if(num < 10) cout << num;
        else cout << (char)('A' + num - 10);
      } else {
        cout << "?";
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 2264
n = int(input())
explored = set()
next = [[]for _ in range(n)]

from collections import deque
ls = []
for i in range(n-1):
    u, v, w= map(int, input().split())
    ls.append((u-1, v-1, w%2))
    next[u-1].append((v-1, w%2))
    next[v-1].append((u-1, w%2))

ans = [-1] * n

exploring = deque()
next_que = deque([0])
ans[0]=0
explored.add(0)
while next_que:
    i = next_que.popleft()
    exploring.extend(next[i])
    while exploring:
        a, b = exploring.popleft()
        ans[a] = (ans[i]+b)%2
        list = next[a]
        if a not in explored:
            next_que.append(a)
        explored.add(a)


for i in ans:
    print(i)

Measured memory_bytes: 59020
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        //int K = sc.nextInt();
        //long N = sc.nextLong();

        long[] x = new long[N];
        long[] y = new long[N];
        for(int i=0; i<N; i++){
            x[i]=sc.nextLong();
            y[i]=sc.nextLong();
            long xx = x[i];
            x[i] = x[i] + y[i];
            y[i] = xx - y[i];
        }

        Arrays.sort(x);
        Arrays.sort(y);

        long res=Math.max(Math.abs(x[N-1]-x[0]),Math.abs(y[N-1]-y[0]));
        

        
        System.out.println(res);
        }
    }

Measured memory_bytes: 64612
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll N = 4e5+5,mod = 1e9+7;
vi fact_mod(N),inv_fact_mod(N);

ll power(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1) ans = (ans*x)%mod;
		y>>=1;
		x=(x*x)%mod;
	}
	return ans;
}

ll inv(ll n)
{
	return power(n,mod-2);
}

void init()
{
	fact_mod[0]=inv_fact_mod[0]=1;
	rep(i,1,N) fact_mod[i] = (fact_mod[i-1]*i)%mod,inv_fact_mod[i] = (inv_fact_mod[i-1]*inv(i))%mod;
}

ll ncr(ll n,ll r)
{
	if(r<=n && n>=0 && r>=0)
	{
		ll ans = fact_mod[n];
		ans = (ans*inv_fact_mod[n-r])%mod;
		ans = (ans*inv_fact_mod[r])%mod;
		return ans;
	}
	else return 0;
}

ll nSr(ll n,ll k)
{
	ll ans=0;
	rep(i,0,k+1)
	{
		ll temp_ans = (ncr(k,i)*power(k-i,n))%mod;
		ans = (ans+(i%2==0?1:-1)*temp_ans+mod)%mod;
	}
	ans = (ans*inv_fact_mod[k])%mod;
	return ans;
}



int solve()
{
	ll n,k;cin>>n>>k;
	ll ans=0;
	// ans = (ncr(2*n-1,n-1) - (n*ncr(n-k-2+n-1-1,n-2))%mod+mod)%mod;
	rep(x,0,min(k+1,n+1)) ans = (ans+(ncr(n-1,x)*ncr(n,x))%mod)%mod;
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 6656
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a;
    set<int> s;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a, s.insert(a);
    if (s.size() == n) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 13040
def abc095c_half_and_half():
    a, b, c, x, y = map(int, input().split())
    total = 0
    if a + b >= 2 * c:
        v = min(x, y)
        total += c * v * 2
        x -= v
        y -= v
    if a >= 2 * c:
        total += 2 * x * c
    else:
        total += x * a
    if b >= 2 * c:
        total += 2 * y * c
    else:
        total += y * b
    print(total)
abc095c_half_and_half()

Measured memory_bytes: 9188
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>

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

int main() {

	int X, Y;
	int y10000, y5000, y1000;

	scanf("%d%d", &X, &Y);

	y10000 = Y / 10000;
	y5000 = Y % 10000 / 5000;
	y1000 = Y % 10000 % 5000 / 1000;

	if (X < y10000 + y5000 + y1000) {
		printf("-1 -1 -1\n");
		return 0;
	}

	while (X > y10000 + y5000 + y1000) {
		if (X < y10000 + y5000 + y1000) {
			printf("-1 -1 -1\n");
			return 0;
		}
		if (y5000 && X >= y10000 + y5000 + y1000 + 4) {
			y5000--;
			y1000 += 5;
		}
		else if(y10000){
			y10000--;
			y5000 += 2;
		}
		else {
			printf("-1 -1 -1\n");
			return 0;
		}
	}

	printf("%d %d %d\n", y10000, y5000, y1000);

	return 0;
}


Measured memory_bytes: 128
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    a = list(map(int, input().split()))

    idx = {}
    for i in range(N):
        idx[a[i]] = i

    ans = 0
    left_idx, right_idx = list(range(N + 2)), list(range(N + 2))
    for a in range(N, 0, -1):
        i = idx[a]
        l, r = left_idx[i], right_idx[i]

        ans += a * (i - l + 1) * (r - i + 1)
        left_idx[r + 1] = l
        right_idx[l - 1] = r

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 46692
#include<iostream>
#include<string>
#include<sstream>
#include<vector>

using namespace std;

void search(string str)
{
    int n = str.size()-1;
    long long int res = 0;
    bool done = true;

    for (int bit=0; bit<(1<<n); ++bit)
    {
        // vector<int> S;
        string sub = "";
        sub += str[0];

        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                // S.push_back(i);
                res += stoll(sub);
                sub = str[i+1];
                // done = false;
            }
            else
            {
                sub += str[i+1];
                // done = true;
            }
        }
        // if(done) res += stoi(sub);
        res += stoll(sub);
        // cout << res << endl

        // cout << bit << ": {";
        // for (int i = 0; i < (int)S.size(); ++i) 
        // {
        //     cout << S[i] << " ";
        // }
        // cout << "}" << endl;
    }
    cout << res << endl;
}

int main()
{
    string S;
    cin >> S;
    // string S = "125";
    search(S);
    
    return 0;
}

Measured memory_bytes: 256
sx,sy,tx,ty = map(int,input().split())
a=tx-sx
b=ty-sy
print("U"*b+"R"*a+"D"*b+"L"*a+"L"+"U"*(b+1)+"R"*(a+1)+"D"+"R"+"D"*(b+1)+"L"*(a+1)+"U")


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int sum(vector<int> temp, int num);

int main() {
	int NumOfTopping, ValueOfTopping , ValueOfPizza, CalOfPizza;
	cin >> NumOfTopping >> ValueOfPizza >> ValueOfTopping >> CalOfPizza;

	vector<int> CalOfTopping(NumOfTopping);
	for (int i = 0; i < NumOfTopping; i++) {
		cin >> CalOfTopping[i];
	}
	sort(CalOfTopping.begin(), CalOfTopping.end(), greater<int>());

	double DollarPerCal = double(CalOfPizza) / double(ValueOfPizza);
	
	for (int i = 0; i < NumOfTopping; i++) {
		if (DollarPerCal < (double(sum(CalOfTopping, i+1) + CalOfPizza) / double(ValueOfPizza + (i+1) * ValueOfTopping))) {
			DollarPerCal = double(sum(CalOfTopping, i+1) + CalOfPizza) / double(ValueOfPizza + (i+1) * ValueOfTopping);
		}
		else {
			break;
		}
	}

	cout << int(DollarPerCal) << endl;
	
	return 0;
}

int sum(vector<int> temp, int num) {
	int temp2 = 0;
	for (int i = 0; i < num; i++) {
		if (temp.size() < num) break;
		temp2 += temp[i];
	}
	return temp2;
}


Measured memory_bytes: 3124