akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,a,ma,mi; cin>>n>>a;
  ma=a; mi=a;
  for(int i=1; i<n; i++){
    cin>>a;
    ma=max(ma,a),mi=min(mi,a);
  }
  cout<<ma-mi;
}

Measured memory_bytes: 3620
from numba import njit
import numpy as np

d = int(input())
cs = list(map(int, input().split()))
cs = np.array(cs, dtype=np.int64)
sm = [list(map(int, input().split())) for _ in range(d)]
sm = np.array(sm, dtype=np.int64)

@njit('i8(i8[:], i8)', cache=True)
def total_satisfaction(ts, d):
    ls = np.zeros(26, dtype=np.int64)
    s = 0
    for i in range(d):
        t = ts[i]
        t -= 1
        s += sm[i][t]
        ls[t] = i + 1

        dv = cs * ((i+1) - ls)
        s -= dv.sum()
    return s

#@njit('i8(i8, i8[:], i8, i8, i8[:])', cache=True)
def differential(s, ts, t, d, ls):
    i = len(ts)

    t -= 1
    bk = ls[t]
    s += sm[i][t]
    ls[t] = i + 1

    dv = cs * ((i+1) - ls)
    s -= dv.sum()

    ls[t] = bk
    return s

ts = []
for i in range(d):
    sc = 0
    if len(ts) > 0:
        tt = np.array(ts, dtype=np.int64)
        sc = total_satisfaction(tt, i)

    ls = np.zeros(26, np.int64)
    for i, t in enumerate(ts, 1):
        ls[t-1] = i

    lst = []
    for t in range(1, 26+1):
        df = differential(sc, ts, t, i + 1, ls)
        s = sc + df
        lst.append((s, t))
    lst.sort(reverse=True)
    mxt = lst[0][1]
    ts.append(mxt)
    print(mxt)

Measured memory_bytes: 114392
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
// 40min
int main(void){
  int n, d;
  int x[11][11];
  int ans = 0;
  double sum = 0;
  scanf("%d%d", &n, &d);

  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= d; j++){
      scanf("%d", &x[i][j]);
    }
  }

  for(int i = 1; i <= n; i++){
    for(int k = 1; k <= n; k++){
      if(i == k){
	break;
      }
      sum = 0;
      for(int j = 1; j <= d; j++){
	sum += pow(x[i][j] - x[k][j], 2.0);
      }
      if(ceil(sqrt(sum)) == floor(sqrt(sum))){
	ans++;
      }
    }
  }
  
  printf("%d\n", ans);

  return 0;
}

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

int main(){
  int k, n;
  cin >> n >> k;
  int a, index;
  for (int i = 0; i < n; i++){
    cin >> a;
    if (a == 1)
      index = i;
  }
  cout << ceil((1.0 * (n - 1) / (k - 1))) << endl;
  return 0;
  }


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

using namespace std;

typedef long long int ll;

const int NMax = 2e5 + 5;
const int LIM = 1e9;

char c[10][10];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m;
    cin >> n >> m;

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            cin >> c[i][j];
        }
    }

    int x, y;
    x = y = 1;

    if(c[x][y] == '.') {
        cout << "Impossible";
        return 0;
    }

    bool ok = true;
    while(ok == true) {
        ok = false;
        c[x][y] = '.';
        if(c[x][y + 1] == '#') {
            ok = true;
            y++;
        } else {
            if(c[x + 1][y] == '#') {
                x++;
                ok = true;
            }
        }
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(c[i][j] != '.') {
                cout << "Impossible";
                return 0;
            }
        }
    }

    cout << "Possible";

    return 0;

}


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

struct edge
{
    int to;
    ll cost;
};
vector<vector<edge>> tree(100010);
vector<ll> depth(100010);

void dfs(int v, int p, ll d)
{ //vからの最短経路、現在地のいっこまえ、はじめからの距離
    depth[v] = d;
    for (auto &e : tree[v])
    {
        if (e.to == p)
            continue;
        dfs(e.to, v, d + e.cost);
    }
}

int main()
{
    int n;
    cin >> n;
    rep(i, n - 1)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        tree[a].push_back({b, c});
        tree[b].push_back({a, c});
    }

    int q, k;
    cin >> q >> k;
    k--;

    dfs(k, -1, 0);
    rep(i, q)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cout << depth[x] + depth[y] << endl;
    }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	map<string, int> freq;
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;
		freq[s]++;
	}
	vector<pair<string, int>> arr(freq.begin(), freq.end());
	sort(arr.begin(), arr.end(), [&](pair<string, int>& a, pair<string, int>& b) {
		if(a.second == b.second)
			return a.first < b.first;
		else
			return a.second > b.second;
	});
	int most = arr[0].second;
	for(auto& p : arr)
		if(p.second == most)
			cout << p.first << '\n';
}


Measured memory_bytes: 27008
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n,d,i,j,count;
	while(cin>>n)
	{
	    count=0; 
		for(i=1;i<=n;i+=2)
		{	
		    d=0;
			for(j=1;j<=sqrt(i);j++)
			{
				if(i%j==0)
				    d+=2;
			}
			if(d==8)
			    count++;
		}
		cout<<count<<endl;
	}
	return 0;
}


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

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

