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

typedef long long int64;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

int main() {
  int N;
  std::map<string, int> S;
  std::cin >> N;
  REP(i, N) {
    string s;
    std::cin >> s;
    S[s]++;
  }

  std::cout << "AC "
            << "x " << S["AC"] << std::endl;
  std::cout << "WA "
            << "x " << S["WA"] << std::endl;
  std::cout << "TLE "
            << "x " << S["TLE"] << std::endl;
  std::cout << "RE "
            << "x " << S["RE"] << std::endl;
  return 0;
}


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

int main() {
    int L, R; cin >> L >> R;
    long long ans = 2019;

    if(R-L >= 2019){
        cout << 0 << endl;
    } else {
        for (long long i = L; i < R; ++i) {
            for (long long j = L+1; j <= R; ++j) {
                if((i*j)%2019<ans) ans = (i*j)%2019;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 1e9 + 7;

template<long long int P>
struct _mint {
  long long int x;
  _mint(long long int x = 0): x((x % P + P) % P) {}

  _mint operator-() const {
    return _mint(-x);
  }

  _mint& operator+=(const _mint a) {
    if((x += a.x) >= P) {
      x -= P;
    }
    return *this;
  }
  _mint& operator-=(const _mint a) {
    if((x += P - a.x) >= P) {
      x -= P;
    }
    return *this;
  }
  _mint& operator*=(const _mint a) {
    (x *= a.x) %= P;
    return *this;
  }
  _mint& operator/=(const _mint a) {
    return (*this) *= a.inv();
  }

  _mint operator+(const _mint a) const {
    _mint res(*this);
    return res += a;
  }
  _mint operator-(const _mint a) const {
    _mint res(*this);
    return res -= a;
  }
  _mint operator*(const _mint a) const {
    _mint res(*this);
    return res *= a;
  }
  _mint operator/(const _mint a) {
    _mint res(*this);
    return res /= a;
  }

  _mint pow(long long int t) const {
    if(! t) return 1;
    _mint a = pow(t >> 1);
    a *= a;
    if(t & 1) a *= *this;
    return a;
  }

  // for prime P
  _mint inv() const {
    return pow(P - 2);
  }
};
using mint = _mint<MOD>;

const int MAX = 2e+6 + 1;
mint fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i;
        inv[i] = mint(MOD) - inv[MOD%i] * (MOD / i);
        finv[i] = finv[i - 1] * inv[i];
    }
}
mint COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * finv[k] * finv[n - k];
}

int main() {
  int n;
  ll k;
  std::cin >> n >> k;

  COMinit();
  mint ans = 0;
  for(int m = 0; m <= (int)std::min((ll)n, k); ++m) {
    ans += COM(n, m) * COM(n - 1, n - m - 1);
  }
  std::cout << ans.x << '\n';
}


Measured memory_bytes: 47104
N=int(input())
S=[]
T=[]
for i in range(N):
  s,t=input().split()
  S.append(str(s))
  T.append(int(t))
X=str(input())

triger=0
j=0
A=0
for i in S:
  if triger==1:
    A+=T[j]
  if i==X:
    triger=1
  j+=1
print(A)

Measured memory_bytes: 3064
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(input())
    S = input()

    print("Yes") if S[:N//2] == S[N//2:] else print("No")


main()


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

using namespace std;


typedef int32_t h_int32;
typedef int64_t h_int64;
typedef uint32_t uh_int32;
typedef uint64_t uh_int64;
typedef h_int64 h_int;

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

#define VINIT( v, type, n )vector<type> v; v.resize( n );
#define VINIT2( v, type, n, a )vector<type> v; v.resize( n, a );
#define VCIN( v, type, n ) VINIT( v, type, n ) REP( i, n ) cin >> v[i];

#define DOUT( x ) cerr << #x << " = " << x << "\n";
#define COUT( x ) cout << ( x ) << "\n";

#define INF 999999999



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

        int n;
        scanf( "%d", &n );
        printf( "ABC%3d", n );
        return 0;
}


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

int main(){
  int N;
  cin >>N;
  map <int,int> P;
  int temp=0;
  for(int i=0;i<N;i++){
    cin>>temp;
    if(P[temp]==0){
      P[temp]++;
    }
    else P[temp]--;
  }
  int cnt=0;
  for (auto x: P)
    cnt=cnt+x.second;
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long lli;

const int MAXP = 200000;
bool isP[MAXP];
vector<lli> Prime;

int main() {
  fill(isP, isP+MAXP, true);
  isP[0] = isP[1] = false;
  for(int i = 2; i < MAXP; ++i) {
    if(!isP[i]) continue;
    Prime.push_back(i);
    for(int j = i*2; j < MAXP; j += i) {
      isP[j] = false;
    }
  }
  for(int i = 1; i < Prime.size(); ++i) {
    Prime[i] += Prime[i-1];
  }
  int n;
  while(cin >> n && n) {
    cout << Prime[n-1] << endl;
  }
  return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    void Calc()
    {
        var sc = new Scanner();
        long N = sc.NextLong();
        double root = Math.Sqrt(N);
        double roottt = Math.Floor(root);
        int root3 = (int)roottt;
        for (int i = root3; i > 0; i--)
        {
            if (N % i == 0)
            {
                long l = N / i;
                string a = l.ToString();
                Console.WriteLine(a.Length);
                break;
            }
        }
    }

    static void Main()
    {
        new Program().Calc();
    }

    class Scanner
    {
        string[] s = new string[0];
        int i = 0;
        char[] cs = new char[] { ' ' };

        public string Next()
        {
            if (i < s.Length) return s[i++];
            s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return s[i++];
        }
        public int NextInt() { return int.Parse(Next()); }
        public long NextLong() { return long.Parse(Next()); }
        public double NextDouble() { return double.Parse(Next()); }
    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
const int INF = 1e9 + 5;

template <typename T> void max_self (T &a, T b){
	a = max(a,b);
	}

bool first_row_or_column(pair<int,int> p){
	return p.first == 0 || p.second == 0;
	}
int main(){
	string a,b;
	cin>> a >> b;
	vector<vector<pair<int, pair<int,int>>>> dp( a.length() + 1, vector<pair<int, pair<int,int>>>(b.length() + 1, { -INF ,{0,0}}));
	dp[0][0] = {0,{0,0}};
	for(int i = 0 ; i < (int) a.length(); ++i){
		for(int j = 0; j < (int) b.length(); ++j){
			if(a[i] == b[j]){
				max_self(dp[i+1][j+1], make_pair(dp[i][j].first + 1 , make_pair(i,j))); 
				}
			max_self(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i,j)));
			max_self(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i,j)));
			}
		}
	pair<int,pair<int,int>> answer = {0,{0,0}};
	for(int i = 0; i <= (int) a.length(); ++i) {
        for(int j = 0; j <= (int) b.length(); ++j) {
			max_self(answer,make_pair(dp[i][j].first, make_pair(i,j)));
			debug() << answer;
			}
		}
	string s;
	pair<int,int> loc = answer.second;
	while(!first_row_or_column(loc)){
		int i = loc.first;
		int j = loc.second;
		pair<int,int> previous = dp[i][j].second;
		if(previous == make_pair(i - 1, j - 1)){
			s += a[i - 1];
			}
		loc = previous;
		}
		reverse(s.begin(),s.end());
		cout<<s << endl;
}

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


