akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;
struct card
{
	int value;
	char suit;
}c1[105],c2[105];
int n;
void bubbleSort()
{
	for(int i = 0;i < n;++i)
	{
		for(int j = 0;j < n-1;++j)
		{
			if(c1[j].value > c1[j+1].value)
				swap(c1[j],c1[j+1]);
		}
	}
}
void insertionSort()
{
	for(int i = 0;i < n;++i)
	{
		int minv = c2[i].value,pos = i;
		for(int j = i+1;j < n;++j)
		{
			if(c2[j].value < minv)
				minv = c2[j].value,pos = j;
		}
		if(minv != c2[i].value)
			swap(c2[pos],c2[i]);
	}
}
bool check()
{
	for(int i = 0;i < n;++i)
		if(c1[i].value != c2[i].value || c1[i].suit != c2[i].suit)
			return false;
	return true;
}
int main()
{
	cin >> n;
	for(int i = 0;i < n;++i)
		cin >> c1[i].suit >> c1[i].value,c2[i].suit = c1[i].suit,c2[i].value = c1[i].value;
	bubbleSort();
	insertionSort();
	for(int i = 0;i < n;++i)
	{
		cout << c1[i].suit << c1[i].value;
		if(i != n-1)
			cout << " ";
	}
	cout << endl << "Stable" << endl;
	for(int i = 0;i < n;++i)
	{
		cout << c2[i].suit << c2[i].value;
		if(i != n-1)
			cout << " ";
	}
	cout << endl;
	if(check())
		cout << "Stable" << endl;
	else 
		cout << "Not stable" << endl;
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
	
using namespace std;
inline void FAST_IO(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

template<class F, class S> ostream& operator<<(ostream& os, pair<F, S> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template<class T, class S> ostream& operator<<(ostream& os, map<T, S> &v) {
	os << "{";
	for(auto &i : v) cout << "{" << i.first << "," << i.second << "}";
	os << "}";
	return os;
}

template<class T> ostream& operator<<(ostream& os, set<T> &v) {
	os << "{";
	for(auto &i : v) cout << i << ",";
	os << "}";
	return os;
}
 
template<class T> ostream& operator<<(ostream& os, vector<T> &v) {
	os << "[";
	if(v.size()) os << v[0];
	for(int i = 1; i < v.size(); ++i) os << "," << v[i];
	os << "]";
	return os;
}

/*----------------------------------------------------------------------------*/

int main (){
	// FAST_IO();

	long long n, d, a;
	cin >> n >> d >> a;

	vector<long long> acc(n);
	vector<pair<long long, long long>> in(n);
	for (int i = 0; i < n; ++i) {
		scanf("%lld %lld", &in[i].first, &in[i].second);
	}

	sort(in.begin(), in.end());

	long long power = 0;
	long long resp = 0;
	for (int i = 0; i < n; ++i) {
		power += acc[i];

		int j = upper_bound(in.begin(), in.end(), make_pair(in[i].first + 2*d + 1, 0LL)) - in.begin();
		long long add = 0;

		if (in[i].second > power) {
			long long diff = in[i].second - power;
			add = (diff + a - 1)/a;
			resp += add;
			add *= a;
		}
		power += add;

		if (j < n) {
			acc[j] -= add;
		}
	}

	cout << resp << endl;

	return 0;
}


Measured memory_bytes: 7952
import Control.Applicative ((<$>))
import Control.Monad
import Data.Complex
import Text.Printf

type Vector = Complex Double

dot :: Vector -> Vector -> Double
dot a b = realPart $ conjugate a * b

normalize :: Vector -> Vector
normalize = signum

readWords :: Read a => IO [a]
readWords = map read . words <$> getLine

main :: IO ()
main = do
  [x1,y1,x2,y2] <- readWords :: IO [Double]
  let
    p1 = x1:+y1
    p2 = x2:+y2
    d = normalize (p2-p1)

  q <- readLn

  ps <- replicateM q $ do
    [x,y] <- readWords :: IO [Double]
    return $ x:+y

  forM_ ps $ \p -> do
    let x:+y = p1+((p-p1)`dot`d:+0)*d
    printf "%.10f %.10f\n" x y

Measured memory_bytes: 4828
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

 
int main() {

    ll h,w;
    cin >> h >> w;

    if(h==1||w==1) {
        cout<<1<<endl;
        return 0;
    }

    if(h%2==0) {
        cout<<h*w/2<<endl;
    }
    else {
        if(w%2==0) {
            cout<<h*w/2<<endl;
        }
        else {
            cout<<(h-1)*(w-1)/2+(h-1)/2+(w-1)/2+1<<endl;
        }
    }

 return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
tmpa=0
ampb=0
tmpc=0

if a%2==1 or b%2==1 or c%2==1:
    print(0)
    exit()

for i in range(10**5):
    tmpa=(b+c)/2
    tmpb=(a+c)/2
    tmpc=(b+a)/2
    a=tmpa
    b=tmpb
    c=tmpc
    if a%2==1 or b%2==1 or c%2==1:
        print(i+1)
        exit()
print(-1)

Measured memory_bytes: 66824
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

#define MAXT 1005
ll N;
vector<int> T;
bool memo[55][MAXT][MAXT];

void dfs(int n, int x, int y,ll sum) {
    if (memo[n][x][y]) return;
    memo[n][x][y] = true;
    if (n == N) return;
    if (x + T[n] < MAXT) dfs(n + 1, x + T[n], y,sum + T[n]);
    if (y + T[n] < MAXT) dfs(n + 1, x, y + T[n],sum + T[n]);
    if (sum - x - y + T[n] < MAXT) dfs(n + 1, x, y, sum + T[n]);
}

ll solve() {
    cin >> N;
    T.resize(N);
    for (auto& in : T) { cin >> in; }
    sort(T.begin(), T.end());
    reverse(T.begin(), T.end());
    dfs(0, 0, 0, 0);
    int sum = accumulate(T.begin(), T.end(), 0);
    
    ll ans = LINF;
    for (int i = 0; i < MAXT; i++) {
        for (int j = 0; j < MAXT; j++) {
            if (memo[N][i][j] == false) continue;
            ll t = -1;
            t = max({ i,j,sum - i - j });
            ans = min(ans, t);
        }
    }
    return ans;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



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

int main() {
  int n, m, a, b;
  scanf("%d %d", &n, &m);
  vector<int> o(n);
  for(int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    o[--a]++;
    o[--b]++;
  }
  for(int i = 0; i < n; i++) printf("%d\n", o[i]);
}

Measured memory_bytes: 256
#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 A, B, C; cin >> A >> B >> C;
	int ans = 1; C--;
	int x = min(B, C);
	ans += x * 2;
	C -= x;
	B -= x;
	ans += B;
	ans += min(A, C);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    rep(i, s.size()){
        if(i == k - 1){
            cout << (char)(s[i] - 'A' + 'a');
        }else {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
/*
参考
・蟻本p197
・https://ei1333.github.io/luzhiled/snippets/graph/bipartite-matching.html
*/
#include <bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;


struct BipartiteMatching{
    Graph graph;
    vector<int> match,used;
    int now,sz;

    BipartiteMatching(int n):sz(n),graph(n),used(n,-1),match(n,-1),now(0){}

    void add_edge(int u,int v){
        graph[u].push_back(v);
        graph[v].push_back(u);
    }

    bool dfs(int idx){
        used[idx]=now;
        for(int to:graph[idx]){
            int to_match=match[to];
            if(to_match==-1 || (used[to_match]!=now && dfs(to_match) )  ){
                match[idx]=to;
                match[to]=idx;
                return true;
            }
        }
        return false;
    }

    int bipartite_matching(){
        int ret=0;
        for(int i=0;i<sz;i++){
            if(match[i]==-1){
                ret+=dfs(i);
                now++;
            }
        }
        return ret;
    }
};

signed main(){
    int x,y,e;
    cin>>x>>y>>e;
    BipartiteMatching b(x+y);

    while(e--){
        int s,t;
        cin>>s>>t;
        b.add_edge(s,t+x);
    }
    cout<<b.bipartite_matching()<<endl;
}


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

#define rip(i,n,s) (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()

long long ooi(vector<int> &da){
	long long no=da.size()-1,ret=0;
	while (no>-1){
		if(da[no]>0){
			ret=(long long) da[no]+ret;
		}
		else{
			break;
		}
		no--;
	}
	return ret;
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n),b(n),da(n);
	for rip(i,n,0){
		cin >> a[i];
	}
	for rip(i,n,0){
		cin >> b[i];
		da[i]=b[i]-a[i];
	}
	sort(all(da));
	long long man=ooi(da);
	int ans=0;
	int co=0;
	while(man>0){
		if(da[co]>0){
			break;
		}
		else{
			man=(long long) man + da[co];
			ans++;
		}
		co++;
	}
	co=n-1;
	while(da[co]>0){
		ans++;
		co--;
	}
	if(man>0){
		ans=-1;
	}
	printf("%d\n",ans);
}

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

int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    vector<int>dp(n);
    dp[0] = 0;
    dp[1] = abs(a[0] - a[1]);
    for(int i = 2;i < n; i++)
    {
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]),dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n - 1];
    return 0;
}


Measured memory_bytes: 4692
/**
*    author:  yuya1234
*    created: 16.07.2020 16:14:16
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T>T lcm(T a,T b){return gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b));}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  //std::cout << std::fixed << std::setprecision(15);

  int n;
  cin>>n;

  int a[n];
  int _min,_max;
  _min=INT_MAX;
  _max=0;
  REP(i,n)
  {
    cin>>a[i];
    chmax(_max,a[i]);
    chmin(_min,a[i]);
  }

  int ans=INT_MAX,sum;
  FOR(i,_min,_max)
  {
    sum=0;
    REP(j,n)
    {
      sum+=pow(a[j]-i,2);
    }
    chmin(ans,sum);
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 3648
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a : i128,
        b: i128,
        c: i128,
        d: i128
    };

    if a >= 0 && c >= 0 {
        let b = b as u128;
        let d = d as u128;

        println!("{}", b * d);
    } else {
        let x1 = a * c;
        let x2 = a * d;
        let x3 = b * c;
        let x4 = b * d;

        let mut result = std::cmp::max(x1, x2);
        result = std::cmp::max(result, x3);
        result = std::cmp::max(result, x4);
        println!("{}", result);
    }
}


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

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main(){
    int A,B,C;
    cin>>A>>B>>C;
    if((A < C && C < B) || (B < C && C < A)) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  ll N, K; cin >> N >> K;
  map<ll, ll> pair; 
  rep(i, N) {
    ll a, b; cin >> a >> b;
    pair[a] += b;
  }

  ll pos = 0, result;
  for (auto x: pair) {
    if (pos+1<=K && pos+x.second>=K) { 
      result = x.first;
      break;
    }
    pos += x.second;
  }
  cout << result << endl;
  return 0;
}

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

#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 998244353

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll N,W;	cin>>N>>W;
	pair<ll,ll> obj[N]; //weight,value
	for(ll i=0;i<N;i++)
		cin>>obj[i].fi>>obj[i].se;
	ll dp[N+1][W+1]; //max value when first i obj are considered and total weight <= j
		
	for(ll i=0;i<=N;i++){
		for(ll j=0;j<=W;j++){
			if(i==0||j==0)	dp[i][j]=0;
			else{
				if(j-obj[i-1].fi>=0)	dp[i][j]=max(dp[i-1][j], dp[i-1][j-obj[i-1].fi] + obj[i-1].se);
				else   dp[i][j]=dp[i-1][j];
			}
		}
	}
	cout<<dp[N][W];
	
	return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl
#define isort(a) sort(a.begin(),a.end())
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}
 
typedef pair<ll,ll> Pair;
const ll inf =1000000007;

void bsolve(){
    ll n;
    cin >> n;
    ll ans=0;
    for(ll i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout << ans << endl;
}

void asolve(){
    string n;
    cin >> n;
    bool ans=false;
    for(ll i=0;i<3;i++){
        if(n[i]=='7') ans=true;
    }
    if(ans) cout <<"Yes" << endl;
    else cout << "No" << endl;
}

void dsolve(){
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> r,g,b;
    rep(i,n){
        if(s[i]=='R') r.pb(i);
        if(s[i]=='G') g.pb(i);
        if(s[i]=='B') b.pb(i);
    }
}


//繰り返し
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M);
}


void esolve(){
    ll n,k;
    cin >> n>>k;
    for(ll i=1;i<=k;i++){
        
    }
}



int main(){
    asolve();
}



Measured memory_bytes: 3628
#include <iostream>
using namespace std;
#define MAX (250)
int parent(int i){
    return i/2;
}
int left(int i){
    return i*2;
}
int right(int i){
    return i*2+1;
}
int main(void){
    int H,i,A[MAX+1];
    cin>>H;
    for(int i=1;i<=H;i++){
        cin>>A[i];
    }
    for(int i=1;i<=H;i++){
        cout<<"node "<<i<<": key = "<<A[i]<<", ";
        if(parent(i)>0)cout<<"parent key = "<<A[parent(i)]<<", ";
        if(left(i)<=H)cout<<"left key = "<<A[left(i)]<<", ";
        if(right(i)<=H)cout<<"right key = "<<A[right(i)]<<", ";
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3124
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 100005;
typedef long long i64;

class Edge {
public:
  int nxt, to;
} e[MAX_N << 1];

int head[MAX_N], cnt, A[MAX_N], flag, deg[MAX_N];

void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
  e[++cnt] = (Edge){head[v], u}, head[v] = cnt;
}

i64 f[MAX_N], mx[MAX_N];

void dfs(int u, int v) {
  if (deg[u] == 1) {
    f[v] += A[u], mx[v] = max(mx[v], (i64)A[u]);
  } else {
    for (int i = head[u]; i; i = e[i].nxt)
      if (e[i].to != v)
	dfs(e[i].to, u);
    if (f[u] > A[u] * 2 || f[u] < A[u] || mx[u] > A[u]) flag = 0;
    f[v] += A[u] * 2 - f[u], mx[v] = max(mx[v], A[u] * 2 - f[u]);
  }
}

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);

  for (int i = 1, u, v; i < N; ++i) {
    scanf("%d%d", &u, &v);
    addedge(u, v), deg[u]++, deg[v]++;
  }
  
  if (N == 2) {
    if (A[1] == A[2]) puts("YES");
    else puts("NO");
    return 0;
  }

  flag = 1;
  for (int i = 1; i <= N; ++i)
    if (deg[i] > 1) {
      dfs(i, 0);
      if (f[i] != A[i] * 2) flag = 0;
      break;
    }

  if (flag) puts("YES");
  else puts("NO");
  
  return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

string a, b, c;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> a >> b >> c;
	if(a.back() == b[0] && b.back() == c[0]) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

const double PI = 3.14159265358979323846;


int main(int argc, char *args[]) {
	int n, k; cin >> n >> k;
	vector<double> p(n + 1);
	rep(i, n) cin >> p[i];
	vector <double> sum(n + 1);
	sum[0] = 0.0000000000000;
	for (int i = 0; i < n; i++) {
		sum[i+1] = sum[i] + (p[i] + 1)/2;
	}
	double ans = 0.000000000;
	for (int i = 1; i <= n-k+1; i++) {
		int l, r;
		l = i-1, r = i + k -1;
		double tmp = sum[r] - sum[l];
		ans = max(tmp, ans);
	}
	cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int N,M,l,r,x;//,r = 0,g = 0,b = 0;
ll dp[310][310][310],inf = 1e9+7;

bool check(int a,int b,int c,int l,int x){
	int A[3] = {a,b,c};
	sort(A,A+3);
	if(x==1) return A[1]<l;
	if(x==2) return A[0]<l && l<=A[1];
	if(x==3) return l<=A[0];
}

int main(){
	cin >> N >> M;
	vector<vector<P>> v(N+1);
	for(int i=1;i<=M;i++){
		cin >> l >> r >> x;
		v[r].push_back({l,x});
	}
	dp[0][0][0] = 1;
	ll ans = 0;
	for(int r=0;r<=N;r++){
		for(int g=0;g<=N;g++){
			for(int b=0;b<=N;b++){
				int m = max(max(r,g),b);
				if(v[m].size()>0){
					for(int i=0;i<v[m].size();i++){
						if(!check(r,g,b,v[m][i].first,v[m][i].second)) dp[r][g][b] = 0;
					}
				}
				dp[m+1][g][b] += dp[r][g][b];
				if(m+1==g || m+1==b) dp[m+1][g][b] = 0;
				dp[r][m+1][b] += dp[r][g][b];
				if(m+1==r || m+1==b) dp[r][m+1][b] = 0;
				dp[r][g][m+1] += dp[r][g][b];
				if(m+1==r || m+1==g) dp[r][g][m+1] = 0;
				dp[m+1][g][b] %= inf; dp[r][m+1][b] %= inf; dp[r][g][m+1] %= inf;
				if(m==N){
					ans += dp[m][g][b]+dp[r][m][b]+dp[r][g][m];
					ans %= inf;
				}
			}
		}
	}
	cout << ans << endl;
}

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

#define LLINF (1LL<<60)
typedef long long ll;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

//C++14 (GCC 5.4.1)
int main() {
    int N;
    cin >>N;

    vector<int> h(N);
    rep(i,N) cin >> h[i];
    
    //-----------------------------------
    bool is=false;
    int ans=h[0];
    repd(i,1,N){
        if(h[i-1]<h[i]){
            ans+=h[i]-h[i-1];
        }
    }


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

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    int n, m;
    while(cin >> n >> m, n){
        vector< P > v(n);
        rep(i, n){
            cin >> v[i].second >> v[i].first;
        }
        SORT_INV(v);
        int ans = 0;
        rep(i, n){
            ans += max(v[i].second - m, 0) * v[i].first;
            m = max(m - v[i].second, 0);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 100000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
      int d,n,m;
      while(cin>>d&&d){
            cin>>n>>m;
            vector<int> V(n);
            REP(i,n-1)cin>>V[i];
            V.PB(0);V.PB(d);
            sort(ALL(V));
            int ans=0;
            REP(i,m){
                  int k,d=INF;
                  cin>>k;
                  d=min(*upper_bound(V.begin(),V.end(),k)-k,k-*(upper_bound(V.begin(),V.end(),k)-1));
                  ans+=d;
            }
            cout<<ans<<endl;
      }
}

Measured memory_bytes: 1796
#include <iostream>
using namespace std;
int s[1000000];
bool binary(int n, int key){
    int left=0,right=n,mid;
    while(left<right){
        mid = (left+right)/2;
        if(s[mid]==key)return true;
        if(s[mid] > key)right = mid;
        else if(s[mid] < key)left = mid+1;
    }
    return false;
}
//Sの要素は昇順に整列されている
int main() {
    int n,q,ans=0;
    cin >> n;
    
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        int key;
        cin >> key;
        if(binary(n, key)){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3500
#include <iostream>

#define INF 10000

int n;
int l = INF, r = -1;

int main() {
    std::cin >> n;
    for (int i=0; i<n; ++i) {
        int a;
        std::cin >> a;
        l = std::min(l, a);
        r = std::max(r, a);
    }
    std::cout << r - l << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int b[100];
int ans[100];

int main() {
    int n, i, j;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &b[i]);
    
    for (i = n - 1; i >= 0; i--) {
        for (j = i; j >= 0; j--) {
            if (b[j] > j + 1) {
                puts("-1");
                
                return 0;
            }
            
            if (b[j] == j + 1) {
                ans[i] = b[j];
                
                for (; j < i; j++) b[j] = b[j + 1];
                
                break;
            }
        }
        
        if (j < 0) {
            puts("-1");
            
            return 0;
        }
    }
    
    for (i = 0; i < n; i++) printf("%d\n", ans[i]);
    
    return 0;
}


Measured memory_bytes: 128
n, T = map(int, input().split())
#ct = [list(map(int, input().split())) for _ in range(n)]
l = []
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        l.append(c)

if l:
    print(min(l))
else:
    print('TLE')

Measured memory_bytes: 9120
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//-----CODE------//

void solve(void)
{
  int N,C;
  cin>>N>>C;
  int SIZE = 10e5+1;
  vector<vector<int> > mat (C,vector<int>(SIZE,0));
  for (int i = 0; i < N; i++)
  {
    int s,t,c;cin>>s>>t>>c;
    mat[c-1][s]++;
    mat[c-1][t+1]--;
  }
  for (int i = 0; i < SIZE-1; i++)
  {
    for (int c = 0; c < C; c++)
    {
      mat[c][i+1] += mat[c][i];
    }
    
  }
  int MAX = 0;
  for (int i = 0; i < SIZE; i++)
  {
    int cnt = 0;
    for (int c = 0; c < C; c++)
    {
      cnt += (int)(mat[c][i] > 0);
    }
    chmax(MAX,cnt);
  }
  cout<<MAX<<endl;

  
  
  return; 
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}

Measured memory_bytes: 242560
n=int(input())
a=[int(i) for i in input().split(' ')]
for i in range(n):
  j=0
  while(True):
    if a[i]%2==0:
      j+=1
      a[i]=a[i]//2
    else:
      a[i]=j
      break
print(sum(a))

Measured memory_bytes: 4148
using System;
using System.Linq;
class dr
{
    static void Main(string[] args)
    {
        while (true)
        {
            string a = Console.ReadLine();
            if (a == null) { break; }
            int[] k = a.Split().Select(int.Parse).ToArray();
          
            Console.WriteLine(k[0]+k[1]);
        }
    }

}

Measured memory_bytes: 9492
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void){
    ll k;cin>>k;
    if(k<=9){cout<<k<<endl;return 0;}
    ll cnt=9;
    queue<ll> q;
    for(ll i=1;i<=9;i++)q.push(i);
    while(cnt!=k){
        ll cr = q.front();
        for(ll i=-1;i<=1;i++){
            ll d = cr%10 + i;
            if(0>d || d>9)continue;
            ll nx = cr*10 + d;
            q.push(nx);
            cnt++;
            if(cnt==k){cout<<q.back()<<endl;return 0;}
        }
        q.pop();
    }
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LLI long long int
#define LI long int 
const LI MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LI n,i;cin>>n;
      LI prev=0,f=0;
      fo(i,0,n){
        LI x;cin>>x;
        if(f) continue;
        if(x==prev) continue;
        if(x<prev) f=1;
        if(x>prev) prev=x-1; 
      }
      if(f) cout<<"No";
      else cout<<"Yes";
    }
    return 0;
}

Measured memory_bytes: 3628
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    mod = 10 ** 9 + 7
    s = sum(A)
    q = sum([a ** 2 for a in A])
    ans = (((s * s) - q)) // 2
    print(int(ans % mod))


if __name__ == '__main__':
    main()


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

int main(){
    int q;
    cin >> q;
    repp(qq, q){
        ll a,b;
        cin >> a >> b;

        ll ans = 0;
        ll aa = (ll)sqrt((double)(a*b));
        if(aa * aa == a*b) aa--;
        ans += 2 * aa;
        if(aa != 0 && aa == (a*b-1)/aa) ans--;
        if(aa >= min(a,b)) ans--;  

        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    int n;
    cin >> n;
    string m = to_string(n);
    ll s = 0;
    REP(i, m.size()){
        s += m[i] - '0';
    }
    if(n % s){print("No");}
    else{print("Yes");}
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int i=1,n; 
  cin>>n;
 while(i<n){
   i*=2;
   }
   if(i<=n){
   cout<<i<<endl;
   }
   else if(i>n){
   cout<<i/2<<endl;
   }
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
const ld pi = 3.14159265358979323846;
 
int main() {
    ll d,t,s;
    cin>>d>>t>>s;
    if (d<=t*s){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3616
let is_palindrome s = s.[0] = s.[4] && s.[1] = s.[3]

let inc_str s = int_of_string s + 1 |> string_of_int

let solve start fin =
  let rec aux x sum =
    if int_of_string x > int_of_string fin then sum
    else if is_palindrome x then aux (inc_str x) (sum + 1)
    else aux (inc_str x) sum
  in
  aux start 0

let () = Scanf.scanf "%s %s" solve |> Printf.printf "%d\n"

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<ctype.h>
typedef long long LL;
#define rep(i,n) for(LL i=0; i<(LL)(n); i++)

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}

LL ans( LL n,LL xx){
	if(n == -1){
		return 0;
	}
	return (n/xx)+1;
}

//main関数
int main(){
	int N;
	scanf("%d", &N);
	int C[N],S[N],F[N];
	for ( int i=1; i<N; i++ ) {
		scanf("%d %d %d",&C[i],&S[i],&F[i]);
	}
	
	int ans[1000] = {0};
	int sec;
	
	for( int i=1; i<N; i++ ){
		sec = 0;
		for( int j=i; j<N; j++){
			sec = max(sec,S[j]);
			//sec += S[i];
			while( (sec % F[j]) != 0){
				sec++;
			}
			sec += C[j];
			//printf("%d  ",sec);
		}
		ans[i] = sec;
	}
	for(int i=1; i<=N; i++){
		printf("%d\n",ans[i]);
	}
	 
}







Measured memory_bytes: 1736
import java.util.*;

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

        int N = sc.nextInt();
        int A = sc.nextInt();
        int[] x = new int[N + 1];
        for (int i = 1; i <= N; ++i) {
            x[i] = sc.nextInt();
        }

        long[][][] dp = new long[N + 1][N + 1][N * A + 1];
        for (int i = 0; i < N; ++i) {
            dp[i][0][0] = 1;
        }

        for (int i = 1; i <= N; ++i) {
            for (int j = 1; j <= i; ++j) {
                for (int k = 1; k <= N * A; ++k) {
                    if (k < x[i]) {
                        dp[i][j][k] = dp[i - 1][j][k];
                    } else {
                        dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x[i]];
                    }
                }
            }
        }

        long ans = 0;
        for (int j = 1; j <= N; ++j) {
            ans += dp[N][j][j * A];
        }

        System.out.println(ans);
    }
}


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

int main() {
    string input;
    cin >> input;
    
    string a = input.substr(2, 1);
    string b = input.substr(3, 1);
    string c = input.substr(4, 1);
    string d = input.substr(5, 1);
    
    if(a == b && c == d){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 100
#define INF 10000
#define NIL -1
#define WHITE 1
#define BLACK 0

int prim();

int n,d[N],pi[N],color[N],G[N][N];

int main(){
    int i,j;

    scanf("%d",&n);

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

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

    return 0;
    
}

int prim(){
    int u,v,mincost,i,weight=0;

    for(u=0;u<n;u++){
        d[u]=INF;
        pi[u]=NIL;
        color[u] = WHITE;
    }

    d[0]=0;

    while(1){
        mincost=INF;

        for(i=0;i<n;i++){
            if(color[i]!=BLACK && d[i]<mincost){
                mincost=d[i];
                u=i;
            }
        }

        if(mincost==INF) break;

        color[u]=BLACK;

        for(v=0;v<n;v++){
            if(G[u][v]!=NIL){
                if(color[v] != BLACK && G[u][v] < d[v]){
                pi[v]=u;
                d[v]=G[u][v];
                }
            }
        }
    }


    for(i=0;i<n;i++) weight+=d[i];

    return weight;

}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 200010;
const int N = 100;

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

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

int main() {
	int h,w,a,b;cin>>h>>w>>a>>b;
	COMinit();
	long long ans=0;
	rep(i, w-b) ans=((COM(i+a-1,a-1)*COM(h+w-a-2-i,h-a-1))%MOD+ans)%MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 4992
def main():
    R,B,G,N = list(map(int,input().split(' ')))
    cnt = 0
    for r in range(N//R+1):
        for g in range(N//G+1):
            if R*r+G*g > N:
                break
            if (N-(R*r+G*g))%B ==0:

                cnt +=1
    print(cnt)
if __name__ =='__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL a,b,c,d;
inline LL gcd(LL x,LL y)
{
	return y==0?x:gcd(y,x%y);
}
inline LL S(LL x,LL y,LL z)
{
	return x/y+x/z-x/(z*y/gcd(y,z));
}
int main()
{
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	printf("%lld",b-S(b,c,d)-a+1+S(a-1,c,d));
}


Measured memory_bytes: 256
def main():

    N = int(input())
    if 0 > N or N > 100:
        print("input N error")
        exit()
        
    answer = []
    for i in range(N):
        s, p = input().split()
        answer.append([s, -int(p), i+1])

    answer.sort()
    for i in range(len(answer)):
        print(answer[i][2])
        
        
if __name__ == '__main__':

    main()

    


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int sgn(int x) { return (x > 0) - (x < 0); }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int X;
    cin>>X;
    cout<<10-X/200<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
//絶対値
ll ze(ll x,ll y=0){
    return max(x,y)-min(x,y);
};

int main(){
    int n,l;
    cin >> n >> l;
    vector<int>  v(n);
    int mn=10000000;
    int memo;
    for(int i=0; i<n; i++){
        v[i]=(l+i);
        if(mn>ze(l+i)){
            mn=ze(l+i);
            memo=i;
        }
    }
    ll sum=0;
    for(int i=0; i<n; i++){
        sum+=v[i];
    }
    //cout << memo << endl;
    cout << sum-v[memo] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int n;
    while(cin>>n&&n){
        int sum[26]={};
        string ans="TIE"; int ansN=0;
        pair<int,int> top;
        rep(i,n){
            char c; cin>>c;
            if(!ansN){
                sum[c-'A']++;
                if(sum[c-'A']>top.second){
                    top=make_pair(c-'A',sum[c-'A']);
                }
                bool flg=1;
                rep(j,26){
                    if(top.first!=j){
                        if(top.second<=sum[j]+n-i-1) flg=0;
                    }
                }
                if(flg){
                    ansN=i+1;
                    char x=top.first+'A';
                    ans=x;
                }
            }
        }
        cout<<ans;
        if(ansN) cout<<" "<<ansN;
        cout<<endl;
    }
    return 0;
}



Measured memory_bytes: 3168
import sys
input = lambda : sys.stdin.readline().rstrip()

import heapq
h = []
heapq.heapify(h)

n, m, s = list(map(int, input().split()))
a, b = [[None] * m for _ in range(2)]
c, d = [[None] * n for _ in range(2)]

ns = {u: [] for u in range(n)}
uv2e = {}
for i in range(m):
    u,v,a[i],b[i] = list(map(int, input().split()))
    ns[u-1].append(v-1)
    ns[v-1].append(u-1)
    uv2e[u-1,v-1] = i
    uv2e[v-1,u-1] = i
for i in range(n):
    c[i], d[i] = list(map(int, input().split()))

maxs = max(a)*(n-1)
s = min(s, maxs)
state = (0, 0, s) # (距離, ノード, 銀貨枚数)
ans = [[None] * (maxs+1) for _ in range(n)]
ans[0][s] = 0
done = [[None] * (maxs+1) for _ in range(n)]
heapq.heappush(h, state)
count = 0
while h:
    count += 1
    dd, u, ss = heapq.heappop(h)
#     if ans[u][ss] is not None and ans[u][ss] <= dd:
#         continue
#     ans[u][ss] = dd
    
    if done[u][ss]:
        continue
    done[u][ss] = True
    
    # グラフの隣接点
    for v in ns[u]:
        e= uv2e[u,v]
        if ss<a[e] or done[v][ss-a[e]] :
            continue
        ans[v][ss-a[e]] = min(ans[v][ss-a[e]], dd + b[e]) if ans[v][ss-a[e]] is not None else dd+b[e]
#         if ss<a[e] or ans[v][ss-a[e]] is not None:
#             continue
        heapq.heappush(h, (dd + b[e], v, ss-a[e]))
    # 両替
    if ss+c[u] <= maxs:
        sss = ss+c[u]
    elif ss < maxs:
        sss = maxs
    else:
        continue
    heapq.heappush(h, (dd + d[u], u, sss))
#     print(sss, maxs, ss, c[u])
    ans[u][sss] = min(ans[u][sss], dd + d[u]) if ans[u][sss] is not None else dd+d[u]

for item in ans[1:]:
    print(min(item))

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

int main()
{


    int n,x,d;
    cin>>n>>x;
    if(x==0)
    {
        cout<<-n;
    }
    else
    {
        int d=x-n;
        cout<<n+d*2<<endl;
    }
}


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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (!(i & 1) && (s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) {
        } else if (i & 1 && (s[i] == 'L' || s[i] == 'U' || s[i] == 'D')) {
        } else {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}


Measured memory_bytes: 256
S = input()

len_ACGT = 0
canCount = False
max_len = 0
for s in S:
  if (s in "ACGT"):
    if(canCount == False):
      canCount = True
    len_ACGT += 1
  else:
    if(canCount == True):
      canCount = False
      len_ACGT = 0

  if(len_ACGT > max_len):
    max_len = len_ACGT

print(max_len)


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdio>

using namespace std;



int main() {
   int x,y;
   int z;
   cin >> x >> y >> z;
   int sum =0;
   for(int i=x;i<=y ;i++){
       if(z%i==0){
           sum++;

       }
       
   
}
  cout << sum <<endl;
}


Measured memory_bytes: 3104
import java.util.*;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String ans = "";
		int num = sc.nextInt();
		String str = sc.next();
		String S[] = str.split("");
		String str2 = sc.next();
		String T[] = str2.split("");
		for(int i=0;i<num;i++)
		{
			ans = ans + S[i] + T[i];
		}
		System.out.println(ans);		
	}
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

int root(int *u,int x){
  if(u[x]==x) return x;
  return u[x]=root(u,u[x]);
}

int same(int *u,int x,int y){
  return root(u,x)==root(u,y);
}

void unite(int *u,int x,int y){
  x=root(u,x);
  y=root(u,y);
  if(x==y) return;
  u[x]=y;
  return;
}

typedef struct weightEdge{
  int s,t;
  int w;
} edge;

int cmp(const void *a,const void *b){
  return ((edge *)a)->w-((edge *)b)->w;
}

void run(void){
  int v,e;
  scanf("%d%d",&v,&e);
  edge *array=(edge *)malloc(sizeof(edge)*e);
  int i;
  for(i=0;i<e;i++){
    int s,t,w;
    scanf("%d%d%d",&s,&t,&w);
    array[i].s=s;
    array[i].t=t;
    array[i].w=w;
  }
  qsort(array,e,sizeof(edge),cmp);
  int *u=(int *)malloc(sizeof(int)*v);
  for(i=0;i<v;i++) u[i]=i;
  int ans=0;
  int cnt=0;
  for(i=0;cnt<v-1;i++){
    if(same(u,array[i].s,array[i].t)) continue;
    unite(u,array[i].s,array[i].t);
    ans+=array[i].w;
    cnt++;
  }
  printf("%d\n",ans);
  free(array);
  free(u);
  return;
}

int main(void){
  run();
  return 0;
}



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

int ketawa(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (a <= ketawa(i) && ketawa(i) <= b) {
      ans += i;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256