akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <string>
using namespace std;
#define min(x, y) ((x < y) ? x : y)
#define rep(x, n) for (int x = 1; x <= n; ++x)
#define zrp(x, n) for (int x = n; x; --x)
const int inf = 214748364;
char s[200005];
int n;

int main()
{
	scanf("%s", s + 1);
	n = strlen(s + 1);
	int x, y;
	rep(i, n) if (s[i] == 'A')
	{
		x = i;
		break;
	}
	zrp(i, n) if (s[i] == 'Z')
	{
		y = i;
		break;
	}
	cout << y - x + 1 << endl;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

typedef struct{
  double x;
  double y;
} Point;

void Koch(int, Point, Point);

int main()
{
  int n;
  Point p1, p2;

  scanf("%d", &n);

  p1.x = 0;
  p2.x = 100;
  p1.y = 0;
  p2.y = 0;

  printf("%.8f %.8f\n", p1.x, p1.y);
  Koch(n, p1, p2);
  printf("%.8f %.8f\n", p2.x, p2.y);

  return 0;
}

void Koch(int n, Point p1, Point p2)
{
  Point s, t, u;
  
  if( n == 0 ) return;

  s.x = (2.0 * p1.x + 1.0 * p2.x) / 3;
  s.y = (2.0 * p1.y + 1.0 * p2.y) / 3;
  t.x = (1.0 * p1.x + 2.0 * p2.x) / 3;
  t.y = (1.0 * p1.y + 2.0 * p2.y) / 3;
  u.x = (t.x - s.x) * cos(M_PI/3) - (t.y - s.y) * sin(M_PI/3) + s.x;
  u.y = (t.x - s.x) * sin(M_PI/3) + (t.y - s.y) * cos(M_PI/3) + s.y;

  Koch(n-1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  Koch(n-1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  Koch(n-1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  Koch(n-1, t, p2);
  
}

Measured memory_bytes: 640
#include<stdio.h>
int main()
{
    int x,y,z,min;
    scanf("%d %d %d",&x,&y,&z);
    min=x+y;
    if((x+z)<=min)
        min=x+z;
    if((y+z)<=min)
        min=y+z;
    printf("%d",min);
    return 0;
}

Measured memory_bytes: 128
n = int(input())

table = [[0 for i in range(10)] for j in range(10)]

for i in range(n):
    si = str(i+1)
    table[int(si[0])][int(si[-1])] += 1

count = 0
for i in range(10):
    for j in range(10):
        count += table[i][j] * table[j][i]

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define IN freopen("in.txt", "r", stdin);
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;


void update(int q,int& last,int& d){
    if(d and q%2 != last%2)d=3-d;
    last=q;
}

pair<VI,VI> solve(int n,string& T){
    if(!n){
        VI p = {0};
        VI W(sz(T),0);
        return {p,W};
    }
    auto pp=solve(n-1,T);
    VI p=pp.fi, w=pp.se;
    VI new_w(sz(w));
    int pot=sz(p);
    VI D(3*pot);
    for(int i=0;i<3;i++)for(int x=0;x<pot;x++)D[i*pot+x]=i;
    VI last(3*pot,0);
    int q=0;
    for(int i=0;i<sz(T);i++){
        int k=w[i];
        for(int x=k;x<3*pot;x+=pot){
            update(q,last[x],D[x]);
            if(D[x]==2)new_w[i]=x;
        }
        if(T[i]=='S')q++;
        if(T[i]=='R'){
            for(int x=k;x<3*pot;x+=pot)D[x]=(D[x]+1)%3;
        }
    }
    VI new_p(3*pot);
    for(int i=0;i<3*pot;i++){
        update(q,last[i],D[i]);
        new_p[i]=p[i%pot]+D[i]*pot;
    }
    return {new_p,new_w};
}

int main(){
    IOS;
    int n;string s;
    cin>>n>>s;
    VI p=solve(n,s).fi;
    for(int x:p)cout<<x<<' ';
    cout<<endl;
    return 0;
}

Measured memory_bytes: 16576
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (n, m) = (v[0], v[1]);
    let mut edges = vec![Vec::new(); n];
    for i in 0..m {
        let v = read_vec::<usize>();
        let (s, t) = (v[0] - 1, v[1] - 1);
        edges[s].push(t);
    }

    let solve = |diff: usize| {
        let mut dp = vec![0.0; n];
        for i in (0..n - 1).rev() {
            let coef = 1.0 / edges[i].len() as f64;
            for &to in edges[i].iter() {
                dp[i] += (1.0 + dp[to]) * coef;
            }
            if i == diff {
                dp[i] += 1.0;
            }
        }
        dp
    };
    let dp = solve(n);
    // debug!(dp);
    let mut ans = dp[0];
    for i in 0..n - 1 {
        if edges[i].len() <= 1 {
            continue;
        }
        let coef = if i == 0 { 1.0 } else { solve(i)[0] - dp[0] };
        let len = edges[i].len() as f64;
        for &to in edges[i].iter() {
            let temp1 = dp[i] - (1.0 + dp[to]) / edges[i].len() as f64;
            let temp2 = temp1 * len / (len - 1.0);
            let diff = temp2 - dp[i];
            // debug!(i, coef, to, diff, temp1, temp2, dp[0] + diff * coef);
            ans = min(Total(ans), Total(dp[0] + diff * coef)).0;
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    // variable
    ll ans = 0;

    // input
    cout << fixed << setprecision(10);
    string S, T; cin >> S >> T;
    int a, b; cin >> a >> b;
    string U; cin >> U;

    // solve
    if(U == S)a--;
    else b--;
    cout << a << " " << b << endl;
    
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll n;
    cin >> n;
    ll a[n + 1];
    a[n] = -1;
    rep(i, n) cin >> a[i];

    stack<ll> st;
    ll max_area = 0;

    for (int i = 0; i <= n; i++)
    {
        while (!st.empty() && a[st.top()] > a[i])
        {
            int t = st.top();
            st.pop();
            max_area = max(max_area, a[t] * (st.empty() ? i : i - st.top() - 1));
        }
        st.push(i);
    }
    OP(max_area);

    return 0;
}


Measured memory_bytes: 4604
// https://atcoder.jp/contests/abc106/tasks/abc106_b

#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1; i <= n; i += 2){
    int cnt = 0;
    for(int j = 1; j <= i; j++){
      if(i%j == 0) cnt++;
    }
    if(cnt == 8) ans++;
  }
  cout << ans << endl;
}


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

int main() {
	// your code goes here
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if((abs(a-b)<=d&&abs(b-c)<=d)||abs(a-c)<=d)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}


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

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

inline void write() {
}

template<class T> void write(T const& t) {
	cout << t;
}

template<class T, class... Args> void write(T const& t, Args const&... args) {
	cout << t << ' ';
	write(args...);
}

template<class... Args> void writeln(Args const&... args) {
	write(args...);
	cout << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin .exceptions(ios_base::badbit | ios_base::failbit);
	cout.exceptions(ios_base::badbit | ios_base::failbit);
	cin .tie(nullptr);
	cout.tie(nullptr);
	cout.precision(16);
	void run();
	run();
	return 0;
}

void run() {
	auto s = read<string>();
	bool result = true;
	for (sint i = 0; i < s.size(); ++i) {
		char c = s[i];
		if ((i + 1) % 2 == 0) {
			result = result && (c == 'L' || c == 'U' || c == 'D');
		}
		else {
			result = result && (c == 'R' || c == 'U' || c == 'D');
		}
	}
	writeln(result ? "Yes" : "No");
}

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

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

  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(M);
  for (int i = 0; i < N; ++i) cin >> A.at(i);
  for (int i = 0; i < M; ++i) cin >> B.at(i);

  bool exist = false;
  for (int ly = 0; ly < N; ++ly) {
    for (int lx = 0; lx < N; ++lx) {
      if (ly + M - 1 >= N || lx + M - 1 >= N) {
        continue;
      }
      bool match = true;
      for (int y = 0; y < M; ++y) {
        for (int x = 0; x < M; ++x) {
          if (A.at(ly + y).at(lx + x) != B.at(y).at(x)) {
            match = false;
          }
        }
      }
      if (match) {
        exist = true;
      }
    }
  }

  if (exist) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using T = tuple<ll,ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()


int main(){
  ll N,H,ans=0;
  cin >> N >> H;
  vec A(N),B(N);
  rep(i,N){
    cin >> A.at(i) >> B.at(i);
  }
  sort(all(A));
  sort(all(B));
  rep(i,N){
    if(B.at(N-1-i)>A.at(N-1)){
      H-=B.at(N-1-i);
      ans++;
      if(H<=0){
        cout << ans << endl;
        return 0;
      }
    }else{
      break;
    }
  }
  ans+=(H-1)/A.at(N-1)+1;
  cout << ans << endl;
        
}
          
         

Measured memory_bytes: 4820
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_B
#include <iostream>
using namespace std;

int many_ways(int n, int x){
  int counter = 0;
  for(int i = n; i > 0; i--){
    for(int j = 1; j < i; j++){
      for(int k= j+1; k < i; k++){
        if(i+j+k == x) counter++;
      }
    }
  }
  return counter;
}

int main(){
  int n,x;
  while(cin >> n >> x){
    if(n == 0 && x == 0) break;
    else cout << many_ways(n,x) << endl;
  }
}

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


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

    int n,m; cin >> n >> m;
    int ans = 0;

    if(n * 2 >= m){
        ans = m / 2;
    }else{
        ans = n;
        m -= n*2;
        ans += m/4;
    }

    cout << ans << endl;
}

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

int main() {
	int K;
	cin >> K;
	int ans = (K/2)*((K+1)/2);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
package main

import (
	"fmt"
)

func merge(left, right []int) (ret []int) {
	ret = []int{}
	for len(left) > 0 && len(right) > 0 {
		var x int
		if right[0] > left[0] {
			x, left = left[0], left[1:]
		} else {
			x, right = right[0], right[1:]
		}
		ret = append(ret, x)
	}
	ret = append(ret, left...)
	ret = append(ret, right...)
	return
}

func sort(left, right []int) (ret []int) {
	if len(left) > 1 {
		l, r := split(left)
		left = sort(l, r)
	}
	if len(right) > 1 {
		l, r := split(right)
		right = sort(l, r)
	}

	ret = merge(left, right)
	return
}

func split(values []int) (left, right []int) {
	left = values[:len(values) / 2]
	right = values[len(values) / 2:]
	return
}

func Sort(values []int) (ret []int) {
	left, right := split(values)
	ret = sort(left, right)
	return
}

func main(){
	a := make([]int,3)
	fmt.Scan(&a[0],&a[1],&a[2])
	b := Sort(a)
	fmt.Println(b[2]-b[0])
}


Measured memory_bytes: 512
#include<stdio.h>
int main(){
  int N,i,j,tmp;
  int b = 0;
  int count = 1;
  scanf("%d",&N);
  int a[N];
  for(i=0;i<N;i++){
    scanf("%d",&b);
    a[i] = b;
  }
  for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (a[i] > a[j]) {
        tmp =  a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  for(i=0;i<N-1;i++){
    if(a[i]!=a[i+1]){
      count = count + 1;
    }
  }
  printf("%d\n",count);
  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void){
int x,y;
while(1){
scanf("%d %d",&x,&y);
if(x==0&&y==0)break;
if(x<y)printf("%d %d\n",x,y);
else printf("%d %d\n",y,x);
}
return 0;
}



Measured memory_bytes: 1932
using CompLib.Util;
using System;
using System.Linq;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        Console.WriteLine((n + 1) / 2);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

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

class Program
{
    public static void Main()
    {


        var n = int.Parse(Console.ReadLine());
        var p = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

        int count = 0;

        for(int i = 1; i < p.Length - 1; i ++)
        {
            if(p[i-1] < p[i] && p[i] < p[i+1]
                || p[i + 1] < p[i] && p[i] < p[i - 1]
                )
            {
                count = count + 1;
            }
        }

        Console.WriteLine(count);



    }
}

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

int main(){
	int i = 0;
	string w,t;
	cin >> w;
	transform(w.begin(), w.end(), w.begin(), ::tolower);

	while (cin >> t, t != "END_OF_TEXT"){
		transform(t.begin(), t.end(), t.begin(), ::tolower);
		if (w == t) i++;
	}
	cout << i << endl;

	return(0);
}

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

ab, bc, ca = MAP()

print(ab*bc//2)


Measured memory_bytes: 5332
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

map<ll,vector<ii> > mp;
string ans[MAXn];

int main()
{
    IOS();
    ll n,m;
    cin>>n>>m;
    REP(i,m)
    {
        ll p,y;
        cin>>p>>y;
        mp[p].pb(ii(y,i));
    }
    for(auto tmp:mp)
    {
        sort(ALL(tmp.Y));
        stringstream ss1;
        ss1<<setw(6)<<setfill('0')<<tmp.X;
        string a;
        ss1>>a;
        ll it = 0;
        for(ii p:tmp.Y)
        {
            it ++;
            stringstream ss2;
            ss2<<setw(6)<<setfill('0')<<it;
            string b;
            ss2>>b;
            ans[p.Y] = a + b;
        }
    }
    REP(i,m)cout<<ans[i]<<endl;
}


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

int main()
{
    string s; cin >> s;
    int ans = 0, cnt = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'R') cnt++;
        else{
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    
    cout << max(cnt, ans) << endl;
    return 0;
}

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

int main(void) {
    string str; cin >> str;
    ll sum = 0;

    for (int i = 0; i < str.size(); i++) {
        int x = (int)(str[i] - '0');  //str[i]　はchar型なのでchar→intへ変換
        sum += x;
    }
    if(sum%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3720
N,M=map(int,input().split())
a=[]
b=[]
for e in range(M):
    x,y=map(int,input().split())
    x-=1
    y-=1
    a.append(x)
    b.append(y)

def solve(e):
    parent=[i for i in range(N)]
    def find(x,parent):
        y=parent[x]
        while y!=parent[y]:
            y=find(y,parent)
        parent[x]=y
        return y
    def unite(a,b,parent):
        x=find(a,parent)
        y=find(b,parent)
        if x!=y:
            parent[x]=y

    for i in range(M):
        if i==e:
            continue
        unite(a[i],b[i],parent)
    cnt=[0 for _ in range(N)]
    for i in range(N):
        cnt[find(i,parent)]=1
    if cnt.count(1)>1:
        return 1
    else:
        return 0
ans=0
for i in range(M):
    ans+=solve(i)
print(ans)


Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll, ll> pii;
const int maxn = 2e5 + 10;
const int INF = 0x3f3f3f3f;
const ll inf = 1e18;
const ll mod = 1000000007;
string s;
int main() {
	cin >> s;
	for (int i = 0; i < s.length(); i++)cout << 'x';
	cout << endl;
	return 0;
};

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 1e5 + 100;
const ll inf = 2e18, mod = 1e9 + 7;

ll n, x, ans;

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

	cin >> n >> x;
	ans = n;
	ll mn = x, mx = n - x;
	if (mn > mx)
		swap(mn, mx);
	while (mn)
	{
		ans += mn * 2 * (mx / mn);
		mx %= mn;
		swap(mn, mx);
	}
	ans -= mx;
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>

using namespace std;


int main() {
  int n;
  long long k;
  int x;
  scanf("%d %lld", &n, &k);

  vector<int> next(n);
  for (int i=0;i<n;++i) {
    scanf("%d", &x);
    next[i] = x - 1;
  }

  vector<bool> visited(n);
  vector<int> chain;

  visited[0] = true;
  chain.push_back(0);

  while (k > 0) {
    int nn = next[chain[chain.size()-1]];
    --k;

    chain.push_back(nn);

    if (visited[nn]) {
      break;
    }
    visited[nn] = true;
  }

  if (k == 0) {
    printf("%d\n", chain[chain.size()-1] + 1);
    return 0;
  }

  // Find cycle

  int index = 0;
  while (chain[index++] != chain[chain.size() - 1]);

  vector<int> whole_cycle(chain.begin() + index, chain.end());

  --k;

  k %= whole_cycle.size();

  printf("%d", whole_cycle[k] + 1);

  return 0;
}


Measured memory_bytes: 4552
import java.util.*;
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
        Reader in = new Reader();
        int n = in.nextInt();
        int[] count = new int[n];
        for (int i=0;i<n - 1;i++)
            count[in.nextInt() - 1]++;
        for (int i=0;i<n;i++)
            System.out.println(count[i]);
    }
}
class Reader
{
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader()
    {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException
    {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException
    {
        byte[] buf = new byte[64]; // line length
        int cnt = 0, c;
        while ((c = read()) != -1)
        {
            if (c == '\n')
                break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException
    {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do
        {
            ret = ret * 10 + c - '0';
        }  while ((c = read()) >= '0' && c <= '9');

        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws IOException
    {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');
        if (neg)
            return -ret;
        return ret;
    }

    public double nextDouble() throws IOException
    {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = (c == '-');
        if (neg)
            c = read();

        do {
            ret = ret * 10 + c - '0';
        }
        while ((c = read()) >= '0' && c <= '9');

        if (c == '.')
        {
            while ((c = read()) >= '0' && c <= '9')
            {
                ret += (c - '0') / (div *= 10);
            }
        }

        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException
    {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws IOException
    {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException
    {
        if (din == null)
            return;
        din.close();
    }
}


Measured memory_bytes: 52956
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    Map<Integer, List<Edge>> g = new HashMap<>();
    int[] color = new int[N-1];
    int[] a = new int[N-1];
    int[] b = new int[N-1];
    for (int i = 0; i < N-1; i++) {
      a[i] = sc.nextInt();
      b[i] = sc.nextInt();
      Edge e = new Edge(i, a[i], b[i]);
      g.computeIfAbsent(a[i], k -> new ArrayList<>()).add(e);
      g.computeIfAbsent(b[i], k -> new ArrayList<>()).add(e);
    }
    int K = g.values().stream().map(List::size).max(Comparator.comparingInt(a2 -> a2)).get();
    dfs(a[0], -1, -1, g, color);

    System.out.println(K);
    for (int i = 0; i < color.length; i++) {
      System.out.println(color[i]);
    }
  }

  static void dfs(int cur, int usedColor, int parent, Map<Integer, List<Edge>> g, int[] color) {
    List<Edge> edges = g.getOrDefault(cur, Collections.emptyList());
    edges.sort(Comparator.comparingInt(e2 -> e2.color));
    int col = 1;
    for (Edge e : edges) {
      if (e.e1 == parent || e.e2 == parent) {
        continue;
      }
      if (col == usedColor) col++;
      e.color = col++;
      color[e.idx] = e.color;
      int next = e.e1 == cur ? e.e2 : e.e1;
      dfs(next, e.color, cur, g, color);
    }
  }

  static class Edge {
    int idx;
    int e1, e2;
    int color = 0;

    Edge(int idx, int e1, int e2) {
      this.idx = idx;
      this.e1 = e1;
      this.e2 = e2;
    }
  }
}


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

int main()
{
  int a,b,c;
  int d;
  cin>>d;
  a=d/100;
  b=d/10%10;
  c=d%10;
  int num=0;
  num+=a+b+c;
  cout<<num<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    ll n,a,b,c,d,e; cin>>n>>a>>b>>c>>d>>e;
    ll mini=min(a,min(b,min(c,min(d,e))));
    if(n%mini==0) cout<<n/mini + 4<<endl;
    else cout<<n/mini +5<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
using namespace std;
 
int main(){
  int N,max = -1;
  cin >> N;
  vector<int> H(N);
  for(int i = 0; i < N; i++) cin >> H[i];
  int count;
  for(int i = 0; i < N; i = i + count + 1){
    count = 0;
    for(int j = i, k = j+1; (H[j] >= H[k] && k < N); j++, k++){
      count++;
    }
    if(count > max) max = count;
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 640
n = int(input())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))
ab.sort(key=lambda x: x[1])
flag = True
time = 0
for i in range(n):
    if time > ab[i][1] -ab[i][0]:
        flag = False
        break
    else:
        time += ab[i][0]
if flag == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 53720
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int a,b,c,n;
  cin>>a>>b>>c>>n;
  if(a>=b and a>=c){
    for(int i=0;i<n;i++){
      a*=2;
    }
  }
  else if(b>c and b>a){
    for(int j=0;j<n;j++){
      b*=2;
    }
  }
  else
    for(int k=0;k<n;k++){
      c*=2;
    }
  cout<<a+b+c<<endl;
}

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

typedef long long ll;
typedef pair<int, int> P;
int dx[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
int dy[] = { -1, -1, 0, 1, 1, 1, 0, -1 };
const ll MOD = 1000000007;
const ll INF = 1000000000;
const int MAX = 10000000;


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

    ll ans = 0;
    for (int i = k + 1; i <= n; i++){
        int count = n / i - 1;
        ans += i - k;
        ans += (i - k)*count + max(0, n % i - k + 1);
    }

    if (k == 0) ans -= n - k;

    cout << ans << endl;

}

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

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

    int count = 0;
    for (int i=a; i<=b; ++i) {
        string s = to_string(i);
        if (s[0] == s[4] && s[1] == s[3]) ++count;
    }
    
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int x1,x2,x3,x4,x5;
  scanf("%d %d %d %d %d",&x1,&x2,&x3,&x4,&x5); 
  if(x1==0)printf("1");
  if(x2==0)printf("2");
  if(x3==0)printf("3");
  if(x4==0)printf("4");
  if(x5==0)printf("5");

  return 0;
}


Measured memory_bytes: 1624
#include<bits/stdc++.h>
using namespace std;
int main()
{
	bool x=0,c=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='C')x=1;
		if(x&&s[i]=='F')c=1;
	}
	if(x&&c)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
n=gets.to_i
d=gets.split.map(&:to_i)
m=d.max
l=[0]*(m+1)
d.each do |e|
  l[e]+=1
end
if d[0]!=0||l[0]!=1
  puts 0
  exit
end
a=1
m.times do |i|
  a*=l[i]**l[i+1]
  a%=998244353
end
puts a

Measured memory_bytes: 8964
#include<bits/stdc++.h>
using namespace std;
const int N = 104;
char s[N];
bool check(int l,int r)
{
    while(l<r)
    {
        if(s[l]!=s[r])  return false;
        ++l,--r;
    }
    return true;
}
int main()
{
    scanf(" %s",s+1);
    int n = strlen(s+1);
    printf(check(1,n)&&check(1,(n-1)/2)&&check((n+3)/2,n) ? "Yes\n" : "No\n");
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if (N<=100&&N>=1) {
		int temp;
		int array[]=new int[N];
		for(int i=0;i<N;i++){
			int a=sc.nextInt();
			if(a<=1000&&a>=0)
			{array[i]=a;}
			else break;
		}
		for(int i=1;i<N;i++){
			if(array[0]<array[i]){
				temp=array[0];
				array[0]=array[i];
				array[i]=temp;
			}
		}
		
		int max=array[0];
		
		for(int i=1;i<N;i++){
			if(array[0]>array[i]){
				temp=array[0];
				array[0]=array[i];
				array[i]=temp;
			}
		}
		int min=array[0];
		int distance=max-min;
		System.out.println(distance);
		
		}
		
		
		}
		
		}



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

struct Drop { int x, y, siz; };
vector<Drop> v, ans;

vector<vector<int>> dx = {
    {},
    {0, -1, 0, 1, 0},
    {0, 1, 2, 0, 1, 2, 0, 1, 2},
    {0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0}
};
vector<vector<int>> dy = {
    {},
    {0, 1, 1, 1, 2},
    {0, 0, 0, 1, 1, 1, 2, 2, 2},
    {0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4}
};

vector<int> pos_x = {0, 0, 1, 0};
vector<int> pos_y = {0, 1, 1, 2};

int n;
int cloth[20][20];

pair<int,int> findBlur() {
    for (int i=5; i<15; ++i) {
        for (int j=5; j<15; ++j) {
            if (0 < cloth[i][j]) {
                return make_pair(j, i);
            }
        }
    }
    return make_pair(-1, -1);
}

void solve() {
    int x, y;
    pair<int,int> t = findBlur();
    if (t.first < 0) {
        if ((int)v.size() == n) {
            ans = v;
        }
        return ;
    } else {
        x = t.first;
        y = t.second;
    }
    for (int i=1; i<=3; ++i) {
        int n = dx[i].size();
        bool ok = true;
        for (int j=0; j<n; ++j) {
            if (cloth[y + dy[i][j]][x + dx[i][j]] <= 0) {
                ok = false;
                break;
            }
        }
        if (ok) {
            for (int j=0; j<n; ++j) {
                cloth[y + dy[i][j]][x + dx[i][j]] --;
            }
            v.push_back((Drop){ x + pos_x[i] - 5, y + pos_y[i] - 5, i });
            solve();
            v.pop_back();
            for (int j=0; j<n; ++j) {
                cloth[y + dy[i][j]][x + dx[i][j]] ++;
            }
        }
    }
}

int main() {
    cin >> n;
    for (int i=5; i<15; ++i) {
        for (int j=5; j<15; ++j) {
            cin >> cloth[i][j];
        }
    }
    solve();
    for (int i=0; i<(int)ans.size(); ++i) {
        cout << ans[i].x << " " << ans[i].y << " " << ans[i].siz << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif


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

    int N; cin >> N;
    vi H(N); REP(i, N) cin >> H[i];

    vi h = H;
    h[0]--;
    FOR(i,1, N) {
        if (h[i] - 1 >= h[i - 1]) h[i]--;
    }

    bool ok = true;
    REP(i,N-1) {
        if (h[i] > h[i+1]) {
            ok = false;
            break;
        }
    }

    string ans = ok ? "Yes" : "No";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int H,W,K;
    cin >> H >> W >> K;
    ll dp[H+1][W];
    rep(i,0,W)dp[0][i] = 0;
    dp[0][0] = 1;
    rep(i,0,H){
        rep(j,0,W)dp[i+1][j] = 0;

        rep(j,0,1 << (W-1)){
            bool ok = true;
            rep(k,0,W-1){
                //横線が2本隣り合っているとき
                if(j & (1 << k) && j & (1 << (k+1))){
                    ok = false;
                    break;
                }
            }
            if(!ok)continue;
            //cout << bitset<8>(j) << endl;
            rep(k,0,W){
                dp[i+1][k] += dp[i][k];
            }
            rep(k,0,W-1){
                if(!(j & (1 << k)))continue;
                dp[i+1][k+1] += dp[i][k] - dp[i][k+1];
                dp[i+1][k] += dp[i][k+1] - dp[i][k];
            }
        }
        rep(j,0,W)dp[i+1][j] %= MOD;
    }
    /*
    rep(i,0,W){
        cout << dp[H][i] << " ";
    }cout << endl;
    */
    cout << dp[H][K-1] << endl;
}

Measured memory_bytes: 384
import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
List = [-A[0]]
for i in range(1, N):
    if -List[-1]>=A[i]:
        List.append(-A[i])
    else:
        index = bisect.bisect_right(List, -A[i])
        List[index] = -A[i]
print(len(List))
        

Measured memory_bytes: 56236
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair <int, int> pii;
typedef vector<int> vi;
 
const int N = 2e5+5;
int n, h[N], a[N];
ll bit[N], dp[N];
 
void update(int p, ll val){
  for(; p<=n; p+=p&(-p)) bit[p]=max(bit[p], val);
}
 
ll query(int p){
  ll ans=0;
  for(; p>=1; p-=p&(-p)) ans=max(ans, bit[p]);
  return ans;
}
 
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
 
  cin >> n;
  for(int i=1; i<=n; i++) cin >> h[i]; 
  for(int i=1; i<=n; i++) cin >> a[i];
 
  for(int i=1; i<=n; i++){
    dp[i]=a[i]+query(h[i]-1);
    update(h[i], dp[i]);
  }
  ll ans=0;
  for(int i=1; i<=n; i++) ans=max(ans, dp[i]);
  cout << ans << endl;
}

Measured memory_bytes: 4992
# TODO C - Five Transportations
# https://atcoder.jp/contests/abc123/tasks/abc123_c

NUM_TRANSPORTATIONS = 5
N = int(input())

min_t = float("inf")

for t in range(NUM_TRANSPORTATIONS):
    tt = int(input())
    if tt < min_t:
        min_t = tt
print '{}'.format( (N-1) / min_t + 5)


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

int main() {
  int n;
  cin >> n;
  vector<int> height(n);
  for (int i = 0; i < height.size(); i++) {
    cin >> height.at(i);
  }
  int ans = 0;
  int max = height.at(0);
  for (int x : height) {
    if (x >= max) {
      ans++;
      max = x;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int m,n,nn,i,a[200000];

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }
  m=a[1]-a[0];
  nn=a[0];

  for(i=1;i<n;i++) {
    if(m <a[i]-nn) 
      m=a[i]-nn;

    if(nn>a[i]) nn=a[i];
  }
  printf("%d\n",m);
  return 0;
}



Measured memory_bytes: 2644
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
#show_flg=True

ans=0

n,m=LI()
a=sorted(LI())
ra=a[::-1]
##show(a,ra)

def Bigger(x,M): # x以上が M 個以上あるか
    cnt=0
    for i in range(n):
        y=x-ra[i]
        c=bisect.bisect(a,y-1)
        cnt+=n-c
##        show(x,a[i],y,cnt)
        if cnt>=M:
            return True
    return False

# function to check if x satisfies the condition
def check(x):
    if x==condition:
        rt=True
    else:
        rt=False
    return rt

# initial value
ng=1+a[-1]+a[-1]
ok=-1

while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if Bigger(mid,m):
        ok=mid
    else:
        ng=mid

mean=ok
##show('ok=',ok,m)
# [ ok | ng ] is the boundary of the condition

##show(Bigger(67,3))

choice=0
for i in range(n):
    num=n-bisect.bisect(a,mean-a[i]-1)
    choice+=num
    ans+=num*a[i]*2
##    show('i,a[i],num,choice',i,a[i],num,choice)
##show('ans=')
#print(ans)
print(ans-mean*(choice-m))


Measured memory_bytes: 56260
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << std::setprecision(10) << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	double r1,r2;
	std::cin >> r1 >> r2;
	print((r1*r2)/(r1+r2));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    while(y > 0) {
        ll tmp = x % y;
        x = y;
        y = tmp;
    }
    return x;
}

map<ll, ll> factorize(ll n) {
    map<ll, ll> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n]++;
    return ret;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    map<ll, ll> mp = factorize(g);
    cout << mp.size() + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	string s;
	cin>>s;
	rep(i, s.size()){
		cout<<'x';
	}
	cout<<endl;
	return 0;
}

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

score = [0 for i in range(N)]
for x in a:
    score[x-1] += 1

yn = ['No', 'Yes']
ans = [yn[min(1,max(K+x-Q,0))] for x in score]

for y in ans:
    print(y)


Measured memory_bytes: 9412
#include<bits/extc++.h>
#ifndef __unix__
#define fread_unlocked fread
#endif
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#include<bits/stdc++.h>
#define dout(i) 0&&0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define pb emplace_back
#define rep(_n) for(int __i = _n;__i--;)
#define rep0(_i, _n) for(int _i = 0; (_i)<(_n) ;++_i)
#define rep1(_i, _n) for(int _i = 1; (_i)<=(_n) ;++_i)
#define yn(i) ((i)?"Yes" : "No")
#define eout(i) {cout << (i) << '\n';exit(0);}
#define rout(i) {return cout << (i) << '\n', 0;}
#define multi int _T;for(read(_T);_T--;)
using namespace std;
using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;
using __gnu_pbds::null_type;
inline char readchar(){static const unsigned bufsize = 1 << 16; static unsigned p = 0, end = 0; static char buf[bufsize]; if (p == end) end = fread_unlocked(buf, sizeof(char), bufsize, stdin), p = 0; return p == end ? EOF : buf[p++]; }
inline void read(char &a){while(isspace(a = readchar()));}
inline void read(char *a){while(isspace(*a = readchar()));++a; while(isgraph(*a = readchar()))++a;}
inline void read(string &a){static char p; while(isspace(p = readchar())); a = p; while(isgraph(p = readchar()))a.push_back(p);}
template<typename T> inline void read(T& a){static char p; static bool b;while (!isdigit(p = readchar()))b = p == '-'; a = p ^ '0'; while (isdigit(p = readchar())) a *= 10, a += p ^ '0'; if(b)a *= -1, b = false; }
template<typename T1, typename T2> inline void read(pair<T1, T2> &a){read(a.first), read(a.second);}
template<typename T> inline void read(T begin, const T &end){while(begin != end)read(*begin), ++begin;}
inline void R(){} template<class T1, class... T2> inline void R(T1 &h, T2 &... e){read(h), R(e...);}
template<typename T> inline void write(T begin, const T &end){while(begin != end)cout << *begin << " \n"[next(begin) == end], ++begin;}
template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;}
template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;}
template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;}
template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;}
const int maxn = 300010;
int n;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	R(n);
	rep1(i, 1e7)if((ll)i*108/100 == n)rout(i);
	rout(":(");
}


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

#define MP make_pair
#define F first
#define S second

using namespace std;

long long int wop(long long int x, long long int y) {
    long long int ret=1;
    for(;y>0;y/=2) {
        if(y&1)ret*=x;
        x*=x;
    }
    return ret;
}

int main () {
    long long int a, b;
    cin >> a >> b;
    cout << (a+b-1)/b;
}


Measured memory_bytes: 256