akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int K;
int A[100010];

int test(int s){
	REP(i,K){
		s-=s%A[i];
	}
	return s;
}

signed main(){
	cin>>K;
	REP(i,K){
		cin>>A[i];
	}
	int ok=K*pow2(10,9)+2,ng=-1;
	while(abs(ok-ng)>1){
		int mid=(ok+ng)/2;
		if(test(mid)>=2){
			ok=mid;
		}
		else{
			ng=mid;
		}
	}
	int m=ok;
	ok=1,ng=K*pow2(10,9)+3;
	while(abs(ok-ng)>1){
		int mid=(ok+ng)/2;
		if(test(mid)<=2){
			ok=mid;
		}
		else{
			ng=mid;
		}
	}
	int M=ok;
	if(M<m){
		cout<<-1<<endl;
		return 0;
	}
	cout<<m<<" "<<M<<endl;
	return 0;
}
/*
N-=N%A[i];
*/

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <climits>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> P1;
typedef pair<P,P> P2;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

#define INF 1000000000
#define mod 1000000007
#define MAX5 100001

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

// cout << setfill('0') << setw(5) << number < endl;
// while(getline(cin, s)) { .. } | `s` is a string

int gcd(int a, int b){
	int old_a, old_b;
	while(a % b != 0){
		old_a = a;
		old_b = b;

		a = old_b;
		b = old_a % old_b;
	}

	return b;
}
#define MAX 1000000000
vector<long long> h;
void precompute() {
	h.push_back(2);
	int i = 2;
	while(h.back() < MAX) {
		h.push_back(h.back() + (i - 1) + i * 2);
		++i;
	}
}

int main(){
	IOS;
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif
	
	string a, b;
	cin >> a >> b;
	bool flag = true;
	for(int i = 0; i < (int)a.size(); ++i) {
		if(a[i] != b[i]){
			flag = false;
			break;
		}
	}

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

/*
11 
4 4 
-2 -2 
-3 -4 
-1 3 
2 3 
-4 0 
1 1 
-1 -1 
3 -1 
-4 2 
-2 4
*/

















Measured memory_bytes: 3616
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
const int maxn = int(4e4) + 7, P = int(1e9) + 7;
typedef long long ll;
ll fac[maxn], inv[maxn];
int n, a[2000007], b[2000007], dp[4007][4007];
ll Pow(ll x,ll y){
    x%=P;
    ll ans=1;
    while(y){
        if (y&1) ans=ans*x%P;
        x=x*x%P;
        y>>=1;
    }
    return ans%P;
}
void init(){
    fac[0]=1;
    for (int i=1; i<=maxn-10; ++i)
        fac[i]=fac[i-1]*i%P;
    inv[maxn-10]=Pow(fac[maxn-10],P-2);
    for (int i=maxn-11; i>=0; --i)
        inv[i]=inv[i+1]*(i+1)%P;
}
ll C(ll x,ll y){
    return fac[x]*inv[y]%P*inv[x-y]%P;
}
int main() {
    init();
    scanf("%lld",&n);
    for (ll i=1; i<=n; i++){
        scanf("%lld%lld",&a[i],&b[i]);
        dp[2001-a[i]][2001-b[i]]++;
    }
    for (ll i=1; i<=4001; i++)
        for (ll j=1; j<=4001; j++){
            dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%P;
        }
    ll ans=0;
    for (ll i=1; i<=n; i++)
        ans=(ans+dp[2001+a[i]][2001+b[i]])%P;
    for (ll i=1; i<=n; i++)
        ans=(ans-C(a[i]+a[i]+b[i]+b[i],a[i]+a[i])+P)%P;
    printf("%lld\n",ans*inv[2]%P);
    // printf("%lld\n", ans * Pow(2, P - 2) % P);
    return 0;
}


Measured memory_bytes: 68048
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  int n;
  cin >> n;
  vector<Pii> ba(n);
  for (auto &x: ba) cin >> x.second >> x.first;

  sort(ba.begin(), ba.end());

  int elapsed = 0;
  for (int i = 0; i < n; i++) {
    elapsed += ba[i].second;
    if (elapsed > ba[i].first) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 1792
S = input()
hantei = True

for i in range(0,len(S)-1,2):
  if S[i]+S[i+1] != 'hi':
    hantei = False
if len(S) % 2 == 1:
  hantei = False
    
if hantei == True:
  print('Yes')
else:
  print('No')

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    lint H, N;
    cin >> H >> N;
    vector<lint> a(N), b(N);
    rep(i, N) cin >> a[i] >> b[i];
    vector<lint> mi(H + 1, LINF);
    mi[0] = 0;
    for (int h = 0; h <= H; h++) {
        if (mi[h] == LINF) continue;
        for (int i = 0; i < N; i++) {
            lint to = min(h + a[i], H);
            mi[to]  = min(mi[to], mi[h] + b[i]);
        }
    }
    cout << mi[H] << endl;

    return 0;
}

Measured memory_bytes: 3680
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int parent,left,right;
};

  struct Node A[MAX];
int n,d[MAX],h[MAX];

void Depth(int x,int y){
  if(x==NIL)return;
  d[x]=y;
  Depth(A[x].left,y+1);
  Depth(A[x].right,y+1);
}

