akhauriyash/Code-Regression huggingface dataset:
/*
    ##############################
    #  Author: Pratyush Gaurav   #
    #  College: NIT ROURKELA     #
    ##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

void solve() {
    lli n, h, w;
    cin >> n >> h >> w;
    lli ans = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (i + h - 1 <= n and j + w - 1 <= n) ans++;
        }
    }
    cout << ans << endl;
}

int main()
{
    IOS;
    lli t = 1;
    //cin >> t;

    solve();

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define M 998244353
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll power(ll a,ll n)
{
    if(n==0){
        return 1;
    }
    ll p=power(a,n/2) % M;
    p = (p * p) % M;
    if (n%2==1)
    {
        p=(p*a)%M;
    }
    return p;
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int main(){
		ios;
		ll n;
		cin>>n;
		map<string,ll> m;
		while(n--){
			string s;
			cin>>s;
			m[s]+=1;
		}
		ll ans=0;
		for(auto i:m){
			ans+=1;
		}
		cout<<ans<<endl;
		return 0;
}

Measured memory_bytes: 19288
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main(){
  int A, B; cin >> A >> B;
  int C, D; cin >> C >> D;

  cout << max(A * B, C * D) << endl;
  return 0;
}


Measured memory_bytes: 256
import Data.List
import Text.Printf

split :: String -> [String]
split text =
  let i = lookup ',' $ zip text [0..]
  in
    case i of
      Just j  -> (take j text):(split $ drop (j+1) text)
      Nothing -> [text]

keys :: [[Int]] -> [Int]
keys [] = []
keys ((a:b:_):xs) = a:(keys xs)

find' :: Int -> [[Int]] -> Int
find' _ [] = 0
find' n ((a:b:_):xs) = if n == a
                      then 1 + (find' n xs)
                      else find' n xs

ans :: [[Int]] -> [[Int]] -> [(Int,Int)]
ans l1 l2 =
  let k1 = nub $ keys l1
      k2 = nub $ keys l2
      k  = sort $ intersect k1 k2
      n  = map (\i -> (i, find' i (l1++l2) ) ) k
  in
    n

main = do
  c <- getContents
  let l = lines c
      l1 = map (map read) $ map split $ takeWhile (/= "") l :: [[Int]]
      l2 = map (map read) $ map split $ drop 1 $ dropWhile (/= "") l :: [[Int]]
      o  = ans l1 l2
  mapM_ (\(a,b) -> printf "%d %d\n" a b) o
  

Measured memory_bytes: 3736
#include <stdio.h>
int main(void){        

    int i,x,y;

    for(i=1;;i++){
    scanf("%d %d",&x,&y);
     if(x==0 && y==0){
        break;
    }else if(x>=y){
        printf("%d %d\n",y,x);
    }else if(x<y){
         printf("%d %d\n",x,y);
    }
    }

    return 0;

}



Measured memory_bytes: 2028
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <cctype>
#include <sstream>

/*

bool isOK(int index, int key) {
	if (a[index] >= key) return true;
	else return false;
}
int binary_search(int key) {
	int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;

		if (isOK(mid, key)) ok = mid;
		else ng = mid;
	}
	return ok;
}
*/

//vector<vector<ll> > data(3, vector<ll>(4));
//vector<ll> data(N);
//v.erase(remove(v.begin(), v.end(), value_to_remove), v.end());
//str s = to_string(i);
//int i = c - '0'
//sort(data.begin(), data.end());
//reverse(data.begin(), data.end());
//data.erase(unique(data.begin(), data.end()), data.end()); //重複なし
//str.substr(n)//n番以降スライス
//str.substr(n,m)//n番以降m文字スライス
//str.erase(n)//n番以降削除
//str.erase(n,m)//n番以降m文字削除
//str.find(str_to_find)//位置 or string::npos
//cout << fixed << setprecision(15) << n;
//while (cin >> c){if (c == EOF) break;
typedef long long ll;
#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=ll(a);i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define PB push_back
#define SIZE(x) ll(x.size())
#define ALL(x) x.begin(),x.end()
#define INF 1000000000000
#define MOD 1000000007
#define PI 3.14159265358979323846

using namespace std;
typedef pair<ll, ll> P;

int main() {
	ll K, S;
	cin >> K >> S;

	ll x, y, z;
	ll counter = 0;
	vector<ll> data;
	REP(i, K + 1) {
		data.push_back(i);
	}


	REP(i, K+1) {
		REP(j, K+1) {
			x = i;
			y = j;
			if (binary_search(ALL(data), S - x - y)) counter++;
		}
	}
	cout << counter << endl;

}



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

using namespace std;
using ll = unsigned long long;
ll MOD = (ll)(1e9 + 7);

ll mult (ll a, ll b) {
	return ((a % MOD) * 1LL * (b % MOD)) % MOD;
}

ll add (ll a, ll b) {	
	b = (b + MOD) % MOD;
	return (a + b) % MOD;
}

