akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
 string s;
 cin>>s;
 for(int i = 0; i < s.length(); i++){
   if(s[i]==',') s[i]=' ';
 }
 cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 256
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
input = sys.stdin.readline

setrecursionlimit(1000000)

dp = defaultdict(lambda x:-1)

def main():
	n = int(input())
	i = int(math.sqrt(n)) + 1
	while True:
		if(n % i == 0):
			print(n//i + i - 2)
			return
		i -= 1

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()


Measured memory_bytes: 63340
class UnionFind:
    def __init__(self, n):
        self.nodes = n
        self.parents = [i for i in range(n)]
        self.sizes = [1] * n
        self.rank = [0] * n

    def find(self, i): # どの集合に属しているか（根ノードの番号）
        if self.parents[i] == i:
            return i
        else:
            self.parents[i] = self.find(self.parents[i]) # 経路圧縮
            return self.parents[i]

    def unite(self, i, j): # 二つの集合を併合
        pi = self.find(i)
        pj = self.find(j)
        if pi != pj:
            if self.rank[pi] < self.rank[pj]:
                self.sizes[pj] += self.sizes[pi]
                self.parents[pi] = pj
            else:
                self.sizes[pi] += self.sizes[pj]
                self.parents[pj] = pi
                if self.rank[pi] == self.rank[pj]:
                    self.rank[pi] += 1
    def same(self, i, j): # 同じ集合に属するかを判定
        return self.find(i)==self.find(j)

    def get_parents(self): # 根ノードの一覧を取得
        for n in range(self.nodes): # findで経路圧縮する
            self.find(n)
        return self.parents

    def size(self, i):
        p = self.find(i)
        return self.sizes[p]


N, M = map(int, input().split())
AB = []
B = []
for m in range(M):
    a, b = map(int, input().split())
    AB.append((a-1,b-1))

ans = []
score = N * (N-1) // 2
uf = UnionFind(N)
for a, b in AB[::-1]:
    ans.append(score)
    if not uf.same(a,b):
        score -= uf.size(a) * uf.size(b)
        uf.unite(a,b)    

for score in ans[::-1]:
    print(score)
    




Measured memory_bytes: 24876
using System;

namespace CS_Competit
{
  class Program
  {
    static void Main(string[] args)
    {
      string s = Console.ReadLine();
      string t = Console.ReadLine();

      int count = 0;
      for (var i = 0; i < s.Length; i++)
      {
        if (s[i] != t[i])
        {
          count++;
        }
      }
      Console.WriteLine(count);
    }
  }
}


Measured memory_bytes: 27412
n= int(input())
if n <= 1:
  print(1)
  exit()
fib_ = [0]*(n+1)
fib_[0] = 1
fib_[1] = 1

def fib(n):
  if fib_[n] >= 1:
    return fib_[n]
  else:
    fib_[n] = fib(n-1)+fib(n-2)
    return fib(n-1)+fib(n-2)
print(fib(n))


Measured memory_bytes: 5600
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

//差の絶対値が同じ人は二人(0を除く)
//Nが奇数の時:差は0~N-1,0の人は真ん中のみ
//Nが偶数の時:差は1~N-1
//iさんは2通り

int main(void){
    ll MOD = pow(10, 9) + 7;
    int N;
    cin >> N;
    int d[N];
    ll ans = 1;
    FOR(i, 0, N) d[i] = 0;
    FOR(i, 0, N){
        int n;
        cin>>n;
        if(n<0 || n>N-1){
            cout << 0 << endl;
            return 0;
        }
        d[n]++;
    }
    if(N%2==0){
        for(int i=1; i<N; i+=2){
            if(d[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    if(N%2==1){
        if(d[0]!=1){
            cout<<0<<endl;
            return 0;
        }
        for(int i=2; i<N; i+=2){
            if(d[i]!=2){
                cout<<0<<endl;
                return 0;
            }
        }
    }
    FOR(i, 0, N/2){
        ans *= 2;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x,i) ((x)|(1ll<<(i)))
#define FLIP(x,i) ((x)^(1ll<<(i)))
#define CLEAR(x,i) ((x)&~(1ll<<(i)))

const double pi = 4 * atan(1);
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAXN = 200005;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int k;
	cin >> k;
	
	vector<bool> seen(k,false);
	
	int m = 0;
	int c = 0;
	
	while(true) {
		m = (m*10+7)%k;
		c++;
		if (m == 0) {
			break;
		}
		if (seen[m]) {
			break;
		}
		seen[m]=true;
	}
	
	if (m == 0) {
		cout << c << "\n";
	} else {
		cout << "-1\n";
	}

}


Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>
#define N 100000
  
int Partition(int [], int, int);
 
int main(void){
  int n,i,A[N],q;
 
  scanf("%d",&n);
  for(i = 1; i < n+1; i++){
    scanf("%d",&A[i]);
  }
 
  q = 1+Partition(A,1,n);
 
  for(i = 1; i < n; i++){
    if(i == q){
      printf("[%d] ",A[i]);
    }else{
      printf("%d ",A[i]);
    }
  }
   
  printf("%d\n",A[i]);
 
  return 0;
}
 
int Partition(int A[], int b, int c){
  int x,i,k,tmp;
 
  i=b-1;


  x = A[c];
  
 
  for(k = b; k <= c-1; k++){
    if(A[k] <=  x){
      i =  i + 1;
      tmp = A[i];
      A[i] = A[k];
      A[k] = tmp;
    }
  }
  tmp = A[i+1];
  A[i+1] = A[c];
  A[c] = tmp;
 
  return i; 
}

Measured memory_bytes: 992
#include<stdio.h>
#define M 200000
char p[M]={1,1};
long long c[10001]={0};
int main(){
  int n,i,j,r=0,co;
  for(i=2;i*i<M;i++){
    if(p[i])continue;
    for(j=i*i;j<M;j+=i)p[j]=1;
  }
  /*for(i=co=0;i<M;i++){
    if(1-p[i])co++;
    }
    printf("c%d\n",co);//*/
  for(r=i=1;r<10001;i++){
    if(p[i]==0){
      c[r]=c[r-1]+i;
      r++;
    }
  }
  while(scanf("%d",&n),n)printf("%lld\n",c[n]);
  return 0;
}

Measured memory_bytes: 872
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scanf("%d%d%d", &a, &b, &c)
	if a+b < c {
		fmt.Printf("%d\n", a+2*b+1)
	} else {
		fmt.Printf("%d\n", b+c)
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout<<"\n"
#define pb push_back
#define se second
#define fi first
#define int long long 
#define pi pair<int,int>
#define vpi vector<pi>
#define vvi vector<vpi>
#define pie =3.14159265358979323846264338327950;
const int mod= 1e9+7;

int32_t main(){
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
	int n,w;
	cin>>n>>w;
	vpi vec(n);
	int mx=0;
	for(int i=0;i<n;i++){
		cin>>vec[i].fi>>vec[i].se;
		mx+=vec[i].se;
	}
	vector<int> dp(mx+1,INT_MAX);
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=mx;j>=vec[i].se;j--){
			if(dp[j-vec[i].se]!=INT_MAX){
				dp[j]=min(dp[j],dp[j-vec[i].se]+vec[i].fi);
			}
		}
	}
	for(int i=mx; i>=0;i--){
		if(dp[i]<=w){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}


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

void pxy(ll x, ll y, char e){cout<<x<<" "<<y<<e;}

int main(){
	ll S; cin>>S;
	ll e = sqrtl(S);
	if(e*e==S){
		pxy(0,0,' ');
		pxy(e,0,' ');
		pxy(0,e,'\n');
	}
	else{
		e++;
		pxy(0,0,' ');
		pxy(e,e*e-S,' ');
		pxy(1,e,'\n');
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 998244353;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

struct mint{
    using i64=int_fast64_t;
    i64 a;
    static constexpr i64 mod= 1e9 + 7;
    mint(const i64 a_=0): a(a_){}
    mint inv(){
        i64 t=1, n= mod - 2, x=a;
        while(n){
            if(n&1) (t*=x)%=mod;
            (x*=x)%=mod;
            n>>=1;
        }
        mint ret(t);
        return ret;
    }
    bool operator==(const mint &x){return a==x.a;}
    bool operator!=(const mint &x){return a!=x.a;}
    mint &operator=(const mint &x){
        a=x.a;
        return *this;
    }
    mint operator+(const mint &x){
        mint ret;
        ret.a=a+x.a;
        if(ret.a>mod) ret.a-=mod;
        return ret;
    }
    mint operator-(const mint &x){
        mint ret;
        ret.a=a-x.a;
        if(ret.a<0) ret.a+=mod;
        return ret;
    }
    mint operator*(const mint &x){
        mint ret;
        ret.a=a*x.a%mod;
        return ret;
    }
    mint operator/(mint &x){
        mint ret;
        ret.a=a*x.inv().a%mod;
        return ret;
    }
    mint &operator+=(const mint &x){
        a+=x.a;
        if(a>=mod) a-=mod;
        return *this;
    }
    mint &operator-=(const mint &x){
        a-=x.a;
        if(a<0) a+=mod;
        return *this;
    }
    mint &operator*=(const mint &x){
        (a*=x.a)%=mod;
        return *this;
    }
    mint &operator/=(mint &x){
        (a*=x.inv().a)%=mod;
        return *this;
    }
};

vector<mint> fact;
vector<mint> revfact;

void setfact(int n){
    fact.resize(n+1); revfact.resize(n+1);
    fact[0] = 1;
    rep(i, n) fact[i+1] = fact[i] * mint(i+1);

    revfact[n] = fact[n].inv();
    for(int i=n-1; i>=0; i--) revfact[i] = revfact[i+1] * mint(i+1);
}

mint getC(int n, int r){
    if(n<r) return 0;
    return fact[n] * revfact[r] * revfact[n-r];
}

int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    setfact(2019);
    For(i, 1, k+1){
        if(i == 1) printf("%d\n", n-k+1);
        else if(i > n-k+1) printf("0\n");
        else{
            mint ans = 0;
            rep(l, n-k+1) ans = (ans + mint(l+1) * getC(n-k-l-1, i-2));
            printf("%lld\n", (ans * getC(k-1, i-1)).a);
        }
    }
}

Measured memory_bytes: 256
<?php
list($a, $b, $c, $x, $y) = explode(" ", trim(fgets(STDIN)));
echo min($a*$x+$b*$y, $c*2*max($x,$y), $c*2*min($x,$y) + $a*($x-min($x,$y))+$b*($y-min($x,$y)));


Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define fir first
#define sec second
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}
typedef double db;

const int N = 200010; 
int n;
string str[N];
int ch[N * 5][26], cnt = 1, sz[N * 5][26], num[N * 5];
void ins(string s) {
  int p = 1;
  int hav[26];
  rep (i, 0, 25) hav[i] = 0;
  rep (i, 0, (int)s.size()-1)
    hav[s[i]-'a'] ++;
  rep (i, 0, (int)s.size()-1) {
    rep (j, 0, 25) sz[p][j] += (hav[j] > 0);
    num[p] ++;
    if (!ch[p][s[i] - 'a'])
      ch[p][s[i]-'a'] = ++ cnt;
    p = ch[p][s[i] - 'a'];
    -- hav[s[i] - 'a'];
  }
  ++ num[p];
}
ll ans = 0;
void doit(string s) {
  int p = 1;
  rep (i, 0, (int)s.size()) {
    if (i + 1 == (int)s.size()) {
      int c = s[i] - 'a';
      rep (a, 0, 25) if (a != c) {
        ans += sz[ch[p][a]][c];
      }
    }
    if (i == (int)s.size()) {
      ans += num[p];
      break;
    }
    p = ch[p][s[i]-'a'];
  }
}
int main() {
  read(n);
  rep (i, 1, n) cin >> str[i];
  rep (i, 1, n) reverse(str[i].begin(), str[i].end());
  sort(str + 1, str + n + 1, [=](string a,string b) -> bool {
    return a.size() > b.size();
  });
  rep (i, 1, n) {
    doit(str[i]);
    ins(str[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 218132
#include <stdio.h>
#include <iostream>
#include <fstream>

using std::cin;
using std::cout;
using std::endl;
using std::terminate;

void solve() {
    int x, y, z; cin >> x >> y >> z;
    printf("%d %d %d\n", z, x, y);
}

int main() {

#ifdef DEV
    std::ifstream in("AtCoder/ABC161/ABC Swap.input");
    cin.rdbuf(in.rdbuf());

    int t; cin >> t;
    for (int x = 1; x <= t; ++x) {
        solve();
    }
#else
    solve();
#endif

    return 0;
}


Measured memory_bytes: 3756
def iskaibun2(s):
    for i in range(len(s)-1):
        if(s[i]==s[-1-i]):
            continue
        else:
            return 0
            break
    return 1

st = input()
l = len(st)
q = (l-1)//2
st1 = st[0:q]
st2 = st[q+1:]
if(iskaibun2(st1)==1 and iskaibun2(st2)==1 and iskaibun2(st)==1):
        print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const names = arg.splice(1, N + 1);
    
    const p = [0, 0, 0, 0, 0, 0, 1, 1, 1, 2];
    const q = [1, 1, 1, 2, 2, 3, 2, 2, 3, 3];
    const r = [2, 3, 4, 3, 4, 4, 3, 4, 4, 4];
    
    let march = [0, 0, 0, 0, 0];
    
    for(let i in names) {
        if(names[i][0] === "M") {
            march[0]++;
        }
        
        if(names[i][0] === "A") {
            march[1]++;
        }
        
        if(names[i][0] === "R") {
            march[2]++;
        }
        
        if(names[i][0] === "C") {
            march[3]++;
        }
        
        if(names[i][0] === "H") {
            march[4]++;
        }
    }
    
    let answer = 0;
    
    for(let i=0; i<10; i++) {
        answer += march[p[i]] * march[q[i]] * march[r[i]];
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 20488
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int a = 0 ;
    int b = 0 ;
    int sec[3] = {0} ;
    cin >> a >> b >> sec[0] >> sec[1] >> sec[2] ;

    if ( a < 0 )
    {
        sec[0] = ( 0 - a ) * sec[0] ;
        sec[2] = b * sec[2] ;
    }
    else
    {
        sec[0] = 0 ;
        sec[1] = 0 ;
        sec[2] = ( b - a ) * sec[2] ;
    }

    cout << sec[0]+sec[1]+sec[2] << endl ;
    return 0 ;
}

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

int main() {
  int cards[4][13] = {};
  char ch;
  int i, num;

  cin >> i;
  for(int j = 0; j < i; j++) {
    cin >> ch >> num;
    if(ch == 'S') {
      cards[0][num - 1] = true;
    } else if(ch == 'H') {
      cards[1][num - 1] = true;
    } else if(ch == 'C') {
      cards[2][num - 1] = true;
    } else {
      cards[3][num - 1] = true;
    }
  }

  for(int x = 0; x < 4; ++x) {
    for(int y = 0; y < 13; ++y) {
      if(!cards[x][y]) {
        if(x == 0) {
          cout << "S " << y + 1<< endl;
        } else if(x == 1) {
          cout << "H " << y + 1<< endl;
        } else if(x == 2) {
          cout << "C " << y + 1<< endl;
        } else {
          cout << "D " << y + 1<< endl;
        }
      }
    }
  }
}

Measured memory_bytes: 3076
/*
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
*/
#include <bits/stdc++.h>
#define LL              long long
#define ll              long long
#define SL(n)           scanf("%lld",&n)
#define LF              double
#define SF(n)           scanf("%lf",&n)
 
#define pb              push_back
#define mp              make_pair
 
#define ON(n,i)         (n|(1LL<<i))
#define OFF(n,i)        (n&(~(1LL<<i)))
#define CHK(n,i)        (n&(1LL<<i))
 
#define ff              first
#define ss              second
 
#define SET(arr)        memset( arr , -1 , sizeof arr)
#define RESET(arr)      memset( arr,0,sizeof arr)
 
#define srt(v)          sort(v.begin(),v.end())
#define uniq(v)			v.resize(distance(v.begin(),unique(v.begin(),v.end())))
#define found( s,d )    (s.find(d) != s.end())
 
#define FOR(i,s,e)      for( LL i = s ; i<=e ; i++ )
#define RFOR(i,e,s)     for( LL i = e ; i>=s ; i-- )
         
 
#define FILEIN          freopen("in.txt","r",stdin)
#define FILEOUT         freopen("WA.txt","w",stdout)
 
#define DEBUG(x)        cerr<<#x<<" = "<<x<<endl
#define PRINTALL(v)     {cerr<<endl<<"Printing: "<<#v<<endl;for(LL i = 0 ; i<v.size(); i++) DEBUG(v[i]); cerr<<endl;}
 
using namespace std;

int main(){
	
	LL N;
	SL(N);
	LL ans = N % 1000;
	ans = (1000LL - ans )%1000;
	cout<<ans<<endl;	
	
return 0;}



Measured memory_bytes: 3760
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define P pair<int , int>
#define V vector<int>
#define VLL vector<long long>
#define M map<int, int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
	string S, T;  cin >> S >> T;
	int A, B;     cin >> A >> B;
	string U;     cin >> U;

	if(U == S)
			printf("%d %d\n", A - 1, B);
	else
			printf("%d %d\n", A, B - 1);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <iomanip>
#include <functional>
//#pragma optimize GCC("O3")
typedef long long ll;
typedef long double ld;
using namespace std;

class query
{
public:
	int l, r, in;
};
long long int pole[2000079];
void ii(long long int kde, long long int r, int n)
{
	while (kde <= n)
	{
		pole[kde] += r;
		kde += kde & -kde;
	}
}
long long int ss(long long int kde)
{
	long long int sum = 0;
	while (kde > 0)
	{
		sum += pole[kde];
		kde = kde & (kde - 1);
	}
	return sum;
}
int main()
{
	int n, q;
	cin >> n >> q;
	vector<int>c(n);
	for (int i = 0; i < n; i++)
		cin >> c[i];
	vector<int> ans(q, 0);
	vector<vector<query> >v(n);
	for (int i = 0; i < q; i++)
	{
		query a;
		cin >> a.l >> a.r;
		a.l--;
		a.r--;
		a.in = i;
		v[a.r].push_back(a);
	}
	vector<int>last(n + 1, -1);
	int in = 0;
	for (int r = 0; r < n; r++)
	{
		ii(r+1, 1, n+1);
		if (last[c[r]] != -1)
			ii(last[c[r]]+1, -1, n+1);
		last[c[r]] = r;
		for (query i : v[r])
			ans[i.in] = ss(r+1) - ss(i.l);
	}
	for (int i = 0; i < q; i++)
		cout << ans[i] << "\n";
	return 0;
}

Measured memory_bytes: 36064
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

if(N >= M):
    print(0)
else:
    L = []
    for i in range(1, M):
        L.append(X[i] - X[i-1])
    L.sort()
    res = X[-1] - X[0]
    for _ in range(N-1):
        res -= L.pop()
    print(res)

Measured memory_bytes: 56664
#include<stdio.h>
int main(){
  int a,b,c,k,count;
  scanf("%d%d%d%d",&a,&b,&c,&k);
  if(a>=k)
    count=k;
  else if(a+b>=k)
    count=a;
  else
    count=2*a+b-k;
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 1728
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7') cout<<"Yes";
    else cout<<"No";

}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,sum;
int tree[808080];
long long ans;
struct pro
{
    int num,pos;
}s[202020];
bool cmp(pro a,pro b)
{
    return a.num<b.num;
}
void modify(int cur,int l,int r,int tar,int val)
{
    if(l==r)
    {
        tree[cur]=1;
        return;
    }
    int mid=(l+r)>>1;
    if(tar<=mid)
        modify(cur<<1,l,mid,tar,val);
    else if(tar>mid)
        modify(cur<<1|1,mid+1,r,tar,val);
    tree[cur]=tree[cur<<1]+tree[cur<<1|1];
    return;
}
void query(int cur,int l,int r,int L,int R)
{
    if(L<=l&&r<=R)
    {
        sum+=tree[cur];
        return;
    }
    int mid=(l+r)>>1;
    if(R<=mid)
        query(cur<<1,l,mid,L,R);
    else if(L>mid)
        query(cur<<1|1,mid+1,r,L,R);
    else
    {
        query(cur<<1,l,mid,L,mid);
        query(cur<<1|1,mid+1,r,mid+1,R);
    }
}
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&s[i].num);
        s[i].pos=i;
    }
    sort(s+1,s+1+n,cmp);
    modify(1,0,n+1,0,1);
    modify(1,0,n+1,n+1,1);
    for(int i=1; i<=n; i++)
    {
        int pos1=0,pos2=0;
        int l=0,r=s[i].pos;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            sum=0;
            query(1,0,n+1,mid,s[i].pos);
            if(sum>=1)
            {
                l=mid+1;
                pos1=mid;
            }
            else
                r=mid-1;
        }
        l=s[i].pos,r=n+1;
        while(l<=r)
        {
            int mid=(l+r)>>1;
            sum=0;
            query(1,0,n+1,s[i].pos,mid);
            if(sum>=1)
            {
                r=mid-1;
                pos2=mid;
            }
            else
                l=mid+1;
        }
        pos1++,pos2--;
        modify(1,0,n+1,s[i].pos,1);
        long long L=s[i].pos-pos1+1;
        long long R=pos2-s[i].pos+1;
        ans+=L*R*s[i].num;
//		cout<<pos1<<" "<<pos2<<endl;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 4352
var
    s1,s2,s3:ansistring;
    i:longint;
    b:boolean;
begin
    readln(s1);
    readln(s2);
    if(length(s1)<length(s2))then
    begin
        s3:=s1;
        s1:=s2;
        s2:=s3;
    end;
    if(length(s1)<>length(s2))then b:=true; 
    if(b)then
    begin
        for i:=1 to length(s1)-1 do
        begin
            write(s1[i],s2[i]);
        end;
        write(s1[length(s1)]);
    end
    else
    begin
        for i:=1 to length(s1) do
        begin
            write(s1[i],s2[i]);
        end;
    end;
end.



Measured memory_bytes: 128
N = int(raw_input())
nums = map(int, raw_input().split())
num_tmp = []
for a in nums:
    num_tmp.append(a)
nums.sort()
med_1 = nums[N/2 - 1]
med_2 = nums[N/2]
for i in range(N):
    if num_tmp[i] <= med_1:
        print(med_2)
    elif num_tmp[i] >= med_2:
        print(med_1)

Measured memory_bytes: 19956
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		String up = str.toUpperCase();
		String low = str.toLowerCase();
		int i;
		for (i = 0; i < str.length(); i++) {
			if (str.charAt(i) == up.charAt(i))
				System.out.print(low.charAt(i));
			else
				System.out.print(up.charAt(i));
		}
		System.out.println();
	}
}


Measured memory_bytes: 26812
#include <stdio.h>
int main (){
char s[5];
  int a,b,c,d,k;
scanf ("%s",s);
  a=s[0]-'0';
  b=s[1]-'0';
  c=s[2]-'0';
  d=s[3]-'0';
  k=7-a;
  if (b+c+d==k){printf ("%d+%d+%d+%d=7",a,b,c,d);}
  else if (b+c-d==k){printf ("%d+%d+%d-%d=7",a,b,c,d);}
  else if (b-c+d==k){printf ("%d+%d-%d+%d=7",a,b,c,d);}
  else if (b-c-d==k){printf ("%d+%d-%d-%d=7",a,b,c,d);}
  else if (-b+c+d==k){printf ("%d-%d+%d+%d=7",a,b,c,d);}
  else if (-b+c-d==k){printf ("%d-%d+%d-%d=7",a,b,c,d);}
  else if (-b-c+d==k){printf ("%d-%d-%d+%d=7",a,b,c,d);}
  else if (-b-c-d==k){printf ("%d-%d-%d-%d=7",a,b,c,d);}
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

vl v;
void dfs(ll x){
  if(x<1000000000){
    v.pb(x);
    dfs(10*x+3);
    dfs(10*x+5);
    dfs(10*x+7);
  }
}

bool check3(ll x){
  while(x>0){
    if(x%10==3){
      return true;
    }
    x /= 10;
  }
  return false;
}

bool check5(ll x){
  while(x>0){
    if(x%10==5){
      return true;
    }
    x /= 10;
  }
  return false;
}

bool check7(ll x){
  while(x>0){
    if(x%10==7){
      return true;
    }
    x /= 10;
  }
  return false;
}

int main() {
  ll n;
  cin >> n;
  int ans=0;
  dfs(0);
  rep(i,v.size()){
    if(v[i]!=0 && v[i]<=n){
      if(check3(v[i]) && check5(v[i]) && check7(v[i])){
        ans ++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

#ifndef _DEBUG
#define main_ main
#endif
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)

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

template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
	return left.second > right.second;
}

void init_global() {}

int main_() {
	int W, H, N;
	cin >> W >> H >> N;

	vvi c(H, vi(W, 0));
	FOR(k, 0, N) {
		int X, Y, A;
		cin >> X >> Y >> A;
		switch (A) {
		case 1:
			FOR(i, 0, H) {
				FOR(j, 0, X) {
					c[i][j] = 1;
				}
			}
			break;
		case 2:
			FOR(i, 0, H) {
				FOR(j, X, W) {
					c[i][j] = 1;
				}
			}
			break;
		case 3:
			FOR(i, 0, Y) {
				FOR(j, 0, W) {
					c[i][j] = 1;
				}
			}
			break;
		default:
			FOR(i, Y, H) {
				FOR(j, 0, W) {
					c[i][j] = 1;
				}
			}
			break;
		}
	}

	int ans = 0;
	FOR(i, 0, H) {
		FOR(j, 0, W) {
			if (c[i][j] == 0) ans++;
		}
	}
	cout << ans << 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 N = sc.nextInt();
        
        for (int i=1; i<=9; i++) {
            for (int j=1; j<=9; j++) {
                if (i*j == N) {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int ans[200005];
int arr[200005];
int main(){
    int n;cin >> n;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    int s = 0, e = n-1;
    int z= 0;
    for(int i = n-1 ; i >= 0; i--){
        if(z%2==1){
            ans[s]=arr[i];
            s++;
        }else{
            ans[e]=arr[i];
            e--;
        }
        z++;
    }
    reverse(ans,ans+n);
    for(int i= 0; i <n; i++){
        cout << ans[i] << " ";
    }

    return 0;
}


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

int n,a[200005];
long long ans;
struct interval {
	int l,r;
} b[200005];
inline bool operator <(interval a,interval b) {
	return (a.l==b.l)?(a.r<b.r):(a.l<b.l);
}
int main() {
	cin>>n;
	for (int i=1;i<=n;i++) {
		cin>>a[i];
		if (a[i]>=i) {
			puts("-1");
			return 0;
		}
		b[i]=(interval){i-a[i],i};
	}
	sort(b+1,b+n+1);
	int rightmost=0;
	for (int i=1;i<=n;i++) {
		while (b[i+1].l==b[i].l) i++;
		if (b[i].r<rightmost) {
			puts("-1");
			return 0;
		} else rightmost=b[i].r;
		ans+=b[i].r-b[i].l;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int r, c, k;
	cin >> r >> c >> k;
	vector<vector<vector<long long>>> dp(r + 1, vector<vector<long long>>(c + 1, vector<long long>(4)));
	vector<vector<long long>> grid(r, vector<long long>(c));
	for (int i = 0; i < k; i++) {
		int a, b, v;
		cin >> a >> b >> v;
		grid[a - 1][b - 1] = v;
	}
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			vector<long long> dp_before = dp[i][j];
			for (int k = 0; k <= 3; k++) {
				dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][k]);
				dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
				if (k < 3) {
					dp[i][j][k + 1] = max(dp[i][j][k + 1], dp_before[k] + grid[i][j]);
				}
			}
		}
	}
	cout << *max_element(dp[r - 1][c - 1].begin(), dp[r - 1][c - 1].end());
}



Measured memory_bytes: 706512
#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,t,d,s=0;
    cin>>n;
    vector<long long>v;
    vector<long long>p;
    for(int i=0;i<=n;i++){
        cin>>t;
        v.push_back(t);
    }
     for(int i=0;i<n;i++){
            cin>>d;
            p.push_back(d);
    }
    for(int i=0;i<n;i++){
        if(v[i]>=p[i]){
            s=s+p[i];
        }
        else if(v[i]+v[i+1]>=p[i]){
            s=s+p[i];
            v[i+1]=(v[i]+v[i+1]-p[i]);

        }
        else{
            s=s+v[i]+v[i+1];
            v[i+1]=0;
        }
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 2548
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>

using namespace std;

int main() {
  string s;
  cin >> s;
  if(s.substr(0, 4) == "YAKI") cout << "Yes" << endl;
  else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int (i)=(a);(i)<(b);++(i))
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cout<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef vector<int> vi;
typedef vector<lint> vl;
typedef vector<char> vc;
typedef vector<vector<int>> vii;
typedef vector<vector<lint>> vll;
typedef vector<vector<char>> vcc;

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

class ARestaurant {
public:
    int N;

    void input(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in>>N;
    }

    void solve(std::istream& in, std::ostream& out){
        input(in, out);
        out<<800*N-N/15*200<<'\n';
    }
};


int main() {
	ARestaurant solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
N, K, Q = input().split()
A = []
for i in range(int(Q)):
    A.append(int(input()))

B = [int(K) - int(Q)] * int(N)

for i in range(int(Q)):
    B[A[i]-1] += 1

for i in range(int(N)):
    if B[i] > 0:
        print("Yes")

    else:
        print("No")


Measured memory_bytes: 10484
import qualified Data.Map as M

f2::Maybe Int->Int
f2 (Just x)=x
f2 Nothing =0

f :: M.Map Int Int->Int->[Int]->[Int]
f _ _ []=[]
f ms1 sum1 (x:xs)=let sum2=sum1+x
                      ms2=M.insertWith (+) sum2 1 ms1
                  in (f2 (M.lookup (sum2) ms1)) : f ms2 sum2 xs

main = do
       n<-getLine
       e<-getLine
       let xs=map read (words e)::[Int]
           ms1=M.empty
           ms2=M.insert 0 1 ms1
       putStrLn $ show $ sum $ f ms2 0 xs

Measured memory_bytes: 106876
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {
	//fios;
	int a;
	cin >> a;
	cout << a + a*a + a*a*a << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

ll dis(Pll a, Pll b){
    ll res = 0;
    res = abs(a.first - b.first) + abs(a.second - b.second);
    return res;
}

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

// template<typename T>
// void print(T &arr){
//     ll sz = sizeof(arr)/sizeof(arr[0]);
//     for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
//     cout << arr[sz-1] << endl;
// }


int main(){
    ll h,w; cin >> h >> w;
    ll d; cin >> d;
    vector<vector<ll>> a(h, vector<ll>(w));
    vector<Pll> rev_a(h*w);
    rep(i,h){
        rep(j,w){
            ll temp;cin >> temp;
            --temp;
            a[i][j] = temp;
            rev_a[temp] = Pll(i,j);
        }
    }
    ll q; cin >> q;
    vector<ll> l(q),r(q);
    rep(i,q){
        cin >> l[i] >> r[i];
        l[i]--;r[i]--;
    }


    vector<vector<ll>> step(d), sum_step(d);
    rep(i,d){
        step[i].emplace_back(0);
        ll now = i + d;
        while(now < h*w){
            ll temp = dis(rev_a[now], rev_a[now-d]);
            step[i].emplace_back(temp);
            now += d;
        }
    }

    rep(i,d){
        sum_step[i].emplace_back(0);
        ll sz = step[i].size();
        rep(j,sz){
            sum_step[i].emplace_back(step[i][j] + sum_step[i][j]);
        }
    }

    rep(i,q){
        ll xl = l[i] / d, y = l[i] % d;
        ll xr = r[i] / d;
        ll res = 0;
        res = sum_step[y][xr+1] - sum_step[y][xl+1];
        cout << res << "\n";
    }
    // print();
    // print("step");
    // print(step);
    // print();
    // print("sum_step");
    // print(sum_step);
    return 0;
}

Measured memory_bytes: 13952
n = int(input())
f = [list(map(int, input().split())) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]

ans = []
stk = [[0] * n]

for i in range(10):
    for j in range(len(stk)):
        total = 0
        arr = []
        for k in range(n):
            open_shops = stk[j][k] + f[k][i]
            arr.append(open_shops)
            total += p[k][open_shops]
        ans.append(total)
        stk.append(arr)

print(max(ans))

Measured memory_bytes: 4084
#include <iostream>
using namespace std;
int main(void)
{
    int a,b;
    cin>>a>>b;
    double ans=((double)a+(double)b)/2.0;
    int x;
    if(ans-(int)ans<0.5)
        x=ans;
    else
        x=ans+1;
    cout<<x<<endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());

  if (N % 2 == 1) {
    cout << B[N / 2] - A[N / 2] + 1 << endl;
  } else {
    cout << (B[N / 2] + B[N / 2 - 1]) - (A[N / 2] + A[N / 2 - 1]) + 1 << endl;
  }
}

Measured memory_bytes: 4844
#include <iostream>
using namespace std;
int a,b;
int main() {
	// your code goes here
	cin>>a>>b;
	if(b==0)cout<<a<<endl;
	else {
		if(a+b>=24)
		cout<<a+b-24<<endl;
		else
		cout<<a+b<<endl;
	}
 
 
	return 0;
}

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

int main() {
  int N;
  long long K;
  cin >> N >> K;
  
  long long ary[100010] = {};
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    ary[a] += b;
  }

  int ans = 0;
  for (int i = 1; i < 100010; i++) {
    K -= ary[i];
    if (K <= 0) {
      ans = i;
      break;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=103974182;
using namespace std;
int no[300005];

int main()
{
//	freopen("input.txt","r",stdin);
	int n,a,b;
	cin>>n>>a>>b;
	if(a+b>n+1) over("-1");
	if(a>n) over("-1");
	if(b>n) over("-1");
	if(a==1)
	{
		if(b!=n) over("-1");
		for(int i=n;i>=1;i--)
		{
			cout<<i<<' ';
		}
		cout<<endl;
		return 0;
	}
	if(b==1)
	{
		if(a!=n) over("-1");
		for(int i=1;i<=n;i++)
		{
			cout<<i<<' ';
		}
		cout<<endl;
		return 0;
	}
	vector <int> ans;
	for(int i=n-a+1;i<=n;i++)
	{
		ans.push_back(i);
	}
	n=n-a;
	b--;
	int t=n/b;
	if(t*b!=n) t++;
	if(t>a) over("-1");
	if(t*b!=n) t--;
	for(int i=0;i<t;i++)
	{
		for(int j=b;j>=1;j--)
		{
			ans.push_back(j+b*i);
		}
	}
//	cout<<">";
	int len=ans.size();
	for(int i=0;i<len;i++)
	{
		no[ans[i]]=true;
	}
	for(int i=n;i>=1;i--)
	{
		if(no[i]==false) ans.push_back(i);
	}
	len=ans.size();
	rep(len)
	{
		cout<<ans[i]<<' ';
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 4720
#include <algorithm>
#include <functional>
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }

    sort(a.begin(), a.end(), greater<int>());
    sort(b.begin(), b.end(), greater<int>());

    int dmg = 0, res = 0;
    for (int i = 0; i < n && a[0] < b[i] && dmg < h; i++) {
        dmg += b[i];
        res++;
    }

    if (dmg < h) {
        res += (h - dmg + a[0] - 1) / a[0];
    }

    cout << res << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcdEx(ll a, ll b, ll *x, ll *y) {
    if (!a) {*x = 0; *y = 1; return b;}
    ll x1, y1, gcd = gcdEx(b % a, a, &x1, &y1); *x = y1 - (b / a) * x1; *y = x1; return gcd;
}
ll modI(ll b, ll m)      {ll x, y; gcdEx(b, m, &x, &y); return (x % m + m) % m;}
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

#define sum(a)     ( accumulate ((a).begin(), (a).end(), 0ll))
#define mine(a)    (*min_element((a).begin(), (a).end()))
#define maxe(a)    (*max_element((a).begin(), (a).end()))
#define mini(a)    ( min_element((a).begin(), (a).end()) - (a).begin())
#define maxi(a)    ( max_element((a).begin(), (a).end()) - (a).begin())
#define lowb(a, x) ( lower_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define uppb(a, x) ( upper_bound((a).begin(), (a).end(), (x)) - (a).begin())
#define MOD                 1000000007
#define modA(a,b)           (((a%MOD)+(b%MOD))%MOD)
#define modS(a,b)           (((((a%MOD)-(b%MOD))%MOD)<0)?(ll)(MOD+((a%MOD)-(b%MOD))%MOD):(ll)(((a%MOD)-(b%MOD))%MOD))
#define modM(a,b)           (ll)((((ll)(a%MOD))*((ll)(b%MOD)))%MOD)
#define modD(a,b)           ((modI(b,MOD)*(a%MOD))%MOD)
ll modP(ll x, ll y)         {
    ll r = 1; x %= MOD; while (y > 0) {
        if (y & 1) {r = (r * x) % MOD;}
        y = y >> 1; x = (x * x) % MOD;
    } return r;
}
ll max(ll a, ll b) {return (a > b ? a : b);}
ll min(ll a, ll b) {return (a < b ? a : b);}
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1 << " | "; __f(comma + 1, args...);
}
ll gcd( ll a, ll b )
{
    if (b == 0)
    {
        return a;
    }
    else
    {
        return gcd( b, (a % b) );
    }
}
ll lcm (ll a, ll b)
{
    ll ans = (a  / gcd(a, b)) * b;
    return ans;
}
void solve()
{
    ll ans = 0;
    ll n;
    cin >> n;
    vector<ll> a(n);

    for (int i = 0; i < n; i++)
        cin >> a[i];

    sort(all(a));
    ans = a[n / 2] - a[(n / 2) - 1];
    cout << ans << '\n';



}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t ;
    t = 1;
//   cin >> t;
    while (t--)
        solve();
    return 0;
}




Measured memory_bytes: 3928
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

void solve() {
    int N, ans = 0, i = 0;
    cin >> N;
    vector<int> p(N);
    rep(j, N) cin >> p[j];
    while (i < N) {
        if (p[i] == i + 1) {
            ans++;
            if (i < N - 1 && p[i + 1] == i + 2) i++;
        }
        i++;
    }
    cout << ans << endl;
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 768
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

r, D, x = MAP()

for i in range(1, 11):
	x *= r
	x -= D
	print(x)

Measured memory_bytes: 5148
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;

int n, k, s;

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> k >> s;
	for (int i = 1; i <= k; i ++)
		cout << s << " ";
	for (int i = k + 1; i <= n; i ++) {
		if (s != 1000000000)	cout << 1000000000 << " ";
		else					cout << 999999999 << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1280
N = int(input()) # 数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

min = 10**9
result = 0

for i in range(N):
    if min > List[i]:
        min = List[i]
        result += 1

print(result)

Measured memory_bytes: 24744
#include<iostream>
#include<cstring>

using namespace std;

int main(){
    string S;
    cin >> S;
    if(S=="Sunny")
      cout << "Cloudy" << endl;
    if(S=="Cloudy")
          cout << "Rainy" << endl;
    if(S=="Rainy")
          cout << "Sunny" << endl;
}


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

using namespace std;

int main(){
  string S, T;
  cin >> S >> T;
  
  int change = 10000;
  for(int i = 0; i < (int)S.size() - (int)T.size() + 1; i++){
    int c = 0;
    for(int j = 0; j < (int)T.size(); j++){
      if(S[i + j] != T[j]) ++c;
    }
    change = min(c, change);
  }
  
  cout << change << endl;
  
  return 0;
}

Measured memory_bytes: 3632