int Height(int x){
  int h1=0,h2=0;
  if(A[x].left!=NIL)h1=Height(A[x].left)+1;
  if(A[x].right!=NIL)h2=Height(A[x].right)+1;

  return h[x]=(h1>h2 ? h1:h2);
}

int Sibling(int x){
  if(A[x].parent==NIL)return NIL;
  if(A[A[x].parent].left!=x && A[A[x].parent].left!=NIL)return A[A[x].parent].left;
  if(A[A[x].parent].right!=x && A[A[x].parent].right!=NIL)return A[A[x].parent].right;

  return NIL;
}
void Print(int x){
  printf("node %d: ",x);
  printf("parent = %d, ",A[x].parent);
  printf("sibling = %d, ",Sibling(x));
  int deg=0;

  if(A[x].left!=NIL)deg++;
  if(A[x].right!=NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",d[x]);
  printf("height = %d, ",h[x]);

  if(A[x].parent == NIL)printf("root\n");
  else if(A[x].left==NIL && A[x].right==NIL)printf("leaf\n");
  else printf("internal node\n");

}

int main(){
  int v,l,r,root=0,i;

  scanf("%d",&n);

  for(i=0;i<n;i++)A[i].parent=NIL;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    A[v].left=l;
    A[v].right=r;
    if(l!=NIL)A[l].parent=v;
    if(r!=NIL)A[r].parent=v;
  }

  for(i=0;i<n;i++)if(A[i].parent==NIL)root=i;

  Depth(root, 0);
  Height(root);

  for(i=0;i<n;i++)Print(i);

  return 0;
}



Measured memory_bytes: 2108
Scanf.scanf "%d\n" (fun n ->
  let b = Array.make n 0 in
  for i = 2 to n do
    Scanf.scanf " %d" (fun j -> b.(j - 1) <- b.(j - 1) + 1)
  done;
  Array.iter (fun i -> Printf.printf "%d\n" i) b
)


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

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

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)



vector<bool> gen_sosuu(vector<bool> sosuu){
  int size = sosuu.size();
  REP(i,size){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(size)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<size;j++){
      sosuu[i*j] =false;
    }
  }
  return sosuu;
}

int n,a,b,c,d;

int main(){
  cin >> n>>a>>b>>c>>d;
  REP(m,n+1){
    if(c*(n-1-m)-d*m<=a-b && -c*m+d*(n-1-m)>=a-b){
      cout << "YES" <<endl;
      return 0;
    }
  }
  cout << "NO" <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1000001];
int main()
{
	int n,m,i;
	cin>>n>>m;
	for(i=1;i<=m;i++)
	{
		scanf("%d",&a[i]);
		n-=a[i];
	}
	if(n>=0)cout<<n;
	else cout<<-1;
	return 0;
}

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

long long order (long long n)
{
	return (-1 + sqrt(8*n+1)) / 2;
}

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

	long long res = 0;

	for (long long i = 2; i*i <= n; ++i)
	{	
		long long ctr = 0;
		while (n % i == 0)
		{
			ctr++;
			n /= i;
		}
		res += order(ctr);
	}

	if (n > 1) res++;
	cout << res << '\n';
	return 0;
}

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

int gcd(int x, int y){
    if (y == 0)
        return x;
    x = x % y;
    gcd(y, x);
}

main(){
    int n;
    cin>>n;
    int ans=0;
    int count=1;
    bool check=false;
    rep(i,n){
        int a;
        cin>>a;
        if(a==count) {
            count++;
            check=true;
        }else{
            ans++;
        }
    }
    if(check)cout<<ans<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a >= b {
		return a
	}
	return b
}

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var x, a int
	fmt.Fscan(read, &x, &a)
	printansInt(x >= a, 10, 0)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define CC(n,m) ((LL)fac[(n)+(m)]*ifac[n]%mo*ifac[m]%mo)

const int N=1e6;
const int maxn=N+10;
const int mo=998244353;

int row,line,sum,Ans;
int n,m,fac[maxn],ifac[maxn];

int power(int x,int k)
{
	int res=1;
	while (k)
	{
		if (k&1) res=(LL)res*x%mo;
		x=(LL)x*x%mo;
		k>>=1;
	}
	return res;
}

int F(int n,int m,int x,int y)
{
	/*
	if (m-y<0) puts("#3");
	if (n-x<0)
	{
		puts("#4");
		printf("%d %d %d %d\n",n,m,x,y);
	}
	*/
//	if (x>N||y>N||n-x>N||m-y>N) printf("...");
	if (x>=0&&y>=0)
		return CC(x,y)*CC((n)-(x),(m)-(y))%mo;
	else
		return CC((n)-(x),(m)-(y))%mo;
}

