akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool count = true;
    while (a > 0 && c > 0) {
        if (count == true) {
            c -= b;
        } else {
            a -= d;
        }
        count = !count;
    }
    if (count == false) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> x(n);
  std::cin >> x;

  std::map<int64_t, int64_t> m;

  for (int64_t i = 0; i < n; i++) {
    m[x[i] - 1] = i;
  }
  std::vector<int64_t> ans;

  for (const auto i : m) {
    int64_t least = i.second;
    while (least != 0) {
      if (m.count(ans.size()) != 0) {
        ans.push_back(m[ans.size()] + 1);
      } else {
        ans.push_back(i.second + 1);
        least--;
      }
    }
    if (i.first < ans.size()) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }

  for (const auto i : m) {
    int64_t least = n - i.second - 1;

    while (m.count(ans.size()) != 0) {
      ans.push_back(m[ans.size()] + 1);
    }

    if (ans.size() <= i.first) {
      std::cout << "No" << std::endl;
      return 0;
    }
    while (least != 0) {
      if (m.count(ans.size()) != 0) {
        ans.push_back(m[ans.size()] + 1);
      } else {
        ans.push_back(i.second + 1);
        least--;
      }
    }
  }
  std::cout << "Yes" << std::endl;
  for (int64_t i = 0; i < ans.size(); i++) {
    std::cout << ans[i];
    if (i + 1 == ans.size()) {
      std::cout << std::endl;
    } else {
      std::cout << " ";
    }
  }

  return 0;
}

Measured memory_bytes: 3316
n, m = map(int, input().split())
h = list(map(int, input().split()))

