akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define minit(a, b) memset(a, b, sizeof(a))
#define size_of(a) (int)(a).size()
 
typedef long long lint;
 
struct Edge {
    int to; lint dst;
    Edge (int to_, lint dst_) : to(to_), dst(dst_) {}
    bool operator > (const Edge& e) const { return dst > e.dst; }
};
 
void minUpdate(lint& a, lint b) { a = min(a, b); }
 
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
 
int n, m, c, s, g;
int p[22], q[22][55], r[22][55];
vector< vector< Edge > > edges;
 
lint cost[22][111][111], dist[22][111][111], price[22][20010];
lint minCost[111];
 
int djk() {
    fill(minCost, minCost + 111, lINF);
    priority_queue< Edge, vector< Edge >, greater< Edge > > que;
    que.push(Edge(s, 0));
    minCost[s] = 0;
     
    while (!que.empty()) {
        Edge e = que.top(); que.pop();
        int u = e.to, dst = e.dst;
         
        if (minCost[u] < dst) continue;
         
        for_(ci,0,c) {
            for_(v,0,n) {
                if (cost[ci][u][v] == iINF) continue;
                 
                int nx_cost = dst + cost[ci][u][v];
                if (minCost[v] > nx_cost) {
                    minCost[v] = nx_cost;
                    que.push(Edge(v, nx_cost));
                }
            }
        }
    }
     
    return (minCost[g] == lINF) ? -1 : minCost[g];
}
 
void solve() {
    for_(ci,0,c) {
        for_(k,0,n) for_(i,0,n) for_(j,0,n) {
            minUpdate(dist[ci][i][j], dist[ci][i][k] + dist[ci][k][j]);
        }
    }
     
    for_(ci, 0, c) {
        for_(u,0,n) for_(v,0,n) {
            if (dist[ci][u][v] == iINF) {
                cost[ci][u][v] = iINF;
                continue;
            }
             
            assert(dist[ci][u][v] <= 20000);
            cost[ci][u][v] = price[ci][dist[ci][u][v]];
        }
    }
     
    cout << djk() << endl;
}
 
int main() {
    while (cin >> n >> m >> c >> s >> g, n) {
        --s; --g;
         
        for_(i,0,22) for_(j,0,111) for_(k,0,111) dist[i][j][k] = iINF;
         
        edges.assign(n, vector< Edge >());
         
        for_(i,0,m) {
            int x, y, cmp; lint dst;
            cin >> x >> y >> dst >> cmp;
            --x; --y; --cmp;
            edges[x].push_back(Edge(y, dst));
            edges[y].push_back(Edge(x, dst));
            dist[cmp][x][y] = dist[cmp][y][x] = min(dist[cmp][y][x], dst);
        }
         
        for_(ci,0,c) cin >> p[ci];
         
        minit(price, 0);
         
        for_(ci,0,c) {
            for_(j,0,p[ci]-1) cin >> q[ci][j];
            for_(j,0,p[ci]) cin >> r[ci][j];
            q[ci][p[ci]-1] = 20005;
             
            int cur = 1;            
            for_(j,0,p[ci]) {
                int qj = q[ci][j];
                while (cur <= q[ci][j]) {
                    price[ci][cur] = price[ci][cur - 1] + r[ci][j];
                    ++cur;
                }
            }
        }
         
        solve();
    }
}