int main()
{
#ifdef h10
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	int i;
	fac[0]=1;
	for (i=1;i<=N;i++)
		fac[i]=(LL)fac[i-1]*i%mo;
	ifac[N]=power(fac[N],mo-2);
	for (i=N;i>=1;i--)
		ifac[i-1]=(LL)ifac[i]*i%mo;

	scanf("%d%d",&n,&m);

	if (n>m) swap(n,m);

	for (i=1;i<=n+m;i++)
	{
//		if (i==1)
//		{
//			row=CC(n,m-1);
//			line=CC(n-1,m);
//		}
//		else
			if (i<=n*2+1)
			{
				if (i&1)
				{
//3 : n,m-2,1,0
//5 : n,m-2,2,1
					(row+=F(n,m-2,i>>1,(i>>1)-1))%=mo;

					if (i<=n*2)

					(line+=F(n-2,m,(i>>1)-1,i>>1))%=mo;
//					if (i==n*2+1)
					if (i==1)
					{
//						printf("+=F(%d,%d,%d,%d)\n",n,m-2,i>>1,(i>>1)-1);
					}
				}
				else
				{
					(row+=mo-F(n-1,m-1,(i>>1)-1,(i>>1)-1))%=mo;
					(line+=mo-F(n-1,m-1,(i>>1)-1,(i>>1)-1))%=mo;
				}
			}
		(sum+=row)%=mo;
		(sum+=line)%=mo;
		(Ans+=(LL)sum*power(i,mo-2)%mo)%=mo;
//		printf("%d : %d %d\n",i,row,line);
	}
	Ans=(LL)Ans*power(CC(n,m),mo-2)%mo;
	printf("%d\n",Ans);
}


Measured memory_bytes: 8064
function Main(input) {
	args = input.split("\n");
	n = parseInt(args[0] ,10);
	var result;
	for( i = 2; i <= n; i++ ){
		for( I = 1; I <= n; I++ ){
			if( args[i] === args[I] && i !== I){
				result = 'No';
				break;
			}
		}
		if( args[i].slice(0, 1) !== args[i-1].slice(-1) ){
			result = 'No';
		}
	}
	if(result === undefined){
		result = 'Yes';	
    }
	console.log('%s', result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9420
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<int> hoge(n+m);
    
    for(int i=0;i<n+m;i++){
        if(i<n) hoge.at(i)=2;
        else hoge.at(i)=1;
    }
    
    int ans=0;
    
    for(int i=0;i<n+m-1;i++){
        for(int j=i+1;j<n+m;j++){
            if((hoge.at(i)+hoge.at(j))%2==0) ans++;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            Integer a[][] = new Integer[n][2];
            for (int i = 0; i < n; i++) {
                a[i][0] = i + 1;
                a[i][1] = Integer.parseInt(in.next());
            }
            Arrays.sort(a, (x, y) -> Integer.compare(x[1], y[1]));

            // 出力
            for (int i = 0; i < n; i++) {
                out.print(a[i][0]);
                if (i < n - 1) out.print(" ");
            }
            out.println();

        }

    }
}



Measured memory_bytes: 53612
# coding: utf-8
import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    S = str(input())
    return (S,)


def solve(S):
    count = collections.Counter([char for char in S])
    for c in count.values():
        if c >= 2:
            ans = "no"
            break
    else:
        ans = "yes"
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()


Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef pair <int, int> pii;
typedef pair <pii, int> ppi;

const int N = 1e3 + 10;
int n, m, ans, mark[N][N];
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
queue <ppi> que;

bool is_val(int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < m;
}

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	memset(mark, 127, sizeof mark);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			char c;
			cin >> c;
			if (c == '#')
				que.push({{i, j}, 0});
		}
	
	while (que.size()) {
		int x = que.front().first.first, y = que.front().first.second, c = que.front().second;
		que.pop();
		if (mark[x][y] < c)
			continue;
		mark[x][y] = c;
		
		for (int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if (is_val(nx, ny) && mark[nx][ny] > c + 1) {
				mark[nx][ny] = c + 1;
				que.push({{nx, ny}, c + 1});
			}
		}
	}
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			ans = max(ans, mark[i][j]);
	cout << ans;
}

Measured memory_bytes: 32820
#include <bits/stdc++.h>
using namespace std;
#define retunr return
#define pb push_back
#define mp make_pair
#define null NULL
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", (x))
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", (x))
#define rep(i,l,r) for (int i = l, lim = r;i <= lim; ++i)
#define repr(i,l,r) for (int i = r, lim = l;i >= lim; --i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef unsigned int uint;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define N 100010
#define M 1024
#define MOD 1000000007
void _add(int &a, int b){a = (a+b)%MOD;}
void _sub(int &a, int b){a = (a+MOD-b)%MOD;}
void _mul(int &a, int b){a = (ll)a*b%MOD;}
void _max(int &a, int b){a = max(a,b);}
void _min(int &a, int b){a = min(a,b);}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b,a%b);}
ll pw(ll a, ll b){ll res(1);while(b){if(b&1)res=res*a%MOD;a=a*a%MOD;b>>=1;}return res;}
ll pwM(ll a, ll b, ll mod){ll res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807ll;
const db PI = 3.14159265358979323846;

/*
struct E{
	int v, w, n;
}G[N];
int cnt, point[N];
void adde(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k,q,p[N],c[N];
int main(){
//	freopen("1", "r", stdin);
	int D,G;
	sc(D),sc(G);
	G /= 100;
	rep(i,0,D-1)sc(p[i]),sc(c[i]), c[i] /= 100;
	int ans = infi;
	rep(x,0,(1<<D)-1){
		int tmp = 0, cnt = 0;
		rep(j,0,D-1){
			if((x>>j)&1){
				cnt += p[j];
				tmp += (j+1)*p[j]+c[j];
			}
		}
		if(tmp >= G){
			_min(ans, cnt);
		}else{
			repr(j,0,D-1){
				if(!((x>>j)&1) && tmp < G){
					if(tmp + (j+1)*p[j] >= G){
						int k = G-tmp;
						k = (k+(j+1)-1)/(j+1);
						cnt += k;
						tmp += k*(j+1);
					}else{
						cnt += p[j];
						tmp += (j+1)*p[j]+c[j];
					}
				}
			}
			if(tmp>=G)_min(ans,cnt);
		}
	}
	pr(ans),ln;
/*
	int Case;
	sc(Case);
	rep(ca, 1, Case){
	    printf("Case #%d: ", ca);
	}
*/
	return 0;
}


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#define assert(...)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second

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