int main()
{
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);

    if(a+b+c >= 22){
        printf("bust");
    }
    else {
        printf("win");
    }
    return 0;
}


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

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

  map<char, int> mp;
  rep(i,0,N-1) {
    string s;
    cin >> s;
    mp[s[0]]++;
  }

  printf("AC x %d\n", mp['A']);
  printf("WA x %d\n", mp['W']);
  printf("TLE x %d\n", mp['T']);
  printf("RE x %d\n", mp['R']);

  return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
#include <numeric>
using namespace std;

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))
#define LLONG_MAX numeric_limits<long long>::max()
#define INT_MAX numeric_limits<int>::max()

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<vi>		vvi;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " " << p.second << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}


template <typename T>
void vecOutPadding(vector<T>& vec, string pad = " ") {
	for (const T& elem : vec)
		cout << elem << pad;
}

template <typename T>
void matOut(vector<vector<T>>& mat) {
	for (const auto& row : mat) {
		for (const T& col : row)
			cout << col << " ";
		cout << endl;
	}
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


int main()
{
	int N, H, W;
	cin >> N >> H >> W;
	cout << (N - H + 1) * (N - W + 1) << endl;

	return 0;
}

Measured memory_bytes: 256
s=input()
alp="".join([chr(i) for i in range(97,97+26)])
if len(s)<26:
    for i in alp:
        if i not in s:
            print(s+i)
            exit()
else:
    if s=="".join([chr(i) for i in range(97,97+26)][::-1]):
        print(-1)
        exit()
    else:
        for i in range(24,-1,-1):
            for j in range(25,i,-1):
                if s[i]<s[j]:
                    print(s[:i]+s[j])
                    exit()

Measured memory_bytes: 3064
n = input()
if(n[-1]=="3")or(n=="3"):
    print("bon")
elif(n[-1]=="0")or(n[-1]=="1")or(n[-1]=="6")or(n[-1]=="8")or(n=="0")or(n=="1")or(n=="6")or(n=="8"):
    print("pon")
else:
    print("hon")

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

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

  string s;
  cin >> s;

  string res = "";
  for (char &c : s) {
    if (c != 'B') {
      res += c;
      continue;
    }
    if (res.empty()) continue;
    res.pop_back();
  }
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define ld long double
#define ff first
#define ss second

using namespace std;

int main() {
    int k, a, b;
    bool achieve = false;

    cin >> k >> a >> b;

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

        // cout << "i = " << i << " k = " << k << endl;
        // cout << i % k << endl;
        if(i % k == 0) {
            achieve = true;
            break;
        }
    }

    cout << (achieve? "OK" : "NG") << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, int> m;
    vector<string> v = {"AC", "WA", "TLE", "RE"};
    string s;
    m["AC"] = m["WA"] = m["TLE"] = m["RE"] = 0;
    for (int i = 0; i < n; i++) {
        cin >> s;
        m[s]++;
    }
    for (int i = 0; i < (int)v.size(); i++) {
        cout << v[i] << " x " << m[v[i]] << "\n";
    }
    cout << endl;
}

