akhauriyash/Code-Regression huggingface dataset:
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long W, H, x, y;
    scan(W, H, x, y);
    writefln("%.10f %s", (W * H) / 2.0, cast(long)(x * 2 == W && y * 2 == H));
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int A[200005];
ll D[200005];
bool arrived[200005];
int main() {
  ios::sync_with_stdio(false);
  int N;
  ll K;
  cin >> N >> K;
  for (int i=1; i<=N; i++) {
    cin >> A[i];
  }
  int idx = 1;
  arrived[idx] = true;
  D[idx] = 0;
  bool fin = false;
  for (ll i=0; i<K; i++) {
    int nx = A[idx];
    if (arrived[nx]) {
      if (fin) {
        D[nx] = D[idx] + 1;
      } else {
        ll cyc = D[idx] + 1 - D[nx];
        //cout << cyc << endl;
        ll n = (K-i-1) / cyc;
        i += n * cyc;
        fin = true;
      }
    } else {
      arrived[nx] = true;
      D[nx] = D[idx] + 1;
    }
    //cout << i << ' ' << idx << ' ' << D[idx] << endl;
    idx = nx;
  }
  cout << idx << endl;
}

Measured memory_bytes: 6180
r, g, b, n = map(int, input().split())

count = 0
for i in range(n//r + 1):
    for j in range(n//g + 1):
        if (n - (r*i + g*j)) % b == 0 and n - (r*i + g*j) >= 0:
            count += 1
print(count)

Measured memory_bytes: 67456
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){int c=0; string str; cin>>str;
        if(str[0]=='R'){
            if(str[1]=='R'){
                if(str[2]=='R')c=3;
                else c=2;
            } else c=1;
        }
        else{
            if(str[1]=='R'){
                if(str[2]=='R')c=2;
                else c=1;
            }
            else{
                if(str[2]=='R')c=1;
                else c=0;
            }
        }
     cout<<c;
 }


Measured memory_bytes: 3624
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <deque>
#include <limits>
#include <numeric>

#define INF 100000000
#define MOD 1000000007

#define ll long long


ll gcd(ll x, ll y);  // 最大公約数を求める関数
ll lcm(ll x, ll y);  // 最小公倍数を求める関数

using namespace std;

int main() {

	ll n, max;

	ll a[3005] = {};
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	
	
	ll ans = 0;

	for (int i = 0; i < n; i++)
	{
		
			ans += a[i] - 1;
	}
	
	cout << ans << endl;
}

ll gcd(ll x, ll y)
{
	ll r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		fprintf(stderr, "引数エラーです。\n");
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}


ll lcm(ll x, ll y)
{
	if (x == 0 || y == 0)  // 引数チェック
	{
		fprintf(stderr, "引数エラーです。\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

Measured memory_bytes: 256
from sys import stdin

N = int(input())
A = [int(x) for x in stdin.readline().rstrip().split()]

cnt = 0

for a in A :
    if a % 2 != 0 :
        break
    else:
        c = 0
        while a % 2 == 0 :
            c = c + 1
            a = a / 2
        
        if cnt == 0 or cnt > c :
            cnt = c
    

print(int(cnt))

Measured memory_bytes: 3060
//#include "pch.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)


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

    string s;
    cin >> s;
    
    string s0 = "2019/04/30";
    
    if(s <= s0){
        cout << "Heisei";
    }
    else {
        cout << "TBD";
    }
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void testcase(){
		Scanner s = new Scanner(System.in);
		int tmp;
		int cnt = 1;
		tmp = s.nextInt();
		while(tmp != 0){
			System.out.println("Case " + cnt + ": " + tmp);
			tmp = s.nextInt();
			cnt++;
		}
	}
	public static void main(String args[]){
		Main m = new Main();
		m.testcase();
	}
}

Measured memory_bytes: 42032
/*
   Created by Rahul Goel.
*/

#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c) (c).begin(), (c).end()
#define pii pair < ll, ll >
#define vi vector < ll >
#define vb vector < bool >
#define vvi vector < vector < ll > >
#define vvb vector < vector < bool > >
#define vpii vector < pair < ll, ll > >
#define vvpii vector < vector < pair < ll, ll > > >
#define present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#define min_pq(t) priority_queue < t, vector < t >, greater < t > >
#define max_pq(t) priority_queue < t >
#define pb push_back
#define ff first
#define ss second

ll mod_sum() { return 0ll; }
template<typename T, typename... Args>
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%mod + mod)%mod; }

ll mod_prod() { return 1LL; }
template<typename T, typename... Args>
T mod_product(T a, Args... args) { return (a*mod_product(args...))%mod; }

// --------------------------------------------------------------

ll pow5(ll x){
    return x*x*x*x*x;
}

ll solve(){
    ll x;
    cin >> x;
    for(ll i=-200; i<=200; i++)
        for(ll j=-200; j<=200; j++)
            if(pow5(i) - pow5(j) == x){
                cout << i << " " << j << endl;
                return 0;
            }
    return 0;
}

int main(){
    fastio;

    ll t = 1;
    while(t--)
        solve();

    return 0;
}



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

int main(){
  long long N, M;
  cin >> N >> M;
  long long ans=1;
  if(abs(N-M)>1) ans=0;
  else if(N==M){
    for(int i=1; i<N+1; i++){
      ans=ans*i%1000000007;
    }
    for(int i=1; i<M+1; i++){
      ans=ans*i%1000000007;
    }
    ans=ans*2%1000000007;
  }
  else{
    for(int i=1; i<N+1; i++){
      ans=ans*i%1000000007;
    }
    for(int i=1; i<M+1; i++){
      ans=ans*i%1000000007;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define rep(i,a,b) for(int i=(a),i##ed=(b);i<=i##ed;i++)
#define per(i,a,b) for(int i=(a),i##ed=(b);i>=i##ed;i--)
using namespace std;
const int N=300010;
int n,m,sum,pos,res;
int t[N];
struct P {
	int x,y;
	inline bool operator<(const P &yy)const { return y-x<yy.y-yy.x; }
};P a[N];

inline void add(int x,int w) { for(;x<=m;x+=x&-x) t[x]+=w; }
inline int ask(int x) { int s=0;for(;x;x-=x&-x) s+=t[x];return s; }
int main() {
	scanf("%d%d",&n,&m),sum=n,pos=1;
	rep(i,1,n) scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1);
	rep(i,1,m) {
		for(;a[pos].y-a[pos].x+1<i&&pos<=n;)
			add(a[pos].x,1),add(a[pos].y+1,-1),++pos,--sum;
		res=0; rep(j,1,m/i) res+=ask(j*i);
		printf("%d\n",res+sum);
	}
	return 0;
}

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

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	set<int> s;
	s.insert(a);
	s.insert(b);
	s.insert(c);
	cout << s.size() << endl;
	return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i){
        int t;
        cin >> t;
        a[i] = t;
    }
    sort(a.begin(), a.end());
    int ng = 0;
    int ok = a[n-1];
    while (abs(ok - ng) > 1){
        int mid = (ok + ng) / 2;
        long long cnt = 0;
        for (int i = 0; i < n; ++i){
            cnt += (a[i] - 1) / mid;
        }
        if(k >= cnt){
            ok = mid;
        } else {
            ng = mid;
        }
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4000
package main

import (
	"bufio"
	"fmt"
	//"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	s, _ := r.ReadString('\n')
	s = strings.TrimRight(s, " \t\n")
	slice := strings.Split(s, " ")
	a := string(slice[0])
	b := string(slice[1])
	A, _ := strconv.Atoi(a)
	B, _ := strconv.Atoi(b)

	fmt.Println((A - 1) * (B - 1))
}


Measured memory_bytes: 1772
N = int(input())
A = tuple(map(int, input().split(' ')))

nodes = [0] * (N + 1)
nodes[0] = 1 - A[0]

if N == 0 and A[0] > 1:
    print(-1)
else:
    for index, a in enumerate(A[1:], start=1):
        nodes[index] = nodes[index - 1] * 2 - a
        if nodes[index] < 0:
            print(-1)
            break
    else:
        fixed_nodes = [0] * (N + 1)
        fixed_nodes[-1] = A[-1]
        for i in reversed(range(N)):
            fixed_nodes[i] = min(nodes[i], fixed_nodes[i + 1]) + A[i]
        if any([n == 0 for n in fixed_nodes]):
            print(-1)
        else:
            print(sum(fixed_nodes))


Measured memory_bytes: 674988
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
# define MAXN 100000

int main(){
  int a[5];
  cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  int min = 10;
  for(int i(0);i<5;i++){
    if (min > a[i]%10 && a[i]%10 != 0){
      min = a[i]%10;
    }
  }
  int sum = 0;

  for(int i(0);i<5;i++){
    if (a[i]%10!=0){
      sum += a[i]+10-a[i]%10;
    }else{
      sum+=a[i];
    }
  }
  cout<<sum-(10-min);
  return 0;
}


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

void eratos( int n, bool prime[] ){
    for ( int i = 0; i <= n; i++ ) prime[i] = true;
    prime[0] = prime[1] = false;
    for ( int i = 2; i*i <= n; i++ ){
	if ( prime[i] )
	    for ( int j = 2; i*j <= n; j++ ) prime[i*j] = false;
    }
}

main(){
    bool prime[110000];
    eratos(110000, prime);
    int T[10001];
    int k = 1;
    for ( int i = 2;; i++ ){
	if ( !prime[i] ) continue;
	T[k++] = i;
	if ( k == 10001 ) break;
    }
    int n;
    while( cin >> n && n ){
	int sum = 0;
	for ( int i = 1; i <= n; i++ ) sum += T[i];
	cout << sum << endl;
    }
    
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	int a, b;
	cin >> a >> b;
	for(int i=1; i<=1009; ++i) {
		int a2=i*8/100, b2=i*10/100;
		if(a2==a&&b2==b) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
using ll = long long;

ll N, A, B;
ll h[101010];

// check if delete all in x times
bool C(ll x) {
    ll cnt = 0;
    for(int i=0; i < N; ++i) {
        ll check = h[i] - x * B;
        if(check > 0) cnt += (check + A-B - 1) / (A-B);
    }
    return cnt <= x;
}


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> A >> B;
    for(int i=0; i < N; ++i) cin >> h[i];

    ll l = 0, r = 1e9;
    for(int i=0; i < 30; ++i) {
        ll x = (l + r) / 2;
        if(C(x)) r = x;
        else l = x;
    }

    cout << r << '\n';
    return 0;
}

Measured memory_bytes: 1152
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    int score = 0;
    for ( char sign : line.toCharArray() ) {
      if ( sign == '+' ) {
        score++;
      } else if ( sign == '-' ) {
        score--;
      }
    }
    System.out.println(score);
  }
}

Measured memory_bytes: 23252
// https://atcoder.jp/contests/abc145/tasks/abc145_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<pair<int, int>> v;
    REP(i, N) {
        int a, b;
        cin >> a >> b;
        v.emplace_back(a, b);
    }
    double sum = 0;
    REP(i, N) FOR(j, i + 1, N) {
        sum += hypot(v[j].first - v[i].first, v[j].second - v[i].second);
    }
    cout << setprecision(12) << 2 * sum / N << endl;

    return 0;
}


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

using namespace std;

int main() {
    int N,K; cin >> N >> K;
    vector<int> V(N);
    for(int i=0;i<N;i++) cin >> V[i];

    long long ans = 0;
    for(int A=0;A<=K;A++) {
        for(int B=0;B<=K-A;B++) {
            if(A+B > N) continue;
            int d = K - A - B;
            long long count = 0;

            vector<int> vec;

            for(int i=0;i<A;i++) {
                count += V[i];
                vec.push_back(V[i]);
            }
            for(int i=N-B;i<N;i++) {
                count += V[i];
                vec.push_back(V[i]);
            }
            sort(vec.begin(), vec.end());
            for(int i=0;i<d;i++) {
                if(i >= vec.size()) break;
                if(vec[i] >= 0) break;

                count -= vec[i];
            }

            ans = max(ans, count);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <numeric>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstring>
#include <map>
#include <cmath>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mod = 1000000007;

#define bs(n) (1ll<<(ll)(n))
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)
#define rrep(i, n) for(ll (i) = 1;(i) <= (n);(i)++)

ll N, Z, W;
ll *a;

ll dp[2][2000][2];

ll rec2(ll, ll);

ll rec(ll a, ll b) {
    if (dp[a][b][0] == 0) {
        dp[a][b][0] = 1;
        dp[a][b][1] = rec2(a, b);
    }
    return dp[a][b][1];
}

ll rec2(ll turnX, ll nRemoved) {
    ll nRemain = N - nRemoved;
    ll aOpponent = 0;
    if (nRemoved > 0) aOpponent = a[nRemoved - 1];
    else {
        if (turnX == 1) aOpponent = W;
        else aOpponent = Z;
    }
    if (turnX == 1) {
        ll maxScore = abs(aOpponent - a[N - 1]);
        for (ll i = 1; i < nRemain; i++) {
            maxScore = max(maxScore, rec(0, nRemoved + i));
        }
        return maxScore;
    } else {
        ll minScore = abs(aOpponent - a[N - 1]);
        for (ll i = 1; i < nRemain; i++) {
            minScore = min(minScore, rec(1, nRemoved + i));
        }
        return minScore;
    }
}

int main() {
    cin >> N >> Z >> W;
    a = new ll[N];
    for (ll i = 0; i < N; i++)cin >> a[i];
    cout << rec(1, 0) << endl;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define BiSearchRangeNum(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y)

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


int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, 0, N) {
    cin >> A[i];
  }

  vector<int> counter(N + 1, 0);
  int M = 0;
  vector<int> ans;

  bool flag = true;

  for (int i = N; i > 0; i--) {
    int ai = A[i - 1];
    int tmp = counter[i];
    if (ai == 1) {
      if (tmp % 2 == 0) {
        ans.pb(i);
        M++;
        for (int j = 1; j * j <= i; j++) {
          if (i % j == 0) {
            counter[j]++;
            if (j * j != i) counter[i / j]++;
          }
        }
      } else if (tmp % 2 == 1) {
        continue;
      }
    } else if (ai == 0) {
      if (tmp % 2 == 0) {
        continue;
      } else if (tmp % 2 == 1) {
        ans.pb(i);
        M++;
        for (int j = 1; j * j <= i; j++) {
          if (i % j == 0) {
            counter[j]++;
            if (j * j != i) counter[i / j]++;
          }
        }
      }
    }
  }

  cout << M << endl;
  if (M > 0) {
    rep(i, 0, ans.size()) {
      cout << ans[i] << endl;
    }
  }

};


Measured memory_bytes: 3064
/**
 *    author:  lets
 *    created: 2020-06-07 13:32:48 JST
 **/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = (int)s.size();
  vector<int> a(n + 1, 0);
  for (int i = 0; i < n; i++) {
    if (s[i] == '<') a[i + 1] = a[i] + 1;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '>') {
      a[i] = max(a[i], a[i + 1] + 1);
    }
  }
  cout << accumulate(a.begin(), a.end(), 0LL) << '\n';
  return 0;
}

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

int main() {
	int N;
	static int A[200010], X[200010] = {};
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = N; i >= 1; i--) {
		int COUNT = 0;
		for (int j = 2; i * j <= N; j++) {
			COUNT += X[i * j];
		}
		if (COUNT % 2 == A[i]) X[i] = 0;
		else X[i] = 1;
	}
	int SUM = 0;
	for (int i = 1; i <= N; i++) SUM += X[i];
	cout << SUM << endl;
	for (int i = 1; i <= N; i++) {
		if (X[i] == 1) {
			cout << i;
			SUM--;
			if (SUM != 0) cout << " ";
			else cout << endl;
		}
	}
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
int main(){

    ll N,ans=0,same=0;
    cin >> N;
    vector<ll> h(N);
    vector<ll> datasum(N);
    vector<ll> datadif(N);
    ll max=0;
    rep(i,N){
        cin >> h.at(i);
        datasum.at(i)=(i+1)+h.at(i);
        datadif.at(i)=(i+1)-h.at(i);
        if(max<datasum.at(i)) max=datasum.at(i);
        if(max<datadif.at(i)) max=datadif.at(i);
        if(datasum.at(i)==datadif.at(i)) same++;
    }
    
    map<ll, ll> number;
    
    rep(i,N){
       if (number.count(datasum.at(i))){
            number[datasum.at(i)]=number.at(datasum.at(i))+1;
       }
       else {
           number[datasum.at(i)]=1;

       }
    }

   rep(i,N){
       if(datadif.at(i)<0) continue;
       else if(number.count(datadif.at(i))){
            ans+=number.at(datadif.at(i));
        }
    }
  

   cout << ans-same << endl;

}

Measured memory_bytes: 20348
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  for(int i=0;i<N;i++){
    int j;
    cin >> j;
    if( j%2==0 && !(j%3==0||j%5==0) ){
    cout << "DENIED" << endl;
    return 0;
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i, n) for(int i=0;i<n;++i)
#define REPR(i, n) for(int i = n-1;i>=0;--i)
#define REPI(itr, v) for(auto itr=v.begin();itr!=v.end();++itr)
#define SORT(v, n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define llong long long
#define INF 999999999
#define pb(a) push_back(a)

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

using namespace std;

int main(){

  int n;
  llong k;
  vector<pair<int, int>> v;

  scanf("%d %lld", &n, &k);
  REP(i, n){
    int t1, t2;
    scanf("%d %d", &t1, &t2);
    v.pb(make_pair(t1, t2));
  }

  SORTV(v);

  llong res = 0;
  REPI(itr, v){
    res += itr->second;
    if(res >= k){
      printf("%d\n", itr->first);
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 1400
"use strict";

function main(input){
  const args = input.trim().split('\n').map(_=>parseInt(_,10));
  const coins = args.slice(0, 3);
  const x = args[3];
  
  let cnt = 0;
  for(let i=0; i<=coins[0]; i++){
    for(let k=0; k<=coins[1]; k++){
      const y = x - 500*i - 100*k;
      if(y < 0) break;
      if(y / 50 <= coins[2]){
         cnt++;
      }
    }
  }
  
  console.log(cnt);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7372
function Main(input) {
    const nums = input.split(/\s/).map(str => { return parseInt(str) });
    const max = Math.min(nums[1], nums[2]);
    const min = Math.max(nums[1] + nums[2] - nums[0], 0);
    console.log(max + ' ' + min);
};
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

void solve()
{
    ll n,ans=0;
    cin>>n;
    vi a(n);
    fo(i,0,n) cin>>a[i];
    sort(all(a));
    fo(i,0,n-2)
    {
        fo(j,i+1,n-1)
        {
            fo(k,j+1,n)
            {
                if(a[k]<a[i]+a[j] && a[i]!=a[j] && a[j]!=a[k])
                {
                    ans++;
                }
            }
        }
    }
    cout<<ans;
    cout<<"\n";
    return;
}
int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t;
    //cin>>t;
    //while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3624
import fractions
import math
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0

lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // fractions.gcd(lcm, a[i])
    #lcm = lcm * a[i] // math.gcd(lcm, a[i])
lcm %= MOD
for i in range(n):
    ans += lcm * pow(a[i] , MOD-2, MOD)
    ans %= MOD
print(ans)


Measured memory_bytes: 67416
s=int(input())

s1=s//100
s2=s%100

ok1=ok2=False
if s1>0 and s1<13:
	ok1=True

if s2>0 and s2<13:
	ok2=True

if ok1 and ok2:
	print("AMBIGUOUS")
elif ok1:
	print("MMYY")
elif ok2:
	print("YYMM")
else:
	print("NA")

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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  for(int i = 0; i < N; i++){
    cin >> L[i];
  }
  int count = 0;
  for(int i = 0; i < N-2; i++){
    for(int j = i; j < N-1; j++){
      for(int k = j; k < N; k++){
        if(L[i] != L[j] && L[i] != L[k] && L[j] != L[k]){
          if(L[i]+L[k] > L[j] && L[i]+L[j] > L[k] && L[j]+L[k] > L[i]){
            count += 1;
          }
        }
      }
    }
  }
  cout << count << endl;

}

Measured memory_bytes: 3648
object Main extends App {
	val x = scala.io.StdIn.readLine
	
	val r = x.split(" ")(0).toInt
	val g = x.split(" ")(1).toInt
	val b = x.split(" ")(2).toInt

	val sum = 100*r + 10*g + b

	if(sum%4 == 0){
		println("YES")
	}else{
		println("NO")
	}
}

Measured memory_bytes: 25284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC081_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfAmount = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] str = input.Split(' ');
            int[] num = new int[numberOfAmount];
            int[] divisionNum = new int[numberOfAmount];
            int minDivisionNum = 0;

            for (int i = 0; i < numberOfAmount; i++)
            {
                num[i] = int.Parse(str[i]);
                divisionNum[i] = 0;

                while (num[i] % 2 == 0)
                {
                    divisionNum[i]++;
                    num[i] /= 2;
                }

                if (i == 0)
                {
                    minDivisionNum = divisionNum[i];
                }

                minDivisionNum = Math.Min(minDivisionNum, divisionNum[i]);
            }

            Console.WriteLine(minDivisionNum);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;

int main(){
  double r;

  cin >> r;
  cout << fixed << setprecision(6) << r*r*M_PI << " " << 2*r*M_PI<< endl;

  return(0);
}

Measured memory_bytes: 1288
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner dataScanner = new Scanner(System.in);
        int numLayers = Integer.parseInt(dataScanner.nextLine());
        HashSet<Integer> diameter = new HashSet<Integer>();
        for (int i = 0; i < numLayers; i++) {
            diameter.add(Integer.parseInt(dataScanner.nextLine()));
        }
        System.out.println(diameter.size());
    }
}


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

int main() {
    int n;
    cin >> n;

    double d = 0.5;
    if (n % 2 != 0) {
        d = (double)((n / 2) + 1) / n;
    }
    cout << fixed << setprecision(10) << d << endl;
}


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

int main()
{
	long long int x;
	cin >> x;
	
	long long ans = 0;
	
	long long tmp1 = 0;
	tmp1 = x/500;
	x -= tmp1 * 500;
	
	long long tmp5 = 0;
	tmp5 = x/5;
	x -= tmp5 * 5;
	
	ans += tmp1 * 1000 + tmp5 * 5;
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int main(){
  	int h,w; cin>>h>>w;
	vvi m(h+2,vi(w+2,0));
	rep(i,h)rep(j,w){
		char c; cin>>c;
		if(c=='#') m[i+1][j+1]=1;
	}
	rep(i,h)rep(j,w){
		if(m[i+1][j+1]==1){
			if(m[i][j+1]+m[i+2][j+1]+m[i+1][j]+m[i+1][j+2]==0){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	
	
	return 0;
}


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

using namespace std;

typedef long long LL;
typedef pair<int,int> pi;
typedef vector<int> vi;
#define ST first
#define ND second
#define PB push_back
#define DET(a,b,c) (LL(b.x-a.x)*LL((c.y-a.y))-LL((c.x-a.x))*LL((b.y-a.y)))

const int MAXN = 101;
const int MAXK = 100*1000+1;
const int MOD = 1000*1000*1000+7;
int n,k;
int a[MAXN];
int dp[MAXK][MAXN];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>k;
    for(int i=1; i<=n;i++) {
        cin>>a[i];
        dp[0][i] = 1;
    }
    int sum=0;
    for(int j=1; j<=n;j++) {
        int s=1;
        sum=min(sum+a[j],k);
        for(int i=1; i<=min(k,sum);i++) {
            s=(s+dp[i][j-1])%MOD;
            if(i>a[j]) {
                s=(s-dp[i-a[j]-1][j-1]+MOD)%MOD;
            }
            dp[i][j] = s;
            //cout<<i<<" "<<j<<" : "<<s<<"\n";
        }
    }
    cout<<dp[k][n];
}


Measured memory_bytes: 39680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Main().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    void solve() throws IOException {
        int n = readInt();
        long w = readLong();
        long[] wi = new long[n];
        int[] vi = new int[n];
        long res = 0;
        int sum = 0;
        for(int i=0;i<n;i++) {
            wi[i] = readLong();
            vi[i] = readInt();
            sum+=vi[i];
        }
        long[] dp = new long[sum+1];
        Arrays.fill(dp,Long.MAX_VALUE-1000000000-100);
        dp[0]=0;
        for(int i=0;i<n;i++){
            long tw = wi[i];
            int tv = vi[i];
            for(int j=sum-tv;j>=0;j--){
                if(dp[j]+tw>w)
                    continue;
                if(dp[j+tv]>dp[j]+tw){
                    dp[j+tv] = dp[j]+tw;
                    if(res<j+tv)
                        res=j+tv;
                }
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007 
#define INF2 1000000000000000000

int main(void)
{
    int N;
    string str1;
    string str2;
    cin >> N;
    cin >> str1;
    cin >> str2;
    int A[100];
    int count = 0;
    ll ans;
    for (int i = 0; i < N; i++){
        if (str1[i] == str2[i]){
            A[count] = 1;
            count++;
        } else {
            A[count] = 2;
            count++;
            i++;
        }
    }
    if(A[0] == 1) ans = 3;
    if(A[0] == 2) ans = 6;
    for(int i = 1; i < count; i++){
        if(A[i-1] == 1 && A[i] == 1) ans *= 2;
        if(A[i-1] == 1 && A[i] == 2) ans *= 2;
        if(A[i-1] == 2 && A[i] == 1) ans *= 1;
        if(A[i-1] == 2 && A[i] == 2) ans *= 3;
        ans = ans % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

#define INF 1e9
#define LLINF 1e18
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int gcd(int a, int b) {
    if(a % b == 0) {
        return b;
    }
    else {
        return(gcd(b, a % b));
    }
}


int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    if (a > b) cout << "Alice" << endl;
    else if (b > a) cout << "Bob" << endl;
    else cout << "Draw" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  if (n==1){
    cout << "Hello World" << endl;
  }
  else {
    int A,B;
    cin >> A >> B;
    cout << A + B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBUG = true;

int main(){

    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }
    else{
        cout << "ABC" << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
/*
    Vora Mahammadasim
*/

#include<bits/stdc++.h>
#include<stdio.h>
#define int long long
#define pb emplace_back
#define Mod 1000000007
#define all(a) a.begin(),a.end()
#define ps(a) partial_sum(all(a),a.begin())
using namespace std;

const int N = 2e5 + 5;
int n,a[N]={0};

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i =1 ;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                a[i*i + j*j + k*k + i*j + j*k + k*i]++;
            }
        }
    }
    for(int i=1;i<=n;i++) cout<<a[i]<<'\n';
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll k;
  cin >> k;
  deque<ll> que;
  vl cost(k,2*k);
  que.push_back(1ll);
  cost[1] = 1ll;
  while(!que.empty()){
    ll node = que[0];
    //cout << node << endl;
    que.pop_front();

    ll nx = (node * 10ll)%k;
    if(cost[node]<cost[nx]){
      cost[nx] = cost[node];
      //cout << "front:" << nx << "," << cost[nx] << endl; 
      que.push_front(nx);
    }
    nx = (node + 1ll)%k;
    if(cost[node]+1ll<cost[nx]){
      cost[nx] = cost[node]+1ll;
      //cout << "back :" << nx << "," << cost[nx] << endl; 
      que.push_back(nx);
    }
  }
  cout << cost[0] << endl;
  return 0;
}


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<long> prime, sieve(31622, 1);
    for(long i = 2; i < 31622; ++i)
        if(sieve[i]){
            prime.push_back(i);
            for(auto j = i * i; j < 31622; j += i)sieve[j] = 0;
        }

    vector<long> a(N);
    long C;
    for(auto& i : a)cin >> i;
    cin >> C;
    long u{C};
    for(const auto i : a)u = __gcd(u, abs(i));

    vector<long> ans;
    for(const auto p : prime)
        if(u % p == 0){
            ans.push_back(p);
            while(u % p == 0)u /= p;
        }else if(p <= N && C % p == 0){
            vector<long> v(p);
            for(unsigned long j = 0, k = 0; j < N; ++j){
                v[k] += a[j];
                if(++k == p - 1)k = 0;
            }
            if(none_of(v.begin(), v.end(), [&p](auto x){return x % p;}))ans.push_back(p);
        }
    for(const auto i : ans)cout << i << endl;
    if(u != 1)cout << u << endl;
}

Measured memory_bytes: 768
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define sortt(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/******* Variable ***********************************/
const int maxn = 1e6 * 50;
const double inf = 0x3f3f3f3f3f;
/******* Function ***********************************/
void out(const vector<int> A) {
  rep(i, 0, A.size()) { cout << A[i] << ((i != A.size() - 1) ? " " : "\n"); }
}

/******* Main ****************************************/
int main() {
  int a, b;
  while (cin >> a >> b) {
    if (a == 0 && b == 0) break;
    if (a <= b) {
      cout << a << " " << b << endl;
    } else {
      cout << b << " " << a << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }


void solve(long long N, std::vector<long long> d){
	ASC(d);
	ll res = d[N/2] - d[N/2-1];
	cout << res << "\n";
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> d(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&d[i]);
    }
    solve(N, std::move(d));
    return 0;
}


Measured memory_bytes: 1152
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoderBeginnerContest148
{
    class D_BrickBreak
    {
        static void Main(string[] args)
        {
            var lengh = int.Parse(Console.ReadLine());
            var items = Console.ReadLine().Split().Select(x => int.Parse(x));
            var originLength = items.Count();

            var i = 1;
            var result = new List<int>();
            foreach (var item in items)
            {
                if (item == i)
                {
                    result.Add(item);
                    i++;
                }
            }
            var afterLength = result.Count();
            if (afterLength == 0)
            {
                Console.WriteLine("-1");
            }
            else
            {
                Console.WriteLine(originLength - afterLength);
            }
        }
    }
}


Measured memory_bytes: 35676
#include<stdio.h>
#include<stdlib.h>
#define INF (1e9+1)
 
typedef struct state{
  int pos,cost;
} state;
 
state A[2000001];
int N=0;
  
int parent(int i){return i/2;}
int left(int i){return i*2;}
int right(int i){return i*2+1;}
  
void exchange(state* a,state* b){
  state tmp=*a;
  *a=*b;
  *b=tmp;
}
  
void minHeapify(int i){
  int l=left(i);
  int r=right(i);
  int small;
   
  if( l<=N && A[l].cost<A[i].cost )small=l;
  else small=i;
   
  if( r<=N && A[r].cost<A[small].cost)small=r;
   
  if(small!=i){
    exchange(&A[i],&A[small]);
    minHeapify(small);
  }
   
}
  
state heapExtractMin(){
  if(N<1)return (state){0,0};
  state min=A[1];
  A[1]=A[N];
  N--;
  minHeapify(1);
  return min;
}
 
  
void heapIncreaseKey(int i,state key){
  if(key.cost>A[i].cost)return;
  
  A[i]=key;
  while(i>1&&A[parent(i)].cost>A[i].cost){
    exchange(&A[i],&A[parent(i)]);
    i=parent(i);
  }
}
  
void minHeapInsert(state key){
  N++;
  A[N]=(state){INF,INF};
  heapIncreaseKey(N,key);
}
 
 
typedef struct edge{
  int to,cost;
} edge;
 
edge* G[10000];
int size[10000];
int n;
int d[10000];
edge e;
state s;
int main(){
  int i,j,a,b;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&a,&b);
    G[a] = malloc( sizeof( edge ) *b );
    size[a]=b;
    for(j=0;j<b;j++){
      scanf("%d %d",&G[a][j].to,&G[a][j].cost);
    }
    d[i]=INF;
  }
  d[0]=0;
  minHeapInsert( (state){0,0} );
  while(N!=0){
    s = heapExtractMin();
    if(s.cost>d[s.pos])continue;
    for(i=0;i<size[s.pos];i++){
      e=G[s.pos][i];
      if(d[e.to]<=d[s.pos]+e.cost)continue;
      d[e.to]=d[s.pos]+e.cost;
      minHeapInsert((state){e.to,d[e.to]});
    }
  }
  for(i=0;i<n;i++)
    printf("%d %d\n",i,d[i]);
   
  return 0;
}

Measured memory_bytes: 4576
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    int n,x,cnt;
    int i,j,k;
    
    scanf("%d",&n); scanf("%d",&x);
    
    while(n!=0||x!=0){
        cnt=0;
         for(i=1;i<=n;i++){
            for(j=i+1;j<=n;j++){
                for(k=j+1;k<=n;k++){
                    if(i+j+k==x) cnt++;
                }
            }
        }
        scanf("%d",&n); scanf("%d",&x);
        printf("%d\n",cnt);
    }
    return 0;
}


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

using I = long long;
using U = unsigned long long;

using F = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;
template <typename T> using PQueue = priority_queue<T>;
template <typename T> using Uq = unique_ptr<T>;

using StrView = string_view;

auto solve(I const A, string& B) -> void {
  B.erase(1, 1);
  I BI = atoi(B.c_str());
  I r100 = A * BI;
  I r = r100 / 100LL;
  cout << r << "\n";
}

auto main() -> int {
  I A;
  scanf("%lld", &A);
  string B;
  cin >> B;
  solve(A, B);
  return 0;
}


Measured memory_bytes: 3696
def calc(X):
    if X % 4 == 0:
        return X
    elif X % 4 == 2:
        return X ^ 1
    elif X % 4 == 1:
        return 1
    else:
        return 0
def main():
    A, B = map(int, input().split())
    print(calc(A-1) ^ calc(B))
main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define edl "\n"
#define str string
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, N = 1e5 + 10;
const ll LINF = LLONG_MAX;
int main() {
    fast();
    
    ll n,a;
    cin >> n >> a;
    cout<<n*n-a;   

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
string A, B;
inline string get(int a)
{
	cout << a << endl;
	fflush(stdout);
	string s;
	cin >> s;
	if(s == "Vacant")exit(0);
	return s;
}
int main()
{
	cin >> n;
	A = get(0);
	B = get(n-1);
	int low = 1, high = n - 2;
	while (low <= high){
		int mid = low + high >> 1;
		string now = get(mid);
		if (now == A){
			if (mid % 2 ==0)low = mid + 1;
			else high = mid - 1;
		}
		else if (now == B){
			if(mid % 2 == 1)low = mid + 1;
			else high = mid - 1;
		}
	} 
	return 0;
}

Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  int ans=0;
  int i=1;
  while(2*i<n){
    bool p=true;
    rep(j,0,i){
      if(s[j]!=s[i+j]) p=false;
    }
    if(p) ans=i;
    i++;
  }
  cout<<2*ans<<endl;
}

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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

char buf[20];
vector<string> v;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; gi(n);
	rep(i, n) {
		gstr(buf);
		v.pb(string(buf));
	}
	sort(all(v));
	int ans = 1;
	rep1(i, n-1) if(v[i] != v[i-1]) ans++;
	print(ans);
}


Measured memory_bytes: 13628
#include <iostream>
#include <string>
//#include <cstring>
//#include <sstream>
#include <fstream>
#include <vector>
#include <algorithm>
//#include <stack>
//#include <queue>
//#include <chrono>
//#include <numeric>
//#include <set>
//#define _USE_MATH_DEFINES
//#include <cmath>
//#include <math.h>
//#include <iomanip>
//#include <list>
//#include <limits>

using namespace std;
const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);

int knapsackProblem(int n, int w, vector<pair<int,int>> &vvw)
{
	vector<vector<int>> vvc;
	vvc = vector<vector<int>>(vvw.size(), vector<int>(w + 1, 0));

	for (int i = 0; i <= w; ++i)
		vvc[0][i] = 0;

	for (int i = 0; i <= n; ++i)
		vvc[i][0] = 0;

	for(int i = 1; i <=n; ++i)
	{
		for (int j = 1; j <= w; ++j)
		{
			//int vm = 0;
			//for (int k = 1; k <= i; ++k)
			//{
			//	if (j - vvw[k].second >= 0)
			//		vm = max(vm, vvw[k].first + vvc[i][j-vvw[k].second]);
			//}
			if (vvw[i].second <= j)
			{
				if (vvw[i].first + vvc[i][j - vvw[i].second] > vvc[i - 1][j])
					vvc[i][j] = vvw[i].first + vvc[i][j - vvw[i].second];
				else
					vvc[i][j] = vvc[i - 1][j];
			}
			else
				vvc[i][j] = vvc[i - 1][j];
		}
	}

	//for(int i = 0; i <= n; ++i)
	//{
	//	for(int j = 0; j <= w; ++j)
	//	{
	//		cout << vvc[i][j] << " ";
	//	}
	//	cout << endl;
	//}

	return vvc[n][w];
}

int main()
{
	//ifstream fin("DPL_1_C-in40.txt");
	////ifstream fin("test.txt");
	//if (!fin.is_open())
	//{
	//	cout << "File not found." << endl;
	//	return 0;
	//}

	//fin.tie(0);
	//ios::sync_with_stdio(false);

	//int n,w;
	//fin >> n >> w;
	//fin.ignore();

	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, w;
	cin >> n >> w;
	cin.ignore();

	int a, b;
	vector<pair<int, int>> vvw;

	vvw.push_back(pair<int,int>(0,0));

	for (int i = 0; i < n; ++i)
	{
		cin >> a >> b;
		//fin >> a >> b;
		vvw.push_back(pair<int,int>(a,b));
	}

	cout << knapsackProblem(n,w,vvw) << endl;

	return 0;
}

Measured memory_bytes: 6812
#include<stdio.h>

    long long int gcd(long long int a,long long int b){
	
    if(b==0)
    return a;
    else
    return gcd(b,a%b);}
int main()
{
	long long int a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF){
		
		printf("%lld %lld\n",gcd(a,b),a/gcd(a,b)*b);
		
	}
	
	return 0;
}
    

Measured memory_bytes: 596