int main(){
#define int ll
  int n,m,x; cin >> n >> m >> x;
  int l = 0, r = 0;
  rep(i,m){
    int a; cin >> a;
    if(a < x) l++;
    else r++;
  }
  cout << min(l,r) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100001
#define w 1000000007
 
int main() {
    int X, A;
    cin >> X >> A;
    if(X < A){
        cout << 0 << endl;
    }else{
        cout << 10 <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        
        for(String str : String.valueOf(n).split("")){
            sum += Integer.parseInt(str);
        }
        
        boolean ans = n % sum == 0 ? true : false;
        System.out.println(ans ? "Yes" : "No");
    }
}


Measured memory_bytes: 23764
#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>;

struct UnionFind {
  vector<int> d;

  UnionFind(int n = 0) : d(n, -1) {}

  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }

  void unite(int x, int y) {
    int rx = find(x);
    int ry = find(y);
    if (rx == ry) return;
    if (ry < rx) swap(rx, ry);
    d[rx] += d[ry];
    d[ry] = rx;
  }

  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

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

  UnionFind uf(n);

  vector<int> f(n, 0);
  rep(i, m) {
    int a, b;
    cin >> a >> b;

    a--;
    b--;

    f[a]++;
    f[b]++;

    uf.unite(a, b);
  }

  vector<int> g(n, 0);
  rep(i, n) g[i] = uf.size(i) - f[i] - 1;

  rep(i, k) {
    int c, d;
    cin >> c >> d;

    c--;
    d--;

    if (uf.same(c, d)) {
      g[c]--;
      g[d]--;
    }
  }

  string s;
  for (int j = 0; j < (int)f.size(); j++) {
    s += to_string(g[j]);

    if (j != (int)f.size()-1) {
      s += " ";
    }
  }

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 5468
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int c[5][5], b[10], a[10];
bool chck(){
  int tmp1, tmp2, tmp3;
  for(int i=0; i<3; ++i){
    for(int j=i+1; j<3; ++j){
      tmp1=c[i][0]-c[j][0];
      tmp2=c[i][1]-c[j][1];
      tmp3=c[i][2]-c[j][2];
      if(tmp1!=tmp2||tmp1!=tmp3||tmp1!=tmp3)
        return 0;
    }
  }
  for(int i=0; i<3; ++i){
    for(int j=i+1; j<3; ++j){
      tmp1=c[0][i]-c[0][j];
      tmp2=c[1][i]-c[1][j];
      tmp3=c[2][i]-c[2][j];
      if(tmp1!=tmp2||tmp1!=tmp3||tmp2!=tmp3)
        return 0;
    }
  }
  return 1;
}
int main(){
  int n;
    for(int i=0; i<3; ++i){
      for(int j=0; j<3; ++j){
        cin>>c[i][j];
      }
    }
    if(chck()){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }

  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int main(){
    int N, A, B, i;
    cin >> N >> A >> B;
    vector< int > P(N);
    vector< int > E(3);
 
    for (i=0; i<N; i++){
        cin >> P[i];
    }
    
    for (i=0; i<N; i++){
        if (P[i] <= A) E[0]++;
        else if (P[i] <= B) E[1]++;
        else E[2]++;
    }
    
    int min = *min_element(E.begin(), E.end());
 
    cout << min << '\n';
}

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

int main()
{
    ios::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
    int n;
    cin >> n;
    for (int p=1; p<=n; p++)
    {
        int res = 0;
        for (int x = 1; x*x + x*2 <= p ; x++)
        {
            for (int y = 1;  x*x + y*y + x*y + x + y <= p ; y++)
            {
                for (int z = 1; (x*x + y*y + z*z + x*y + y*z + z*x <= p) ; z++)
                    if (x*x + y*y + z*z + x*y + y*z + z*x == p)
                        res++;
            }
        }
        cout << res <<'\n';
    }
    return 0;
}

Measured memory_bytes: 3472
#pragma GCC optimize("3","inline","Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>inline void read(T &x) {
	x=0;T f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-48,ch=getchar();
	x*=f;
}
inline void Setfile(string Str="") {
	if(Str=="")
		return;
	freopen((Str+".in").c_str(),"r",stdin);
	freopen((Str+".out").c_str(),"w",stdout);
}
const int maxn=100005;
int n,m,p[maxn];
vector<int>G[maxn];
inline int K(int u,int f) {
	if((int)G[u].size()>2)
		return u;
	for(auto v:G[u])
		if(v!=f)
			return K(v,u);
	return u;
}
int main() {
	Setfile();
	read(n);
	for(int i=1,x,y;i<n;++i)
		read(x),read(y),++x,++y,G[x].push_back(y),G[y].push_back(x);
	for(int i=1;i<=n;++i)
		if((int)G[i].size()==1)
			p[K(i,0)]=1,++m;
	for(int i=1;i<=n;++i)
		if(p[i])
			--m;
	printf("%d\n",max(m,1));
}

Measured memory_bytes: 6656
#include<iostream>
#include<algorithm>
using namespace std;
struct node{
	int parent ,left ,right ;
};
int getroot(node);
const int nil = -1;
int D[30],H[30];
node N[30];
void setdepth(int,int);
int setheight(int);
void preorder(int);
void inorder(int);
void postorder(int);

int main(){
	int n;
	cin >>n;
	for(int i=0;i<n;i++) N[i].parent = N[i].left = N[i].right = nil;
	for(int i=0;i<n;i++){
		int id;
		cin >> id;
		cin >> N[id].left >> N[id].right;
		if(N[id].left != nil) N[N[id].left].parent = id;
		if(N[id].right != nil) N[N[id].right].parent = id;
	}
	//cerr << "input was succeeded." << endl;
	int root = getroot(N[0]);
	cout << "Preorder" << endl;
	preorder(root);
	cout << endl << "Inorder" << endl;
	inorder(root);
	cout << endl << "Postorder" << endl;
	postorder(root);
	cout << endl;

}

int getroot(node x){
	int x_id = 0;
	while(x.parent != nil){
		x_id = x.parent;
		x = N[x_id];
	}
	//cerr << "root:" << x_id << endl;
	return x_id;
}

void setdepth(int id,int d){
	D[id] = d;
	if(N[id].left != nil) setdepth(N[id].left,d+1);
	if(N[id].right != nil) setdepth(N[id].right,d+1);
}

int setheight(int id){
		int l,r;
		l = r = 0;
		if(N[id].left != nil) l = setheight(N[id].left)+1;
		if(N[id].right != nil) r = setheight(N[id].right)+1;
		return H[id] = max(l,r);
}

void preorder(int id){
	cout << " " << id;
	if(N[id].left != nil) preorder(N[id].left);
	if(N[id].right != nil) preorder(N[id].right);
}

void inorder(int id){
	if(N[id].left != nil) inorder(N[id].left);
	cout << " " << id;
	if(N[id].right != nil) inorder(N[id].right);
}

void postorder(int id){
	if(N[id].left != nil) postorder(N[id].left);
	if(N[id].right != nil) postorder(N[id].right);
	cout << " " << id;
}

Measured memory_bytes: 3116
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int N, K;
    cin >> N >> K;

    vs64 x(N);
    rep (i, N) cin >> x[i];

    s64 ans = 1e9;
    rep (i, N)
    {
        if (i + K > N) break;
        if (x[i + K - 1] <= 0)
        {
            ans = MIN(ans, -x[i]);
        }
        else if (x[i] >= 0)
        {
            ans = MIN(ans, x[i + K - 1]);
        }
        else
        {
            ans = MIN(ans, x[i + K - 1] - x[i] + MIN(-x[i], x[i + K - 1]));
        }
    }

    cout << ans << "\n";
    return 0;
}



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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long i64;
typedef pair<i64,i64> P;