Measured memory_bytes: 3608
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

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

    ll ans = 0;
    for(int i=0; i+k-1<n; i++){
        ll range = asum[i+k] - asum[i];
        ll a_black = (b[n] - b[i+k]) + (b[i]);
        chmax(ans, max(range, 0LL) + a_black);
    }

    cout << ans << endl;
}

Measured memory_bytes: 2176
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        if (n == 0)
        {
            Console.WriteLine("0");
            return;
        }

        var digits = new StringBuilder();
        var k = AntiBinary.Log(n);
        var p = (k % 2 == 0 ? 1 : -1) * 1L << k;
        var x = 0L;
        while (k >= 0)
        {
            var c = '0';
            var y = x + p;
            if (p > 0 && y + AntiBinary.MinValue(k) <= n || p < 0 && y + AntiBinary.MaxValue(k) >= n)
            {
                c = '1';
                x = y;
            }
            digits.Append(c);
            k--;
            p = -p / 2;
        }
        Console.WriteLine(digits);
    }

    static class AntiBinary
    {
        private const int len = 34;
        private static long[] minAntilog = new long[len];
        private static long[] maxAntilog = new long[len];

        static AntiBinary()
        {
            long x = 0x5555555555555555 & (1L << len) - 1;
            int i = len - 1;
            while (i >= 0)
            {
                if ((x & 1) > 0)
                {
                    maxAntilog[i] = x;
                    if (i < 1)
                    {
                        break;
                    }
                    x >>= 1;
                    minAntilog[i] = -x;
                }
                else
                {
                    minAntilog[i] = -x;
                    if (i < 1)
                    {
                        break;
                    }
                    x >>= 1;
                    maxAntilog[i] = x;
                }
                i--;
            }
        }

        public static int Log(int x)
        {
            if (x < -(int)1e9 || (int)1e9 < x)
            {
                throw new ArgumentOutOfRangeException();
            }

            if (x == 0)
            {
                return 1;
            }

            int i = 0;
            if (x < 0)
            {
                while (minAntilog[i++] > x);
            }
            else
            {
                while (maxAntilog[i++] < x);
            }
            return i - 2;
        }

        public static long Parse(string s)
        {
            var x = 0L;
            var k = 1L;
            var stack = new Stack<char>(s);
            while (stack.Any())
            {
                switch (stack.Pop())
                {
                    case '0': break;
                    case '1': x += k; break;
                    default: throw new FormatException();
                }

                k = -k * 2;
            }
            return x;
        }

        public static long MinValue(int n) => minAntilog[n];
        public static long MaxValue(int n) => maxAntilog[n];
    }
}

