akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

template <typename T>
struct twodim_fenwick_tree {
    int h, w;
    vector<vector<T>> data;
    twodim_fenwick_tree(int h, int w) : h(h), w(w), data(h+1, vector<T>(w+1)) {}
    void add(int r, int c, T x=1) {
        for (int i = r+1; i <= h; i += i&-i)
            for (int j = c+1; j <= w; j += j&-j) data[i][j] += x;
    }
    T sum(int r, int c) {
        T res = 0;
        for (int i = r; i; i -= i&-i)
            for (int j = c; j; j -= j&-j) res += data[i][j];
        return res;
    }
    T sum(int r1, int c1, int r2, int c2) {
        return sum(r2, c2) - sum(r1, c2) - sum(r2, c1) + sum(r1, c1);
    }
};

template <typename T>
struct compress {
    vector<T> xs;
    compress(const vector<T> vs) {
        xs = vs;
        sort(xs.begin(), xs.end());
        xs.erase(unique(xs.begin(), xs.end()), xs.end());
    }
    vector<int> get(const vector<T> &vs) const {
        vector<int> res;
        transform(vs.begin(), vs.end(), back_inserter(res),
                  [&](const T &x) { return lower_bound(xs.begin(), xs.end(), x) - xs.begin();}
            );
        return res;
    }
    int get(const T &x) const {
        return lower_bound(xs.begin(), xs.end(), x) - xs.begin();
    }
    const T &operator[](int k) const { return xs[k];}
};

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

    int n, k;
    cin >> n >> k;

    vector<int> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    compress<int> cx(x), cy(y);
    int h = cy.xs.size();
    int w = cx.xs.size();
    twodim_fenwick_tree<int> ft(h, w);

    rep(i, n) {
        ft.add(cy.get(y[i]), cx.get(x[i]));
    }
    
    ll ans = 5e18;
    for (int y1 = 0; y1 < h; ++y1) {
        for (int y2 = y1+1; y2 < h; ++y2) {
            for (int x1 = 0; x1 < w; ++x1) {
                for (int x2 = x1+1; x2 < w; ++x2) {
                    int sum = ft.sum(y1, x1, y2+1, x2+1);
                    if (sum < k) continue;
                    ll s = 1LL * (cy[y2] - cy[y1]) * (cx[x2] - cx[x1]);
                    chmin(ans, s);
                }
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
//#pragma GCC target ("avx,tune=native")
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;

const double pi = acos(-1);
const int INF = 1e9 + 5;
const int N = 2e5 + 20;


void solve()
{
	int n, k;
	cin >> n >> k;
	vector <int> v(n);
	for(int i = 0; i < n; ++i) cin >> v[i];
	sort(v.begin(), v.end());
	int sum = 0;
	for(int i = 0; i < k; ++i) sum += v[i];
	cout << sum;
}

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


Measured memory_bytes: 3564
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            var count = 0;
            for (int i = 2; i < N; i++)
            {
                if (S[i - 2] == 'A' && S[i - 1] == 'B' && S[i] == 'C') count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define int long long int

using namespace std;
typedef pair<int, int> PII;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;
typedef pair<PII, PII> PPP;
typedef vector<PII> VP;
typedef VP::iterator VPI;
typedef vector<int> VI;
const int INF = 3e18;
const double PI = acos(-1);
const int MOD = 1e9 + 7;

int n, a[200010];
int lft[200010], rgt[200010];

VP num1, num2;
int ans = 0;

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

  num1.PB(MP(-INF, -1));
  for(int i = 0; i < n; i++){
    while(num1[num1.size() - 1].F > a[i]){
      num1.pop_back();
    }
    lft[i] = num1[num1.size() - 1].S;
    num1.PB(MP(a[i], i));
  }

  num2.PB(MP(-INF, n));
  for(int i = n - 1; i >= 0; i--){
    while(num2[num2.size() - 1].F > a[i]){
      num2.pop_back();
    }
    rgt[i] = num2[num2.size() - 1].S;
    num2.PB(MP(a[i], i));
  }

  for(int i = 0; i < n; i++){
    ans += a[i] * (rgt[i] - i) * (i - lft[i]);
  }

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


Measured memory_bytes: 8560
#include<bits/stdc++.h>
using namespace std;
int a,b,c,i,j,n,s;
int main()
{
    cin>>a>>b>>c>>n;
    for (i=0;i<=a;i++)
    {
        for (j=0;j<=b;j++)
        {
            if ((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50))
            {
                ++s;
            }
        }
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int k = sc.nextInt();
      int num = 1;
      for(int i=0; i<n;i++){
      	if((num+k)>2*num){
        	num=2*num;
        }else{
        	num +=k;
        }
      }
      System.out.println(num);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
int main ()
{
    int a,b,c,temp;
    scanf ("%d %d %d",&a, &b, &c);
    temp=b;
    b=a;
    a=c;
    c=temp;
    printf ("%d %d %d\n",a, b, c);
    return 0;
}


Measured memory_bytes: 128
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


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

    int n; cin >> n;
    vector<int> a(n);

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


    for(int i = 1;i < n+1;i ++){
        ans += b[i] * (b[i] - 1) / 2;
    }

    for(int i = 0;i < n;i ++){
        int t = b[a[i]];
        cout << ans - t * (t-1) / 2 + (t-1) * (t-2) /2 << '\n';
    }
}



Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n, m;
    string s;
    cin >> s;
    cout << (s[0] == s[2] ? "Yes" : "No" ) << endl;
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans = INF;
    if(A+B <= 2*C){
        ans = A*X + B*Y;
        // cout << A*X + B*Y << endl;
    }
    else{
        ll m = min(X, Y);
        ll t = max(X, Y);

        for(ll i=m; i<=t; i++){
            ans = min(ans, i*2*C + max(ll(0), X-i)*A + max(ll(0), Y-i)*B);
            // cout << i*2*C + (X-i)*A + (Y-i)*B << endl;
        }        
    }
    cout << ans << endl;
    return 0;
}

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

constexpr long int m = 1000000000 + 7;

template<int N> class ModInv{
public:
    constexpr ModInv() : array(){
        for(int i=1; i<=N; ++i){
            array[i-1]=this->getModInv(i);
        }
    }
    const long int &operator[](int i) const {
        return array[i-1];
    }
private:
    long int array[N];
    constexpr long int getModInv(const int a){
        constexpr long int p = m-2;
        long int mod = 1;
        for(int j=62; j>=0; --j){
            mod = mod*mod % m;
            if( ((p>>j)&1)==1 ){
                mod = mod*a % m;
            }
        }
        return mod;
    }
};

int main(int argc, char *argv[]){
    constexpr auto inv = ModInv<2000>();
    int N,K;
    std::cin >> N >> K;
    long int permutation = N - K + 1;
    std::cout << permutation << std::endl;
    for(int i=1; i<K; ++i){
        permutation *= (K-i);
        permutation %= m;
        permutation *= (N-K+1-i);
        permutation %= m;
        permutation *= inv[i];
        permutation %= m;
        permutation *= inv[i+1];
        permutation %= m;
        std::cout << permutation << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int> 

int main(){
  int N, M; cin >> N >> M;
  int P[M], Y[M];
  unordered_map<int,vector<int>> YM;
  rep(i,M){
    cin >> P[i] >> Y[i];
    YM[P[i]].push_back(Y[i]);
  }

  //rep(i,N+1) sort(all(YM.at(i)));
  for (auto i=YM.begin();i!=YM.end();i++){
    sort(all(i->second));
  }

  rep(i,M){
    auto x = lower_bound(all(YM.at(P[i])),Y[i]) - YM.at(P[i]).begin();
    printf("%06d",P[i]);
    printf("%06d\n",int(x)+1);
  }

  return 0;
}

Measured memory_bytes: 11044
#include <iostream>
#include <fstream>
#include <vector>
#include <climits>
using namespace std;
const int nmax=105;
vector<int> v[nmax];
long long fl[nmax][nmax],c[nmax][nmax];
long long a[nmax];
long long sum,minfl,flow;
int prc[nmax],q[nmax];
int n,m,i,j,start,node,source,sink,p,u;
void add(int x,int y,long long cap)
{
    c[x][y]=1LL*cap;//c[y][x]=1LL*cap;
    v[x].push_back(y);
    v[y].push_back(x);
}
bool bfs()
{
    for(i=1;i<=sink;i++)
        prc[i]=0;
    prc[source]=-1;
    p=u=1;q[u]=source;
    while(p<=u)
    {
        start=q[p];p++;if(start==sink) return 1;
        for(i=0;i<v[start].size();i++)
        {
            node=v[start][i];
            if(prc[node]==0&&fl[start][node]<c[start][node])
                q[++u]=node,prc[node]=start;
        }
    }
    return 0;
}
int main()
{
    //freopen("data.in","r",stdin);
    cin>>n;
    source=n+1;sink=n+2;
    //conectam de source=pastram
    //conectam de sink=dam
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]<=0) add(source,i,-a[i]);
        else add(i,sink,a[i]),sum+=a[i];
        for(j=2*i;j<=n;j+=i)
            add(i,j,LLONG_MAX);
    }
    while(bfs())
    {
        node=sink;minfl=LLONG_MAX;
        while(node!=source)
        {
            minfl=1LL*min(minfl,c[prc[node]][node]-fl[prc[node]][node]);
            node=prc[node];
        }
        node=sink;
        while(node!=source)
        {
            fl[prc[node]][node]+=minfl;
            fl[node][prc[node]]-=minfl;
            node=prc[node];
        }
        flow+=minfl;
    }
    cout<<sum-flow;
    return 0;
}


Measured memory_bytes: 384
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

n = I()
a = IR(n)

# N個のボタンがあり、今1個のボタンが光っている。
# ボタンは1~Nまで番号があり、iが光っているときに押すと、iの光が消え、aiが光る。
# 光っていないボタンを押しても反応しない。
# ボタン１が光っている状態で開始、ボタン2が光っている状態で終了したい。
# そのようなことが不可能であれば－1、可能であれば最小回数を出力

#　普通にシミュレートしたらよい。
#　n回ボタン押したうえで、2にたどり着かなかったらどこかで同じボタンを2回押していることになる。

count = 0
cur = 1

while count < n:
    count += 1
    cur = a[cur-1]
    if cur == 2:
        print(count)
        sys.exit()
print(-1)

Measured memory_bytes: 79360
#include <iostream>
#include <string>

int S_alphabets_counts[200001];
int T_alphabets_counts[200001];

int main(){

	std::string S, T;

	std::cin >> S >> T;

	for(int i = 0; i < 26; ++i){

		char target_c = 'a' + i;

		int s_count = 0, t_count = 0;
		for(const auto& c : S){
			if(c == target_c){
				++s_count;
			}
		}
		for(const auto& c : T){
			if(c == target_c){
				++t_count;
			}
		}

		++S_alphabets_counts[s_count];
		++T_alphabets_counts[t_count];
	}

	bool flag = true;
	for(int i = 0; i < 200001; ++i){
		if(S_alphabets_counts[i] != T_alphabets_counts[i]){
			flag = false;
			break;
		}
	}

	if(flag){
		std::cout << "Yes" << std::endl;
	}
	else{
		std::cout << "No" << std::endl;
	}

	return 0;
}


Measured memory_bytes: 1020
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		int ans = 0;
		Scanner in = new Scanner(System.in);
		String str = in.next();
		int K = Integer.parseInt(str);

		for (int i = 1; i <= K; i++) {
			for (int j = i; j <= K; j++) {
				for (int k = j; k <= K; k++) {
					ans += calcGcd(i, j, k);
				}
			}
		}
		System.out.println(ans);
		in.close();
	}

	public static int calcGcd(int i, int j, int k) {// i<j<k
		int p = k, q = j, temp, num = 6;
		if (i == j && j == k) {
			num = 1;
		} else if (i == j || j == k) {
			num = 3;
		}
		while (p % q != 0) {
			temp = p % q;
			p = q;
			q = temp;
		}
		if (i < q) {
			p = q;
			q = i;
		} else {
			p = i;
		}
		while (p % q != 0) {
			temp = p % q;
			p = q;
			q = temp;
		}
		return q * num;
	}

}

Measured memory_bytes: 35644
import java.io.*;
import java.util.*;
 
public class Main {
  private static boolean debug = false;
  private static boolean elapsed = false;
 
  private static PrintWriter _err = new PrintWriter(System.err);
 
  private String[] keys = {
    "dreameraser", "dreamerase", "dreamer", "dream", "eraser", "erase"
  };
 
  private void solve(Scanner sc, PrintWriter out) {
    String S = sc.nextLine();
 
    int i = 0;
    while (i < S.length()) {
      boolean found = false;
      for (int j = 0; j < keys.length; ++j) {
        int keylen = keys[j].length();
        if (i + keylen <= S.length()) {
          String s = S.substring(i, i + keylen);
          if (s.equals(keys[j])) {
            i += keylen;
            found = true;
            break;
          }
        }
      }
      if (!found) {
        break;
      }
    }
    out.println((i == S.length() ? "YES" : "NO"));
  }
  private long C(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    for (long i = r; i > 1; --i) {
      res /= i;
    }
    return res;
  }
  private long P(long n, long r) {
    long res = 1;
    for (long i = n; i > n - r; --i) {
      res *= i;
    }
    return res;
  }
  /*
   * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
   * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
   */
  public static void main(String[] args) {
    long S = System.currentTimeMillis();
 
    Scanner sc = new Scanner(System.in);
    PrintWriter out = new PrintWriter(System.out);
    new Main().solve(sc, out);
    out.flush();
 
    long G = System.currentTimeMillis();
    if (elapsed) {
      _err.println((G - S) + "ms");
    }
    _err.flush();
  }
}

Measured memory_bytes: 28476
N, M, X = map(int, input().split())

costlist = []
booklist = []
for i in range(0, N):
	inpt = list(map(int, input().split()))
	costlist.append(inpt[0])
	booklist.append(inpt[1:])

def bnr(n):
	lst = []
	now = n
	for i in range(0, N):
		lst.append(now%2==1)
		now = now//2
	return lst

def pow2(n):
	now = 1
	for i in range(0, n):
		now *= 2
	return now

def judge(lst):
	for i in range(0, len(lst)):
		if lst[i] < X:
			return False
	return True

mincost = 5000000000000000

for i in range(0, pow2(N)):
	cost = 0
	lst = []
	for j in range(0, M):
		lst.append(0)
	buyornot = bnr(i)
	for j in range(0, N):
		if buyornot[j]:
			cost += costlist[j]
			for k in range(0, M):
				lst[k] += booklist[j][k]
	if judge(lst) and cost<mincost:
		mincost = cost
if mincost == 5000000000000000:
	mincost = -1
print(mincost)

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,s,a[3003],dp[3003][3003];
int get(int pos,int rem){
    if(rem==0) return (n-pos+1);
    if(pos==n) return 0;
    int &ans=dp[pos][rem];
    if(ans!=-1) return ans;
    ans=get(pos+1,rem);
    if(rem>=a[pos]) ans=(ans+get(pos+1,rem-a[pos]))%hell;
    return ans;
}
void solve(){
    int ans=0;
    memset(dp,-1,sizeof dp);
    cin>>n>>s;
    rep(i,0,n) cin>>a[i];
    rep(i,0,n) ans=(ans+get(i,s))%hell;
    cout<<ans<<endl;
}

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

Measured memory_bytes: 70912
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <numeric>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600
#define long long long

int main(){
  long a,b,x;
  cin>>a>>b>>x;

  if(a==0) cout<<b/x+1<<endl;
  else cout<<b/x-(a-1)/x<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void)
{
	int s,m,h,S;
		scanf("%d", &S);
		
			s = S % 60;
			m = S / 60;
			h = m / 60;
			m = m % 60;

			printf("%d:%d:%d\n",h,m,s);
	
	return 0;
}

Measured memory_bytes: 2692
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

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

   cout << (n-1)*(m-1) << endl;

   return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long max = Integer.MIN_VALUE;
        long min = sc.nextLong();

        for (int i = 1; i < n; i++) {
            long a = sc.nextLong();
            max = Math.max(max, a - min);
            min = Math.min(min, a);
        }
        System.out.println(max);
    }
}