int a,b;

int main(){
	cin >> a >> b;
	
	if(a<b){
		cout << 0 << endl;
	}
	else{
		cout << 10 << endl;
	}
	
	return 0;
}

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

s = []
g = []
for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')



Measured memory_bytes: 21848
m,n = map(int,input().split())
matrix_1 = []
matrix_2 = []
matrix_new = []

for i in range(m):
    x = list(map(int,input().split()))
    matrix_1.append(x)

for j in range(n):
    y = int(input())
    matrix_2.append(y)

c=0
while c<m:
    element = 0
    for j in range(n):
        element += matrix_1[c][j]*matrix_2[j]
    matrix_new.append(element)
    c+=1

for p in range(len(matrix_new)):
    print(matrix_new[p])

Measured memory_bytes: 7980
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>
#include <cmath>

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<long long, long long>;


void solve() {

    char ch;
    cin >> ch;

    cout << char(ch + 1);
}


int main() {
    ios_base::sync_with_stdio(false);

    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(5);
#ifdef __JETBRAINS_IDE__
    freopen("../input.in", "r", stdin);
    freopen("../output.out", "w", stdout);
#endif
    //gen();
    solve();
#ifdef __JETBRAINS_IDE__
    //cout << '\n' << (double)clock() / CLOCKS_PER_SEC << '\n';
#endif
}

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

#define long long int

const int D = 365;
vector<int> C(26), ans(D, 0);
vector<vector<int>> S(D, vector<int>(26));