template <typename T>
inline void read(T &x)
{
    T data = 0, f = 1;
    char ch = getchar();
    while (!isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (isdigit(ch))
    {
        data = (data << 3) + (data << 1) + ch - '0';
        ch = getchar();
    }
    x = f * data;
}
const int maxn = 3e5 + 9;
const ll mod = 1e9 + 7;
ll a[maxn], s[maxn];
signed main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("data.txt", "w", stdout);
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //std::cout.tie(0);
    int n;
    read(n);
    s[0] = 0;
    for (int i = 1; i <= n; ++i)
    {
        read(a[i]);
        s[i] = (s[i - 1] + a[i]);
    }
    ll ans = 0;
    for (int i = 1; i < n; ++i)
    {
        ans += a[i] * ((s[n] - s[i]) % mod) % mod;
        ans %= mod;
    }
    cout << ans % mod << endl;
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

Measured memory_bytes: 6768
#include <bits/stdc++.h>
#define MAX 100001
using namespace std;

int root;
int parent[MAX];
int parent_cnt[MAX];
deque<int> child[MAX];
deque<int> que;

/*
  入力を読み込みながら
  -親を記録
  -親の数をカウント
  -子をリストに記録
  ※親が複数いる場合どれか1つを記録しておけばいい
  
  親の記録を辿って根を決定
  
  根から順に頂点を取り出す
  取り出したことで出来た新しい根をさらに取り出す
  
  キューで管理することで浅いところから順に処理
*/
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n, m;
  cin >> n >> m;
  root = 1;
  
  for(int i=1; i<n+m; i++){
    int a, b;
    cin >> a >> b;
    parent[b] = a;
    parent_cnt[b]++;
    child[a].push_back(b);
  }
  
  while(parent[root] != 0)
    root = parent[root];
  
  que.push_back(root);
  while(!que.empty()){
    int r = que.front();
    que.pop_front();
    for(int c: child[r]){
      parent_cnt[c]--;
      if(parent_cnt[c]==0){
        que.push_back(c);
        parent[c] = r;
      }
    }
  }
  
  for(int i=1; i<=n; i++)
    cout << parent[i]  << "\n";
  
  cout << flush;
  return 0;
}

Measured memory_bytes: 69632
n = int(input())
a = [int(e) for e in input().split(' ')]

ans = 0
freq = {}
for e in a:
    if e not in freq:
        freq[e] = 0
    freq[e] += 1
    if (freq[e] > e):
        ans += 1
        freq[e] -= 1

for e in freq:
    if e != freq[e]:
        ans += freq[e]

print(ans)

Measured memory_bytes: 17780
import java.util.Scanner;

public class Main{

	public static int prime(int a) {
		
		if( a == 0 || a == 1){
			return 0;
		}

		for (int i = 2; i <= Math.sqrt(a); i++) {
			
			if( a % i == 0){
				return 0;
			}

		}
		
		return 1;
	}

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int A[] = new int[n];

		for (int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
		}
		sc.close();
		
		int c = 0;
		
		for( int i = 0; i < n; i++){
			c += prime(A[i]);
		}
		
		System.out.println(c);

	}

}



Measured memory_bytes: 41032
//*
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <map>
#include <utility>

int main()
{
    int N;
    char K;
    int i;
    std::string in_str;
	std::string dstr;
    std::cin>>N;
    std::cin.ignore();
    bool ef=false;
	while(N){
		std::map<std::string,int> dmap;
        std::vector<std::pair<int,std::string> > vecs;
        std::stringstream ss;
        for(i=0;i<N;i++){
            std::getline(std::cin,in_str);
        	ss<<in_str<<" ";
        }
		while(ss>>in_str){
			if(!dmap.count(in_str)){
            	dmap.insert(std::map<std::string,int>::value_type(in_str,0));
        	}else{
        		dmap[in_str]--;
        	}
    	}
        std::cin>>K;
        std::cin.ignore();
        std::map<std::string,int>::iterator it;
        for(it=dmap.begin();it!=dmap.end();it++){
        	if((*it).first[0]==K){
        		vecs.push_back(std::pair<int,std::string>((*it).second,(*it).first));
        	}
        }
        if(vecs.empty()){
			std::cout<<"NA"<<std::endl;
		}else{
			std::sort(vecs.begin(),vecs.end());
            std::cout<<vecs[0].second;
			for(i=1;i<5&&i<vecs.size();i++){
					std::cout<<" "<<vecs[i].second;
			}
            std::cout<<std::endl;
		}
        std::cin>>N;
        std::cin.ignore();
	}
}
//*/

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