Measured memory_bytes: 11092
/*
ID: duttonl1
TASK: Frog1.cpp 
LANG: C++
*/
#include <bits/stdc++.h>

#define pb push_back
#define fst first
#define snd second
#define DEBUGA(a, b) cout << "[ "; for (auto _x = (a); _x != (b); _x++) cout << *_x << " "; cout << "]"<< endl
#define DEBUG(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string>_it(_ss); err(_it, args); };cout << endl
#define fr(i,x) for (int i = 0; i < int(x); i++)
#define frab(i,a,b) for (int i = int(a); i < int(b); i++)
#define sz(x) ((int) (x).size())
void run();
int main() {
    std::ios::sync_with_stdio(false);
    run();
    return 0;
}

using namespace std;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << "; ";
    err(++it, args...);
}


typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int A[100005];
int dp[100005];
void run() {
    int n; cin >> n;
    fr(i,n) cin >> A[i];
    dp[0] = 0; dp[1] = abs(A[1] - A[0]);
    frab(i,2,n) {
        dp[i] = min(abs(A[i]-A[i-1]) + dp[i-1], abs(A[i]-A[i-2]) + dp[i-2]);
    }
    cout << dp[n-1] << endl;
}




Measured memory_bytes: 1024
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x = sc.nextInt();
		sc.close();

		Map<Integer, String> map = new TreeMap<>();
		for (int i=(x-k+1); i<(x+k); i++) {
			map.put(i, String.valueOf(i));
		}

		System.out.println(String.join(" ", map.values()));
	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const ll MOD = (ll)1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

vector<int> v[200000], rv[200000];

int main() {
    int tc;
    scanf("%d", &tc);

    while (tc--) {
        int n;
        scanf("%d", &n);

        ll ans = 0;
        int a,b,c;
        for (int i = 0; i < n; i++) {
            scanf("%d %d %d", &a, &b, &c);
            a--;
            if (b>=c || a==n-1) {
                v[a].push_back(b - c);
                ans += c;
            }
            else rv[a+1].push_back(c-b), ans += b;
        }

        priority_queue<int, vector<int>, greater<int>> pq, rpq;

        for (int i = 0; i < n; i++) {
            int ii = n-i-1;
            for (int j : v[i]) pq.push(j), ans += j;
            for (int j : rv[ii]) rpq.push(j), ans += j;
            v[i].clear();
            rv[ii].clear();

            while (sz(pq) > i+1) {
                ans -= pq.top();
                pq.pop();
            }
            while (sz(rpq) > i+1) {
                ans -= rpq.top();
                rpq.pop();
            }
        }

        printf("%lld\n", ans);
    }
}

Measured memory_bytes: 18124
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<int,pint> tint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int dp[810][810];
bool sumi[810][810];
string ma[810];
priority_queue<tint> q;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
void aedge(int x,int y,int z){
	if(dp[x][y]<=z) return;
	dp[x][y]=z;
	q.push(mp(-z,mp(x,y)));
}
int main()
{
	int h,w,k,inf=1145141919,sx,sy;
	rep(i,810) rep(j,810) dp[i][j]=inf;
	memset(sumi,false,sizeof(sumi));
	cin>>h>>w>>k;
	rep(i,h) cin>>ma[i];
	rep(i,h) rep(j,w){
		if(ma[i][j]=='S') sx=i,sy=j;
	}
	aedge(sx,sy,0);
	while(!q.empty()){
		tint p=q.top();q.pop();
		int x=p.se.fi,y=p.se.se,z=-p.fi;
		if(x==0 || x==h-1 || y==0 || y==w-1){
			cout<<(z+k-1)/k<<endl;return 0;
		}
		if(sumi[x][y]) continue;
		sumi[x][y]=true;
		rep(i,4){
			int nx=x+dx[i],ny=y+dy[i];
			if(nx<0 || nx>=h || ny<0 || ny>=w) continue;
			if(ma[nx][ny]=='#') aedge(nx,ny,max(z,k)+1);
			else aedge(nx,ny,z+1);
		}
	}
}


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