void rand_init()
{
    rep(i,26) C[i] = rand() % 100;
    rep(i,D) rep(j,26) S[i][j] = rand() % 20000;
}
void input()
{
    int tmp;
    cin >> tmp;
    if(tmp == 0)
    {
        rand_init();
        return;
    }
    rep(i,26) cin >> C[i];
    rep(i,D)rep(j,26) cin >> S[i][j];
    rep(i,D) cin >> ans[i]; rep(i,D) ans[i]--; //B,C問題用
}
void output()
{
    for(auto x : ans)
        cout << x+1 << "\n";
}
int calc(vector<int> &vec)
{
    int score = 0;
    vector<int> last(26, -1);
    rep(i,D) score += S[i][ans[i]];
    rep(i,D)
    {
        int cur = vec[i];
        last[cur] = i;
        rep(j,26)
        {
            score -= C[j] * (i - last[j]);
        }
    }
    return score;
}
void incremental()
{
    rep(t, 100000)
    {
        vector<int> old = ans;
        rep(i,rand()%5)
        {
            int d = rand() % D, q = rand() % 26;
            ans[d] = q;
        }
        if(calc(ans) < calc(old))
            ans = old;
    }
}
void greedy()
{
    vector<int> last(26, -1);
    rep(i,D)
    {
      int cur = 0, pt = -1e9;
      rep(j,26)
      {
        int sum = S[i][j];
        rep(k, 26)
        {
          if(j == k) continue;
          sum -= C[k] * (i - last[k]);
        }
        if(sum > pt)
        {
          cur = j;
          pt = sum;
        }
      }
      ans[i] = cur;
      last[cur] = i;
    }   
}
void solve()
{
  greedy();
  incremental();
}
void outcalc() 
{
  cout << calc(ans) << endl;
  return;
}

int main()
{
    input();
    solve();
    output();
    //outcalc();
    
    return 0;
}


Measured memory_bytes: 3664
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
//typedef long long ll;
using ll = long long;
using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;

set<int> s;

signed main()
{
    int N;
    int a[110];
    int cnt = 0;

    cin >> N;
    REP(i,N) {
        cin >> a[i];
        if (a[i] <= 3199) {
            s.insert(a[i] / 400);
        } else {
            cnt++;
        }
    }

    if (s.size() == 0) {
        cout << 1 << " " << (int)(s.size() + cnt) << endl;
    } else {
        cout << s.size() << " " << (int)(s.size() + cnt) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import math, heapq
from operator import itemgetter as ig
from collections import defaultdict as dd
# 定数
INF = float("inf")
MOD = int(1e9 + 7)
# ヒープ
class heapque:
    def __init__(self, *args):
        self.que = []
        for arg in args:
            self.push(arg)
    def push(self, v):
        heapq.heappush(self.que, v)
    def pop(self):
        return heapq.heappop(self.que)
# 最大公約数 / 最小公倍数
def gcd(v1, v2):
    if v2 == 0:
        return v1
    return gcd(v2, v1 % v2)
def lcm(v1, v2):
    return (v1 // gcd(v1, v2)) * v2
# 二分探索
def bsr(a, v, lo=0, hi=None):
    if hi == None:
        hi = len(a) - 1
    if hi < lo:
        return lo
    mi = (lo + hi) // 2
    if v < a[mi]:
        return bsr(a, v, lo, mi - 1)
    else:
        return bsr(a, v, mi + 1, hi)
# Union-Find木
class uft:
    def __init__(self, n):
        self.height = [1] * n
        self.group = [-1] * n
    def root(self, v):
        if self.group[v] < 0:
            return v
        self.group[v] = self.root(self.group[v])
        return self.group[v]
    def size(self, v):
        return - self.group[self.root(v)]
    def merge(self, v1, v2):
        v1, v2 = self.root(v1), self.root(v2)
        if v1 == v2:
            return
        if self.height[v1] < self.height[v2]:
            self.group[v2] += self.group[v1]
            self.group[v1] = v2
            self.height[v2] = max(self.height[v1] + 1, self.height[v2])
        else:
            self.group[v1] += self.group[v2]
            self.group[v2] = v1
            self.height[v1] = max(self.height[v1] , self.height[v2] + 1)
# グラフ
class graph:
    def __init__(self, n):
        self.n = n
        self.graph = [[] for _ in range(n)]
    def append(self, v1, v2, cost=1):
        self.graph[v1].append((v2, cost))
    # 最短経路：ダイクストラ法(Dijkstra's Algorithm)
    def dks(self, v):
        costs = [INF] * self.n
        costs[v] = 0
        done = [False] * self.n
        heap = heapque((0, v))
        while heap.que:
            c_cost, c_index = heap.pop()
            if done[c_index]:
                continue
            done[c_index] = True
            for n_index, n_cost in self.graph[c_index]:
                if c_cost + n_cost < costs[n_index]:
                    costs[n_index] = c_cost + n_cost
                    heap.push((costs[n_index], n_index))
        return costs

def main():
    N, M = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]

    ab = dd(list)
    for a, b in AB:
        ab[a] += [b]
    heap = heapque()
    v = 0
    for m in range(1, M + 1):
        if m in ab:
            for b in ab[m]:
                heap.push(-b)
        if heap.que:
            v += -heap.pop()
    print(v)

main()


Measured memory_bytes: 42544
fun main(args:Array<String>){
    val  H= readLine()!!.toInt()
    val W = readLine()!!.toInt()
    val N = readLine()!!.toInt()
    var a = 1
    var d: Int

    if (H > W){
        d = H
    }else{
        d = W
    }

    while (true){
        if( d*a >= N){
            println(a)
            break
        }
        a++
    }

}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++) cin >> B[i];
  for(int i = 0; i < N; i++) cin >> C[i];
  
  A.push_back(1<<30);
  B.push_back((1<<30)+1);

  sort(A.begin(), A.end());
  sort(B.begin(), B.end());
  sort(C.begin(), C.end());
  
  ll ans = 0;
  int iA, iB;
  iA = -1;
  iB = -1;

  vector<ll> totalB(N), sumB(N);
  for(int i = 0; i < N; i++){
    while(A[iA+1] < B[i]){
      iA++;
    }
    totalB[i] = iA+1;
  }

  sumB[0] = totalB[0];
  for(int i = 1; i < N; i++){
    sumB[i] = sumB[i-1] + totalB[i];
  }
  
  for(int i = 0; i < N; i++){

    while(B[iB+1] < C[i]){
      iB++;
    }
    if(iB >= 0){
      ans += sumB[iB];
    }
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 3056
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] data = br.readLine().split(" ");

		int[] A = new int[n];
		for (int i=0; i < n; i++) {
			A[i] = Integer.parseInt(data[i]);
		}

		long h = mergeSort(A, 0, n);
		System.out.println(h);

	}

	static long merge(int[] A, int l, int m, int r) { // l:left, m:mid, r:right
		int n1 = m - l;
		int n2 = r - m;

		int max = Integer.MAX_VALUE; //bannpei
		// L = {A[l], A[l+1], A[l+2], ... , A[m-2], A[m-1], bannpei}
		int[] L = new int[n1+1];
		for (int i=0; i < n1; i++) {
			L[i] = A[l+i];
		}

		// R = {A[m], A[m+1], ... , A[r-1], bannpei}
		int[] R = new int[n2+1];
		for (int i=0; i < n2; i++) {
			R[i] = A[m+i];
		}

		// bannpei?¨????
		L[n1] = max;
		R[n2] = max;

		int i = 0;
		int j = 0;
		long count = 0;
		for (int k = l; k < r; k++) {
			if ( L[i] <= R[j] ) {
				A[k] = L[i];
				i++;
			} else {
				A[k] = R[j];
				j++;
				count += n1 - i;
			}
		}
		return count;
	}

	/**
	 * A????????????l <= index < r??¨????????¨?????????????????´????????????
	 */
	static long mergeSort(int[] A, int l, int r) {
		long count = 0;
		if ( l+1 < r ) {
			int m = (l+r) / 2;
			count += mergeSort(A, l, m);
			count += mergeSort(A, m, r);
			count += merge(A, l, m, r);
		}
		return count;
	}
}