int main(){
  int h,w,n;
  cin >> h >> w >> n;
  int ans;
  if(h>w){
    if(n%h==0){
      ans = n/h;
    }else{
      ans = n/h+1;
    }
  }else{
    if(n%w==0){
      ans = n/w;
    }else{
      ans = n/w+1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 100001;

int n, fact[N], inv[N], s[N], mod = 1e9 + 7;
vector <int> a;

int powlog(int a, int b){
    if(b == 0) return 1;
    int ret = powlog(a, b / 2);
    if(b % 2) return 1LL * ret * ret % mod * a % mod;
    return 1LL * ret * ret % mod;
}
int calc(int m){
    return 1LL * s[m] * fact[n] % mod * inv[m] % mod;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    fact[0] = 1;
    for(int i = 1 ; i < N ; i++){
        fact[i] = 1LL * fact[i - 1] * i % mod;
    }
    inv[N - 1] = powlog(fact[N - 1], mod - 2);
    for(int i = N - 2 ; i >= 0 ; i--){
        inv[i] = 1LL * (i + 1) * inv[i + 1] % mod;
    }
    for(int i = 1 ; i < N ; i++){
        s[i] = (1LL * i * s[i - 1] + fact[i - 1]) % mod;
    }
    cin >> n;
    a.resize(n);
    for(auto &i : a) cin >> i;
    int ans = 0;
    for(int i = 0 ; i < n ; i++){
        ans = (ans + 1LL * a[i] * (calc(i + 1) + calc(n - i)) % mod) % mod; 
        ans = (ans - 1LL * a[i] * fact[n] % mod + mod) % mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
    int K,N;
    cin>>K>>N;
    vector<int> v(N);
    for(int i=0;i<N;i++){
        cin>>v[i];
    }
    int maximumDistance = 0,previous = 0;
    for(int i=0;i<N;i++){
        maximumDistance = max(maximumDistance,abs(v[i]-previous));
        previous = v[i];
    }
    maximumDistance = max(maximumDistance,K-v.back()+v[0]);
    cout<<K-maximumDistance<<endl;
}

Measured memory_bytes: 4044
/**
*    created: 22.05.2020 23:39:24
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int a, b, n;
    cin >> a >> b >> n;
    int t = min(n,b-1);
    cout << floor(a*t/b) << endl;
    return 0;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(r,D,x);
    ll X=x;
    rep(i,10){
        X=r*X-D;
        printf("%lld\n",X);
    }

    return 0;
}

Measured memory_bytes: 256
#import sys
#input = sys.stdin.read

n=int(input())
lsta=list(map(int, input().split()))

abslsta=[abs(v) for v in lsta]
min_index=abslsta.index(min(abslsta))

for i in range(n-1):
    if lsta[i]<0:
        lsta[i]=lsta[i]*(-1)
        lsta[i+1]=lsta[i+1]*(-1)

if lsta[n-1]<0:
    if min_index==n-1:
        print(sum(lsta))

    else:
        print(sum(lsta)-lsta[n-1]*2-lsta[min_index]*2)

else:
    print(sum(lsta))

Measured memory_bytes: 14468
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long ll;
const int MYINF = 1e9+7;

typedef struct node_st {
	int val;
	struct node_st *prev;
	struct node_st *next;
} node_t;

typedef struct {
	node_t *head;
	node_t *tail;
	node_t *fl;
} deque_t;

void *xmalloc(size_t s) {
	void *p = malloc(s);
	if (p == NULL) {
		fprintf(stderr, "Can't malloc\n");
		exit(1);
	}
	return p;
}

deque_t *deque_init() {
	deque_t *d = xmalloc(sizeof(deque_t));
	d->head = xmalloc(sizeof(node_t));
	d->tail = xmalloc(sizeof(node_t));

	d->head->val = -1;
	d->head->prev = d->head;
	d->head->next = d->tail;

	d->tail->val = -2;
	d->tail->prev = d->head;
	d->tail->next = d->tail;

	d->fl = d->tail;
	return d;
}

node_t *node_get(deque_t *d) {
	node_t *p;
	if (d->fl == d->tail) {
		p = xmalloc(sizeof(node_t));
	} else {
		p = d->fl;
		d->fl = p->next;
	}
	return p;
}

void node_free(deque_t *d, node_t *p) {
	p->next->prev = p->prev;
	p->prev->next = p->next;
	p->next = d->fl;
	d->fl = p;
}

void insert(deque_t *d, int x) {
	node_t *p = node_get(d);
	p->val = x;
	p->next = d->head->next;
	p->prev = d->head;
	d->head->next->prev = p;
	d->head->next = p;
}

void delete(deque_t *d, int x) {
	node_t *p;
	for (p = d->head->next; p != d->tail; p = p->next) {
		if (p->val == x) {
			node_free(d, p);
			break;
		}
	}
}

void deleteFirst(deque_t *d) {
	if (d->head->next != d->tail) node_free(d, d->head->next);
}

void deleteLast(deque_t *d) {
	if (d->tail->prev != d->head) node_free(d, d->tail->prev);
}

void print(deque_t *d) {
	node_t *p;
	const char *sp = "";
	for (p = d->head->next; p != d->tail; p = p->next) {
		printf("%s%d", sp, p->val);
		sp = " ";
	}
	putchar('\n');
}

int main(int argc, char **argv)
{
	int n, i, x;
	char buf[128];
	deque_t *d;

	d = deque_init();
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", buf);
		if (strcmp(buf, "insert") == 0) {
			scanf("%d", &x);
			insert(d, x);
		} else if (strcmp(buf, "delete") == 0) {
			scanf("%d", &x);
			delete(d, x);
		} else if (strcmp(buf, "deleteFirst") == 0) {
			deleteFirst(d);
		} else if (strcmp(buf, "deleteLast") == 0) {
			deleteLast(d);
		} else {
			fprintf(stderr, "Command not found: %s\n", buf);
		}
	}

	print(d);

	return 0;
}

Measured memory_bytes: 31852
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (X, Y, Z) = read!(i64, i64, i64);
    println!("{} {} {}", Z, X, Y);
}


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

int main(){
  ll N;
  vector<int> A(200000), num(200000);
  cin >> N;
  for (int i = 1; i < N; i++) cin >> A.at(i);
  for (int i = 1; i < N; i++) num.at(A.at(i) - 1)++;
  rep (i, N) cout << num.at(i) << endl;

}


Measured memory_bytes: 4664
/* Lavish Gupta */
#define ll long long
#define dd long double
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mp make_pair
#define mt make_tuple
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
//#include<bits/stdc++.h>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<utility>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<stack>
dd pi = acos(-1) ;
ll z =  1000000007 ;
ll inf = 100000000000000000 ;
ll p1 = 37 ;
ll p2 = 53 ;
ll mod1 =  202976689 ;
ll mod2 =  203034253 ;
ll fact[100] ;
ll gdp(ll a , ll b){return (a - (a%b)) ;}
ll ld(ll a , ll b){if(a < 0) return -1*gdp(abs(a) , b) ; if(a%b == 0) return a ; return (a + (b - a%b)) ;} // least number >=a divisible by b
ll gd(ll a , ll b){if(a < 0) return(-1 * ld(abs(a) , b)) ;    return (a - (a%b)) ;} // greatest number <= a divisible by b
ll gcd(ll a , ll b){ if(b > a) return gcd(b , a) ; if(b == 0) return a ; return gcd(b , a%b) ;}
ll e_gcd(ll a , ll b , ll &x , ll &y){ if(b > a) return e_gcd(b , a , y , x) ; if(b == 0){x = 1 ; y = 0 ; return a ;}
ll x1 , y1 ; e_gcd(b , a%b , x1 , y1) ; x = y1 ; y = (x1 - ((a/b) * y1)) ; return e_gcd(b , a%b , x1 , y1) ;}
ll power(ll a ,ll b , ll p){if(b == 0) return 1 ; ll c = power(a , b/2 , p) ; if(b%2 == 0) return ((c*c)%p) ; else return ((((c*c)%p)*a)%p) ;}
ll inverse(ll a ,ll n){return power(a , n-2 , n) ;}
ll max(ll a , ll b){if(a > b) return a ; return b ;}
ll min(ll a , ll b){if(a < b) return a ; return b ;}
ll left(ll i){return ((2*i)+1) ;}
ll right(ll i){return ((2*i) + 2) ;}
ll ncr(ll n , ll r){if(n < r|| (n < 0) || (r < 0)) return 0 ; return ((((fact[n] * inverse(fact[r] , z)) % z) * inverse(fact[n-r] , z)) % z);}
void swap(ll&a , ll&b){ll c = a ; a = b ; b = c ; return ;}
//ios_base::sync_with_stdio(0);
//cin.tie(0); cout.tie(0);
using namespace std ;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
//__builtin_popcount(n) -> returns number of set bits in n

void solve()
{
    string str ;
    cin >> str ;
    fo(i , str.size())
    {
        if(str[i] == 'P')
            cout << str[i] ;
        else
            cout << 'D' ;
    }
    return ;

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif*/
    
    ll t ;
    //cin >> t ;
    t = 1 ;
   
    while(t--)
    {
        solve() ;
    }
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
    return 0;
}

Measured memory_bytes: 3748
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b)
{
    return *(int *)a-*(int *)b;
}
int main(void)
{
    int n,p[60],q[60];
    scanf("%d",&n);
    int c=0;
    for(int i=0;i<n;i++){
        scanf("%d",&p[i]);
        q[i]=p[i];
    }
    qsort(q,n,sizeof(int),cmp);
    for(int i=0;i<n;i++){
        if(p[i]!=q[i]) c++;
    }
    if(c==0 || c==2) puts("YES");
    else puts("NO");
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    string S; cin >> S;
    int N = 15 - S.length();
    int cnt = 0;
    for (char c : S) if (c == 'o') cnt++;
    if (cnt + N >= 8) printf("%s\n", "YES");
    else printf("%s\n", "NO");
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int n,i;
double x,sum;
string u;
int main(){
  cin>>n;
  for(i=0;i<n;i++){
    cin>>x>>u;
    if(u=="BTC")sum+=x*380000.0;
    else sum+=x;
  }
  printf("%f\n",sum);
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    string S;
    cin >> S;
    if (S == "ABC")
    {
        cout << "ARC";
    }
    else
    {
        cout << "ABC";
    }
}


Measured memory_bytes: 3628
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int X = scan.nextInt();
                int N = scan.nextInt();
                
                int min1=-1;
                ArrayList<Integer> list = new ArrayList<>();
                for(int i=-1; i<=101; i++){
                    list.add(i);
                }       
                for(int i=0; i<N;i++){
                    int p = scan.nextInt();
                    for(int j=0; j<list.size(); j++){
                        if(p==list.get(j)){
                            list.remove(j);
                            break;
                        }
                    }
                }
                int sa = 1000;
                int ans = -1;
                for(int i=0; i<list.size();i++){
                     if(sa>Math.abs(X-list.get(i))){
                         sa = Math.abs(X-list.get(i));
                         ans = list.get(i);
                     }
                }
                
                System.out.println(ans);
        }
}

Measured memory_bytes: 35972
#include<bits/stdc++.h>
    using namespace std;
     
    vector <int> B[1000100];
    vector <int> CZ[1000100];
    map < pair <int,int>, int> mapka;
    pair <int,int> para;
    queue <int> Q;
    int odcz[1000100],odb[10000100];
    int n,m,k,a,b,x;
     void BFSB(int u)
    {
        odb[u]=x;
        Q.push(u);
        while(!Q.empty())
        {
     
     
            int w=Q.front();
            Q.pop();
     
            ///////////////////////////////////
            for(int i=0;i<B[w].size();i++)
            {
                int v=B[w][i];
     
                if(odb[v]==0)
                {
                    odb[v]=x;
                    Q.push(v);
                }
            }
          }
    }
    void BFSCZ(int u)
    {
        odcz[u]=x;
        Q.push(u);
        while(!Q.empty())
        {
     
     
            int w=Q.front();
            Q.pop();
     
            ///////////////////////////////////
            for(int i=0;i<CZ[w].size();i++)
            {
                int v=CZ[w][i];
     
                if(odcz[v]==0)
                {
                    odcz[v]=x;
                    Q.push(v);
                }
            }
         }
    }
     
      int main()
      {
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      cin>>n>>m>>k;
      for(int i=1;i<=m;i++)
      {
         cin>>a>>b;
         CZ[a].push_back(b);
         CZ[b].push_back(a);
      }
      for(int i=1;i<=k;i++)
      {
         cin>>a>>b;
         B[a].push_back(b);
         B[b].push_back(a);
      }
      for(int i=1;i<=n;i++)
      {
       if(odb[i]==0)
       {
       x++;
       BFSB(i);
       }
      }
      for(int i=1;i<=n;i++)
      {
       if(odcz[i]==0)
       {
       x++;
       BFSCZ(i);
       }
      }
      for(int i=1;i<=n;i++)
      {
     // cout<<odcz[i]<<" "<<odb[i]<<endl;
      }
      for(int i=1;i<=n;i++)
      {
      para.first=odcz[i];
      para.second=odb[i];
      mapka[para]++;
      }
      for(int i=1;i<=n;i++)
      {
      para.first=odcz[i];
      para.second=odb[i];
       cout<<mapka[para]<<" ";
      }
     
    }

Measured memory_bytes: 68736
#include<bits/stdc++.h>
using namespace std;
int func(vector<int> &longest_path,vector<int> node_edge[],int node)
{
    //cout<<node<<"n ";
    //for(int i=0;i<node_edge[node].size();++i)
    //cout<<node_edge[node][i]<<" ";
    //cout<<endl;
    if(longest_path[node] >= 0)
    {
      //  cout<<longest_path[node]<<" one\n";
          return longest_path[node];
    }
  
    if(node_edge[node].size() == 0)
    {
        longest_path[node]=0;
       // cout<<"0 two\n";
        return 0;
    }
    //cout<<"YES";
    for(int i=0;i<node_edge[node].size();++i)
    {
     //   cout<<node_edge[node][i]<<" ";
         longest_path[node]=max(longest_path[node],1+func(longest_path,node_edge,node_edge[node][i]));
    }
   //cout<<endl;
    //cout<<longest_path[node]<<" three\n";
    return longest_path[node];
}
int main()
{
    int n,m;
    cin>>n>>m;
    vector<int> node_edge[100001];
    for(int i=0;i<m;++i)
    {
        int x,y;
        cin>>x>>y;
        node_edge[x].push_back(y);
    }
    vector<int> longest_path;
    for(int  i=0;i<100001;++i)
    longest_path.push_back(-1);
  
    for(int i=1;i<100001;++i)
    {
        if(node_edge[i].size() == 0)
        continue;
        if(longest_path[i] >= 0)
        continue;
        //cout<<"YES";
        for(int j=0;j<node_edge[i].size();++j)
            {
             //   cout<<node_edge[i][j]<<" "<<i<<" "<<j<<" "<<node_edge[i].size()<<" YES\n";
                longest_path[i]=max(longest_path[i],1+func(longest_path,node_edge,node_edge[i][j]));
            }
    }
   
    int ans=0;
    for(int i=0;i<100001;++i)
    {
        //cout<<longest_path[i]<<" ";
        ans=max(ans,longest_path[i]);
    }
   // cout<<endl;
    
    cout<<ans;
}
/*
6 3
2 3
4 5
5 6
*/

Measured memory_bytes: 8952
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(a: int, s: str):
    if a >= 3200:
        print(s)
    else:
        print("red")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    a = int(next(tokens))  # type: int
    s = next(tokens)  # type: str
    solve(a, s)


if __name__ == '__main__':
    main()


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

int main(){
  int A, B, C, X;
  int sum = 0, cnt = 0;
  cin >> A >> B >> C >> X;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        sum = 500 * i + 100 * j + 50 * k;
        if(sum == X) cnt++;
      }
    }
  }

  cout << cnt << endl;
  
  return 0;
}