d = [[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    d[a - 1].append(b - 1)
    d[b - 1].append(a - 1)

ans = 0
for i in range(n):
    flg = True
    for j in d[i]:
        if h[i] <= h[j]:
            flg = False
            break
    if flg:
        ans += 1

print(ans)

Measured memory_bytes: 29496
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=2e5+10;
const int mod=2019;

int dp[2][2050];
int n,a[maxn];
string s;

int main(){
	cin>>s; 
	n=(int)s.size();
	for(int i=0;i<s.size();i++) a[i+1]=s[i]-'0';
	ll ans=0;
	for(int i=1;i<=n;i++){
		int now=(i-1)%2,nxt=i%2;
		dp[nxt][a[i]]=1;
		for(int d=0;d<mod;d++){
			int d2=(d*10+a[i])%mod;
			dp[nxt][d2]+=dp[now][d];
		}
		ans+=dp[nxt][0];
		for(int d=0;d<mod;d++) dp[now][d]=0;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4508
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	ans := 0
	tmp := 0

	for i := 0; i < 3; i++ {
		if s[i] == 'R' {
			tmp++
		} else {
			if ans < tmp {
				ans = tmp
			}
			tmp = 0
		}
	}
	if ans < tmp {
		ans = tmp
	}

	fmt.Println(ans)
}


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

int main(){
	string s; 
	int x=0,mx=0,n;
	cin>>n;
	getchar();
	getline(cin,s);
	for(int i=0;i<n;i++){
		if(s[i]=='I'){
			x++;
		}else{
			x--;
		}
		mx=max(mx,x);
	}
	cout<<mx;
	return 0;
}


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

typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<ll, ll> P;
typedef tuple<ll,ll,ll> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr ll INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    ll N,M,K; cin >> N >> M >> K;
    VI A(N), B(M); REP(i,N) cin >> A[i]; REP(i,M) cin >> B[i];
    VL SA(N+1,0), SB(M+1,0);
    REP(i,N) SA[i+1] = SA[i]+A[i];
    REP(i,M) SB[i+1] = SB[i]+B[i];

    ll ans = 0;
    REP(i,N+1){
        if(K-SA[i]<0) break;
        int itr = LB(SB,K-SA[i]+1);
        chmax(ans, i+itr-1);
    }
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    ll t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}

Measured memory_bytes: 9524
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
string s;
int q;
int main(){
	cin>>s;
	read(q);
	int now=1;
	while(q--){
		int op1,op2;
		string c;
		read(op1);
		if(op1==1){
			now^=1;
		}
		else{
			read(op2);cin>>c;
			if(op2==1){
				if(now==1)s.insert(0,c);
				else s+=c;
			}
			else{
				if(now==1)s+=c;
				else s.insert(0,c);
			}
		}
	}
	if(now==1)
		cout<<s<<endl;
	else reverse(s.begin(),s.end()),cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 900
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 目標の文字を決める -> シミュレーション

import numpy as np

S = np.array(list(read().rstrip()))

def F(S,x):
    A = (S == x)
    t = 0
    while True:
        if np.all(A):
            return t
        A = (A[:-1] | A[1:])
        t += 1

answer = min(F(S,x) for x in set(S))
print(answer)

Measured memory_bytes: 12548
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    ll n, d, cnt = 0;
    cin >> n >> d;
    ll x, y;
    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        if (sqrt(x * x + y * y) <= d)
            cnt++;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 3164
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    h,w = map(int, input().split())
    S = [input() for _ in range(h)]
    ans = [[0]*(w+2) for _ in range(h)]
    ans.insert(0, [0]*(w+2))
    ans.append([0]*(w+2))

    for i in range(h):
        for j in range(w):
            if S[i][j] == '#':
                for k in [-1, 0, 1]:
                    for l in [-1, 0, 1]:
                        if k == l == 0:
                            ans[i+1][j+1] = '#'
                        if ans[i+k+1][j+l+1] != '#':
                            ans[i+k+1][j+l+1] += 1
    for i in range(1,h+1):
        tmp = ''
        for j in range(1,w+1):
            tmp += str(ans[i][j])
        print(tmp)


if __name__ == '__main__':
    main()


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

#define pb push_back
#define mp make_pair

typedef long long ll;

const ll mod = 1e9 + 7;

int cnt[1000];

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

  for(int i = 1; i <= n; i++){
    int x = i;
    for(int j = 2; j*j <= i; j++){
      while(x % j == 0){
        x /= j;
        cnt[j]++;
      }
    }
    if(x != 1) cnt[x]++;
  }

  ll ans = 1;
  for(int i = 1; i < 1000; i++){
    if(cnt[i]){
      ans = ans * (cnt[i]+1) % mod;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
	int n;cin>>n;int a[n],b[n],c[n];
	for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
	ll dp[n][3];
	dp[0][0]=a[0];dp[0][1]=b[0];dp[0][2]=c[0];
	for(int i=1;i<n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i];
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b[i];
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
	}
	ll ans=max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
	cout<<ans<<endl;
}

Measured memory_bytes: 3712
# -*- coding: utf-8 -*-

N, M = map(int, input().split())
P = list()
S = list()
for i in range(M):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)

ac = 0
penalty = 0
if M == 0:
    print(ac, penalty)
    exit()

ac_list = [0] * N
wa_list = [0] * N
for i in range(M):
    if S[i] == 'AC' and ac_list[P[i] - 1] == 0:
        ac_list[P[i] - 1] = 1
        ac += 1
    elif S[i] == 'WA' and ac_list[P[i] - 1] == 0:
        wa_list[P[i] - 1] += 1

for i in range(N):
    if ac_list[i] == 1:
        penalty += wa_list[i]

print(ac, penalty)


Measured memory_bytes: 14896
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    //(1)%2==0 (2)==0となるようにしたい。
    int N;
    cin >> N ;
    vector<int> vec(N);
    bool answer =true;
    int count =0;

  for (int i=0; i<N;i++){
     cin>>vec.at(i);
  }
  for(int j=1;  ; j++){
  for(int i=0 ; i<N;i++){ 
     if(vec.at(i)%2==1){
      answer = false;
      break;
     }
     vec.at(i)/=2;
      }
    if(answer){
       count++;
    }
    else {
        break;
    }
  }
  cout << count++ <<endl;
}

Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string a;
            a = Console.ReadLine(); //標準入力
            int anser = 0;
            for(int i = 0;i < a.Length; i++)
            {
                anser += int.Parse(a[i].ToString());
            }
            int b = int.Parse(a);
            if (b % anser == 0) Console.WriteLine("Yes");
            else Console.WriteLine("No");

        }
    }
}