ll cc (ll l, ll r, ll x) {
	l = (l / x  + (l % x > 0)) * x;
	if (l > r) {
		return 0;
	}
	return (r - l) / x  + 1;
}


int main () {
	ll k, q;
	cin >> k >> q;
	ll ar[k];
	for (ll i = 0; i < k; i++) {
		cin >> ar[i];
	}
	for (ll i = 0; i < q; i++) {
		ll n, x, m, c = 0, aa[k];
		ll su = 0;
		cin >> n >> x >> m;
		ll kk = (n - 1) / k, rr = (n - 1) % k;
		for (ll j = 0; j < k; j++) {
			su += ar[j] % m;
			aa[j] = su;
			if (!(ar[j] % m)) {
				c += kk + (j < rr);
			}
		}
		cout << n - 1 - c - cc (x + 1, x +  kk * su + (rr > 0 ) * aa[rr - 1], m) << "\n";
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MaxN 1000000000000000000
int main() {
  std::ios_base::sync_with_stdio(false);
      std::cin.tie(NULL);
      int n;
      std::cin >>n;
      std::vector<long long int> v(n);
      for(int i=0;i<n;i++){
          std::cin >>v[i];
          if(v[i] == 0){
           std::cout << 0 << '\n';
           return 0;
         }
        }

      unsigned long long ans =1;
      for(int i=0;i<n;i++){
          ans *= v[i];
          unsigned long long Num = (unsigned long long)(1e18)/ans;
          if(v[i+1]>Num && i+1<n){
             std::cout << "-1" << '\n';
            return 0;
          }
      }
      std::cout << ans << '\n';
return 0;
}


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

int main() {
	// your code goes here
	string s,t;
	cin>>s>>t;
	ll c=INT_MAX;
	ll si=s.size()-t.size()+1;
	for(ll i=0;i<si;i++)
	{
		string adon=s.substr(i,t.size());
		ll tot=0;
		for(ll j=0;j<t.size();j++)
		{
			if(adon[j]==t[j])
			    continue;
			else    
				tot++;
		}
		c=min(c,tot);
	}
	printf("%lld\n",c);
}


Measured memory_bytes: 3684
use std::vec::Vec;
use std::cmp::*;

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}
// [9, 81, 729, 6561, 59049, 531441]
// [6, 36, 216, 1296, 7776, 46656, 279936]
fn main() {
  let n: usize = read();


  let mut res = 1_000_000_000;

  for i in 0..n+1 {
    let mut count = 0;
    let mut t = i;

    while t > 0 {
      count += t % 6;
      t /= 6;
    }

    t = n - i;

    while t > 0 {
      count += t % 9;
      t /= 9;
    }
    res = min(res, count);
  }
  println!("{}", res);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>

int main(void)
{
	int i;
	int n;
	char str[128];
	int num[128];
	int total;
	
	while (scanf("%s", str) != EOF){
		n = strlen(str);
		for (i = 0; i < n; i++){
			if (str[i] == 'I'){
				num[i] = 1;
			}
			if (str[i] == 'V'){
				num[i] = 5;
			}
			if (str[i] == 'X'){
				num[i] = 10;
			}
			if (str[i] == 'L'){
				num[i] = 50;
			}
			if (str[i] == 'C'){
				num[i] = 100;
			}
			if (str[i] == 'D'){
				num[i] = 500;
			}
			if (str[i] == 'M'){
				num[i] = 1000;
			}
		}
		for (i = 1; i < n; i++){
			if (num[i] > num[i - 1]){
				num[i] -= num[i - 1];
				num[i - 1] = 0;
			}
		}
		total = 0;
		for (i = 0; i < n; i++){
			total += num[i];
		}
		
		printf("%d\n", total);
	}
	return (0);
}

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

int main() {
  int w, a, b;
  cin >> w >> a >> b;
  
  if(a + w < b){
    cout << b - a - w << endl;
  }
  else if(b + w < a){
    cout << a - b - w << endl;
  }
  else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
n,m=map(int,input().split())
way=[[] for i in range(n)]
H = list(map(int,input().split()))
for i in range(m):
    a,b=map(int,input().split())
    way[a-1].append(b-1)
    way[b-1].append(a-1)

for i in range(n):
    way[i]=list(set(way[i]))

ans=0
for i in range(n):
    high=True
    for j in way[i]:
        if H[i]<=H[j]:
            high=0
            break
    if high:
        ans+=1
print(ans)

Measured memory_bytes: 32708
#include<cstdio>
#include<iostream>

using namespace std;

int main(void) {

	int a, b, c;
	cin >> a >> b >> c;

	for (int i = 1;; i++)
	{
		int tmp = a * i;
		//cout << tmp << "\n";

		if (tmp%b == c) {
			cout << "YES\n";
			break;
		}

		if (i==a*b) {
			cout << "NO\n";
			break;
		}
	}

	return 0;
}

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

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

using namespace std;

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

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

vector<int> vec;
int n;

int main(){
  cin >> n;
  REP(i,n){
    int a;
    cin >>a;
    vec.push_back(a);
  }
  sort(vec.begin(),vec.end(),greater<int>());
  int ans = 0;
  REP(i,n){
    if(i%2==0){
      ans+=vec[i];
    }else{
      ans-=vec[i];
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000

struct Node{
  int p,l,r;
};
struct Node NA[N];
int D[N];
void Set(int x,int p){
  D[x]=p;
  if(NA[x].r != -1)Set(NA[x].r,p);
  if(NA[x].l != -1)Set(NA[x].l,p+1);
}

int main(){

  int i,j,n,id;
  int k,c,l,r;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    NA[i].p=-1;
    NA[i].l=-1;
    NA[i].r=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      if(j==0)NA[id].l=c;
      else NA[l].r=c;
      l=c;
      NA[c].p=id;
    }
  }
  for(i=0;i<n;i++){
    if(NA[i].p==-1)r=i;
  }
  Set(r,0);

  for(i=0;i<n;i++){
    printf("node %d: ",i);
    printf("parent = %d, ",NA[i].p);
    printf("depth = %d, ",D[i]);
    if(NA[i].p==-1)printf("root, ");
    else if(NA[i].l==-1)printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    for(j=0,c=NA[i].l;c!=-1;j++,c=NA[c].r){
      if(j==0)printf("%d",c);
      else printf(", %d",c);
    }
    printf("]\n");
  }
  return 0;
}



Measured memory_bytes: 6424
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

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

    li ans = 0;
    vector<vector<li>> dist(n, vector<li>(n));
    vector<vector<li>> state(n, vector<li>(n, 1));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            dist[i][j] = min<li>({i, j, n - 1 - i, n - 1 - j});
        }
    }

    auto get_dist = [&](const int x, const int y) {
        if (x < 0 || y < 0 || x >= n || y >= n) {
            return 0LL;
        }
        return dist[x][y];
    };
    for (int i = 0; i < n * n; ++i) {
        li p;
        cin >> p; p--;
        const int x = p % n;
        const int y = p / n;

        ans += dist[x][y];
        state[x][y] = 0;

        queue<pair<li, pair<li, li>>> q;
        for (int d = 0; d < 4; ++d) {
            const int nx = x + dx[d];
            const int ny = y + dy[d];

            if (get_dist(nx, ny) > dist[x][y]) {
                q.emplace(dist[x][y], make_pair(nx, ny));
            }
        }

        while (not q.empty()) {
            auto t = q.front();
            q.pop();
            const li cost = t.first;
            const li nx = t.second.first;
            const li ny = t.second.second;

            if (cost >= dist[nx][ny]) {
                continue;
            }
            dist[nx][ny] = cost;
            const int ncost = cost + state[nx][ny];
            for (int d = 0; d < 4; ++d) {
                const int nnx = nx + dx[d];
                const int nny = ny + dy[d];

                if (get_dist(nnx, nny) > ncost) {
                    q.emplace(ncost, make_pair(nnx, nny));
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 7628
//
// Created on 2020/03/28.
//

//#include <bits/stdc++.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int ans = 0;
    int x;
    cin>>x;

    int gohyakuenn;
    int goenn;

    gohyakuenn = x/500;
    x %= 500;
    goenn = x/5;

    ans += gohyakuenn *1000;
    ans += goenn * 5;

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll  powFac(ll a,ll b,ll m)
{
  ll temp1=1, ans=1;
  if(a<0)temp1=0;
  else {
  for(ll i=1;i<=a;i++)temp1=temp1*i%m;
}
   while(b>0)
   {
    if(b&1)ans=ans*temp1%m;
    temp1=temp1*temp1%m;
    b>>=1;
   }
 return ans;
} 




int main()
{
   
    ll i,j,n,r,flag=0,temp1=0,temp2=0,temp3=0,m=1000000007;
   cin>>n>>r;

  if(n>=10)
  {
    i=r;
  }
  else 
  {
    i=100*(10-n)+r;
  }

  cout<<i<<endl;

 return 0;
  }

Measured memory_bytes: 256
#include<stdio.h>

int rc[1000][1000];

int main(void)
{

  int r,c;
  int i,j;

  scanf("%d %d",&r,&c);

  for(i = 0; i < r; i++)
    {
      for(j = 0; j < c; j++)
	{
	  scanf("%d",&rc[i][j]);
	}
    }

  for(i = 0; i < r; i++)
    {
      for(j = 0; j < c; j++)
	{
	  rc[i][c] += rc[i][j];
	  rc[r][j] += rc[i][j];
	  rc[r][c] += rc[i][j];
	}
    }

  for(i = 0; i <= r; i++)
    {
      for(j = 0; j <= c; j++)
	{
	  printf("%d",rc[i][j]);
	  j == c ? putchar('\n'):putchar(' ');
	}
    }

	  return 0;
}


Measured memory_bytes: 2076
package main

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

// const abcd = "abcdefghijklnmopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}
var inf int = 1e9

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	n := next.Int()
	k := next.Int()
	x := make([]int, n)
	y := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = next.Int()
		y[i] = i + 1
	}
	ans := 0
	for i := 0; i < n; i++ {
		ans += min(x[i]*2, (abs(k-x[i]) * 2))
	}

	fmt.Println(ans)
}

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

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

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

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

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a(2e5 + 2);

bool check(int k) {
  vector<pair<int, int>> st;
  for (int i = 1; i < n; i++) {
    if (a[i] <= a[i - 1]) {
      if (k == 1){
        return false;
      }
      while (!st.empty() && st.back().first > a[i]){
          st.pop_back();
      }
      int cur = a[i];
      while(!st.empty() && st.back().first == cur && st.back().second == k - 1) {
        st.pop_back();
        cur--;
      }
      if (cur < 1) {
        return false;
      }
      if (st.empty() || st.back().first < cur) {
        st.emplace_back(cur, 1);
      } else {
        st.back().second++;
      }
    }
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int lb = 0;
  int ub = n + 1;
  int mid;
  while (ub - lb > 1){
      mid = (ub + lb) >> 1;
      if (check(mid)) {
          ub = mid;
      } else {
        lb = mid;
      }
  }
  cout << ub << '\n';

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
int main(){
    ios_base::sync_with_stdio(0);
    string x;
    cin>>x;
    int o=0,s=0,k=0;
    for(int i=0;i<x.size();i++){
        if(o==0&&x[i]=='R'){
            s++;
        }
        else{
           k=max(k,s);
           s=0;
        }

    }
    cout<<max(s,k);
    }



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

public class Hello
{
    public static void Main()
    {
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var n = int.Parse(line.Trim());
            Console.WriteLine(n == 1 ? 0 : getPcount(n));
        }
    }
    public static int getPcount(int m)
    {
        var p = new List<int>();
        int prime;
        var sqrtMax = Math.Sqrt(m);
        var searchList = Enumerable.Range(2, m - 1).ToList();
        do
        {
            prime = searchList.First();
            p.Add(prime);
            searchList.RemoveAll(n => n % prime == 0);
        }
        while (prime < sqrtMax);
        p.AddRange(searchList);
        return p.Count();
    }
}





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

int main(){
  int n;
  cin >> n;
  int a, maxv;
  map<int, int> mp;
  for ( int i = 0; i < n; i++){
    cin >> a;
    mp[a-1]++;
    mp[a]++;
    mp[a+1]++;
    maxv = max(maxv, max(mp[a-1], max(mp[a], mp[a+1])));
  }

  cout << maxv << endl;

  return 0;
}

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

#define ll long long
#define endl "\n"
#define FILEIN freopen("input.txt", "r", stdin)


int main(){
    // FILEIN;
    //ll n, flag = 1, sum = 0, sum2 = 0; cin>>n;
    //while(n--){
    //    ll ar[3] = {};
    //    for(int i = 0; i<3; i++){
    //        cin>>ar[i];
    //    }
    //    sort(ar, ar+3);
    //    if(flag){
    //        sum2 += ar[1];
    //        sum += ar[2];
    //    }else{
    //        sum2 += ar[2];
    //        sum += ar[1];
    //    }
    //    flag = !flag;
    //}
    //if(sum > sum2){
    //    cout<<sum<<endl;
    //}else{
    //    cout<<sum2<<endl;
    //}

    ll n, k, sum = 0;cin>>n>>k;
    if(k >= n){
        cout<<0<<endl;
    }else{
        ll ar[n] = {};
        for(int i = 0; i<n; i++){
            cin>>ar[i];
            sum += ar[i];
        }
        sort(ar, ar+n);
        ll j = n-1;
        while(k--){
            sum -= ar[j--];
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (lli i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli h, w;
vector<string> a;
int main() {
  cin >> h >> w; read_n(a, h);
  lli cnt[128]; fill(begin(cnt), end(cnt), 0);
  for (lli j=0; j<h; ++j) {
    for (lli i=0; i<w; ++i) {
      cnt[(lli)a[j][i]]++;
    }
  }
  lli c = 'a';
  for (lli i=0; i < (h/2) * (w/2); ++i) {
    while (c<='z') {
      if (cnt[c] >= 4) { cnt[c]-=4; break; }
      else ++c;
    }
  }
  if (c > 'z') { cout << "No\n"; return 0; }

  c = 'a';
  for (lli i=0; i < (w%2)*(h/2) + (h%2)*(w/2); ++i) {
    while (c<='z') {
      if (cnt[c] >= 2) { cnt[c]-=2; break; }
      else ++c;
    }
  }
  if (c > 'z') cout << "No\n";
  else cout << "Yes\n";
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define all(x) (x).begin(), (x).end()

#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#define idbg(x) #x " = " << x
#include "pretty_print.h"
#else
#define dbg(x)
#define idbg(x) ""
#endif

#ifdef _WIN32
#  define LLD "%I64d"
#else
#  define LLD "%lld"
#endif

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
template <typename T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template <typename T> bool chmin(T &x, const T& y) { if (x > y) { x = y; return true; } return false; }
template <typename T> bool chmax(T &x, const T& y) { if (x < y) { x = y; return true; } return false; }


int main(int /* argc */, char** /* argv */)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL
    assert(freopen("inp", "r", stdin));
    assert(freopen("out", "w", stdout));
    #endif

    for (;;) {
        vector<int> a(3);
        for (int i = 0; i < 3; ++i) {
            if (!(cin >> a[i])) {
                return 0;
            }
        }
        int c = 0;
        c += a[0] == a[1];
        c += a[0] == a[2];
        c += a[1] == a[2];
        cout << (c == 1? "Yes" : "No") << endl;
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
const int N=200005;
int a[N],n,k;
int main() {
  scanf("%d%d",&n,&k);
  for (int i=1;i<=n;++i) scanf("%d",&a[i]);
  for (int i=k+1;i<=n;++i) {
    if(a[i]>a[i-k]) {
      puts("Yes");
    }
    else puts("No");
  }
  return 0;
}


Measured memory_bytes: 4536
N, A, B = map(int, input().split())

# 私たちは N人で旅行しようとしており、その交通手段として電車とタクシーがあります。
# 電車を使うと 1人あたり A円かかります。
# タクシーを使うと N人で B円かかります。
# 全員の交通費の合計は最小でいくらになるでしょうか。

train = N * A
taxi = B

print(min(train, B))

Measured memory_bytes: 9192
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;

int main(){
  int k,x;
  cin >> k >> x;
  if(500*k >= x) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    # 式 f の末尾に "+" を追加するかしないかして次の数字を追加
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))

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

int main() {

	int N;
	string S;
	int P;
	pair<pair<string, int>, int> p[100];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> S >> P;
		p[i] = make_pair( make_pair( S, -P ), i );
	}

	sort(p, p + N);

	for (int i = 0; i < N; i++) {
		cout << p[i].second+1 << endl;
	}
}

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

int main(void)
{
 int k,s,x,y,z,ans=0;
 cin>>k>>s;
 for(x=0;x<=k;x++){
   for(y=0;y<=k;y++){
     z=s-x-y;
     if(0<=z&&z<=k)
      ans++;
   }
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

use std::iter::Iterator;


fn main() {
    input!{
        n:i32,
        a:[f64;n],
    }

    let mut bunnbo:f64 = 0.0;

   for item in a {
    bunnbo = bunnbo + (1_f64/item);
   }

   println!("{}", 1_f64/bunnbo);
}


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

using namespace std;

/*helpfull*/
using vl  = vector<long long>;
using vpl = vector<pair<long long, long long>>;
using vs = vector<string>;
using pl  = pair<long long, long long>;
using ll  = long long int;
using vb  = vector<bool>;


struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1> {}(p.first);
        auto hash2 = hash<T2> {}(p.second);
        return hash1 ^ hash2;
    }
};
// #ifndef ONLINE_JUDGE
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);
// #endif

// shortcut macros
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp              make_pair
#define fi              first
#define se              second
// #define mt              make_tuple
#define pb              push_back
#define all(x)          (x).begin(), (x).end()
#define ini(a, v)       memset(a, v, sizeof(a))
#define rep(i, a, n)    for(ll i=a ; i<n ; ++i)
#define For(i, n)       rep(i, 0, n)
#define sz(x)           (int((x).size()))
#define ump(x,y)        unordered_map<x,y>
#define umpr(x,y,z)     unordered_map<x,y,z>
void printcase(ll &x) {
    cout << "Case #" << x << ": ";
}
void read(vector<ll>&v, ll &n) {
    For(i, n)
    cin >> v[i];
}
void read(ll &x) {
    cin >> x;
}
void read(string &s) {
    cin >> s;
}
void read(int &x) {
    cin >> x;
}
void read(ll a[], ll &n) {
    For(i, n)
    cin >> a[i];
}
void print() {
    cout << endl;
}
void write(vector<ll>&v, ll &n) {
    For(i, n)
    cout << v[i] << " ";
    cout << endl;
}
void write(vector<ll>&v) {
    ll n = v.size();
    For(i, n)
    cout << v[i] << " ";
    cout << endl;
}
void write(ll x) {
    cout << x << endl;
}
void write(string &s) {
    cout << s << endl;
}
void write(int &x) {
    cout << x << endl;
}
void write(ll a[], ll &n) {
    For(i, n)
    cout << a[i] << " ";
    cout << endl;
}
const ll mod = 1e9 + 7;


double cal(vector<double> &v, ll &n, ll i, ll h, vector<vector<double>> &dp) {
    if (dp[i][h] != -1)
        return dp[i][h];
    if (i == n) {
        if (h > n - h)
            return 1.0;
        else
            return 0;
    }

    dp[i][h] = v[i] * cal(v, n, i + 1, h + 1, dp) + (1.0 - v[i]) * cal(v, n, i + 1, h, dp);
    return dp[i][h];
}



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll n;
    cin >> n;
    vector<double> v(n);
    For(i, n)
    cin >> v[i];

    vector<vector<double>> dp(n + 1, vector<double>(n + 1, -1.0));

    // cout <<  << endl;
    printf("%.10f\n", cal(v, n, 0, 0, dp));


    return 0;
}




Measured memory_bytes: 74012
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
# A.sort()
d = {}
for i in range(N):
    a = A[i]
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
flag = True
if len(d.keys()) == 1:
    if list(d.keys())[0] == 0:
        flag = True
    else:
        flag = False
elif len(d.keys()) == 2:
    keys = list(sorted(list(d.keys())))
    if d[keys[0]] == N // 3:
        flag = True
    else:
        flag = False
elif len(d.keys()) == 3:
    keys = list(d.keys())
    if keys[0] ^ keys[1] ^ keys[2] == 0:
        if d[keys[0]] == d[keys[1]] == d[keys[2]]:
            flag = True
        else:
            flag = False
    else:
        flag = False
else:
    flag = False
print("Yes" if flag else "No")

Measured memory_bytes: 14212
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
int a[1010];
int main()
{
	int n = 1000;
	for(int i=1;i<=n;i++)a[i] = a[i-1] + i;
//	for(int i=1;i<=20;i++)cout<<a[i]<<endl;
	int x,y;cin>>x>>y;
	for(int i=1;i<n;i++)
	if((a[i]-x)==(a[i+1]-y))
	{
		cout<<a[i]-x<<endl;
		return 0;
	}
}

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

int main() {
  int n;
  cin >> n;
  map<int, int> m;
  rep(i, n) {
    int p;
    cin >> p;
    m[p] = i;
  }
  for (auto it = m.begin(); it != m.end(); it++) {
    if (it == m.begin()){
      printf("%d", it->second);
    } else {
      printf(" %d", it->second);
    }
  }
  return 0;
}

Measured memory_bytes: 5504
<?php

function input_and_explode() {
    $input_line = trim(fgets(STDIN));
    return explode(" ", $input_line);
}

$R = (int)input_and_explode()[0];

// var_dump($R);

if ($R < 1200) {
    $contest = 'ABC';
} else if ($R < 2800) {
    $contest = 'ARC';
} else {
    $contest = 'AGC';
}

echo "$contest\n";

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
//#define ld long double
#define mod 1000000007
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mpp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define repr(x,n,j)for(ll x=n;x>j;x--)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;
typedef long double ld;
bool isprime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}




ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}

ll addmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll submod(ll a,ll b)
{
    a%=mod;
    b%=mod;
    a-=b;
    if(a<0)a+=mod;
    return a%mod;
}
struct CustomCompare
{
    bool operator()(ll a,ll b)
    {
        return a>b;
    }
};
/*
const int mxn = 5*(1e6) +10;
vi spf(mxn);
void sieve()
{
    for(ll i =0;i<mxn;i++)spf[i]  = i;
    for(ll i=2;i<mxn;i+=2)spf[i] = 2;
    for(ll i = 3;i*i<mxn;i++)
    {
        if(spf[i]==i)
        {
            for(ll j = i*i;j<mxn;j+=i)
            {
                if(spf[j]==j)spf[j] = i;
            }
        }
    }
}
*/


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

string s; cin>>s;
if(s.back()=='s')s+="es";
else s+="s";
cout<<s<<endl;
return 0;
}
/*
4
1
1 2 1

*/


Measured memory_bytes: 3664
'use strict'
function main(input) {
  input = input.trim()
  const a = Number(input.slice(0, 2))
  const b = Number(input.slice(2, 4))
  const text = ['YYMM','MMYY','AMBIGUOUS','NA']
  const isMonth = num => ((0 < num) && (num < 13))
  const am = isMonth(a)
  const bm = isMonth(b)
  let result = ''

  if (am && bm) {
    result = text[2]
  } else if (am) {
    result = text[1]
  } else if (bm) {
    result = text[0]
  } else {
    result = text[3]
  }
  console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



q = int(input())
lr = [None]*q
for i in range(q):
    lr[i] = tuple(map(int, input().split()))
n = max(item[1] for item in lr) + 10

def hurui(n):
    """n以下の素数のリストを返す
    """
    l = list(range(2,n+1))
    p = 2
    i = 0
    while True:
        l = [item for item in l if item==p or item%p!=0]
        i += 1
        p = l[i]
        if p*p>n:
            break
    return l
l = hurui(n)
l = set(l)
v = [0]*n # 0, 1, ..., iのうちの個数
c = 0
for i in range(n):
    if i%2==1 and i in l and (i+1)//2 in l:
        c += 1
    v[i] = c
ans = []
for l,r in lr:
    ans.append(v[r]-v[l-1])
write("\n".join(map(str, ans)))

Measured memory_bytes: 102596
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
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;}
const int inf = 1001001001;

int main() {
    string s;
    cin >> s;
    int last = s[0]-'0';
    int cnt = 1;
    int ans = 0;
    rep2(i,1,s.size()) {
        int n = s[i]-'0';
        if(n != last) {
            if(cnt > 0) {
                cnt--;
                ans += 2;
            } else {
                last = n;
                cnt = 1;
            }
        } else {
            cnt++;
        }
    }
    cout << ans << endl;
}

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

int main() {
	int a[5+1];

	for (int i = 1; i <= 5; i++) 
		cin >> a[i];

	for (int j = 2; j <= 5; j++) {
		int key = a[j];
		int i = j-1;
		while (i >= 1 && a[i] < key) {
			a[i+1] = a[i];
			i--;
		}
		a[i+1] = key;
	}

	for (int i = 1; i < 5; i++) {
		cout << a[i] << " ";
	}
	cout << a[5] << endl;

	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int n, m;
vector<int> G[MAX];

vector<int> bfs(int s){
    vector<int> d(n, mod);
    d[s] = 0;
    queue<int> que;
    que.push(s);
    while(!que.empty()){
        int v = que.front();
        que.pop();
        for(auto nv: G[v])if(chmin(d[nv], d[v] + 1)){
            que.push(nv);
        }
    }
    return d;
}

int main(){
    int s, t;
    scanf("%d%d%d%d", &n, &m, &s, &t);
    --s; --t;
    rep(i, m){
        int a, b;
        scanf("%d%d", &a, &b);
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    auto ds = bfs(s), dt = bfs(t);
    int dst = ds[t];
    lint ans = 0, cnt[n+10];
    memset(cnt, 0LL, sizeof(cnt));
    rep(i, n)if(dt[i] < n+10) ++cnt[dt[i]];
    rep(i, n)if(dst-2 - ds[i] >= 0) ans += cnt[dst-2 - ds[i]];
    printf("%lld\n", ans);
}


Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, a;
    set<int> s;
    cin >> n;
    while (n--) {
        cin >> a;
        if (s.find(a) == s.end()) s.insert(a);
        else s.erase(a);
    }
    cout << s.size();
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if ((n % 2) == 1) {
    cout << "No\n";
    return 0;
  }
  
  for (int i = 0; i < n / 2; ++i) {
    if (s[i] != s[n / 2 + i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)
#define mx 100005
bool vis[mx];
vector<int> v[mx];
deque<int> dq;
int L[mx];
void dfs(int a,int u){
    vis[a] = true;
    for(int i:v[a]){
        if(i==u)    continue;
        if(!vis[i])
            dfs(i,a);
    }
    dq.push_back(a);
}


int main(){

int n,m;
scanf("%d%d",&n,&m);
for(int i = 0; i<m; i++){
    int a,b;
    scanf("%d%d",&a,&b);
    v[a].push_back(b);
}

for(int i = 1; i<=n; i++){
    if(!vis[i]) dfs(i,0);
}

while(dq.size()){
    int u = dq.front();
    dq.pop_front();
    for(int i:v[u]){
        L[u] = max(L[u],1+L[i]);
    }
}
int ans = 0;
for(int i = 1; i<=n; i++)   ans = max(ans,L[i]);
printf("%d\n",ans);

return 0;
}


Measured memory_bytes: 8704
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int n, ans=0;
  cin >> n;
  for(int i=0; i<=n; i++){
    if(1<=i && i<=9 || 100<=i && i<=999 || 10000<=i && i<=99999){
      ans++;
    }
  }
  cout << ans << endl;

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>

int main() {
  unsigned long long H, W, N;
  std::cin >> H >> W >> N;
  std::vector<std::pair<unsigned, unsigned>> paint(N);
  std::map<std::pair<unsigned, unsigned>, unsigned long long> cnt;
  for (unsigned i = 0; i < N; ++i) {
    std::cin >> paint[i].first >> paint[i].second;
    for (unsigned j = 0; j <= 2; ++j) {
      for (unsigned k = 0; k <= 2; ++k) {
        if (paint[i].first <= j) {continue;}
        if (paint[i].second <= k) {continue;}
        if (paint[i].first - j > H - 2) {continue;}
        if (paint[i].second - k > W - 2) {continue;}
        cnt.emplace(std::make_pair(paint[i].first - j, paint[i].second - k), 0);
      }
    }
  }
  for (unsigned i = 0; i < N; ++i) {
    for (unsigned j = 0; j <= 2; ++j) {
      for (unsigned k = 0; k <= 2; ++k) {
        if (paint[i].first <= j) {continue;}
        if (paint[i].second <= k) {continue;}
        if (paint[i].first - j > H - 2) {continue;}
        if (paint[i].second - k > W - 2) {continue;}
        auto p = cnt.find(std::make_pair(paint[i].first - j, paint[i].second - k));
        if (p != cnt.end()) {
          ++(p->second);
        }
      }
    }
  }
  std::vector<unsigned long long> ans(10, 0);
  for (auto &i : cnt) {
    ++ans[i.second];
  }
  ans[0] = (H - 2) * (W - 2);
  for (unsigned i = 1; i < 10; ++i) {
    ans[0] -= ans[i];
  }
  for (unsigned i = 0; i < 10; ++i) {
    std::cout << ans[i] << std::endl;
  }
  return 0;
}

Measured memory_bytes: 57344
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
    ans += B[A[i]-1]
    if  i>0 and A[i] == A[i-1] + 1:
        ans += C[A[i-1]-1]
print(ans)

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

#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#ifdef DEBUG
#define DEBUG_PRINT(...) printf(__VA_ARGS__)
#else
#define DEBUG_PRINT(...)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

long long N, A[100000], B[100000], C[100000];
long long a[100000], b[100000], c[100000];


int main(){
  scanf("%lld", &N);
  REP(N){
    scanf("%lld", &A[i]);
  }
  REP(N){
    scanf("%lld", &B[i]);
  }
  REP(N){
    scanf("%lld", &C[i]);
  }

  sort(A, A+N);
  sort(B, B+N);
  sort(C, C+N);

  REP(N){
    long long* tmp = lower_bound(A, A+N, B[i]);
    b[i] = (tmp-A);
  }

  REP(N-1){
    b[i+1]+=b[i];
    assert(b[i+1]>=0);
  }

  REP(N){
    DEBUG_PRINT("%d ", b[i]);
  }
  DEBUG_PRINT("\n");

  REP(N){
    long long* tmp = lower_bound(B, B+N, C[i]);
    if((long long)(tmp-B) == 0){c[i] = 0;continue;}
    c[i] = b[(long long)(tmp-B)-1];
    assert(c[i]>=0);
  }

  REP(N){
    DEBUG_PRINT("%d ", c[i]);
  }
  DEBUG_PRINT("\n");

  REP(N-1){
    c[i+1]+=c[i];
    assert(c[i+1]>=0);
  }

  printf("%lld\n", c[N-1]);

  return 0;
}



Measured memory_bytes: 4480
#include<iostream>
#include<cmath>
#define F first
#define S second
#define EPS 1e-10
using namespace std;
typedef pair<double,double> P;

int main(){
  P p1,p2,p3,p4;
  while(cin >> p1.F >> p1.S >> p2.F >> p2.S >> p3.F >> p3.S >> p4.F >> p4.S){
    if(!(p4.F < p1.F ) && !( p2.F < p3.F ) ){
      if(!(p4.S < p1.S) && !(p2.S < p3.S ))cout << "YES" << endl;      
      else cout << "NO" << endl;
    }
    else{
      cout << "NO" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1220
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<vector>
using namespace std;

int main(){
 
    int n,t;
    cin>>n>>t;
    
    int c[n];
    int time[n];
    
   
    for (int i=0; i<n; i++) {
        cin>>c[i]>>time[i];
    }
    
    int ans=1500;
    
    for(int j=0;j<n;j++){
        if(time[j]<=t){
            if(ans>c[j]){
                ans=c[j];
            }
        }
    }
    
    if(ans==1500){
        cout<<"TLE"<<endl;
    }else{
        cout<<ans<<endl;
    }
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
import numpy as np

N, K = map(int, input().split())
A = list(map(int, input().split()))

A_1 = np.array(A[K:])
A_2 = np.array(A[:-K])

A_bool = A_1 - A_2

for a_bool in A_bool:
    if a_bool > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 50036
tmp = input().split()
S = tmp[0]
T = tmp[1]
i = list(map(int, input().split()))
A = i[0]
B = i[1]
U = input()

if S == U:
  print(str(A-1) + " " + str(B))
else:
  print(str(A) + " " + str(B-1))



Measured memory_bytes: 3060
//#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <cassert>
#include <fstream>
#include <algorithm>
#include <list>
#include <random>
#include <ctime>
#include <cmath>
#include <random>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define mmin(a, b) a = min(a, (b))
#define mmax(a, b) a = max(a, (b))
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define ALL(a) a.begin(),a.end()
#define sqr(x) (x) * (x)
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define cint const int & 
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;

const double PI = 2 * acos(0.0);

template<class T>
void show(const vector<T> &a) {
	for (T x : a)
		cout << x << " ";
	cout << endl;
}


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

	int n;
	cin >> n;
	vector<pii> a(n);
	fori(i, n) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(ALL(a));
	vi ans(n);
	fori(i, n) {
		if (i < n / 2) ans[a[i].second] = a[n / 2].first;
		else ans[a[i].second] = a[n / 2 - 1].first;
	}
	fori(i, n)
		cout << ans[i] << "\n";
}

Measured memory_bytes: 4608