int main(){
    int h,w,k;
    cin >> h >> w >> k;
    vector<vector<int>> mat(h,vector<int>(w));
    rep(i,h){
        rep(j,w){
            char c;
            cin >> c;
            if(c == '#') mat.at(i).at(j) = 1;
            else mat.at(i).at(j) = 0;
        }
    }
    ll ans=0;
    for(int bit=0;bit<(1<<(h+w));bit++){
        vector<int> cr, cc;
        for(int i=0;i<h;i++){
            if(bit & (1<<i)){
                cr.push_back(i);
            }
        }
        for(int j=0;j<w;j++){
            if(bit & (1<<(h+j))){
                cc.push_back(j);
            }
        }
        // rep(i,cr.size()) cout << cr.at(i);
        // cout << " ";
        // rep(i,cc.size()) cout << cc.at(i);
        // cout << endl;
        int cnt = 0;
        for(int y:cr){
            for(int x:cc){
                if(mat.at(y).at(x) == 1) cnt++;
            }
        }
        if(cnt == k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
use std::collections::VecDeque;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    // 葉を選んだとき => 選んだ葉以外の葉をむしる
    // 葉以外を選んだとき => 葉を全てむしる

    // 直径の端点 => 直径を1減らす
    // その他の点 => 直径を2減らす

    // 0=>first
    // 1=>second
    // 2=>first
    // 3

    let n = sc.read();
    if n == 1 {
        println!("First");
        return;
    }
    if n == 2 {
        println!("Second");
        return;
    }
    let mut graph = vec![vec![]; n];
    for _ in 1..n {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        graph[a].push(b);
        graph[b].push(a);
    }
    let mut dist = vec![n; n];
    let mut q = VecDeque::new();
    q.push_back(0);
    dist[0] = 0;

    while let Some(v) = q.pop_front() {
        for &next in graph[v].iter() {
            if dist[next] > dist[v] + 1 {
                dist[next] = dist[v] + 1;
                q.push_back(next);
            }
        }
    }
    let (_, d1) = dist
        .into_iter()
        .enumerate()
        .map(|(i, d)| (d, i))
        .max()
        .unwrap();

    let mut dist = vec![n; n];
    q.push_back(d1);
    dist[d1] = 0;
    while let Some(v) = q.pop_front() {
        for &next in graph[v].iter() {
            if dist[next] > dist[v] + 1 {
                dist[next] = dist[v] + 1;
                q.push_back(next);
            }
        }
    }

    let (dist, _) = dist
        .into_iter()
        .enumerate()
        .map(|(i, d)| (d, i))
        .max()
        .unwrap();

    let inf = n * 10;
    let mut grundy = vec![inf; dist + 1];
    grundy[0] = 1;
    grundy[1] = 0;
    grundy[2] = 1;
    for i in 3..(dist + 1) {
        let mut next = vec![];
        next.push(grundy[i - 1]);
        next.push(grundy[i - 2]);
        grundy[i] = (0..).find(|i| !next.contains(i)).unwrap();
    }
    if grundy[dist] == 0 {
        println!("Second");
    } else {
        println!("First");
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 23668
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

int INF = INT_MAX / 2;
ll MOD = 1234576891234601LL;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	vector<int> dp(100000, INF);
	vector<vector<int> > v(100000);
	dp[0] = 1;
	for (int i = 0; i < 100000; i++)
		for (int j = 1; ; j++) {
			int _i = i + j * (j + 1) / 2 - 1;
			if (_i >= 100000) break;
			if (dp[i] + j < dp[_i]) {
				dp[_i] = dp[i] + j;
				v[_i] = v[i];
				v[_i].push_back(j);
			}
		}
	map<int, int> mp;
	for (int i = 1; i <= 2000; i++)
		mp[i * (i - 1) / 2] = i;
	int N; cin >> N;
	if (N == 2) {
		cout << -1 << endl;
		return 0;
	}
	if (N == 7) {
		cout << 6 << endl;
		cout << 0 << ' ' << 0 << endl;
		cout << 4 << ' ' << 0 << endl;
		cout << 2 << ' ' << 2 << endl;
		cout << 1 << ' ' << 3 << endl;
		cout << 3 << ' ' << 3 << endl;
		cout << 2 << ' ' << 6 << endl;
		return 0;
	}
	if (N == 9) {
		cout << 6 << endl;
		cout << 0 << ' ' << 0 << endl;
		cout << 1 << ' ' << 0 << endl;
		cout << 2 << ' ' << 0 << endl;
		cout << 1 << ' ' << 1 << endl;
		cout << 0 << ' ' << 2 << endl;
		cout << 2 << ' ' << 2 << endl;
		return 0;
	}
	if (N == 20) {
		cout << 8 << endl;
		cout << 1 << ' ' << 0 << endl;
		cout << 2 << ' ' << 0 << endl;
		cout << 3 << ' ' << 0 << endl;
		cout << 0 << ' ' << 1 << endl;
		cout << 2 << ' ' << 1 << endl;
		cout << 4 << ' ' << 1 << endl;
		cout << 1 << ' ' << 2 << endl;
		cout << 3 << ' ' << 2 << endl;
	}
	int K;
	vector<int> a;
	for (int i = 0; i < 100000; i++) {
		int _N = N + i;
		if (!mp.count(_N)) continue;
		int V = mp[_N];
		if (V < dp[i]) continue;
		K = V;
		a = v[i];
		for (int t = 0; t <= V - dp[i]; t++)
			a.push_back(1);
		break;
	}
	cout << K << endl;
	int x = 0, y = 0;
	cout << x << ' ' << y << endl;
	for (int i = 0; i < a.size(); i++) {
		while (a[i]--) {
			x++;
			y += i;
			cout << x << ' ' << y << endl;
		}
	}
}

Measured memory_bytes: 9060
#include <bits/stdc++.h>
using namespace std;
int n,m,dp[100010];
vector<vector<int> > g;
int rec(int v){
  if(dp[v] != -1){
    return dp[v];
  }else{
    int ma=0;
    for(auto i : g[v]){
      ma = max(ma,rec(i)+1);
    }
    return dp[v] = ma;
  }
}
  
int main(){
  int ans=0;
  cin >> n >> m;
  g.assign(n, vector<int>());
  for(int j=0; j<m; j++){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);//xからyに行く辺
  }
  
  //初期化
  for(int i=0; i<n; i++){
    dp[i] = -1;
  }
  
  for(int v=0; v<n; v++){
    ans = max(ans,rec(v));
  }
  cout << ans << endl;
}

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

using namespace std;

int n,m,k,i,j,x;

int main() {
	scanf("%d%d%d",&n,&m,&k);
	
	for (i=0 ; i<=n ; i++) {
		for (j=0 ; j<=m ; j++) {
			x = m*i + n*j - 2*i*j;
			if (x == k) {
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
}


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

int main() {
	string forecast;
	string real;
	char fc[3];
	char r[3];
	int index = 0;
	int ans = 0;

	cin >> forecast;
	cin >> real;

	for(char c : forecast){
		fc[index] = c;
		index++;
	}

	index = 0;

	for (char c : real) {
		r[index] = c;
		index++;
	}

	index = 0;
	for (int i = 0; i < 3; i++) {
		if (fc[i] == r[i]) {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) ((int)(a).size())
#define FIN ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define fore(i,a,b) for(int i = a; i < b; i++)
using namespace std;
typedef long long ll;

int main(){
  int N, K, tmp, ans = 0, mx = 0; cin >> N >> K;
  int g = 0, can = 1;
  fore(x,0,N) cin >> tmp, g = __gcd(g,tmp), mx = max(tmp,mx);
  if(N == 1)
    can = tmp == K;
  else can = K % g == 0 && mx >= K;
  cout << (can ? "POSSIBLE" : "IMPOSSIBLE") << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <limits.h>

using namespace std;

int main(int argc, char const* argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    long long count = 0;
    for (int i=0; i<N; ++i) {
        int ai;
        cin >> ai;
        while ((ai & 1) == 0) {
            ai = ai >> 1;
            ++count;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	int n,i,k,a,cnt;
	scanf("%d %d",&n,&k);
	cnt=0;
	for(i=0;i<n;i++){
		scanf("%d",&a);
		if(a>=k)	cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

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

namespace ConsoleApplication6
{

    class Program
    {
        static void Main(string[] args)
        {
            int N = (int)c2i(RL());
            var Ai = RL2IE().ToList();
            long cnt = 0;

            for (int i = 1; i <N; i++)
            {
                if (Ai[i-1] > Ai[i])
                {
                    cnt += (Ai[i - 1] - Ai[i]);
                    Ai[i] = Ai[i - 1];
                }
            }

            Console.WriteLine(cnt);
            Console.ReadLine();

        }

        static IEnumerable<long> RL2IE() { return spr(RL()).Select(x => (long)c2i(x)); }
        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static Int64 c2i(string c) { return Int64.Parse(c); }
        //static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}


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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

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

    vi vals(3);
    for (int i = 0; i < 3; i++) {
        cin >> vals[i];
    }
    sort(all(vals));

    int ops = 0;
    do {
        if (((vals[0]&1) == (vals[1]&1)) && ((vals[0]&1) != (vals[2]&1))) {
            ops++;
            vals[0]++;
            vals[1]++;
        }
    } while (next_permutation(all(vals)));

    int T = *max_element(all(vals));
    for (int v : vals)
        ops += (T - v) / 2;
    cout << ops << endl;

    return 0;
}



Measured memory_bytes: 256
#![allow(unused_imports)]
use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::min;

#[fastout]
fn main() {
    input! {
    d: usize,
    g: i64,
    pc: [(i64, i64); d]
    }
    let (mut l, mut r) = (0, std::i64::MAX);
    while l + 1 < r {
        let mid = (l + r) / 2;
        let mut update = false;
        for i in 0..1 << d {
            let mut rest_count = mid.clone();
            let mut point = 0;
            for j in 0..d {
                if i & 1 << j > 0 {
                    rest_count -= pc[j].0;
                    point += pc[j].1 + pc[j].0 * 100 * (j as i64 + 1);
                }
            }
            for j in (0..d).rev() {
                if rest_count <= 0 {break}
                if i & 1 << j == 0 {
                    point += 100 * (j as i64 + 1) * min(pc[j].0 - 1, rest_count);
                    rest_count -= min(pc[j].0 - 1, rest_count);
                }
            }
            if rest_count >= 0 && point >= g {
                r = mid;
                update = true;
                break;
            }
        }
        if !update {
            l = mid;
        }
    }
    println!("{}", r);
}


Measured memory_bytes: 2168
from itertools import permutations
from math import sqrt, factorial


def main():
    N = int(input())
    P = [list(map(int, input().split())) for _ in range(N)]
    ans = 0
    for p in permutations(range(N), N):
        for i in range(N-1):
            x1, y1 = P[p[i]]
            x2, y2 = P[p[i+1]]
            ans += sqrt((x1-x2)**2 + (y1-y2)**2)
    ans /= factorial(N)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 42092
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int X = scanner.nextInt();
        int[] L = new int[N];
        for (int i=0; i < N; i++) {
            L[i] = scanner.nextInt();
        }

        long count = 1;
        long index = 0;
        for (int i=0; i< N; i++) {
            index += L[i];
            if (index > X) {
                break;
            }

            count++;
        }

        System.out.println(count);
    }
}

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

using namespace std;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define F first
#define S second
#define loop(z, v) for(auto &z: v)
#define nl "\n"
#define fat 1000000007

int main()
{
    boost
    string s;
    cin >> s;

    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << nl;
    else cout << "No" << nl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 2e18;

template< int mod >
struct ModInt {
    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if((x += p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &p) {
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p) {
        x = (int) (1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt< mod >(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;


signed main() {
    int N;
    cin >> N;
    vector<int> C(1);
    cin >> C;
    vector<set<int>> idx(200100);
    for (int i = 1; i < N; i++) {
        int temp;
        cin >> temp;
        if (*C.rbegin() != temp) C.push_back(temp);
        idx[temp].insert(C.size() - 1);
    }
    vector<modint> ans(C.size(), 1);
    for (int i = C.size() - 2; i >= 0; i--) {
        auto itr = idx[C[i]].upper_bound(i);
        if (itr == idx[C[i]].end()) ans[i] = ans[i + 1];
        else ans[i] = ans[i + 1] + ans[*itr];
    }
    cout << ans[0] << endl;
}


Measured memory_bytes: 22128
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1<<28)
#define int long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)


signed main(){
  int n;
  cin>>n;
  vector<pair<int,int> > v;
  lp(i,n){
    int x,y;
    cin>>x>>y;
    v.push_back({x,1});
    v.push_back({y+1,-1});
  }
  int ans=0;
  int now=0;
  sort(v.begin(),v.end());
  int bef=-1;
  lp(i,v.size()){
    if(bef!=v[i].first){
      ans=max(now,ans);
    }
    bef=v[i].first;
    now+=v[i].second;
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 7028
import java.util.*;
public class Main {
	public static void main(String[] args){
      	
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int A = sc.nextInt();
		int B = sc.nextInt();
		String U = sc.next();
		if (S.equals(U)) {
			System.out.println(A-1 +" "+ B);
		} else {
			System.out.println(A + " "+ (B-1));
		}
		
      	sc.close();
    }
		
		
}


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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c,d;
    int p=0;
     cin >> a >> b >> c >> d;
     int l=max(a,c);
     int k= min(b,d);
     if(l>=k)
        cout << p;
        else
            cout << k-l;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll factorial[1000001];
ll power(ll a, ll b,ll mod)
{ 
	ll x = 1, y = a; 
	while (b > 0)
	{ 
		if (b%2)
		{ 
			x = (x*y)%mod; 
		} 
		y = (y*y)%mod; 
		b /= 2; 
	} 
	return x%mod; 
}	 
ll nCr(ll n, ll k, ll mod)
{
    ll x = (power(factorial[k],mod-2,mod)*power(factorial[n-k],mod-2,mod))%mod;
	return (factorial[n]*x)%mod; 
} 
int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int t,n;
    t = 1;
    int mod = 1000000007;
    factorial[0] =1;
    for(int i=1;i<=1000001;i++)
    {
        factorial[i] = (factorial[i-1]*i)%mod;
    }
    for(int i=0;i<t;i++)
    {
        int n,k;
        cin>>n>>k;
        int arr[n];
        ll ans = 0;
        for(int i=0;i<n;i++)
        {
            cin>>arr[i];
        }
        sort(arr,arr+n);
        for(int i=0;i<n;i++)
        {
            if(n-i>=k)
            {
                ans = (ans-(arr[i]*nCr(n-i-1,k-1,mod))%mod)%mod;
            }
        }
        for(int i=k-1;i<n;i++)
        {
            ans = (ans+(arr[i]*nCr(i,k-1,mod))%mod)%mod;
        }
        cout<<ans;
    }
    return 0;
}


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

int main(){
	int N;
	int A[100];
	int i;

	scanf("%d",&N);

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

	for(i=0;i<N;i++){
		if(A[i]%2 == 0){
			if(A[i]%3 != 0 && A[i]%5 != 0){
				printf("DENIED\n");
				return 0;
			}
			
		}

	}

	printf("APPROVED\n");

	return 0;
}

Measured memory_bytes: 128
N = int(input())
A = [int(x) for x in input().split()]
A.sort(reverse=True)

if N%2==0:
    ans = sum(A[:N//2]) * 2 - A[0]
else:
    ans = sum(A[:N//2]) * 2 - A[0] + A[N//2]
print(ans)

Measured memory_bytes: 31444
#include<iostream>
#include<algorithm>
using namespace std;
int n, ans = 0;
void solve(long num, bool s, bool t, bool r) {
    if (num > n) return;
    if (s && t && r) ans++;
    solve(num * 10 + 7, true, t, r);
    solve(num * 10 + 5, s, true, r);
    solve(num * 10 + 3, s, t, true);
}
int main() {
    cin >> n;
    solve(0, false, false, false);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

long power(long a, long b) {
    return b ? power(a*a%MOD, b/2) * (b%2?a:1)%MOD:1;
}

long perm(int N, int K) {
    long x = 1;
    for(int i = 1; i <= K; i++) x = x * (N-i+1) % MOD;
    return x % MOD;
}

long comb(int N,int K) {
    long x = 1, y = 1;
    for(int i = 1; i <= K; i++) {
        x = x * (N-i+1) % MOD;
        y = y * i % MOD;
    }
    return x * power(y, MOD-2) % MOD;
}

bool isprime(int n) {
    if(n < 2) return false;
    for(int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return false;
    }
    return true;
}

void dfs(const vector<vector<int> > &G, int v, vector<int> &seen) {
    seen[v] = true;

    for(int next_v : G[v]) {
        if(seen[next_v]) continue;
        dfs(G, next_v, seen);
    }
}

void yes() { cout << "Yes" << endl;}
void no() { cout << "No" << endl;}

int main() {
  int x, y;
  bool flag = false;
  cin >> x >> y;
  for (int i = 0; i <= x; i++) {
    for (int j = 0; j <= x; j++) {
      if (i+j==x && 2*i+4*j==y) flag = true;
    }
  }
  if (flag) yes();
  else no();
}

Measured memory_bytes: 3628