akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections;
using System.Collections.Generic;

namespace ABC125 {
  class ProblemA {
    static void Main(string[] args) {
      int[] input = Input.nums;
      System.Console.WriteLine((input[2] / input[0]) * (input[1]));
    }
  }
  public class Input {
    public static string str => System.Console.ReadLine();
    public static string[] strs => str.Split(' ');
    public static char[] charArr => str.ToCharArray();
    public static int num => int.Parse(str);
    public static int[] nums => Array.ConvertAll(strs, int.Parse);
    public static long numL => long.Parse(str);
    public static long[] numLs => Array.ConvertAll(strs, long.Parse);
  }
}

Measured memory_bytes: 11220
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto kx = readln.split.to!(int[]);
    auto K = kx[0];
    auto X = kx[1];
    auto i = X-K+1;
    int[] r;
    while (i < X+K) {
        r ~= i++;
    }
    writeln(r.to!(string[]).join(" "));
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  a.insert(a.begin(), 0);
  a.push_back(0);
  int sum_a = 0;
  for (int i = 0; i < a.size() - 1; i++) {
    sum_a += abs(a.at(i) - a.at(i + 1));
  }
  for (int i = 1; i < a.size() - 1; i++) {
    int ans = sum_a - abs(a.at(i) - a.at(i - 1)) - abs(a.at(i) - a.at(i + 1)) + abs(a.at(i - 1) - a.at(i + 1));
    cout << ans << endl;
  }
}


Measured memory_bytes: 1656
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const long long MOD = 1000000007;