Measured memory_bytes: 11092
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		if (A == B && B == C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Pair {
		private int A;
		private int B;

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

		public int getA() {
			return A;
		}

		public int getB() {
			return B;
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}


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

int main(){
    int N;
	cin >> N;
    vector<int> a(N+1,0);
    for(int i=1; i<N+1; i++){
        cin >> a.at(i);
    }

    int ans=0;
    for(int i=1; i<N+1; i++){
        if( i%2 != 0 ){
            if ( a.at(i)%2 !=0 ){
                ans++;
            }
        }
    }
    
    cout << ans << endl;

}


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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    if(n%10 == 2)ans++;
    if(n%100/10 == 2)ans++;
    if(n%1000/100 == 2)ans++;
    if(n/1000 == 2)ans++;
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using LL = long long;

const int MOD = 1e9+7;

class Edge{
public:
    LL from,to, value;
    Edge(int f,int t, int c){
        from = f;
        to = t;
        value = c;
    }
};

int main(){
    int K,T;cin >> K >> T;
    priority_queue<int> que;
    for(int i = 0;i < T;i++){
        int b;cin >> b;
        que.push(b);
    }
    int ans = 0;
    int usi = que.top();
    que.pop();
    usi--;
    while(que.size() >= 1){
        int q = que.top();
        que.pop();
        q--;
        if(usi != 0)que.push(usi);
        usi = q;
    }
    cout<<que.top()-1<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
string S;
 
int Check(int a)
{
  if(S[a]!='m')return 0;
  a++;
  if(S[a]!='e'){
    a=Check(a);
    if(a==0)return 0;
  }
  a++;
  if(S[a]!='w'){
    a=Check(a);
    if(a==0)return 0;
  }
  a++;
  return a;
}
 
int main()
{
  cin>>S;
  if(Check(0)==S.length())cout<<"Cat"<<endl;
  else cout<<"Rabbit"<<endl;
  return 0;
}


Measured memory_bytes: 3192
import math
import itertools

N = int(input())

towns = [ list(map(int, input().split())) for _ in range(N) ]


# 順列の生成
p = itertools.permutations(range(N))

# 総数
totalCount = math.factorial(N)

prevX = 0
prevY = 0

totalKyori = 0

for nr in p:
    for i, nt in enumerate(nr):
        if i == 0:
            prevX = towns[nt][0]
            prevY = towns[nt][1]
        else:
            # 前の町と今の町の距離を計算
            kyori = math.sqrt( (prevX - towns[nt][0])**2 + (prevY - towns[nt][1])**2 )
            totalKyori += kyori


print(totalKyori / totalCount)

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

using namespace std;

int main(void) {
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

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

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int h,w,n;cin>>h>>w>>n;
    int m=mmax(h,w);
    int ans=n/m;
    if(n%m!=0)ans++;
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(a))
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,k,a[101],ans=-1e9,b[101];
vi v;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>k;
	fo(i,0,n)cin>>a[i];
	int u=0;
	fo(i,0,n)u+=a[i];
	fo(i,0,k+1){
		if(i>=n){
			fo(j,0,n)b[j]=a[j];
			sort(b,b+n);
			int x=u;
			fo(j,0,k-i) if(b[j]<0)x-=b[j];
			ans=max(ans,x);
		}
		else fo(j,0,i+1){
			v.clear();
			int l=i-j;
			fo(x,0,j)v.pb(a[x]);
			fo(x,0,l)v.pb(a[n-x-1]);
			sort(all(v));
			int f=0;
			fo(x,0,v.size())f+=v[x];
			fo(x,0,min(k-i,(int)v.size())) if(v[x]<0)f-=v[x];
			ans=max(ans,f);
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

string xmaseve (string xmas, int n) {
    if (n==25)
        return xmas;
    else if (n<25) {
        return (xmaseve(xmas, n+1) + " Eve");
    }
}

int main(){
	ios_base::sync_with_stdio(false);
  	cin.tie(NULL); cout.tie(NULL);

    int n;

    cin >> n;

    cout << xmaseve("Christmas", n);

}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	A, B := nextInt(), nextInt()
	gcd := gcdof2numbers(A, B)
	pf := primeFuctorize(gcd)
	fmt.Println(len(pf) + 1)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


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

using namespace std;

typedef long long swl;

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

int main(void) {
  swl a, b, dv;

  cin >> a >> b;
  dv = gcd(a, b);
  cout << a/dv * b/dv * dv << endl;

  return 0;
} 


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

int main(){
	char c;
	cin >> c;
	if (c <= 'Z'){
		cout << "A" << endl;
	}else{
		cout << "a" << endl;
	}
	return 0;
}



Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll H,W;
    cin >>H>>W;
    vector<string> S(H);
    vector<vector<ll>>RL(H,vector<ll>(W));
    vector<vector<ll>>UD(H,vector<ll>(W));
    rep(i,H){
        cin>>S[i];
    }

    rep(i,H){
        ll cnt=0;
        rep(j,W){
            if(S[i][j]=='.'){
                cnt++;
            }else{
                rep3(k,j-cnt,j){
                    RL[i][k]=cnt;
                }
                cnt=0;
            }
        }
        rep3(k,W-cnt,W){
            RL[i][k]=cnt;
        }

    }

    rep(i,W){
        ll cnt=0;
        rep(j,H){
            if(S[j][i]=='.'){
                cnt++;
            }else{
                rep3(k,j-cnt,j){
                    UD[k][i]=cnt;
                }
                cnt=0;
            }
        }
        rep3(k,H-cnt,H){
            UD[k][i]=cnt;
        }

    }
    ll ans =0;
    rep(i,H){
        rep(j,W){
            
           chmax(ans,RL[i][j]+UD[i][j]-1);
        }
        
    }


    cout<<ans<<endl;



    return 0;
    

}

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

int main() {
  int N, i;
  string S;
  cin >> N;
  for (i = 0; i < N; i++){
    cin >> S;
    if (S == "Y"){
      cout << "Four" <<endl;
      break;
    }
    else {
      if (i == N-1){
        cout << "Three" <<endl;
      }
      else {
        continue;
      }
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;

void Result (int mid, int last, int make){
	if(mid == -1 || last == -1 || mid+last < 30) cout << 'F' << endl;
	
	else if(mid+last >= 80) cout << 'A' << endl;
	
	else if(mid+last >= 65) cout << 'B' << endl;
	
	else if(mid+last >= 50 || make >= 50) cout << 'C' << endl;
	
	else if(mid+last >= 30) cout << 'D' << endl;
}


int main(){
	int mid,last,make;
	
	while(true){
		cin >> mid >> last >> make;
		
		if(mid == -1 && last == -1 && make == -1) break;
		
		Result(mid, last, make);
	}
}

Measured memory_bytes: 3076
#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 rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	int ans = 0;
	int A = 1;
	for (int i = 1; i <= n; i++) {
		int cnt = 0;
		int t = i;
		while (t % 2 == 0) {
			t /= 2;
			cnt++;
		}
		if (chmax(ans, cnt)) A = i;
	}

	cout << A << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//using
using intl = long long;
using itnl = long long;//typo用
using uintl = unsigned long long;
using itn = int;//typo用
using ld = long double;
using namespace std;

//関数マクロ
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a) - 1; i >= (intl)(b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define debug(x) cout << #x << ":" << x << endl

//定数マクロ
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>

//定数
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = acos(-1);

//テンプレート関数
template<class T> inline bool chmin(T& a, T b) { if (a > b) {a = b; return true;} return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) {a = b; return true;} return false; }
//intl gcd(intl a, intl b){ if(!b)return a; return gcd(b, a % b); } //c++17からある
//intl lcm(intl a,intl b){ return a / gcd(a, b) * b; } //c++17からある

//自作テンプレート関数
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}//Yes,Noの出力を楽にするよう
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}//上の関数のYes,Noを任意の文字列でできるようにしたもの
intl kai(intl k){ intl a = 1; for(int i = 2; i <= k; i++){ a *= i; } return a; }//k!を求める関数,O(N)
intl digit10(intl a){ intl b = 0; do{ a /= 10; b++; }while(a); return b; }//aを10進数で表したときの桁数を求める関数,桁数回の演算だからだいたいO(logN)くらい?



signed main(){
    cout << fixed << setprecision(10);
    intl n;
    cin >> n;
    intl cnt[4];
    m0(cnt);
    rep(i,n){
        string s;
        cin >> s;
        if(s == "AC")cnt[0]++;
        else if(s == "WA")cnt[1]++;
        else if(s == "TLE")cnt[2]++;
        else cnt[3]++;
    }
    cout << "AC x " << cnt[0] << endl;
    cout << "WA x " << cnt[1] << endl;
    cout << "TLE x " << cnt[2] << endl;
    cout << "RE x " << cnt[3] << endl;
    return 0;
}


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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9+7;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;

    vector<ll> a(n);
    REP(i, n) {
        cin >> a[i];
    }

    sort(ALL(a));
    ll ans = 1;

    if (n % 2 != 0) {
        if (a[0] != 0) {
            MSG(0)
            exit(EXIT_SUCCESS);
        }

        ll idx = 1;
        ll now = 2;
        while (idx < n) {
            if (a[idx] != now || a[idx+1] != now) {
                MSG(0)
                exit(EXIT_SUCCESS);
            }
            idx += 2;
            now += 2;
            ans *= 2;
            ans = ans % MOD;
        }

    } else {
        ll idx = 0;
        ll now = 1;
        while (idx < n) {
            if (a[idx] != now || a[idx+1] != now) {
                MSG(0)
                exit(EXIT_SUCCESS);
            }
            idx += 2;
            now += 2;
            ans *= 2;
            ans = ans % MOD;
        }
    }

    MSG(ans % MOD)
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int a[225252];
ll sum[225252];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",a+i);
  REP(i,n)sum[i+1] = sum[i] + a[i];
  ll ans = 1e18;
  FOR(i,1,n){
    CHMIN(ans, abs(sum[i]-(sum[n]-sum[i])));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(long long i=a; i<b; i+=1)
#define repr(i,a,b) for(long long i=a; i<=b; i+=1)
#define vec vector<ll>
#define map map<string,int>
#define repa(p,A) for(auto p:A)
#define pb push_back
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())

using namespace std;
int main() {
  string S;
  cin>>S;
  if(S=="ARC")
    cout<<"ABC"<<endl;
  else
    cout<<"ARC"<<endl;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int x;
    cin>>x;
    int ans=(x/11)*2;
    x%=11;
    if(x){
        ans++;
        x=max(0ll,x-6);
    }
    if(x)ans++;
    cout<<ans<<endl;
    return 0;
}


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

#define ll long long
ll w,h,x,y,ret=0;
long double ans;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>w>>h>>x>>y;
	if(w==x*2 && h==y*2)
		ret=1;
	ans=double(w*h)/2.0;
	cout<<fixed<<setprecision(6)<<ans<<' '<<ret;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second
int main()
{
    ll n;cin >> n;
    string ans;
    while(n>0)
    {
        ans.pb((char)((n-1)%26+'a'));
        n = n-(n-1)%26;
        n = n/26;
    }
    reverse(all(ans));
    cout << ans << endl;
}
    

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define re register
#define rep(i,a,b) for(re int i=a,i##end=b; i<=i##end; i++)
#define drep(i,a,b) for(re int i=a,i##end=b; i>=i##end; i--)
#define repp(i,a,b) for(re int i=a,i##end=b; i<i##end; i++)
#define drepp(i,a,b) for(re int i=a,i##end=b; i>i##end; i--)
#define Erep(i,x) for(int i=head[x]; ~i; i=Edge[i].nxt)
#define ll long long
#define debug(x) cerr<<#x<<" = "<<x<<endl
#define lowbit(x) (x&-x)
#define ms(x,a) memset(x,a,sizeof x)
using namespace std;
template <class T> inline bool Max(T &x, T y){
	return x<y?x=y,1:0;
}
template <class T> inline bool Min(T &x, T y){
	return x>y?x=y,1:0;
}
template <class T> inline T rd() {
	static char ch;static bool neg;
	static T x=0;
	for(ch=neg=0;ch<'0' || '9'<ch;neg|=ch=='-',ch=getchar());
	for(x=0;'0'<=ch && ch<='9';(x*=10)+=ch-'0',ch=getchar());
	return x=(neg?-x:x);
}
const int mod=1e9+7,oo=1e9;

int main(){
	int a=rd<int>(),b=rd<int>();
	printf("%d\n",max(a+b,max(a-b,a*b)));
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
typedef long long ll;
typedef unsigned long long ull;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(ll i = (a); i < (ll) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define MOD 1000000007

int main() {
    FIN;
    string s;
    cin >> s;
    ll cont =0;
    forn(i,s.size())
    {
        if(s[i]!=s[s.size()-1-i])
        {
            cont++;
            s[i]=s[s.size()-1-i];
        }
    }
    cout << cont << endl;
    return 0;
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define GOOGLE 0
#define MULTIPLE_TC 0

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 998244353;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

const int N = 2e5 + 10;
int f[N];

void pre(){ // Reset each global variable (esp. for graphs)
  f[0] = 1;
  for(int i = 1; i < N; i++){
    f[i] = mul(i, f[i - 1]);
  }
}

int nCr(int n, int r){
  if(n < r)
    return 0;
  return mul(f[n], inv(mul(f[r], f[n - r])));
}

void solve(){
  int n, m, k, i, ans = 0;
  cin >> n >> m >> k;
  for(i = 0; i <= k; i++){
    int ways = nCr(n - 1, n - i - 1);
    int cols = mul(m, modexpo(m - 1, n - i - 1));
    ans = add(ans, mul(ways, cols));
  }
  cout << ans << '\n';
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL); 

  pre();

  int t = 1, T;

  if(MULTIPLE_TC)
    cin >> t;

  for(T = 1; T <= t; T++){
    if(GOOGLE)
      cout << "Case #" << T << ": ";
    solve();
  }

  ktj();
}


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

int main() {
  int H, W;
  cin >> H >> W;
  string all_S = "";
  
  for (int k = 0-1; k < W+1; k++) {
    all_S += '.';
  }
  for (int i = 0; i < H; i++) {
    string S;
    cin >> S;
    all_S += '.' + S + '.';
  }
  for (int k = 0-1; k < W+1; k++) {
    all_S += '.';
  }

  //cout << all_S << endl;

  for (int i = 1; i < H+1; i++) {
    for (int j = 1; j < W+1; j++) {
      //int x = 0;
      if (all_S.at((W+2)*i+j) == '#') {
        //result_all_S += '#';
        cout << '#';
        continue;
      }
      else if (all_S.at((W+2)*i+j) == '.') {
        int x = 0;
        if (all_S.at((W+2)*(i-1)+(j-1)) == '#') x++;
        if (all_S.at((W+2)*(i-1)+j    ) == '#') x++;
        if (all_S.at((W+2)*(i-1)+(j+1)) == '#') x++;
        if (all_S.at((W+2)*i    +(j-1)) == '#') x++;
        if (all_S.at((W+2)*i    +(j+1)) == '#') x++;
        if (all_S.at((W+2)*(i+1)+(j-1)) == '#') x++;
        if (all_S.at((W+2)*(i+1)+j    ) == '#') x++;
        if (all_S.at((W+2)*(i+1)+(j+1)) == '#') x++;
        //result_all_S += x;
        cout << x;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import sys
from heapq import heappush, heappop

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
works = [[] for _ in range(M+1)]
#Bが報酬
for _ in range(N):
    a, b = lr()
    if a <= M:
        works[a].append(b)

cand = []
answer = 0
for i in range(1, M+1):
    for work in works[i]:
        heappush(cand, -work)
    if cand:
        answer -= heappop(cand)

print(answer)


Measured memory_bytes: 23748
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

typedef  pair<int,int> P;
typedef long long LL;

const LL  INF=1<<31;



int main(){
     LL a,b,x;
     cin>>a>>b>>x;
     LL ans=b/x-a/x+(a%x==0);
     cout<<ans<<endl;
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout << fixed << setprecision(10);
	string s, t;
	cin >> s >> t;
	REP(i, s.size()){
		bool flg = true;
		REP(j, s.size()){
			if(s[(i + j) % s.size()] != t[j]){
				flg = false;
				break;
			}
		}
		if(flg){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int Partition(int *,int,int);
int main()
{
  int i,n,q;
  int A[2000000];

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

  q=Partition(A,0,n-1);

  for(i=0;i<q;i++){
    printf("%d ",A[i]);
  }
  printf("[%d] ",A[q]);
  for(i=q+1;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n",A[i]);
  return 0;
}

int Partition(int *A,int p,int r)
{
  int x,i,j,temp;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;
}



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

int main() {
  int N,M,ans;
  cin>>N>>M;
  for(int i=0;i<100;i++){
    if(i*(N-1)+1>=M){
      ans=i;
      break;
    }
  }
  cout<<ans;
  
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >>D;
  if (B <= C)
    cout << 0 << endl;
  else if (D <= A)
    cout << 0 << endl;
  else if (A <= C && B <= D)
    cout << B - C << endl;
  else if (A < C && D < B)
    cout << D - C << endl;
  else if (C <= A && D < B)
    cout << D - A << endl;
  else if (C < A && B <= D)
    cout << B - A << endl;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
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; }
ll a,b,n;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>a>>b;
    if(a>b)return cout<<0<<"\n",0;
    if(n==1&&a!=b)return cout<<0<<"\n",0;
    ll summax=a+b+max(n-2,ll(0))*b;
    ll summin=a+b+max(n-2,ll(0))*a;
    cout << summax-summin+1<< "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1000000007;
void files(){
 freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);

}
void fast(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

}
int main(){
 fast();
 ll n;
 cin>>n;
 vector<ll> x(n,0),y(n,0);
 for(int i=0; i<n; i++){
    ll a,b;
    cin>>a>>b;
    x[i]=a-b;
    y[i]=a+b;
 }
 sort(x.begin(),x.end());
 sort(y.begin(),y.end());
 cout<<max(x[n-1]-x[0],y[n-1]-y[0]);
}

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

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

int main(){
    int N,M,i,a,b,count=0;
    int *H,*A,*B,*f;
    cin >> N >> M;
    H = new int[N];
    A = new int[M];
    B = new int[M];
    f = new int[N]; //高さ負けたフラグ
    for(i=0;i<N;i++) f[i] = 0;
    for(i=0;i<N;i++) cin >> H[i];
    for(i=0;i<M;i++) cin >> A[i] >> B[i];
    for(i=0;i<M;i++){
        a = H[A[i]-1];
        b = H[B[i]-1];
        if(a > b){
            f[B[i]-1]++;
        }else if(b > a){
            f[A[i]-1]++;
        }else{
            f[A[i]-1]++;
            f[B[i]-1]++;
        }
    }
    for(i=0;i<N;i++){
        if(f[i] == 0) count++;
    }
    cout << count;
}

Measured memory_bytes: 5192
n,m=map(int,input().split())
a=list(map(int,input().split()))

from collections import Counter
c=Counter()
s=0
c[s]+=1
for i in range(n):
  s+=a[i]
  c[s%m]+=1

ans=0
for v in c.values():
  ans+=v*(v-1)//2
print(ans)


Measured memory_bytes: 14696
#include <stdio.h>

int main(){
   int  h1,m1,h2,m2,k,l;

   scanf("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
   l=h2*60+m2-h1*60-m1;
   printf("%d\n",l-k);
   return 0;
}


Measured memory_bytes: 1732
/*input
271828182
*/
#include <string.h>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std;

int main()
{
	long int n,i;
	cin>>n;
	for(i=n;i>0;i--)
	{
		int s = sqrt(i);
		if(s*s == i)
		{
			cout<<i;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int num,num2,sum=0,num3;
    cin >> num >> num2;
    int x[num2];
    for(int i=0; i<num2; i++){
        cin >> x[i];
    }
    for(int i=0; i<num2; i++){
        sum+=x[i];
    }
    num+=1;
    num3=sum/num;
    if(sum%num>0){
        num3+=1;
    }
    cout << num3 <<  endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long long> r(n);
    long long ans=-1e9;
    for(int i=0;i<n;i++) cin >> r[i];
    long long minv = r[0];
    for(int i=1;i<n;i++){
        ans=max(ans,r[i]-minv);
        minv=min(minv, r[i]);
        
    }
    
    //sort(r.begin(), r.end());
    
    cout << ans << endl;
    return 0;
}


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

#define all(v) v.begin(), v.end()
#define mp make_pair
#define EPS (int)1e-9
#define PI acos(-1)
#define endl '\n'
#define pb push_back
#define fi first
#define se second

using namespace std;
using ld = long double;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

const int mod = 1000000007;

map<char, int> toFreqMap(string &s)
{
	map<char, int> freq;
	int n = s.size();

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

	return freq;
}

map<char, int> intersect(map<char, int>&a, map<char, int>&b)
{
	map<char, int> ans;

	for(pair<char, int> x: a)
	{
		if(b.find(x.fi) != b.end())
			ans[x.fi] = min(x.se, b[x.fi]);
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;
	string s = "";
	cin >> s;

	map<char,int> ans, aux;
	ans = toFreqMap(s);

	for(int i = 1; i < n; i++)
	{
		s = "";
		cin >> s;
		aux = toFreqMap(s);
		ans = intersect(ans, aux);
	}

	if(!ans.empty())
		for(pair<char, int> x: ans)
			cout << string(x.se, x.fi);

	cout << endl;

	return 0;	
}

Measured memory_bytes: 256