Measured memory_bytes: 9064
#include<bits/stdc++.h>
using namespace std;
int n,k;
string s;
int main()
{
    cin>>n>>s>>k;
    char x=s[k-1];
    for(int i=0;i<n;i++)
    {
        if(s[i]==x)
            continue;
        else s[i]='*';
    }
    cout<<s;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 vector<vector<long long>> vec(3, vector<long long>(3));
  for(long long i = 0; i < 3; i++){
    for(long long j = 0; j < 3; j++){
      cin >> vec.at(i).at(j);
    }
  }
vector<long long>y(3);
  for(long long i = 0; i < 3; i++){
    y.at(i) = vec.at(i).at(0) - vec.at(0).at(0); 
  }
  if(vec.at(1).at(1) == y.at(1) + vec.at(0).at(1) && 
     vec.at(1).at(2) == y.at(1) + vec.at(0).at(2) &&
     vec.at(2).at(1) == y.at(2) + vec.at(0).at(1) &&
     vec.at(2).at(2) == y.at(2) + vec.at(0).at(2)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
   

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define mod 1000000007
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

LL gcd(LL m, LL n) {
    if (n == 0) return abs(m);
    else return gcd(n, m % n);
}

int main() {
    LL n, x;
    cin >> n >> x;

    vector<LL> city(n);
    rep(i, n) {
        cin >> city[i];
    }
    vector<LL> dist(n);
    rep(i, n) {
        dist[i] = abs(city[i] - x);
    }

    LL ans = dist[0];
    rep(i, n) {
        ans = gcd(ans, dist[i]);
    }
    cout << ans << endl;

}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
using namespace std;

int main(void) {
	int a, b=0, c;
	cin >> a;
	for (int i = 1; i <= a; i++) {
		b += i;
	}
	cout << b << endl;
	return 0;
}

Measured memory_bytes: 256
arr = 3.times.map{gets.chomp.split.map(&:to_i)}
N = gets.to_i
B = N.times.map{gets.to_i}

B.each do |b|
  3.times do |y|
    3.times do |x|
      if arr[y][x] == b
        arr[y][x] = -1
      end
    end
  end
end

flag = false
arr2 = arr.transpose
3.times do |i|
  flag = true if arr[i].select{|num| num == -1}.length == 3
  flag = true if arr2[i].select{|num| num == -1}.length == 3
end

flag = true if arr[0][0] == arr[1][1] && arr[1][1] == arr[2][2] && arr[1][1] == -1
flag = true if arr[0][2] == arr[1][1] && arr[1][1] == arr[2][0] && arr[1][1] == -1
  
puts (flag ? 'Yes' : 'No')
      

Measured memory_bytes: 1788
use std::collections::HashMap;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u64,
        s: [chars; n],
    }
    let mut s = s.clone();
    let mut map: HashMap<Vec<char>, u64> = HashMap::new();
    let mut ans = 0;

    for ss in &mut s {
        ss.sort_by(|a, b| b.cmp(a));
        let duplicate = match map.get(ss) {
            Some(count) => { *count }
            None => { 0 }
        };
        ans += duplicate;
        map.insert(ss.clone(), duplicate + 1);
    }
    println!("{}", ans);
}


Measured memory_bytes: 37116
function Main(input){
    const arr = input.split(' ').map(Number);
    let K = arr[3];
    let total=0;
 
    if(K>=arr[0]){
        total += arr[0];
        K -= (arr[0]+arr[1]);
        console.log(K>0 ? total-K:total)
    } else {
        console.log(total+K);
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29868
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define DUMP(x) cout << #x << " = " << (x) << endl;
#define REP(i, n) for(size_t i = 0; i < (n); i++)
#define REPR(i, n) for(size_t i = (n); i >= 0; i--)
#define FOR(i, a, b) for(size_t i = (a); i < (b); i++)
#define FOREACH(x, a) for(auto& (x) : (a))

const int INF = 1e9;
const int MOD = 1e9 + 7;

int N;
vector<int> A;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    cin >> N;
    REP(i, N) {
        int Ai; cin >> Ai;
        A.push_back(Ai);
    }

    sort(A.begin(), A.end(), greater<int>());
    int s1 = 0; // 長い辺
    int s2 = 0; // 短い辺
    REP(i, N) {
        if(A[i] == A[i + 1]) {
            swap(s1, s2);
            s2 = A[i];
            i++;
        }
        if (s1 > 0) break;
    }

    cout << (ll)s1 * s2 << "\n";
}

Measured memory_bytes: 892
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

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

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> x(N), y(N); rep(i, 0, N) {
		cin >> x[i] >> y[i];
	}
	vector<int> v(N);
	iota(all(v), 0);
	cout << fixed << setprecision(10);
	double ans = 0;
	do {
		rep(i, 0, N - 1) {
			ans += sqrt((x[v[i]] - x[v[i + 1]])*(x[v[i]] - x[v[i + 1]]) + (y[v[i]] - y[v[i + 1]])*(y[v[i]] - y[v[i + 1]]));
		}
		dump(ans);
	} while (next_permutation(all(v)));

	rep(i, 1, N + 1) {
		ans /= i;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

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

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

ll N;
vector<ll> A;
vector<ll> C;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    C.assign(N+10,0LL);
    for (ll i = 0; i < N; i++)
    {
        ll a;
        cin >> a;
        C[a]++;
        A.push_back(a);
    }
}

int solve(){
    ll ma=0LL;
    for(auto c:C) ma+=(c*(c-1LL)/2LL);
    for (ll i = 0; i < N; i++)
    {
        // cout << ma-c*(c-1LL)/2LL+(c-1LL)*(c-2LL)/2LL << "\n";
        cout << (ma-C[A[i]]+1LL) << "\n";
    }
    
    return 0;
}   

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


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
vi g[125252];

pll dfs(int p, int bef){
  pll ret = pll(1,1);
  for(int to : g[p])if(to != bef){
    pll P = dfs(to,p);
    ret.first = ret.first * P.second % MOD;
    ret.second = ret.second * (P.first + P.second) % MOD;
  }
  return ret;
}

int main(){
  scanf("%d",&n);
  REP(i,n-1){
    int a,b;
    scanf("%d%d",&a,&b);
    --a;--b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  pll ans = dfs(0,-1);
  printf("%lld\n",(ans.first + ans.second) % MOD);
  return 0;
}


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

int main(){
	int N;
	int W;
	cin>>N>>W;
	int v[N]; 
	int w[N];
	int DP[N+1][W+1];
	for(int i=0;i<N;i++){
		cin>>v[i]>>w[i];
	}
	for(int i=0;i<=W;i++){
		DP[0][i]=0;
	}
	for(int i=1;i<=N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i-1]){
				DP[i][j]=DP[i-1][j];
			}else{
				if(DP[i-1][j]>DP[i][j-w[i-1]]+v[i-1]){
					DP[i][j]=DP[i-1][j];
				}else{
					DP[i][j]=DP[i][j-w[i-1]]+v[i-1];
				}
			}
		}
	}

	
	cout<<DP[N][W]<<endl;
	return 0;
}