Measured memory_bytes: 256
//     . .. ... .... ..... be name khoda ..... .... ... .. .     \\

#include <bits/stdc++.h>
using namespace std;

inline int in() { int x; scanf("%d", &x); return x; }
const int N = 2002;

int p[N], a[N], sz[N], h[N];
bool mark[N];
vector <int> g[N];

bool cmp(int a, int b) { return sz[a] > sz[b]; }

int calc(int v, int height = 0)
{
	h[v] = height;
	sz[v]++;
	for(int u : g[v])
		sz[v] += calc(u, height + 1);
	return sz[v];
}

int getLocation(int x)
{
	for(int u : g[x])
		if(!mark[u])
			return getLocation(u);
	return x;
}

int getLocationInMarks(int x, int v)
{
	int minChild = -1;
	for(int u : g[v])
		if(minChild == -1 || h[a[minChild]] > h[a[u]])
			minChild = u;
	if(minChild == -1 || h[a[minChild]] > h[x])
		return v;
	return getLocationInMarks(x, minChild);
}

void put(int x, int v)
{
	int lst = a[v];
	for(int u = p[v]; u != -1; u = p[u])
		swap(lst, a[u]);
	a[v] = x;
}

void fixMark(int v)
{
	for(; v != -1; v = p[v])
		for(int u : g[v])
		{
			mark[v] &= mark[u];
			mark[v] &= (h[a[v]] < h[a[u]]); 
		}
}