int main(){
  ll n, c, k;
  cin>>n>>c>>k;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  sort(v.begin(), v.end());
  ll ans = 0;
  ll num = 0;
  ll bus = 0;
  rep(i,n) {
    if(v[i] <= bus and num < c) {
      num++;
    } else {
      ans++;
      num = 1;
      bus = v[i]+k;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 1024
from itertools import permutations

n = int(input())
box = []
for _ in range(n):
    x,y = map(int,input().split())
    box.append([x,y])
ans = 0
ans_box = list(permutations(range(n)))
cnt = len(ans_box)
for i in range(cnt):
    for j in range(n-1):
        ans += (((box[ans_box[i][j+1]][0] - box[ans_box[i][j]][0]) ** 2 + (box[ans_box[i][j+1]][1] - box[ans_box[i][j]][1]) ** 2 ) ** 0.5)

print(ans/cnt)

Measured memory_bytes: 8052
#pragma GCC optimize("O3", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

signed main() {
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	for (int i = 0; i < n - 1; ++i)
		if (s[i] != s[i + 1])
			++ans;
	cout << (++ans) << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<stdio.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e9

int main()
{
	int n;
	cin >> n;
	int s[n];
	int sm = 0;
	rep(i, n) {
		cin >> s[i];
		sm += s[i];
	}

	int ans = 0;
	if (sm % 10 != 0) {
		ans = sm;
	} else {
		rep(i, n) {
			if ((sm - s[i]) % 10 != 0) {
				ans = max(ans, sm - s[i]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n;
	while(cin >> n, n){
		vi v(n);
		rep(i, n) cin >> v[i];
		sort(all(v));
		int ans = inf;
		rep(i, n - 1) ans = min(ans, v[i + 1] - v[i]);
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, l, t;
	cin >> n >> l >> t;
	vector<int> x(n), w(n), pos(n);
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> w[i];
		if (w[i] == 1) {
			pos[i] = (x[i] + t % l) % l;
		} else {
			pos[i] = (x[i] - t % l + l) % l;
		}
	}

	int sum = 0;
	for (int i = 1; i < n; i++) {
		if (w[i] == w[0]) continue;
		sum += 2 * t / l;
		if (w[0] == 1) {
			sum += ((x[i] + l - x[0]) % l < 2 * t % l);
		} else {
			sum += ((x[0] + l - x[i]) % l < 2 * t % l);
		}
	}

	int idx = sum * (w[0] == 1 ? 1 : -1);
	int tar = pos[0];
	sort(pos.begin(), pos.end());

	for (int i = 0; i < n; i++) {
		if (pos[i] == tar) {
			idx -= i;
			if (i + 1 < n && pos[i + 1] == pos[i] && w[0] == 2) idx--;
			break;
		}
	}
	
	idx = (idx % n + n) % n;
	vector<int> ans(n);
	for (int i = 0; i < n; i++) {
		ans[(idx + i) % n] = pos[i];
	}

	for (int x : ans) cout << x << endl;
	return 0;
}

Measured memory_bytes: 2816
#include <stdio.h>
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

int gcd(const int a, const int b);

int main() {
	int k; scanf("%d", &k);
	if (gcd(k, 10) != 1)
		puts("-1");
	else {
		int i, j;
		for (i = 1, j = 7 % k; j != 0; ++i, j = (j * 10 + 7) % k);
		printf("%d\n", i);
	}
	return 0;
}

int gcd(const int a, const int b) {
	return b == 0 ? a : gcd(b, a % b);
}



Measured memory_bytes: 1704
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, m; cin >> n >> m;
	int l = 1, r = n;
	for(int i = 0; i < m; i++){
		int x, y; cin >> x >> y;
		l = max(l, x);
		r = min(r, y);
	}
	cout << max(r - l + 1, 0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
#define endl "\n"
#define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define mem(a,b) memset((a),(b),sizeof (a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF long long(1e18)
#define MOD 1000000007


void solve(){
	int n;cin>>n;
	int c500 = n/500;
	n-= c500*500;
	c500*=1000;
	c500+=(n/5)*5;
	cout<<c500<<endl;
	
}

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




Measured memory_bytes: 3156
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
Alice = 0
Bob = 0
for i in range(0, len(a), 2):
    Alice += a[i]
for i in range(1, len(a), 2):
    Bob += a[i]
print(Alice - Bob)

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

int main(){
    int n, m;
    cin >> n >> m;
    long long ans[100001];
    bool isBroken[100001];
    for(int i = 0; i <= n; i++){
        isBroken[i] = false;
        ans[i] = 0;
    }
    int a = 0;
    for(int i = 1; i <= m; i++){
        cin >> a;
        isBroken[a] = true;
    }
    ans[0] = 1;
    if(!isBroken[1]){
        ans[1] = 1;
    } else {
        ans[1] = 0;
    }
    for(int i = 2; i <= n; i++){
        if(!isBroken[i-1] && !isBroken[i-2]){
            ans[i] = ans[i-1] + ans[i-2];
        } else if(!isBroken[i-1] && isBroken[i-2]){
            ans[i] = ans[i-1];
        } else if(isBroken[i-1] && !isBroken[i-2]){
            ans[i] = ans[i-2];
        }
        ans[i] %= 1000000007;
    }
    cout << ans[n] << endl;
}

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

public class Main {
	public static void main(String[] args) {
    	Scanner in = new Scanner(System.in);
      	int a = in.nextInt();
        int b = in.nextInt();
      	int c = in.nextInt();
      	int d = in.nextInt();
        while (a > 0 && c > 0) {
        	if (c <= b) c = 0;
          	else if (a <= d) a = 0;
          	else {
            	a -= d;
              	c -= b;
            }
        }
      	System.out.println(a == 0 ? "No" : "Yes");
    }
}


Measured memory_bytes: 35804
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
#include <algorithm>
#include <functional>
//#include<stdlib.h>
using namespace std;
int main() {
	int a, b;
	cin >> b >> a;
	cout << ((b < a) ? 0 : 10);
	return 0;
}

Measured memory_bytes: 888
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, dp[60000];

int main(){
	while(cin >> n, n){
		memset(dp, 0, sizeof(dp));
		vector<vi> in;
		vi i13(13), i17(17), i19(19), i23(23);
		rep(i, n){
			int d, t;
			cin >> d >> t;
			vi v(d);
			rep(j, d) cin >> v[(j - t + d) % d];
			if(d == 13) rep(j, d) i13[j] += v[j];
			else if(d == 17) rep(j, d) i17[j] += v[j];
			else if(d == 19) rep(j, d) i19[j] += v[j];
			else if(d == 23) rep(j, d) i23[j] += v[j];
			else{
				rep(j, 60000) dp[j] += v[j % v.size()];
			}
		}
		int ans = *max_element(dp, dp + 60000);
		ans += *max_element(all(i13)) + *max_element(all(i17));
		ans += *max_element(all(i19)) + *max_element(all(i23));
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1436
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	cin >> N;
	multiset<string> ms;
	REP(i, N) {
		string s;
		cin >> s;
		ms.emplace(s);
	}
	cout << "AC x " << ms.count("AC") << endl;
	cout << "WA x " << ms.count("WA") << endl;
	cout << "TLE x " << ms.count("TLE") << endl;
	cout << "RE x " << ms.count("RE") << endl;

	return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

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

  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  int sum = 0;
  int ans = 0;
  mp[0] = 1;
  rep(i, n) {
    int a;
    cin >> a;
    sum += a;
    sum %= m;
    ans += mp[sum];
    mp[sum]++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4224
N, K = map(int, input().split())
H = list(map(int, input().split()))

a = 0

if K > N:
  a = K - N

for _ in range(a):
  H.append(0)

H.sort(reverse = True)
sum = 0

for i in range(K):
  H[i] = 0
  
for i in range(N):
  sum += H[i]
  
print(sum)


Measured memory_bytes: 31400
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;
int main(int argc, char const *argv[]){
    ll n, ans, m;
    ans=0;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    m=a[n-1];
    vector<ll> b(m+1);
    rep(i,n){
        for(int j=1;a[i]*j<=m;j++){
            b[a[i]*j]++;
        }
    }
    rep(i,n){
        if(b[a[i]]==1){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 12688
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[110000];
int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	LL ans = 0;
	for(int i = 0; i < n; i++){
		ans += (LL)a[i]/2;
		a[i] %= 2;
		if(a[i] && a[i+1]){
			ans++;
			a[i]--;
			a[i+1]--;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(10000);
vector<ll> ifac(10000);

//べき乗高速化
ll mpow(ll x, ll n){
	ll ans = 1;
	while(n != 0){
		if (n&1) ans = ans * x % M;
		x = x*x % M;
		n  = n >> 1;
	}
	return ans;
}

//aCbを計算
ll comb(ll a, ll b){
	if (a == 0 && b == 0) return 1;
	if (a < b || a < 0){
		return 0;
	}
	ll temp = ifac[a-b] * ifac[b] % M;
	return temp * fac[a] % M;
}

int main(){
	ll s;
	cin >> s;
	fac[0] = 1;
	ifac[0] = 1;
	for(ll i = 0; i<= 5000; i++){
		fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
		ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
	}
	ll ans = 0;
	int max_length = (s + 2) / 3;
	for (int length = 1; length <= max_length; ++length){
		ll temp = s - 3 * length;
		ans += comb(temp + length - 1, length - 1);
		ans %= M;
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3780
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    string s,t,a;
    cin>>s>>t;
    for(i=0;i<n;i++)
    {
        a+=s[i];
        a+=t[i];
    }

    cout<<a<<endl;
    return 0;
}


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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n;
    cin >> n;
    vec<ll> a(n), b(n);
    REP(i, n) { cin >> a[i]; }
    REP(i, n) { cin >> b[i]; }

    vec<ll> cn, cp;
    ll sum = 0;
    REP(i, n) {
        if(a[i] > b[i])
            cp.push_back(a[i] - b[i]);
        if(a[i] < b[i]) {
            cn.push_back(b[i] - a[i]);
            sum += a[i] - b[i];
        }
    }
    ll ans = cn.size();
    int pos = 0;
    sort(all(cp), greater<ll>());
    while(sum) {
        ans++;
        sum += cp[pos];
        if(sum >= 0) {
            cout << ans << en;
            return;
        }
        pos++;
        if(pos == cp.size()) {
            cout << -1 << en;
            return;
        }
    }
    cout << ans << en;
}

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

    solve();
    /*
    ll t;
    cin >> t;
    REP(i, t)
    solve();
    */

    return 0;
}


Measured memory_bytes: 5744
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;

int n,a[(1<<18)];
P p[(1<<18)];

P g(P x, P y){
    P v[4];
    v[0]=P(a[x.first], x.first);
    v[1]=P(a[x.second], x.second);
    v[2]=P(a[y.first], y.first);
    v[3]=P(a[y.second], y.second);
    sort(v, v+4, greater<P>());
    P r=P(v[0].second, 0);
    for(int i=1;i<4;i++){
        if(v[i].second!=v[0].second){
            r.second=v[i].second;
            break;
        }
    }
    return r;
}

P f(int x){
    if(p[x].first>=0)return p[x];
    int b=0;
    for(int i=0;i<n;i++){
        if(((x>>i)&1)==1){
            b++;
        }
    }
    if(b==0)return P(0, 0);
    if(b==1)return P(x, 0);
    P r=P(x, 0);
    for(int i=0;i<n;i++){
        if(((x>>i)&1)==1){
            P t=f(x-(1<<i));
            r=g(r, t);
        }
    }
    return p[x]=r;
}
int main(void){
    cin>>n;
    for(int i=0;i<(1<<n);i++){
        cin>>a[i];
        p[i]=P(-1, 0);
    }
    int z=0;
    for(int i=1;i<(1<<n);i++){
        P q=f(i);
        //cout << i << " : " << q.first << ", " << q.second << endl;
        int x=a[q.first]+a[q.second];
        z=max(z, x);
        cout << z << endl;
    }
}


Measured memory_bytes: 6144
# -*- coding: utf-8 -*-
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

total_a, total_b = [0], [0]
for i in range(n):
    total_a.append(total_a[i]+a[i])
for i in range(m):
    total_b.append(total_b[i]+b[i])

ans = 0
j = m
for i in range(n+1):
    if total_a[i] > k:
        break
    while total_b[j] > k - total_a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)


Measured memory_bytes: 47544
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
struct edge{int from,to,cost;};
bool comp(const edge& e1,const edge& e2){
	return e1.cost<e2.cost;
}
int V,E;
edge G[100000];
//Union-Find
int par[10000];
int Rank[10000];
void init()
{
	for(int i=0;i<V;i++){
		par[i]=i;
		Rank[i]=0;
	}
}
int find(int x)
{
	if(x==par[x])return x;
	return par[x]=find(par[x]);
}
void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return ;

	if(Rank[x]<Rank[y]){
		par[x]=y;
	}
	else{
		par[y]=x;

	}
	if(Rank[x]==Rank[y])Rank[x]++;
}
bool same(int x,int y){
	return find(x)==find(y);
}
int kkk()
{
	int ans=0;
	for(int i=0;i<E;i++){
		//printf("%d\n",same(G[i].from,G[i].to));
		//printf("%d %d\n",G[i].from,G[i].to);
		if(!same(G[i].from,G[i].to)){
			unite(G[i].from,G[i].to);
			ans+=G[i].cost;
		}
	}
	return ans;
}
int main()
{
	scanf("%d%d",&V,&E);
	for(int i=0;i<E;i++){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		edge e1={a,b,c};
		G[i]=e1;
	}
	sort(G,G+E,comp);
	init();
	printf("%d\n",kkk());
	return 0;
}

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

struct Node {
  int val;
  Node *next;
  Node *prev;
};

class List {
  Node *dummy;

public:
  List() {
    dummy = new Node();
    dummy->val = 0;
    dummy->next = dummy;
    dummy->prev = dummy;
  };
  ~List() {
    Node *tmp = dummy->next;
    Node *n;
    while (tmp != dummy) {
      n = tmp->next;
      delete tmp;
      tmp = n;
    }
    delete dummy;
  }
  void InsertFirst(int x) {
    Node *m = new Node();
    m->val = x;
    m->prev = dummy;
    m->next = dummy->next;
    dummy->next->prev = m;
    dummy->next = m;
  }
  void Delete(Node *n) {
    Node *tmp = n;
    tmp->prev->next = tmp->next;
    tmp->next->prev = tmp->prev;
    delete tmp;
  }
  void DeleteFirst() { Delete(dummy->next); }
  void DeleteLast() { Delete(dummy->prev); }
  Node *Search(int x) {
    Node *tmp = dummy->next;
    while (tmp != dummy) {
      if (tmp->val == x)
        return tmp;
      else
        tmp = tmp->next;
    }
    return nullptr;
  }
  void DeleteKey(int x) {
    Node *tmp = Search(x);
    if (tmp) {
      Delete(tmp);
    }
  }
  void Print() {
    Node *tmp = dummy->next;
    while (tmp != dummy) {
      if (tmp->next == dummy)
        printf("%d\n", tmp->val);
      else
        printf("%d ", tmp->val);
      tmp = tmp->next;
    }
  }
};

void ExecCommand(List &l, char *s) {
  if (s[0] == 'i') {
    int x;
    scanf("%d", &x);
    l.InsertFirst(x);
  } else if (s[0] == 'd' && s[6] == '\0') {
    int x;
    scanf("%d", &x);
    l.DeleteKey(x);
  } else if (s[6] == 'F')
    l.DeleteFirst();
  else
    l.DeleteLast();
}

int main() {
  int n;
  List l;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    char input[20];
    int x;
    scanf("%s", input);
    ExecCommand(l, input);
  }
  l.Print();

  return 0;
}



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

int main() {
  long long N,K;
  cin >> N >> K;
  vector<int> A(N);
  vector<int> num(200005,0);
  vector<vector<int>> loc(200005,vector<int>(0));
  vector<int> poi(N);
  for (int i=0; i<N; i++) {
    cin >> A[i];
    poi[i] = num[A[i]];
    loc[A[i]].insert(loc[A[i]].begin() + num[A[i]], i);
    num[A[i]]++;
  }
  long long roll = 0;
  int pos = 0;
  int prepos;
  long long period;
  int aa;
  while (roll < K) {
    prepos = pos;
    aa = (poi[pos]+1)%num[A[pos]];
    pos = (loc[A[pos]][aa])%N;
    if (prepos >= pos) {
      roll++;
    }
    pos++;
    pos%=N;
    if(pos == 0) {
      roll++;
    }
    if (roll == K) {
      period = 100000000000000;
      break;
    }
    if (pos == 0) {
      period = roll;
      break;
    }
  }
  
  long long hosii = K % period;
  if (hosii == 0) {
    return 0;
  }
  pos = 0;
  roll = 0;
  while (roll < hosii) {
    aa = (poi[pos]+1)%num[A[pos]];
    prepos = pos;
    pos = loc[A[pos]][aa];
    if (prepos >= pos) {
      roll++;
    }
    pos++;
    pos%=N;
    if (pos == 0) {
      roll++;
    }
  }
  
  bool fi = false;
  for (int i=prepos; i<N; i++) {
    if (poi[i] == num[A[i]]-1) {
      if (fi) {
        cout << ' ';
      }
      cout << A[i];
      fi = true;
    }
    else {
      aa = (poi[i]+1);
      prepos = pos;
      i = loc[A[i]][aa];
    }
  }
  
    
  
  
  return 0;
}

Measured memory_bytes: 14848
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i, n) cin >> p[i];
    sort(p.begin(), p.end());
    reverse(p.begin(), p.end());
    int diff_min = 1e8;
    int ans = 0;
    for (int i = 500; i >= -500; --i) {
        bool skip = false;
        rep(j, n) {
            if (i == p[j]) skip = true;
        }
        if (skip) continue;
        if (abs(i-x) <= diff_min) {
            //cout << i << endl;
            diff_min = abs(i-x);
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
//#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200000];
vll v;
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            v.push(p);
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[60];
void power()
{
    powe[0]=1;
    REP(i,1,15)
    {
        powe[i]=2*powe[i-1];
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
} 
ll fact[100005];
void factorial()
{
    fact[0]=1;
    REP(i,1,100002)
    {
        fact[i]=mymod(i*fact[i-1], num);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    if(n==m)
    cout<<"Yes\n";
    else
    cout<<"No\n";
	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    vector<pair<int,int> >v;

    for(int i=1;i<=n;i++)
    {
        int a;
        cin>>a;
        v.push_back(make_pair(a,i));
    }
    sort(v.begin(),v.end());

    for(int i=0;i<v.size();i++)
    {
        cout<<v[i].second<<" ";
    }
}


Measured memory_bytes: 1780
n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(1,n+1):t[i],x[i],y[i]=map(int,input().split())
print('YNeos'[not all(t[i+1]-t[i]-abs(x[i]-x[i+1])-abs(y[i]-y[i+1])>=0 and (t[i+1]-t[i]-abs(x[i]-x[i+1])-abs(y[i]-y[i+1]))%2==0 for i in range(n))::2])

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

 
int main() {

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  
  
    while(b <= a) { // b > a になるまで操作する
      b *= 2;
      k--;
    }
  
    while(c <= b) { // c > b になるまで操作する
      c *= 2;
      k--;
    }
  
    if(k >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;    
}

Measured memory_bytes: 3632
/**
 *    author:  accesss_denied
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll mod=1e9+7;			
ll inf=1e18;

int main() {
			fast
			// #ifndef ONLINE_JUDGE
			// freopen("input.txt","r",stdin);
			// freopen("output.txt","w",stdout);
			// #endif

			
			ll n,m,k;
			cin>>n>>m>>k;
			map<ll,ll>x,y;
			map<pair<ll,ll>,ll>arr;
			for(ll i=0;i<k;i++)
			{
				ll a,b;
				cin>>a>>b;
				x[a]+=1;
				y[b]+=1;
				arr[{a,b}]+=1;;
			}
			if(k==1)
			{
				cout<<1;
				return 0;
			}

			vector<pair<ll,ll>>xx,yy;
			for(auto it:x)
			{
				xx.pb({it.ss,it.ff});
			}
			for(auto it:y)
			{
				yy.pb({it.ss,it.ff});
			}
			sort(xx.rbegin(),xx.rend());
			sort(yy.rbegin(),yy.rend());

			ll xxx=xx[0].ss;
			ll yyy=yy[0].ss;
			ll ans=xx[0].ff+yy[0].ff;
			if(arr.find({xxx,yyy})!=arr.end())
			ans-=1;
			
			ll curx=xx[0].ss;
			for(ll i=0;i<yy.size();i++)
			{
				ll cury=yy[i].ss;
				ll cs=xx[0].ff+yy[i].ff;
				if(arr.find({curx,cury})!=arr.end())
				cs-=1;
				ans=max(ans,cs);
			}
			if(xx.size()>1)
			{		
				curx=xx[1].ss;	
			for(ll i=0;i<yy.size();i++)
			{
				ll cury=yy[i].ss;
				ll cs=xx[1].ff+yy[i].ff;
				if(arr.find({curx,cury})!=arr.end())
				cs-=1;
				ans=max(ans,cs);
			}
			}
			ll cury=yy[0].ss;
			for(ll i=0;i<xx.size();i++)
			{
				ll curx=xx[i].ss;
				ll cs=yy[0].ff+xx[i].ff;
				if(arr.find({curx,cury})!=arr.end())
				cs-=1;
				ans=max(ans,cs);
			}
			if(yy.size()>1)
			{		
				cury=yy[1].ss;
			for(ll i=0;i<xx.size();i++)
			{
				ll curx=xx[i].ss;
				ll cs=yy[1].ff+xx[i].ff;
				if(arr.find({curx,cury})!=arr.end())
				cs-=1;
				ans=max(ans,cs);
			}
			}




				cout<<ans<<endl;
			
			
				// for(auto it:xx)
				// {
				// 	cout<<it.ss<<" "<<it.ff<<endl;
				// }
				// cout<<endl<<endl;
				// for(auto it:yy)
				// {
				// 	cout<<it.ss<<" "<<it.ff<<endl;
				// }

				
                
			
			return 0;
		 }	




Measured memory_bytes: 76436
#![allow(non_snake_case)]

#[allow(unused_macros)]
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, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

fn main() {
    input!{
        N: usize,
        K: usize,
    }
    println!(
        "{}",
        if (N % 2 == 0 && N / 2 >= K) || (N % 2 == 1 && N / 2 + 1 >= K) {
            "YES"
        } else {
            "NO"
        }
    )
}


Measured memory_bytes: 4352
import collections

n=int(input())
a=list(map(int, input().split()))

c=collections.Counter(a)

su=0
an={}
for k in c.keys():
    tmp=c[k]*(c[k]-1)//2
    su+=tmp
    an[k]=(c[k]*(c[k]-1)-(c[k]-1)*(c[k]-2))//2

for o in a:
    print(su-an[o])

Measured memory_bytes: 32020
using System;
using System.Linq;
using System.Text;

namespace ITP1_5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var sb1 = new StringBuilder();
            for(int i = 0; i <= 300; i++)
            {
                sb1.Append(i % 2 == 0 ? '#' : '.');
            }
            var txt = sb1.ToString();

            var sb2 = new StringBuilder();
            while (true)
            {
                var input = Console.ReadLine().Split(' ');
                if (input.All(s => s == "0"))
                    break;
                var H = int.Parse(input[0]);
                var W = int.Parse(input[1]);
                var p1 = txt.Substring(0, W);
                var p2 = txt.Substring(1, W);
                for(int i = 0; i < H; i++)
                {
                    sb2.AppendLine(i % 2 == 0 ? p1 : p2);
                }
                sb2.AppendLine();
            }
            Console.Write(sb2);
        }
    }
}

Measured memory_bytes: 9552
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

a = inp()
sinput = input()

if a >= 3200:
    print(sinput)
else:
    print('red')

Measured memory_bytes: 12448
#include<bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
double PI=acos(-1);
int n,w;
ll val[105],weight[105];
ll dp[100005][105];
ll solve(int ww,int i){
    if(ww<0 ) return -1e18;
    if(i==n) return 0;
    if(dp[ww][i]!=-1)
        return dp[ww][i];
    return dp[ww][i]=max(solve(ww-weight[i],i+1)+val[i],solve(ww,i+1));
}





int main(){
    //IO
    memset(dp,-1,sizeof dp);
    cin>>n>>w;
    for(int i=0;i<n;i++) cin>>weight[i]>>val[i];
    cout<<solve(w,0);




    return 0;
}


Measured memory_bytes: 85672
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    sort(all(l));
    lint ans = 0;
    // i:max
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            auto itr = lower_bound(all(l), l[j] - l[i] + 1);
            if (itr - l.begin() >= i) {
                continue;
            }
            ans += i - (itr - l.begin());
        }
    }
    cout << ans << endl;
}

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

using namespace std;


void solve() {
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
    }
    int res = (n-1+k-2)/(k-1);
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    vector<vector<ll> > G(N, vector<ll>(N));
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) scanf("%lld", &G[i][j]);

    ll ans = 0;
    // floyd
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
        if (i == j) continue;
        bool use = true;
            for (int k = 0; k < N; k++) {
                if (k == i || k == j) continue;
                ll d = G[i][k] + G[k][j];
                if (d < G[i][j]) {
                    cout << -1 << '\n';
                    return 0;
                }
                else if (d == G[i][j]) use = false;
            }
        if (use) ans += G[i][j];
        }
    }
    cout << ans << '\n';
}


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

using namespace std;

int main(){
	int n, mx = 2*1e5, ans = 0; cin >> n;
	vector<int> p(n);
	vector<int> mxx(n);
	for(int i = 0; i < n; ++i){
		cin >> p[i];
		mx = min(mx, p[i]);
		mxx[i] = mx;
	}
	for(int i = 0; i < n; ++i) if(mxx[i] >= p[i]) ans++;
	cout << ans << endl;
}

Measured memory_bytes: 1792
import numpy as np

h,w = map(int,input().split())
f = []
bk = 0
f.append(["#" for i in range(w+2)])
for i in range(h):
    l = list(input())
    for c in l:
        if c=="#":
            bk += 1
    f.append(["#"]+l+["#"])
f.append(["#" for i in range(w+2)])
visited = {"1,1":0}

now = [[1,1]]
next = []

def to_key(l):
    return str(l[0])+","+str(l[1])

flag = True
count = 1
while 1:
    if len(now) == 0:
        flag = False
        break
    for state in now:
        x = state[0]
        y = state[1]

        if x==h and y == w:
            break

        if f[x+1][y]=="." and to_key([x+1,y]) not in visited:
            next.append([x+1,y])
            visited[to_key([x+1,y])] = count
        if f[x][y+1]=="." and to_key([x,y+1]) not in visited:
            next.append([x,y+1])
            visited[to_key([x,y+1])] = count
        if f[x-1][y]=="." and to_key([x-1,y]) not in visited:
            next.append([x-1,y])
            visited[to_key([x-1,y])] = count
        if f[x][y-1] == "." and to_key([x,y-1]) not in visited:
            next.append([x, y-1])
            visited[to_key([x,y-1])] = count
    count += 1
    now = next
    next = []
    # print(visited)

if flag:
    print(h*w-visited[to_key([h,w])]-bk-1)
else:
    if to_key([h,w]) in visited:
        print(h * w - visited[to_key([h, w])] - bk-1)
    else:
        print(-1)

Measured memory_bytes: 21676
#include <iostream>
#include <string>
#include <vector>

void addFrame(int heightPixel, int widthPixel, std::vector<std::string>& picture);

int main() {
    int heightPixel = 0;
    int widthPixel = 0;
    std::cin >> heightPixel >> widthPixel;
    
    std::vector<std::string> picture;
    std::string line;
    for (int i = 0; i < heightPixel; ++i) {
        std::cin >> line;
        picture.push_back(line);
    }
    
    addFrame(heightPixel, widthPixel, picture);
    
    for (std::string line : picture) {
        std::cout << line << std::endl;
    }
}

void addFrame(int heightPixel, int widthPixel, std::vector<std::string>& picture) { 
    for (int i = 0; i < heightPixel; ++i) {
        picture.at(i) = "#" + picture.at(i) + "#";
    }
    
    std::string frame;
    for (int i = 0; i < widthPixel + 2; ++i) {
        frame += "#";
    }
        
    picture.insert(picture.begin(), frame);
    picture.push_back(frame);
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 40;
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
const ll MOD = 1e9 + 7;

ll solve(int n){
    ll res = 1;
    FOR(i,1,n+1){
        res *= i;
        res %= MOD;
    }
    return res;
}

int main(){
    int N;cin >> N;
    cout << solve(N) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int x = (a + b) / 2;
		System.out.println((x * 2 == a + b)? x : x + 1);
	}
}

Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class Pair
{
	public long A { get; private set; }
	public long B { get; private set; }

	public Pair(long a, long b)
	{
		A = a;
		B = b;
	}
}


public class C
{
	public static void Main()	
	{
		long N = GetLong();
		long K = GetLong();  // N <= 10^5, bi <= 10^5 thus K <= 10^10
		List<Pair> pairs = new List<Pair>();
		for(long i = 0; i < N; i++)
			pairs.Add(new Pair(GetLong(), GetLong()));
		pairs.Sort((x,y) => (int)(x.A - y.A));

		long num = 0;
		for(long i = 0; i < N; i++)
		{
			num += pairs[(int)i].B;
			if(num >= K)
			{
				Console.WriteLine(pairs[(int)i].A);
				return;
			}
		}
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 24128
#include <stdio.h>

int main(){
  char S[3];
  char T[3];
  int hit=0,k;
  scanf("%s",S);
  scanf("%s",T);
  for(k=0;k<3;k++)
    if(S[k]==T[k])
      hit++;
  printf("%d\n",hit);
  return 0;
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 1200000;
int t[N];
void update(int v, int tl, int tr, int p, int x){
    if (p < tl || p > tr) return;
    if (tl == tr){
        t[v] = x;
        return;
    }
    int mid = (tl + tr) / 2;
    update(v + v, tl, mid, p, x);
    update(v + v + 1, mid + 1, tr, p, x);
    t[v] = max(t[v + v], t[v + v + 1]);
}
int query(int v, int tl, int tr, int l, int r){
    if (l > tr || r < tl) return 0;
    if (l <= tl && tr <= r) return t[v];
    int mid = (tl + tr) / 2;
    return max(query(v + v, tl, mid, l, r), query(v + v + 1, mid + 1, tr, l, r));
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    vector <int> b(n);
    vector <pair<int,int> > a(n + 1);
    for (int i = 0; i < n; i++){
        cin >> a[i].F >> a[i].S;
    }
    a[n] = {2e9 + 10, 0};
    sort(a.begin(), a.end());
    for (int i = n - 1; i >= 0; i--){
        int l = i;
        int r = n;
        while(r - l > 1){
            int mid = (r + l) / 2;
            if (a[mid].F < a[i].S + a[i].F) l = mid; else r = mid;
        }
        b[i] = max(l, query(1, 0, n, i + 1, l));
        update(1, 0, n, i, b[i]);
    }
    vector <int> dp(n + 2);
    dp[n] = 1;
    for (int i = n - 1; i >= 0; i--){
        dp[i] = (dp[i + 1] + dp[b[i] + 1]) % mod;
    }
    cout << dp[0];
}


Measured memory_bytes: 12672
#include<bits/stdc++.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 perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int mod = MOD9;
const int max_n = 200005;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}comb(max_n);

mint dp[3010][3010];
int main(){
    ll a,b,c,d;cin >> a  >>  b >> c >> d;
    //ll dp[3010][3010];
    dp[a][b]=1;
    repl(i,a,3009){
        repl(j,b,3009){
            dp[i+1][j]+=dp[i][j]*j;
            dp[i][j+1]+=dp[i][j]*i;
            dp[i+1][j+1]-=dp[i][j]*(i*j);
        }
    }
    cout << dp[c][d] <<endl;
    /*repl(i,a,c+1){
        repl(j,b,d+1){
            cout << dp[i][j] <<" ";
        }
        cout << endl;
    }*/
}

Measured memory_bytes: 76960
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			BigDecimal a = BigDecimal.valueOf(sc.nextDouble());
			BigDecimal b = BigDecimal.valueOf(sc.nextDouble());

			a = a.multiply(b);
			a = a.setScale(0, BigDecimal.ROUND_DOWN);
			System.out.println(a);
		}
	}
}


Measured memory_bytes: 37692
# coding: utf-8
import sys


def main(argv=sys.argv):

    char_list = input()

    char_set = set(char_list)

    for char_ in char_set:

        if char_list.count(char_) % 2 != 0:

            print('No')

            return 0

    print('Yes')

    return 0


if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 3060
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
	ll c[3][3];
	rep(i,3)rep(j,3)cin>>c[i][j];
	bool isOK=true;
	rep(i,2){
		ll num1=c[0][i]-c[0][i+1];
		rep(j,3){
			if(num1!=c[j][i]-c[j][i+1])isOK=false;
		}
	}
	
	rep(i,2){
		ll num1=c[i][0]-c[i+1][0];
		rep(j,3){
			if(num1!=c[i][j]-c[i+1][j])isOK=false;
		}
	}
	
	if(isOK)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}


Measured memory_bytes: 256