Measured memory_bytes: 7004
#include<bits/stdc++.h>
#define MOD (1000000007)

using namespace std;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); 
 
  int n, k;
  int ans = 0;
  cin >> n >> k;
  for(; k <= n+1; k++){
      int tmp =  (((long long)k*(n-k)) % MOD + k + 1) % MOD;
      ans = (ans+tmp) % MOD;
  }

  cout << ans;

     



    
    return 0; 
}

Measured memory_bytes: 3660
A, B = map(int, input().split())
S = input()

flag = True

if (S[A]!="-"):
    flag = False
if (not S[:A].isdigit()):
    flag = False
if (not S[A+1:A+B+1].isdigit()):
    flag = False

print("Yes" if flag else "No")

Measured memory_bytes: 3060
from operator import itemgetter

N = int(input())
works = [tuple(map(int, input().split())) for _ in range(N)]
works.sort(key=itemgetter(1))

total = 0
for work in works:
    total += work[0]
    if total > work[1]:
        print("No")
        break
else:
    print("Yes")


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

int main() {
  int N,ans=-1,now=0;
  cin >> N;
  vector<int> A(N,0);
  for (int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for (int i=1;i<N+1;i++){
    now=A.at(now)-1;
    if (now==1){
      ans=i;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = int( 2e5 );
 
int N;
int X[ MAXN ], Y[ MAXN ];
 
signed main() {
  ios::sync_with_stdio( 0 );
  cin >> N;
  for( int i = 0; i < N; ++i ) {
    cin >> X[ i ] >> Y[ i ];
  }
  long long ans = 1LL * 1e18;
  int mine = min( *min_element( X, X + N ), *min_element( Y, Y + N ) );
  int maxe = max( *max_element( X, X + N ), *max_element( Y, Y + N ) );
  { // case 1
    int max_min = 0, min_max = int( 1e9 ) ;
    for( int i = 0; i < N; ++i ) {
      max_min = max( max_min, min( X[ i ], Y[ i ] ) );
      min_max = min( min_max, max( X[ i ], Y[ i ] ) );
    }
    ans = 1LL * ( max_min - mine ) * ( maxe - min_max );
  }
  { // case2
    priority_queue< pair< int, int > > pq;
    multiset< int > bag;
    for( int i = 0; i < N; ++i ) {
      pq.emplace( -min( X[ i ], Y[ i ] ), max( X[ i ], Y[ i ] ) );
      bag.emplace( min( X[ i ], Y[ i ] ) );
    }
   
    for( int i = 0; i < N; ++i ) {
      int s, t;
      tie( s, t ) = pq.top();
      pq.pop();
      bag.erase( bag.find( -s ) );
      bag.emplace( t );
      ans = min( ans, 1LL * ( maxe - mine ) * ( *--bag.end() - *bag.begin() ) );
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12784
//  RAKSHIT KADAM

 #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
#warning !!!check the Size of arrayss!!!
    
// NUMERIC DEFINITIONS :
    #define INF 1000000000000000005
    #define inf 1000000037
    #define MOD  1000000007
    #define newMOD  998244353
    #define MAX 300006
    #define pi 3.1415926535897932384626433832795
#define ld long double
                         #define ll long long
                         #define int long long
//  #define ll int
 #define present(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define vi vector<ll>
 #define Endl endl
 #define lb lower_bound
 #define ub upper_bound
#define pii pair<ll,ll>
    
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout)
 #define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
using namespace std;
 
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;return (y%2 == 0)? p : (x * p) % m;}
ll modInverse(int a, int m){{ return power(a, m-2, m);}}
const int maxn =506003;

void solve()
{
    ll a;cin>>a;
    cout<<a+a*a+a*a*a<<endl;
}
signed main()
{
   Need_for_speed(activated);
    
//satisfy
//    {
//  solve();
//   }
    solve();
    
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i)
void fastscan(int &x)
 {
        bool neg=false;
        register int c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    } 
string alpha = "abcdefghijklmnopqrstuvwxyz";
const int mod = 1e9+7;
const int inf = 2e18+5;
const int nax = 100010;
const int mod1 = 998244353;
   

signed main()
 {
int n;
  cin>>n;
  vector<int> v;
  loop(i,0,n)
   {
    int x;
    cin>>x;
    v.pb(x);
   }
   int dp[n];
   dp[n-2] =abs(v[n-2] - v[n-1]);
   dp[n-3] =abs(v[n-3] - v[n-1]);
   loopb(i,n-3,0)
    {
      dp[i-1] = min(dp[i]+abs(v[i]-v[i-1]),dp[i+1]+abs(v[i+1]-v[i-1]));
    }
    cout<<dp[0];
return 0;
}


Measured memory_bytes: 1908
#include <cstdio>

int main() {
	int W, H, x, y;
	scanf("%d %d %d %d", &W, &H, &x, &y)+1;

	printf("%lf %d", (double)W * H / 2.0, ((W == x * 2) && (H == y * 2)) ? 1:0);
	return 0;
}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  scanf("%d",&n);
  int blocks[n];
  REP(i,n) scanf("%d",&blocks[i]);
  if(n==1 && blocks[1] == 1) {
    cout << 0 << endl;
    return 0;
  }
  int index = 1;
  int ans = 0;
  REP(i,n) {
    if(blocks[i] == index) {
      ++index;
      continue;
    }
    ++ans;
  }
  
  if(ans == n) cout << -1;
  else cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 1024
#include<stdio.h>
#define ll long long int
ll gcd(ll a,ll b){
  ll hi, lo,c;
  if(a>=b){
    hi=a; lo=b;
  }else{
    hi=b; lo=a;
  }
  c=hi%lo;
  if(c==0)return lo;
  else gcd(lo,c);
}
int main(){
  int n,i;
  ll t,ans=1;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%lld",&t);
    ans = ans/gcd(ans,t)*t;
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main() {
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;
    int min_v = min(a, b);
    int max_profit = b - a;
    for (int i = 0; i < n - 2; i++) {
        cin >> a;
        max_profit = max(max_profit, a - min_v);
        min_v = min(min_v, a);
    }
    cout << max_profit << endl;
    return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

bool Query(LL v) {
  printf("? %lld\n", v);
  fflush(stdout);

  char c;
  assert(scanf(" %c", &c) == 1);
  return c == 'Y';
}

int main() {
  LL cand = 0;
  LL ns = 0;
  LL m = 1;
  rep(i, 11) m *= 10;

  bool need_inc = true;
  rep(i, 10) {
    int low = -1;
    int high = 10;
    if (i == 0) low = 0;
  
    while (high - low > 1) {
      int mid = (high+low)/2;
      LL t = cand*10 + mid;
      if (Query(t*m)) high = mid;
      else low = mid;
    }

    if (low == -1 || (i == 0 && low == 0)) {
      need_inc = false;
      ++low;
    }

    cand = cand*10 + low;
    ns = ns*10 + 9;
    m /= 10;
  }
  if (need_inc) cand++;

  rrep(i, 9) {
    ns /= 10;
    if (!Query(ns)) break;
    if (cand%10) break;
    cand /= 10;
  }
  printf("! %lld\n", cand);
  fflush(stdout);
}


Measured memory_bytes: 596
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_N = 100001;

bool isprime(int x) {
	int i;
	if (x < 2) {
		return false;
	}
	else if (x == 2)
	{
		return true;
	}
	if (x % 2 == 0) {
		return false;
	}

	for (i = 3; i * i <= x; i += 2) {
		if (x % i == 0) {
			return false;
		}
	}
	return true;
}

int main()
{
	ll x; cin >> x;
	rep(i, x, 200000) {
		if (isprime(i)) {
			cout << i << endl;
			return 0;
		}

	}
}



Measured memory_bytes: 384
n = int(input())
S = [input() for i in range(n)]
al = "abcdefghijklmnopqrstuvwxyz"
count = [[0 for i in range(len(al))] for j in range(n)]

for i in range(n):
  for j in range(len(al)):
    count[i][j] = S[i].count(al[j])

ans = ''
for j in range(len(al)):
  num = 999
  for i in range(n):
    if count[i][j] < num:
      num = count[i][j]
  if num != 0:
    for k in range(num):
      ans+=al[j]
      
print(ans)

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

int main() {
  int N;
  bool flag = false;
  cin >> N;
  
  for (int i = 0;i < N;i++) {
    string color;
    cin >> color;
    
    if (color == "Y") {
      flag = true;
    }
  }
  
  if (flag == true) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define EPS 1e-10
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> PP;

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

int n, c;
int brd[10][10];
bool dead[10][10];

int check(){
	queue<PP> que;
	rep(i,n) for(int j = 0; j <= i; j++){
		if(brd[i][j] != 0) continue;
		dead[i][j] = false;
		que.push(PP(P(i,j),0));
		while(true){
			if(que.size() == 0) break;
			PP p = que.front();
			que.pop();
			rep(k,6){
				if(0>p.first.first+dy[k]||p.first.first+dy[k]>=10) continue;
				if(0>p.first.second+dx[k]||p.first.second+dx[k]>=10) continue;
				if(brd[p.first.first+dy[k]][p.first.second+dx[k]] == INF) continue;
				if(!dead[p.first.first+dy[k]][p.first.second+dx[k]]) continue;
				if(p.second != 0 && p.second != brd[p.first.first+dy[k]][p.first.second+dx[k]]) continue;
				dead[p.first.first+dy[k]][p.first.second+dx[k]] = false;
				que.push(PP(P(p.first.first+dy[k],p.first.second+dx[k]),brd[p.first.first+dy[k]][p.first.second+dx[k]]));
			}
		}
	}
	int ret = 0;
	rep(i,n) for(int j = 0; j <= i; j++){
		if(dead[i][j]){
			if(brd[i][j] == c) ret--;
			else ret++;
		}
	}
	return ret;
}

void solve(){
	rep(i,10) rep(j,10) brd[i][j] = INF;
	rep(i,n){
		for(int j = 0; j <= i; j++) cin >> brd[i][j];
	}
	int ans = -INF;
	rep(i,n){
		for(int j = 0; j <= i; j++){
			if(brd[i][j] != 0) continue;
			brd[i][j] = c;
			rep(k,10) rep(u,10){
				if(brd[k][u] == 0) dead[k][u] = false;
				else dead[k][u] = true;
			}
			int cnt = 0;
			cnt = check();
			
			brd[i][j] = 0;
			ans = max(ans,cnt);
		}
	}
	cout << ans << endl;
}

int main(){
	while(cin >> n >> c){
		if(n == 0 && c == 0) break;
		solve();
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define in(e,l) (std::find(l.begin(), l.end(), e) != l.end())
#define asort(l) (std::sort(l.begin(), l.end()))
#define dsort(l) (std::sort(l.rbegin(), l.rend()))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;

int main() {
  ll N;
  cin >> N;
  ll B = 0, tmp = 0;
  cin >> B;

  ll ans = 0;
  ans += B;
  tmp = B;
  rep(i, N - 2){
    cin >> B;
    mins(tmp, B);
    ans += tmp;
    tmp = B;
  }
  ans += tmp;
  cout << ans << endl;
  return 0;
}



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

using namespace std;


int main(){
	long long int n;
	long long int ans=0;
	long long int temp=5;
	
	cin >> n;
	
	if(n%2 == 1){
		cout << 0 << endl;
		return 0;
	}
	
	for(int i=1;i<26;i++){
		ans = ans + (n/temp)/2;
		temp = temp*5;
	}
	cout << ans << endl;
	return 0;
}
	

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


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a[] = new int[3];
		for(int i = 0; i < 3; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		
		System.out.println(a[0] * a[1] / 2);

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define repl(i, l, r) for (int i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using G = vector<vector<int>>;

int main()
{
    int n;
    cin >> n;
    vector<ll> sum(n+1);
    sum[0] = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        sum[i + 1] = sum[i] + a;
    }
    map<ll,ll> mp;
    rep(i, n + 1) {
        mp[sum[i]]++;
    }
    ll ans = 0;
    for(auto x : mp) {
        ans += x.second * (x.second - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17084
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 1e6 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

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

    int res = b;
    if (a + b >= c) {
        res += c;
    } else {
        res += a + b + 1;
    }
    cout << res << "\n";
}


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

typedef long long ll;
const int mod = 1e9 + 7;

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

    string S;
    cin >> S;

    vector<int> nums;
    int now = 1;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == (char)('0' + now)) cnt++;
        else {
            nums.push_back(cnt);
            now = 1 - now;
            cnt = 1;
        }
    }
    nums.push_back(cnt);

    int add = 2 * K + 1;
    int ans = 0;

    int left = 0;
    int right = 0;
    int tmp = 0; // [left, right)

    for (int i = 0; i < nums.size(); i += 2) {
        int next_left = i;
        int next_right = min(i + add, (int)nums.size());

        while (next_left > left) {
            tmp -= nums[left];
            left++;
        }
        while (next_right > right) {
            tmp += nums[right];
            right++;
        }
        ans = max(tmp, ans);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
  int a;
  string s;
  cin >>a>>s;
  if(a>=3200) {
cout <<s << endl;
  }
else {
cout << "red" << endl;
}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9+7;

int main() {

  string s;
  int k;
  cin >> s >> k;
  int n = s.size();
  for(int i=0; i<n; i++){
    char c = s[i];
    int t = (26-(c-'a'))%26;
    if( t <= k ){
      k -= t;
      s[i] = 'a';
    }
  }

  k %= 26;
  int a = s[n-1]-'a';
  a += k;
  a %= 26;
  s[n-1] = (char) a + 'a';
  cout << s << endl;

  return 0;
}

//


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    ll x = tx - sx;
    ll y = ty - sy;

    rep(i, x) {
        cout << 'R';
    }

    rep(i, y) {
        cout << 'U';
    }

    rep(i, x) {
        cout << 'L';
    }

    rep(i, y+1) {
        cout << 'D';
    }

    rep(i, x+1) {
        cout << 'R';
    }

    rep(i, y+1) {
        cout << 'U';
    }

    rep(i, 1) {
        cout << 'L';
    }

    rep(i, 1) {
        cout << 'U';
    }

    rep(i, x+1) {
        cout << 'L';
    }

    rep(i, y+1) {
        cout << 'D';
    }

    rep(i, 1) {
        cout << 'R';
    }

    cout << endl;
    re0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
const ll MOD=1e9+7;
ll dp[2001][2001]{};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin>>N>>M;
    vector<ll>S(N);
    vector<ll>T(M);
    for(ll i=0;i<N;i++){
        cin>>S[i];
    }
    for(ll i=0;i<M;i++){
        cin>>T[i];
    }
    for(ll i=1;i<=N;i++){
        for(ll j=1;j<=M;j++){
            if(S[i-1]==T[j-1]){dp[i][j]+=dp[i-1][j-1]+1;dp[i][j]%=MOD;}
            dp[i][j]+=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1];
            dp[i][j]%=MOD;
        }
    }
    if(dp[N][M]<0)dp[N][M]+=MOD;
    cout<<dp[N][M]+1<<endl;
}

Measured memory_bytes: 31616
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main(){
	ll before = 0;
	ll after = 0;
	int n;
	cin >> n;
	vector<ll>a(n + 1);
	vector<ll>b(n);
	rep(i, n + 1) {
		cin >> a[i];
		before += a[i];
	}
	rep(i, n)cin >> b[i];

	ll x;
	rep(i, n) {
		x = a[i];
		a[i] = a[i] - b[i];
		b[i] = b[i] - x;
		if (a[i] < 0) {
			a[i] = 0;
			a[i + 1] = a[i + 1] - b[i];
			if (a[i + 1] < 0) {
				a[i + 1] = 0;
			}
		}
	}

	rep(i, n + 1) {
		after += a[i];
	}

	cout << before - after << endl;
	return 0;
}


Measured memory_bytes: 1792
N = int(input())
N -= 1

d = 26
for i in range(1,15):
    if N >= d:
        N -= d
        d *= 26
    else:
        d //= 26
        ans = ""
        for j in range(i):
            ans += chr(N // d + ord("a"))
            N %= d
            d //= 26
        break

print(ans)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu long long unsigned
int main()
{
        int t,a,b,x,y,z,n,mx,mn,tmp;
        int cnt=0,ans=0;
        string s="";
        vector<int>vc;
        map<int,int>mp;
        map<char,int>mc;
        scanf("%d",&x);
        char ch,ch2;
        cin>>s;
        if(s.size()<=x) cout<<s<<"\n";
        else{
            for(int j=0;j<x;j++){
                printf("%c",s[j]);
            }
            puts("...");
        }





    return 0;
}







Measured memory_bytes: 3692
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int n;
	while(cin >> n && n)
	{
		vint v(10, 0);

		rep(i, n)
		{
			int d;
			cin >> d;

			v[d]++;
		}

		rep(i, 10)
		{
			if(v[i]) rep(j, v[i]) cout << "*";
			else cout << "-";

			cout << endl;
		}
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();

		long[] T = new long[n];
		long[] A = new long[n];
		for(int i = 0;i < n;i++){
			T[i] =sc.nextLong();
			A[i] = sc.nextLong();
		}

		long takahasi = T[0];
		long aoki = A[0];
	//	System.out.println(" taka " +takahasi + " aoki " +aoki);

		for(int i = 1;i < n;i++){
			if(aoki*T[i] != takahasi*A[i]){
				if(A[i] < aoki && T[i] < takahasi){
					long aa = 0;
					long tt = 0;
					if(aoki%A[i] == 0){
						aa = aoki/A[i];
					}else{
						aa = aoki/A[i]+1;
					}
					if(takahasi%T[i] == 0){
						tt = takahasi/T[i];
					}else{
						tt = takahasi/T[i]+1;
					}
					long x = (long)Math.max(aa, tt);
					aoki = A[i]*x;
					takahasi = T[i]*x;
				}else if(A[i] >= aoki && T[i] >= takahasi){				//どっちもおっきい
					aoki = (long)A[i];
					takahasi = (long)T[i];
					
				}else if(T[i] >= takahasi){
					
					long kake = ((aoki / A[i]) + 1);
					if(aoki % A[i] == 0){
						kake = aoki / A[i];
					}
					aoki  = A[i]*kake;
					takahasi = T[i]*kake;
				}else{
					long kake = (( takahasi / T[i]) + 1) ;
					if(takahasi % T[i] == 0){
						kake = takahasi / T[i];
					}
					aoki  = A[i]*kake;
					takahasi = T[i]*kake;
				}

			}
			
		//	System.out.println(" taka " +takahasi + " aoki " +aoki);
		}


		System.out.println(takahasi+aoki);

	}
}

Measured memory_bytes: 23788
#include<bits/stdc++.h>
using namespace std;
int main () {
  int n,t;
  cin>>n>>t;
  int ans = INT_MAX;
  bool found = false;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    if(b<=t){
        ans=min(ans,a);
        found=true;
    }
  }
  if(!found){
    cout<<"TLE"<<endl;
    return 0;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INF 1000000000000 //10^12

int main(){
    ll a,b,c,d;
    cin >>a >> b>> c>> d;
    while(1){
        c -=b;
         if(c <=0){
             cout << "Yes"<<endl;
            break;
         }
        a -=d;
        if(a <=0){
            cout << "No" <<endl;
            break;
        }
    }
}

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

#define ALL(obj) (obj).begin(), (obj).end()
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,b) for(int i=a; i<=b; i++)
#define drep2(i,a,b) for(int i=a; i>=b; i--)
using ll = long long;
#define pb push_back

class TWO {
  public:
    ll pos;
    ll value;
    TWO ( ll pos, ll value) : pos(pos), value(value) {} 
};


ll get_max(vector<ll>x, vector<ll>v, int N, ll C) 
{
  ll nowp = 0;
  vector<ll> cum_cl(N);
  vector<ll> max_cl(N);

  cum_cl[0] = 0;

  rep(i,  N) {
    if (i == 0 )
      cum_cl[i] = v[i] - ( x[i] - nowp ) ;
    else 
      cum_cl[i] = cum_cl[i-1] + v[i] - (x[i] - nowp);
    nowp = x[i];
  }
  ll mmax = LLONG_MIN;
  rep(i, N ) {
    if (cum_cl[i] > mmax) {
      mmax = cum_cl[i];
      max_cl[i] = max(cum_cl[i], mmax);
    } else {
      max_cl[i] = mmax;
    }
  }
  ll limit = -1;
  nowp = C;
  ll nowv = 0;
  ll maxvans = 0;

  // counter clock -> then clock
  drep2(i, N, 0) {
    if (i == N) {
      limit = i - 1;
      maxvans = max(maxvans, max_cl[limit]);
      continue;
    }
    nowv += v[i] - (nowp - x[i]);
    limit = i-1;
    nowp = x[i];
    if (limit == -1) 
      maxvans = max(maxvans, nowv);
    else
      maxvans = max(maxvans, max(nowv, nowv-(C-x[i])+max_cl[limit]));

  //  cout << "nowv: " << nowv << endl;
  //  cout << "limit: " << limit << endl;
  //  cout << "nowp: " << nowp << endl;
  //  cout << "maxvans: " << maxvans << endl;
  //
  //  cout << "--------"  << endl << endl;
  }
  return maxvans;

}

int main()
{
  int N;
  ll C;
  cin >> N >> C;
  vector<ll> x(N), v(N);
  vector<TWO> tt;
  rep(i, N ) {
    cin >> x[i] >> v[i];
    tt.pb(TWO(x[i], v[i]));
  }
  sort(ALL(tt), [](const TWO& l, const TWO& r) { return l.pos < r.pos; });
  rep(i, N) {
    TWO temp_two = tt[i];
    x[i] = temp_two.pos;
    v[i] = temp_two.value;
  }
  //rep(i, N) {
  //  cout << "x[" << i << "]: " << x[i] << ", v[" << i << "]: " << v[i] << endl;
  //}


  /////////////////////
  //    get_max      //
  /////////////////////

  // rep(i, N) {
  //   cout << "cum : " << cum_cl[i] << endl;
  //   cout << "mmax_cum : " << max_cl[i] << endl;
  // }

  ll max_vans = get_max(x,v,N, C);
  //cout << "max_vans: " << max_vans << endl;


  sort(ALL(tt), [](const TWO& l, const TWO& r) { return l.pos > r.pos; });
  rep(i, N) {
    TWO temp_two = tt[i];
    x[i] = C- temp_two.pos;
    v[i] = temp_two.value;
    //cout << "x[" << i << "]: " << x[i] << endl;
    //cout << "v[" << i << "]: " << v[i] << endl;
  }

  max_vans = max(max_vans, get_max(x,v,N,C));
  cout << max_vans << endl;

  // max vans
  // COUNTERCLOCK -> CLOCK 
  // $B$NCM$O<j$KF~$C$?(B


}

Measured memory_bytes: 7024
#include<bits/stdc++.h>
using namespace std;
int n,ans=0,a[1000001];
int main(){
	cin>>n;
	for(int i=1;i<=2*n;i++)
		cin>>a[i];
	sort(a+1,a+2*n+1);
	for(int i=1;i<=2*n;i+=2)
		ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
D = [2*a for a in A]
X = [0] * (N+1)
for i in range(N):
    X[i+1] = D[i] - X[i]

X[0] = (X[0] + X[-1])//2

for i in range(N):
    X[i+1] = D[i] - X[i]

print(*X[:-1])

Measured memory_bytes: 18256
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int get_max(int x){
  while(x>=10){
    x/=10;
  }
  return x;
}

int main(){
  int n;
  cin >> n;
  int count[10][10];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      count[i][j]=0;
    }
  }
  rep(i,n+1){
    if(i==0) continue;
    int x,y;
    x = get_max(i);
    y = i%10;
    count[x][y]++;
  }
  ll ans=0LL;
  /*for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      cout << count[i][j] << " ";
    }
    cout << endl;
  }*/
  for(int i=1;i<10;i++){
    for(int j=i;j<10;j++){
      if(i!=j) ans += count[i][j]*count[j][i]*2;
      else ans += count[i][j]+count[i][j]*(count[i][j]-1);
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#A問題
N,A,B,C,D = map(int,input().split())
Slist = list(str(input()))

flag = 0

Rock = 0
for i in range(D-B+1):
    I = B-1+i
    if Slist[I] == "#":
        Rock+=1
        if Rock == 2:
            flag = 1
            break
    else:
        Rock = 0
Rock = 0
for i in range(C-A+1):
        I = A-1+i
        if Slist[I] == "#":
            Rock+=1
            if Rock == 2:
                flag = 1
                break
        else:
            Rock = 0

if C > D:
    white = 0
    wflag = 0
    for i in range(D-B+3):
        I = B-2+i
        if Slist[I] == ".":
            white+=1
            if white >= 3:
                wflag = 1
                break
        else:
            white = 0
    if white >= 3:
        wflag = 1
        
    if wflag == 0:
        flag = 1
        
if flag == 1:
    print("No")
else:
    print("Yes")


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

template<typename Monoid, typename OperatorMonoid>
struct LazySegmentTree {
    using F = function<Monoid(Monoid, Monoid)>;
    using G = function<Monoid(Monoid, OperatorMonoid)>;
    using H = function<OperatorMonoid(OperatorMonoid, OperatorMonoid)>;
    const F f;
    const G g;
    const H h;
    const Monoid M1;
    const OperatorMonoid OM0;
    int sz, height;
    vector<Monoid> data;
    vector<OperatorMonoid> lazy;
    LazySegmentTree(int n, const F f, const G g, const H h,
                    const Monoid &M1, const OperatorMonoid &OM0)
        : f(f), g(g), h(h), M1(M1), OM0(OM0), sz(1), height(0)
    {
        while (sz < n) sz <<= 1, height++;
        data.assign(sz * 2, M1);
        lazy.assign(sz * 2, OM0);
    }
    void set(int k, const Monoid &x) { data[k + sz] = x; }
    void build() {
        for (int k = sz - 1; k > 0; k--) {
            data[k] = f(data[k << 1 | 0], data[k << 1 | 1]);
        }
    }
    inline Monoid reflect(int k) {
        return lazy[k] == OM0 ? data[k] : g(data[k], lazy[k]);
    }
    inline void propagate(int k) {
        if (lazy[k] == OM0) return ;
        lazy[k << 1 | 0] = h(lazy[k << 1 | 0], lazy[k]);
        lazy[k << 1 | 1] = h(lazy[k << 1 | 1], lazy[k]);
        data[k] = reflect(k);
        lazy[k] = OM0;
    }
    inline void thrust(int k) {
        for (int i = height; i > 0; i--) propagate(k >> i);
    }
    inline void recalc(int k) {
        while (k >>= 1) data[k] = f(reflect(k << 1 | 0), reflect(k << 1 | 1));
    }
    void update(int a, int b, const OperatorMonoid &x) {
        thrust(a += sz);
        thrust(b += sz - 1);
        for (int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
            if (l & 1) lazy[l] = h(lazy[l], x), ++l;
            if (r & 1) --r, lazy[r] = h(lazy[r], x);
        }
        recalc(a);
        recalc(b);
    }
    Monoid get(int a, int b) {
        thrust(a += sz);
        thrust(b += sz - 1);
        Monoid L = M1, R = M1;
        for (int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
            if (l & 1) L = f(L, reflect(l++));
            if (r & 1) R = f(reflect(--r), R);
        }
        return f(L, R);
    }
    Monoid operator[](const int &k) { return get(k, k + 1); }
};

const int MAX = numeric_limits<int>::max();
int main() {
    int n, q; cin >> n >> q;
    using T = int;
    using E = int;
    auto f = [](T a, T b) { return T(min(a, b)); };
    auto g = [](T a, E b) { (void)a; return T(b); };
    auto h = [](E a, E b) { (void)a; return E(b); };
    LazySegmentTree<T, E> seg(n, f, g, h, T(MAX), E(-1));
    seg.build();
    while (q--) {
        int op; cin >> op;
        int s, t; cin >> s >> t; t++;
        if (op == 0) {
            int x; cin >> x;
            seg.update(s, t, x);
        }
        if (op == 1) {
            cout << seg.get(s, t) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 4888