int main()
{
	int n = in();
	p[0] = -1;
	for(int i = 1; i < n; i++)
		g[p[i] = in()].push_back(i);
	for(int i = 0; i < n; i++)
		a[i] = in();
	calc(0);
	for(int i = 0; i < n; i++)
		sort(g[i].begin(), g[i].end(), cmp);
	vector <int> moves;
	while(!mark[0])
	{
		int pl = getLocation(a[0]);
		int p2 = pl;
		for(; mark[p2]; p2 = p[p2]);
		mark[p2] = true;
		
//		cerr << a[0] << " : " << pl << " -> ";
		
		pl = getLocationInMarks(a[0], pl);
		moves.push_back(pl);
		while(moves.size() > 25000);

//		cerr << pl << endl;
		
		put(a[0], pl);
		fixMark(pl);

		
/*		for(int i = 0; i < n; i++)
			cerr << mark[i];
		cerr << endl;
		for(int i = 0; i < n; i++)
			cerr << a[i];
		cerr << endl;
*/		
	
	}
	for(int i = 0; i < n; i++)
		assert(a[i] == i);
	cout << moves.size() << endl;
	for(int x : moves)
		cout << x << endl;
}


Measured memory_bytes: 512
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int H = sc.nextInt();
		int W = sc.nextInt();
		int K = sc.nextInt();

		char[][] s = new char[H][W];
		for (int i = 0; i < H; i++) {
			String str = sc.next();
			for (int j = 0; j < W; j++) {
				s[i][j] = str.charAt(j);
			}
		}

		sc.close();

		int[][] ans = new int[H][W];

		int n = 1;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				ans[i][j] = s[i][j] == '#' ? n++ : 0;
			}
		}

		// 左右に伸ばす
		for (int i = 0; i < H; i++) {
			int m = 0;
			for (int j = 0; j < W; j++) {
				if (m != ans[i][j] && ans[i][j] != 0) {
					m = ans[i][j];
				}
				ans[i][j] = m;
			}
			m = 0;
			for (int j = W - 1; j >= 0; j--) {
				if (m != ans[i][j] && ans[i][j] != 0) {
					m = ans[i][j];
				}
				ans[i][j] = m;
			}
		}

		for (int i = 1; i < H; i++) {
			if (allZero(ans[i])) {
				ans[i] = Arrays.copyOf(ans[i - 1], ans[i - 1].length);
			}
		}

		for (int i = H - 2; i >= 0; i--) {
			if (allZero(ans[i])) {
				ans[i] = Arrays.copyOf(ans[i + 1], ans[i + 1].length);
			}
		}

		for (int i = 0; i < H; i++) {
			out.println(join(" ", ans[i]));
		}

	}

	private boolean allZero(int[] a) {
		for (int n : a) {
			if (n != 0) {
				return false;
			}
		}
		return true;
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

	@SuppressWarnings("unused")
	private String join(String delimiter, int[] a) {
		StringBuilder sb = new StringBuilder();

		for (int i = 0; i < a.length; i++) {
			sb.append(a[i]);
			sb.append(delimiter);
		}
		return sb.substring(0, Math.max(sb.length() - delimiter.length(), 0));
	}
}


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

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

	if (1 + 2 * (k - 1) <= n)
		std::cout << "YES" << std::endl;
	else
		std::cout << "NO" << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) y=min(x,y)
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;
}