Measured memory_bytes: 67588
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> H(N);
    for(int i=0; i<N; i++)
        cin >> H.at(i);
    int max=0;
    int count=0;
    for(int i=0; i<N-1; i++){
        if(H.at(i)>H.at(i+1)){
            count++;
        }
        if(H.at(i)<H.at(i+1)){
            max=count;
            break;
        }
    }
    count=0;
    int start=0;
    for(int i=0; i<N-1; i++){
        if(H.at(i)>=H.at(i+1)){
            count++;
           if(max<count){
                max=count;
            } 
        }
        if(H.at(i)<H.at(i+1)){
            if(max<count){
                max=count;
            }
            count=0;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 640
import java.util.*;

// ARC 95-D
// https://beta.atcoder.jp/contests/arc095/tasks/arc095_b

public class Main {

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

		int N = in.nextInt();

		int[] nums = new int[N];
		for (int i = 0; i < N; i++) {
			nums[i] = in.nextInt();
		}
		
		Arrays.sort(nums);
	
		int n = nums[N - 1];
		int r = nums[0];
		
		for (int i = 1; i < N; i++) {
			if (Math.abs(nums[i] - n / 2.0) < Math.abs(r - n / 2.0)) {
				r = nums[i];
			}
		}
		
		System.out.printf("%d %d\n", n, r);
	}
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll 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(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    char b;
    cin >> b;
    if(b=='A'){
        cout << 'T' << endl;
    }else if(b=='T'){
        cout << 'A' << endl;
    }else if(b=='G'){
        cout << 'C' << endl;
    }else{
        cout << 'G' << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    char c;
    cin >> c;
    if(c == 'a' ||c == 'e' || c == 'i' || c == 'o' || c == 'u'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <climits>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int64_t a, b, c, d; cin >> a >> b >> c >> d;
    cout << max(max(a * c, a * d), max(b * c, b * d)) << endl;
}



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

int main()
{
       char s[51];
       int length, f, i;

       scanf("%s", s );

       length = strlen( s );

       for( i = length; i >= 0; i-- ) //Fは後ろから何番目か
       {
              if( s[i] == 'F' )
              {
                     f = i;
                     break;
              }
       }

       for( i = 0; i <= f-1; i++ )
       {
              printf( "%c", s[i] );
       }

       printf( "\n" );
       return 0;
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    printf("%d %d %d\n", x, y, z);
    return 0;
}


Measured memory_bytes: 3720
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
typedef pair<int,int> P;
int main(){
    int a,b;cin>>a>>b;
    cout<<a*b-a-b+1<<endl;
}   

Measured memory_bytes: 256
from collections import deque
H, W=map(int, input().split(" "))
field=[list(input()) for _ in range(H)]
dist=[[-1]*W for _ in range(H)]
que=deque([[0,0]])
dist[0][0]=0
dx=[1,0,-1,0]
dy=[0,1,0,-1]
cnt=0
#BFS
while que:
    y, x=que.popleft()
    if [y, x]==[H-1, W-1]:
        break
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if (0<=nx<W and 0<=ny<H and field[ny][nx]=="." and dist[ny][nx]==-1):
            dist[ny][nx]=dist[y][x]+1
            que.append([ny, nx])

if dist[H-1][W-1]!=-1:
    for j in range(H):
        for k in range(W):
            if field[j][k]=="#":
                cnt+=1
    print(H*W-dist[H-1][W-1]-cnt-2+1)
else:
    print("-1")

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

int main(){
    int w, n;
    cin >> w >> n;
    vector<int> num(w, 0);
    int it = 1;
    for(int& k : num) k = it++;
    rep(i, n){
        int a, b;
        char c;
        cin >> a >> c >> b;
        a--; b--;
        swap(num[a], num[b]);
    }
    for(int k : num)
      cout << k << endl;
    return 0;
}

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n, q, l, r, count = 0, flag;
	char *str;
	int *map;
	scanf("%d %d", &n, &q);
	str = malloc(sizeof(char) * (n + 1));
	map = malloc(sizeof(int) * n);
	scanf("%s", str);
	for(int i = 0; i < n; i++){
		if(flag == 1 && str[i] == 'C'){
			count++;
			flag = 0;
		}else if(str[i] == 'A'){
			flag = 1;
		}else{
			flag = 0;
		}
		map[i] = count;
	}
	for(int i = 0; i < q; i++){
		scanf("%d %d", &l, &r);
		printf("%d\n", map[r - 1] - map[l - 1]);
	}
	return 0;
}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()         

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn 
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 3e6 + 7, M = 998244353, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q, s;
int arr[N+2];
int dp[3002][3002];

int subset(int id, int sum   )
{     
      if(sum < 0) return 0;
      if(!sum) return id + 1;
      if( id == 0 ) return 0;

      int &mafia = dp[id][sum];
      if( mafia != -1 ) return mafia;

      int a = 0, b = 0;
      a = subset(id-1, sum);
      b = subset(id-1, sum-arr[id]);

      return mafia = (a+b)%M; 
}


void solve()
{
      cin >> n >> s;
      lop(i,1,n+1) cin >> arr[i];
      int ans = 0;
      memset(dp, -1, sizeof dp);
      lop(i,1,n+1) ans += subset(i,s), ans %= M;
      cout << ans;
}


int32_t main()
{
      
      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
     // INP(); 
      int t = 1;
      //cin >> t;
      while(t--) solve();

}











inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //






Measured memory_bytes: 72064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
// #define sort(a) sort(all(a))
using P = pair<int, int>;
using ll = long long;
using ld = long double;
typedef vector<int> vi;
int dx[4] = { 0, 1, 0,-1 };
int dy[4] = { 1, 0,-1, 0 };
const ll MOD = 1000000007;

signed main() {
  int a,b;
  cin >> a >> b;
  if(a<b) {
    for (int i = 0; i < b; i++) cout << a;
  } else {
    for (int i = 0; i < a; i++) cout << b;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main (){
	int a;
	long long int total = 0;
	scanf("%d", &a);
	
	for(int i = 1; i <= a; i++){
		if(i % 5 ==0 && i % 3 ==0 ){
			printf("");
		}
		else if (i % 3 ==0){
			printf("");
		}
		else if (i%5==0){
			printf("");
		}
		else{
			total = total + i;
		}
	}
	
	printf("%lld", total);
	return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main(void) {
	string s;
	string t;
	cin >> s;
	cin >> t;
	int n = s.length();
	int i = 0;
	int ans = 0;
	while ((int)t.find(s.front(), i) != -1 && ans < 1) {
		int l = (int)t.find(s.front(), i);
		string a = t.substr(l);
		string b = t.substr(0, l);
		if (a + b == s) {
			ans++;
		}
		i = l+1;
	}
	if (ans < 1) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>

int main()
{
	int n, m;

	std::cin >> n >> m;

	std::vector<std::vector<int> > v(n, std::vector<int>(n, 0));

	for (int i = 0; i < m; i++) {
		int a, b;

		std::cin >> a >> b;
		a--;
		b--;
		v[a][b]++;
		v[b][a]++;
	}

	for (int i = 0; i < n; i++) {
		std::cout << std::accumulate(v[i].begin(), v[i].end(), 0) << std::endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct edge { int to; int cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int dp[3010][3010];

int main(){
	int n,t;
	cin >> n >> t;
	vector<P> ab(n);
	rep(i,n) cin >> ab[i].first >> ab[i].second;
	sort(all(ab));
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= t; j++){
			// 食べない場合
			dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
			// 食べる場合
			if(j == t) continue; // もう食べれない
			dp[i+1][min(j+ab[i].first,t)] = max(dp[i+1][min(j+ab[i].first,t)],dp[i][j]+ab[i].second);
		}
	}
	cout << dp[n][t] << endl;

	return 0;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  if (s.length() % 2 != 0) {
    cout << "No" << endl;
    return 0;
  } else {
    REP(i, n / 2) {
      if (s[i] != s[i + n / 2]) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
long long absolute(long long a, long long b) {
  if (a < b)
    return b-a; 
  return a-b; 
}
using namespace std; 
int main() {
  long long n, k; 
  cin >> n >> k; 
  long long d = n%k; 
  if (absolute(d,k) < d) 
    cout << absolute(d,k); 
  else
    cout << d; 
  return 0; 
}

Measured memory_bytes: 3592
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int Y = scan.nextInt();
        int count = 0;
        int x = 0;
        int y = 0;

        for(x = 0; x <= N; x++){
            for(y = 0; y <= N-x; y++){
                if((Y == 10000*x + 5000 * y + 1000 * (N-x-y)) && (count == 0)){
                    System.out.println(x + " " + y + " " + (N - x- y));
                    count++;
                    break;
                }
            }
        }
        
        if(count == 0){            
            System.out.println("-1 -1 -1");
        }
    }
}

Measured memory_bytes: 23764
from collections import Counter

N = int(input())
s = [0]*N
for i in range(N):
    s[i] = ''.join(sorted(list(input())))

ct = Counter(s).values()
ct2 = Counter(ct).items()

ans = 0
for i, j in ct2:
    if i >= 2:
        ans += j*i*(i-1)//2

print(ans)


Measured memory_bytes: 19720
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  string s;
  int cnt=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='C'&&cnt==0) cnt++;
    if(s[i]=='F'&&cnt==1){
      cout<<"Yes"<<endl;
      break;
    }
    if(i==s.size()-1) cout<<"No"<<endl;
  }
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var N int
	var Y int
	fmt.Scan(&N, &Y)

	for i := 0; i <= N; i++ {
		if 10000*i > Y { break }
		for j := 0; j <= N-i; j++ {
			sum := 10000*i + 5000*j + 1000*(N-i-j)
			if  sum == Y {
				fmt.Printf("%d %d %d", i, j, N-i-j)
				return
			}
			if sum > Y { break }
		}
	}
	fmt.Println("-1 -1 -1")
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
	string s[100] = { { "" }, { "Man" }, { "Oku" }, { "Cho" }, { "Kei" }, { "Gai" }, { "Jo" }, { "Jou" }, { "Ko" }, { "Kan" }, { "Sei" }, { "Sai" }, { "Gok" }, { "Ggs" }, { "Asg" }, { "Nyt" }, { "Fks" }, { "Mts" } };
	int n, m;
	while (true){
		cin >> m >> n;
		if (m == 0 && n == 0)break;
		vector<int> p;
		p.resize(51);
		p[0] = 1;
		for (int i = 0; i < n; i++){
			for (int j = 0; j < 50; j++){
				p[j] *= m;
			}
			for (int j = 0; j < 50; j++){
				p[j + 1] += p[j] / 10000;
				p[j] %= 10000;
			}
		}
		for (int i = 50; i >= 0; i--){
			if (p[i]>0){
				cout << p[i];
				cout << s[i];
			}
		}
		cout << endl;
	}
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	int n;
  	cin >> n;
  	vi a(n), b(n), c(n-1);
  	int sum = 0;
  	rep(i,n) {
      	cin >> a[i];
    }
  	rep(i,n) {
      	cin >> b[i];
    	sum += b[i];
    }
  	rep(i,n-1) {
      	cin >> c[i];
    }
  	rep(i,n-1){
    	if(a[i+1]-a[i]==1) sum += c[a[i]-1];
    }
	cout << sum << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

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

	if (a * b % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}


		
}

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

namespace B___Small_and_Large_Integers
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = ABK[0];
            var B = ABK[1];
            var K = ABK[2];

            var arr = new List<int>();

            for (int i = A; i < A + K && i <= B; i++)
                arr.Add(i);

            for (int i = B - K + 1; i <= B && i >= A ; i++)
                arr.Add(i);

            foreach (var a in arr.Distinct().ToArray())
                Console.WriteLine(a);

        }
    }
}

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

int main() {
  char chFore[3];
  char chFact[3];
  int count = 0;
  cin >> chFore;
  cin >> chFact;
  
  for(int i = 0; i < 3; i++) {
	if(chFore[i] == chFact[i]) {
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }


map<ll,ll> m;

int main() {
  ll N,K;
  scanf("%lld%lld", &N,&K);
  ll a[N],b[N];
  for (int i = 0; i < N; ++i) {
    scanf("%lld%lld", &a[i],&b[i]);
    m[a[i]] += b[i];
  }

  ll count = 0;
  bool flug = true;
  int ref = 1;
  while(flug == true){
    count += m[ref];
    if(count>=K) flug = false;
    else ref++;
  }

  cout << ref << endl;



}



Measured memory_bytes: 8064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL <<60;
typedef long long ll;
using namespace std;

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

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

ll choose2(ll n){
    return n*(n-1)/2;
}

int n,m,q;
vector<int> a,b,c,d;
int ans;

void dfs(vector<int> A){
    if(A.size() == n+1){
        int now = 0;
        rep(i,0,q-1){
            if(A[b[i]] - A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans,now);
        return;
    }
    A.push_back(A.back());
    while(A.back()<=m){
        dfs(A);
        A.back()++;
    }
}

int main(){
    cin>>n>>m>>q;
    a = b = c = d = vector<int>(q);
    rep(i,0,q-1) cin>>a[i]>>b[i]>>c[i]>>d[i];
    dfs(vector<int>(1,1));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};

int main(){

    ll H, W;
    cin >> H >> W;
    for(ll i = 0; i < W + 2; i++)cout << "#";
    cout << endl;
    for(ll i = 0; i < H; i++){
        cout << "#";
        string s;
        cin >> s;
        cout << s << "#" << endl;
    }
    for(ll i = 0; i < W + 2; i++)cout << "#";
    cout << endl;
    

    return 0;
}

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

using namespace std;

long long ans, n, m, x, y, a[100005];
bool b[100005];

int main() {

    cin >> n >> m;
    b[1] = 1;

    for (int j = 1; j <= m; ++j){
        cin >> x >> y;
        if(a[x] != -1 && b[x]) b[y] = 1;
        a[y]++;
        a[x]--;
        if (a[x] == -1) b[x] = 0;
    }
    for (int i = 1; i <= n; ++i){
        ans += b[i];
    }

    cout << ans;

    return 0;

}


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

#define dbg(a)	cerr << #a << " = " << a << endl;

int main(){
	int n, r;	cin >> n >> r;
	if(n >= 10){
		cout << r << endl;
	}
	else{
		cout << r+100*(10-n) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
const int mxn=1e5+5;
vector<int>fact;
ll up5(ll x){
	return x*1ll*x*x*x*x;
}
int main(){
	fast;
	ll x; cin>>x;// if(x==1){cout<<0<<" "<<-1<<endl; return 0;}
	for(ll i=1ll; i*1ll*i<=x; i++) if(x%i==0){
		fact.push_back(i); if(i!=x/i) fact.push_back(x/i);
	}
	for(ll i:fact){
		ll l=(-1ll)*i/2, r=500, md;
		ll ans=10000;
		while(r-l>3){
			md=(l+r)/2;
			ll res=up5(md+i)-up5(md);
			if(res>x) r=md-1;
			else if(res<x) l=md+1;
			else if(res==x){ans=md; break;}
		}
		if(ans!=10000){
			cout<<ans+i<<" "<<ans<<endl;
			return 0;
		}
		for(ll j=l; j<=r; j++){
			ll res=up5(j+i)-up5(j);
			if(res==x){
				cout<<j+i<<" "<<j<<endl;
				return 0;
			}
		}
	}
}

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

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

int n, q, cnt[200001], res[200001];
vector<int> adj[200001];
bool vis[200001];

void dfs(int vtx, int sum){
	vis[vtx] = true;
	sum += cnt[vtx];
	res[vtx] = sum;
	for(auto &i : adj[vtx])
		if(!vis[i]) dfs(i, sum);
}

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> q;
	for(int i = 0; i < n - 1; i++){
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	for(int i = 0; i < q; i++){
		int p, x;
		cin >> p >> x;
		cnt[p] += x;
	}
	dfs(1, 0);
	for(int i = 1; i <= n; i++) cout << res[i] << ((i == n) ? '\n' : ' ');
	return 0;
}

Measured memory_bytes: 21120
#! coding: utf-8

N = int(input())
C = list(input())

judged = True
red_flg = True
for c in C:
    if (red_flg == True) and (c == 'W'): red_flg = False
    if (red_flg == False) and (c == 'R'): judged = False

red_cnt = C.count('R')

if (judged):
    print(0)
else:
    print(C[red_cnt:].count('R'))

Measured memory_bytes: 11916
if __name__ == "__main__":
    N, M = [int(s) for s in input().split()]
    accepted = [False] * N
    penalties = [0] * N
    for _ in range(M):
        p, S = input().split()
        p = int(p)
        # S = 'AC' or 'WA'
        if S == "AC":
            accepted[p - 1] = True
        if S == "WA" and not accepted[p - 1]:
            penalties[p - 1] += 1

    N_accepted = len([a for a in accepted if a])
    sum_penalties = sum([p for p, a in zip(penalties, accepted) if a])
    print(N_accepted, sum_penalties)

Measured memory_bytes: 5424
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
ans = 0

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

A = factorization(N)

#print(A)

for i in A:
    for j in range(1, 10**12):
        if(i[1]<j*(j+1)//2):
            ans += j-1
            break
if(N == 1):
    print(0)
else:
    print(ans)


Measured memory_bytes: 69216
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;

signed main() 
{
    fastio;
    int n,r;
    cin>>n>>r;
    if(n>=10)cout<<r<<endl;
    else cout<<r+100*(10-n)<<endl;
}


Measured memory_bytes: 256