Measured memory_bytes: 61256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        for(int i=0; i<19; i++){
            if(s.charAt(i)==','){
                System.out.print(" ");
            }else{
                System.out.print(s.charAt(i));
            }
        }
        
   }
}


Measured memory_bytes: 35520
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define endl "\n" 
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;


int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int x, y, z;
  cin >> x >> y >> z;
  swap(x,y);
  swap(x,z);
  cout << x << " " << y << " " << z << endl;

  return 0;
}


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;
const int SIZE = 200000;

vector<int> G[SIZE];
vector<int> ans(SIZE), a(SIZE);
vector<int> L;
void dfs(int k = 0, int p = -1){
    int flag = -1;
    int itr = lower_bound(L.begin(), L.end(), a[k]) - L.begin();
    vector<int>::iterator it = lower_bound(L.begin(), L.end(), a[k]);
    if (it == L.end()){
        L.push_back(a[k]);
    }
    else {
        flag = L[itr];
        L[itr] = a[k];
    }
    ans[k] = L.size();
    for (auto &&i : G[k]){
        if (i == p)continue;
        dfs(i, k);
    }
    if (flag == -1)L.pop_back();
    else L[itr] = flag;
}
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n; cin >> n;
    rep(i,n)cin >> a[i];
    rep(i,n-1){
        int u, v; cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs();
    rep(i,n)
        cout << ans[i] << endl;
}

Measured memory_bytes: 27124
#include <bits/stdc++.h>
#define adj_list vector<vi>
#define endl "\n"
#define INF_INT 2e9
#define INF_LL 2e18
#define matmax 25
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define pi pair<int, int>
#define pii pair<int, pair<int, int> >
#define pl pair<ll, ll>
#define pll pair<ll, pair<ll, ll> >
#define vi vector<int>
#define vl vector<ll>
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long int ll;

int lsone(int n)
{
	return (n&-n);
}

ll pow1(ll a, ll b)
{
	if (b == 0)
		return 1ll;
	else if (b == 1)
		return a;
	else
	{
		ll x = pow1(a, b/2);
		x *= x;
		x %= mod;
		if (b%2)
		{
			x *= a;
			x %= mod;
		}
		return x;
	}
}

int n, m, x, y, dp[110000], in[110000], vis[110000];
vector< vector<int> > v(110000);

int dfs(int index)
{
	if (dp[index] != -1)
		return dp[index];
	dp[index] = 0;

	for (auto node : v[index])
	{
		dp[index] = max(dp[index], 1+dfs(node));
	}
	return dp[index];
}

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

	for (int i = 1; i <= m; i++)
	{
		cin>>x>>y;
		in[y]++;
		v[x].pb(y);
	}
	int ans = 0;
	memset(dp, -1, sizeof(dp));
	for (int i = 1; i <= n; i++)
	{
		if (in[i] == 0)
		{
			ans = max(ans, dfs(i));
		}
	}

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


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
ll x;
ll a[110];