Measured memory_bytes: 256
x, y = map(int, input().split())

def f(x, y):
  ans = [x]
  
  for i in range(100):
    if ans[i] * 2 <= y:
      ans.append(ans[i] * 2)
    else:
      return len(ans)
  
  return len(ans)

print(f(x, y))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <math.h>
#include <queue>
#include <map>

std::priority_queue<int> A;
std::vector<int> B[100005];

int main (){
  int N, M;
  scanf("%d %d",&N,&M);
  int temp1, temp2;
  for (int i=0; i<N; i++){
    scanf("%d %d", &temp1, &temp2);
    B[temp1].push_back(temp2);
  }
  long long ans = 0;
  for (int i=1; i<=M; i++){
    //printf("i=%d\n",i);
    //printf("size=%lu\n",B[i].size());
    for (int j=0; j<B[i].size(); j++){
      A.push(B[i][j]);
    }
    if (!A.empty()){
      ans += A.top();
      A.pop();
    }
  }

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

Measured memory_bytes: 5632
#include <iostream>
#include <algorithm>

using namespace std;

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

    while (n--) {
        string a, b, res;
        cin >> a >> b;

        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());

        int max_size = max(a.size(), b.size());

        for (int i = a.size(); i < max_size; i++) {
            a += '0';
        }
        for (int i = b.size(); i < max_size; i++) {
            b += '0';
        }

        int c = 0;
        for (int i = 0; i < max_size; i++) {
            int lhs = a[i] - '0';
            int rhs = b[i] - '0';
            c = lhs + rhs + c;
            res.push_back(c % 10 + '0');
            c /= 10;
        }

        if (c > 0) {
            res.push_back(c + '0');
        }

        reverse(res.begin(), res.end());

        if (res.size() > 80) {
            cout << "overflow" << endl;
        } else {
            cout << res << endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 1208
#include <algorithm>
#include <vector>
#include <cstdio>
using namespace std;

int main(){
	long long x1,y1,x2,y2;
	int n,xf=1,yf=1;
	scanf("%lld%lld%lld%lld%d",&x1,&y1,&x2,&y2,&n);
	if(x1>x2)swap(x1,x2),xf=-1;
	if(y1>y2)swap(y1,y2),yf=-1;
	vector<pair<long long,long long>>v;
	for(int i=0;i<n;i++){
		long long x,y;
		scanf("%lld%lld",&x,&y);
		if(x1<=x&&x<=x2 && y1<=y&&y<=y2)v.emplace_back(x*xf,y*yf);
	}
	sort(v.begin(),v.end());
	vector<int>d(v.size(),1<<30);
	for(auto &e:v)n=e.second,*lower_bound(d.begin(),d.end(),n)=n;
	n=lower_bound(d.begin(),d.end(),1<<30)-d.begin();
	printf("%.15f\n",100LL*(x2-x1+y2-y1)-20*n+5*(n+(n>=min(x2-x1,y2-y1)+1))*3.14159265358979323846);
}

Measured memory_bytes: 6512
def minn(a):
    tmp = 9999
    for i in range(len(a)):
        if a[i] < tmp:
            tmp = a[i]
    return tmp


n, x = map(int, input().split())
m = []
cnt = 0
for i in range(n):
    m.append(int(input()))

for i in range(n):
    x -= m[i]
    cnt += 1

cnt += (x // minn(m))

print(cnt)


Measured memory_bytes: 3060
N, K = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(K)]

MOD = 998244353
class Mint:
    def __init__(self, value=0):
        self.value = value % MOD
        if self.value < 0: self.value += MOD

    @staticmethod
    def get_value(x): return x.value if isinstance(x, Mint) else x

    def inverse(self):
        a, b = self.value, MOD
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        if u < 0: u += MOD
        return u

    def __repr__(self): return str(self.value)
    def __eq__(self, other): return self.value == other.value
    def __neg__(self): return Mint(-self.value)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value = (self.value + Mint.get_value(other)) % MOD
        return self

    def __add__(self, other):
        new_obj = Mint(self.value)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value = (self.value - Mint.get_value(other)) % MOD
        if self.value < 0: self.value += MOD
        return self

    def __sub__(self, other):
        new_obj = Mint(self.value)
        new_obj -= other
        return new_obj

    def __rsub__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * Mint.get_value(other) % MOD
        return self

    def __mul__(self, other):
        new_obj = Mint(self.value)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other)
        self *= other.inverse()
        return self

    def __floordiv__(self, other):
        new_obj = Mint(self.value)
        new_obj //= other
        return new_obj

    def __rfloordiv__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj //= self
        return new_obj

LR.sort(key=lambda x: x[1])
pl = pr = -1
LR2 = []
for l, r in LR:
    if LR2:
        pl, pr = LR2.pop()
        if l <= pl:
            LR2.append((l, r))
        elif l <= pr:
            LR2.append((pl, r))
        else:
            LR2.append((pl, pr))
            LR2.append((l, r))
    else:
        LR2.append((l, r))

dp = [Mint() for _ in range(N + 5)]
dp[1] += 1
dp[2] -= 1
for i in range(1, N):
    dp[i] += dp[i - 1]
    for l, r in LR2:
        nl = min(i + l, N + 1)
        nr = min(i + r, N + 1)
        dp[nl] += dp[i]
        dp[nr + 1] -= dp[i]
dp[N] += dp[N - 1]
print(dp[N])


Measured memory_bytes: 100428
#include<iostream>
using namespace std;;
int main(){
char a;
char b;
cin >>a>>b;
int a1,b1;
if(a=='A'){
a1=10;
}
else if(a=='B'){
a1=11;
}
else if(a=='C'){
a1=12;
}
else if(a=='D'){
a1=13;
}
else if(a=='E'){
a1=14;
}
else if(a=='F'){
a1=15;
}
if(b=='A'){
b1=10;
}
else if(b=='B'){
b1=11;
}
else if(b=='C'){
b1=12;
}
else if(b=='D'){
b1=13;
}
else if(b=='E'){
b1=14;
}
else if(b=='F'){
b1=15;
}
if(a1<b1){
cout << "<";
}
else if(a1>b1){
cout <<">";
}
else{
cout <<"=";
}
return 0;
}

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

int main(){
  int A,B,C;
  cin >> A >> B;
  
  int count;
  for(int i=0; i <= B-A ;i++){
    C = A +i;
    if(C/10000 == C%10){
      C = (C - (C%10)- (C/10000)*10000)/10;
      if(C/100 == C%10){
        count++;
      }
    }
    
  }
  cout << count <<endl;
}

Measured memory_bytes: 256
n = int(input())
a,b = (int(i) for i in input().split())
p = [int(i) for i in input().split()]
x,y,z = 0,0,0
for i in p:
	if i<=a: x+=1
	elif a<i<=b: y+=1
	else: z+=1
print(min(x,y,z))

Measured memory_bytes: 3064
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
#define N 2010
// #define M 19
 
#define mod 998244353
#define mod1 1000000007
#define mod2 1000000009
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 2000000000000000000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> set_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
 
template<typename t> void fff(const char* x, t&& val1){
    cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}
 
int main(){
	fastio;
	ll n; cin>>n;
	vector<string >tnt;
	FER(i, 0, n) {
		string s; cin>>s;
		tnt.pb(s);
	}
	sort(all(tnt));
	tnt.erase(unique(all(tnt)), tnt.end());
	cout<<sz(tnt)<<"\n";
	return 0;
}

Measured memory_bytes: 11656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll n, m;
    cin >> n >> m;
    VP p(n);
    rep(i, 0, n) cin >> p[i].first >> p[i].second;
    sort(ALL(p));
    ll i  = 0, ans = 0;
    while(m > 0){
        if(m - p[i].second > 0){
            m -= p[i].second;
            ans += p[i].first * p[i].second;
        }else{
            ans += m * p[i].first;
            m = 0;
        }
        i++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int n; cin >> n;
	if (n % 2 == 0) cout << n / 2;
	else cout << n / 2 + 1;
}

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

int main(){
	int N,M; cin>>N>>M;
	int maxi = 1;//answer. max(gcd({a1~aN}))
	for(int g=1; g*g<=M; ++g){//g: max divisor candidate
		if(M%g) continue;
		int pg = M/g;//pg: pair divisor (g, pg)
		if(g>M/N) continue;
		maxi = max(maxi, g);
		if(pg>M/N) continue;
		maxi = max(maxi, pg);
	}
	cout<< maxi <<endl;
}

Measured memory_bytes: 256
import copy

def partition(p, r):
    i = p
    for j in range(p, r):
        if A[r][1] >= A[j][1]:
            A[i], A[j] = A[j], A[i]
            i += 1
    A[r], A[i] = A[i], A[r]
    return i

def quick_sort(p, r):
    if p < r:
        q = partition(p, r)
        quick_sort(p, q-1)
        quick_sort(q+1, r)

def correct_same_num_suits(l, num, first):
    suits = []
    for i in range(first, N):
        if num == l[i][1]:
            suits.append(l[i][0])
    return suits

def is_stable():
    idx = 0
    while idx < N-1:
        idx_incr_flg = True
        if A[idx][1] == A[idx+1][1]:
            num = A[idx][1]
            sorted_suits = correct_same_num_suits(A, num, idx)
            orig_suits = correct_same_num_suits(orig_list, num, 0)
            if sorted_suits != orig_suits:
                return False
            idx += len(sorted_suits)
            idx_incr_flg = False
        if idx_incr_flg:
            idx += 1
    return True


N = int(input())
A = []
for _ in range(N):
    suit, num = input().split()
    num = int(num)
    A.append([suit, num])
orig_list = copy.deepcopy(A)

quick_sort(0, N-1)

is_stable = is_stable()
if is_stable:
    print("Stable")
else:
    print("Not stable")

for card in A:
    print("%s %d" % (card[0], card[1]))


Measured memory_bytes: 39444
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
#define MOD 1000000007
int main(){
    string l;
    cin >> l;

    ll dp[100100][2] = {};
    dp[0][0] = 1;
    rep(i, l.size())rep(j, 2){
        if(l[i]=='1')dp[i+1][1]=(dp[i+1][1]+dp[i][j])%MOD;
        else dp[i+1][j] = (dp[i+1][j]+dp[i][j])%MOD; 

        if(l[i]=='0'&&j==0)continue;
        dp[i+1][j] = (dp[i+1][j]+dp[i][j]*2)%MOD;
    }
    ll ans = (dp[l.size()][0]+dp[l.size()][1])%MOD;
    cout << ans << endl;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N,M;
    cin >> N>>M;
    if(N==M){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll d, l;
  cin >> d >> l;
  cout << (d / l) + (d % l) << endl;
	return 0;
}


Measured memory_bytes: 3192
X, N = map(int, input().split())
p = list(map(int, input().split()))

def is_in_p(j):
    flag = True
    for p_i in p:
        if p_i == j:
            flag = False
    return flag

abs_min = 101 
min_num = 0

for j in range(102):
    if abs(X - j) < abs_min and is_in_p(j):
        abs_min = abs(X - j)
        min_num = j
print(min_num)

Measured memory_bytes: 9200
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;

fn main() {
    let a: usize = read!();
    let mut max: usize = 0;
    let mut min: usize = 100000000000;
    for i in 0..a {
        let b: usize = read!();
        if max<b {
            max=b;
        }
        if min>b {
            min=b;
        }
    }
    println!("{}",max-min)
}

Measured memory_bytes: 2092