int main() {
	cin >> N >> x;
	ll s = 0;

	rep(i, N) {
		cin >> a[i];
		s += a[i];
	}

	if (s == x) {
		cout << N << endl;
		return 0;
	}

	sort(a, a + N);
	s = 0;
	int ans = 0;

	rep(i, N-1) {
		s += a[i];
		if (s <= x) {
			ans = i + 1;
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

ll n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

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


int main(void) {
  ll a, b, c, x;

  cin >> a >> b >> c >> x;

  FOR(i, 0, a+1) {
	FOR(j, 0, b+1) {
	  FOR(k, 0, c+1) {
		if (x == 500 * i + 100 * j + 50 * k) {
		  cnt++;
		}
	  }
	}
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define MAX (ll)(1e3 + 10)
#define MOD (ll)(1e9 + 7)

ll dp[MAX][MAX];
ll r, c;

ll solve(ll i, ll j)
{
    if (i < 0)
        return 0;
    if (j < 0)
        return 0;

    if (dp[i][j] == -1)
        dp[i][j] = (solve(i - 1, j) + solve(i, j - 1)) % MOD;
    return dp[i][j];
}

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

    cin >> r >> c;
    memset(dp, -1, sizeof(dp));
    dp[0][0] = 1;

    char x;
    for (int i = 0; i < r; i++)
    {
        for (int j = 0; j < c; j++)
        {
            cin >> x;
            if (x == '#')
                dp[i][j] = 0;
        }
    }

    cout << solve(r - 1, c - 1) << "\n";
}


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

class UnionFind{
  public:
  //くっついてるグループの代表者を示す．
  //自身が代表者の場合，そのグループのサイズをマイナスでもつ
  vector<int> Parent;
  //n点のunionfind木をつくる
  //最初は全員バラバラなので，全員が代表者かつサイズは1より-1をいれる
  UnionFind(int n){
    Parent=vector<int>(n,-1);
  }
  
  //aが誰を代表とするグループに属しているか調べる
  //代表者はParentの中に入ってる
  //a自身が代表者の場合，Parentには負の値が入っている
  int root(int a){
    if(Parent[a]<0) return a;
    //自分が誰の元にいるか見て，さらにその人が誰の下にいるか見ていく
    //これによって一番根本の人にあたるまで実行される
    //さらにここで代表者を一人に管理しなおしている
    Parent[a]=root(Parent[a]);
    return Parent[a];
  }
  
  //aのいるグループのサイズを調べる
  //aのいるグループの代表者のParentに負の値として入っているのでそれにアクセス
  int size(int a){
    return -Parent[root(a)];
  }
  
  //二つのグループをくっつける
  bool connect(int a,int b){
    a=root(a);
    b=root(b);
    //元々くっついてるグループならfalse
    if(a==b) return false;
    //aのグループの方が大きいとして，大きいほうに小さいほうをくっつける
    if(size(a)<size(b)) swap(a,b);
    //くっつくことでaのグループは，bのグループの大きさだけ大きくなる
    Parent[a]+=Parent[b];
    //bのグループの代表者はaのグループの代表者に移るため
    //bのグループの代表者のParentはaの代表者に変更される
    Parent[b]=a;
    return true;
  }

};


int main()
{
  int n,m;
  cin>>n>>m;
  vector<pair<int,int>> bridge;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    bridge.push_back(make_pair(a-1,b-1));
  }
  reverse(bridge.begin(),bridge.end());
  UnionFind land(n);
  ll inc=(ll)(n-1)*n/2;
  vector<ll> ans;
  ans.push_back(inc);
  for(int i=0;i<m;i++){
    
    int a=bridge[i].first,b=bridge[i].second;
    //くっついてなかった場合
    if(land.root(a)!=land.root(b)){
      inc-=(ll)(land.size(a)*land.size(b));
      land.connect(a,b);
      ans.push_back(inc);
    }
    //すでにくっついてる場合，変化はない
    else ans.push_back(inc);
  }
  reverse(ans.begin(),ans.end());
  ans.erase(ans.begin());
  for(ll x:ans){
    cout<<x<<endl;
  }
}

Measured memory_bytes: 3444
sx,sy,tx,ty=map(int,input().split())
ans=""
width=tx-sx
length=ty-sy
A="U"*length
B="R"*width
C="D"*length
D="L"*width
for i in range(2):
    if i==0:
        ans +=A+B+C+D
    else:
        ans +="L"+A+"UR"+B+"DR"+C+"DL"+D+"U"
print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(ReadLine());
        int[] A = ReadLine().Split(' ').Select(int.Parse).ToArray();
        int[] Y = new int[N + 1];

        for (int i = 0; i < N; i++)
        {
            Y[i + 1] = A[i] - Y[i];
        }
        Y[0] = Y[N] / 2;
        for(int i = 0; i < N; i++)
        {
            Y[i + 1] = A[i] - Y[i];
        }
        Write(2 * Y[0]);
        for (int i = 1; i < N; i++)
            Write(" " + 2 * Y[i]);
        WriteLine();
    }
}

Measured memory_bytes: 29912