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

int main() {
  int N, l, r, count = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3552
#include <stdio.h>

int main(void){
            int n,a,b,c;
            int i;
            scanf("%d",&n);
              for(i=0; i<n; i++){
            scanf("%d %d %d",&a,&b,&c);
            if(a*a == b*b+c*c || b*b == a*a+c*c ||c*c == b*b+a*a ){printf("YES\n");}else{printf("NO\n");} }
               return 0;
            }

Measured memory_bytes: 580
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vl a(n), b(m);
	REP(i, n)cin >> a[i];
	REP(i, m)cin >> b[i];
	vvi dp(n + 1, vi(m + 1, 0));
	REP(i, n)REP(j, m) {
		dp[i + 1][j + 1] = ((dp[i][j + 1] + dp[i + 1][j] - dp[i][j]) % MOD + MOD) % MOD;
		dp[i + 1][j + 1] %= MOD;
		if (a[i] == b[j]) {
			dp[i + 1][j + 1] += 1 + dp[i][j];
			dp[i + 1][j + 1] %= MOD;
		}
	}
	cout << (dp[n][m] + 1) % MOD << endl;
}

Measured memory_bytes: 16000
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;

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

const ll MOD = 998244353;

const ll MX = 200005;



ll mpow(ll a, ll n){
    if(n == 0) return 1;
    ll r = mpow(a, n / 2);
    r *= r; r %= MOD;
    if(n % 2) r *= a;
    return r % MOD;
}

ll inv(ll a){
    return mpow(a, MOD - 2);
}

ll INV9 = inv(9);
ll P10[MX];

void init(){
    P10[0] = 1;
    for(int i=1; i<MX; i++){
        P10[i] = (P10[i-1] * 10) % MOD;
    }
}

ll calMod(ll l, ll r){
    ll a = ((P10[r+1] - P10[l])%MOD + MOD)%MOD;
    a = a * INV9;
    return (a%MOD + MOD)%MOD;
}

struct Node {
	ll v;
	ll lazy;
	ll lv, rv;
	Node *left ,*right;
	Node(ll l, ll r){
		v=calMod(l, r); lazy=0;
		lv=l; rv=r;
		left=NULL; right=NULL;
		if(lv>=rv) return;
		ll m=lv + (rv-lv)/2;
		left=new Node(l, m);
		right=new Node(m+1, r);
	}

	void output(){
		cout<<lv<<" "<<rv<<" "<<v<<endl;
		if(left!=NULL) left->output();
		if(right!=NULL) right->output();
	}

	void pushdown(){
		ll mv = lv + (rv - lv)/2;
		if(lazy!=0){
			if(left!=NULL) {
                left->v = (calMod(lv, mv) * lazy)%MOD;
				//left->v += lazy * (mv - lv + 1);
				left->lazy = lazy;
			}
			if(right!=NULL) {
                right->v = (calMod(mv+1, rv) *lazy) % MOD;
				//right->v += lazy * (rv - mv);
				right->lazy = lazy;
			}
			lazy=0;
		}
	}

	void add(ll l, ll r, ll vv){
		//cout<<l<<" "<<r<<" "<<lv<<" "<<rv<<endl;
        if(lazy > 0) pushdown();

		if(lv==l && rv==r){
			v = (calMod(l, r) * vv) % MOD;
			lazy = vv;
			return;
		}

        ll v0 = query(l, r);
        v = ((v - v0 + calMod(l, r) * vv) % MOD + MOD ) % MOD;
		ll m=lv + (rv - lv)/2;
		if(r<=m){
			left->add(l, r, vv);
		}else if (l>m){
			right->add(l, r, vv);
		}else{
			left->add(l, m, vv);
			right->add(m+1, r, vv);
		}
		//v = (calMod(l, r) * vv) % MOD;
	}

	ll query(ll l, ll r){
		if(l==lv && r==rv){
			return v;
		}
		pushdown();
		ll m=lv + (rv - lv)/2;
		if(r<=m){
			return left->query(l, r);
		}else if(l>m){
			return right->query(l, r);
		}else{
			return (left->query(l,m) + right->query(m+1, r)) % MOD;
		}
		return 0;
	}
};

ll N, Q, L, R, D;


int main(){
    //freopen("in.txt", "r", stdin);
    init();
    cin>>N>>Q;
    Node sg(0, N-1);
    //cout<<sg.query(0, N-1)<<endl;
    while(Q--){
        cin>>L>>R>>D;
        ll l = N - R, r = N - L;
        //cout<<l<<" "<<r<<endl;
        sg.add(l, r, D);
        cout<<sg.query(0, N-1)<<endl;
    }
    return 0;
}





Measured memory_bytes: 30236
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define st string
#define dl double
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define pr(n) cout << fixed << setprecision(n)
#define ci(n) cin >> n
#define ci2(n, o) cin >> n >> o
#define ci3(n, o, p) cin >> n >> o >> p
#define co(n) cout << n << endl

int main() {
  ll A, B;
  ci2(A, B);
  if((A + B) % 2 == 0) {
    co((A + B) / 2);
  }
  else {
    co("IMPOSSIBLE");
  }
}  

Measured memory_bytes: 256
#include <cstdio>

int counter_0start = 0;
int counter_1start = 0;

int main()
{
  int c;
  for (int i = 0;; ++i) {
    c = getchar();
    if (c == EOF || c == '\n') {
      break;
    }
    if (i % 2 == 0) {
      if (c == '0') {
        ++counter_1start;
      } else {
        ++counter_0start;
      }
    } else {
      if (c == '1') {
        ++counter_1start;
      } else {
        ++counter_0start;
      }
    }
  }
  if (counter_0start < counter_1start) {
    printf("%d\n", counter_0start);
  } else {
    printf("%d\n", counter_1start);
  }
  return 0;
}



Measured memory_bytes: 128
#include <stdio.h>
#include <algorithm>
typedef long long ll;

int main(void) {
  ll i, j, k, n, c, be, cnt = 1, ans = 1;
  scanf("%lld%lld%lld", &n, &c, &k);
  ll t[n];
  for(i = 0; i < n; ++i) scanf("%lld", &t[i]);
  std::sort(t, t + n);
  be = t[0];
  for(i = 1; i < n; ++i) {
    if(t[i] > be + k) ans++, be = t[i], cnt = 0;
    cnt++;
    if(cnt > c) ans++, be = t[i], cnt = 1;
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
 
using namespace std;
#define int long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back


int MOD=1000000007;
int A,B;
int ans=0;
signed main(){
    scanf("%lld %lld",&A,&B);
    printf("%lld\n",max(A*B,max(A+B,A-B)));
}


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

/*------------------------------------------------------------------*/

#define ll long long int
#define mp make_pair
#define pb push_back
#define MOD 1000000007

bool isvowel(char c)
{
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        return true;
        return false;
}
ll isprime(ll n)
{
    ll ans=1;
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            ans = i;
    }
    return ans;
}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    if(b==1)
        return a%m;
    ll temp=power(a,b/2,m);
    if(b%2==0)
        return ((temp%m)*(temp%m))%m;
    else
        return ((((temp%m)*(temp%m))%m)*a%m)%m;
}

/*-----------------------------------------------------------------------------*/

ll c(ll n, ll k)
{
    ll C[n + 1][k + 1];
    ll i, j;

    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {

            if (j == 0 || j == i)
                C[i][j] = 1;

            else
                C[i][j] = (C[i - 1][j - 1]%MOD +
                          C[i - 1][j])%MOD;
        }
    }
    return C[n][k]%MOD;
}
ll modInverse(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
      return 0;

    while (a > 1)
    {

        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;


        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;

    return x;
}
ll func(ll n)
{
    ll ans=0;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            if(i/10==0)
                ans+=1+func(i)*func(n/i);
            else
                ans+=func(i)*func(n/i);
        }
    }
    return ans;
}
ll dp[2001][2001];
ll check(vector<pair<ll,ll> >v,ll l,ll r,ll i)
{ 
   //cout<<l<<" "<<r<<endl;
   if(l>r)
    return 0; 
   if(dp[l][r]!=-1)
    return dp[l][r]; 
   ll ans=0;
   ll p1=v[i].first;
   ll p2=v[i].second;
   ans=max(p1*(p2-l)+check(v,l+1,r,i+1),p1*(r-p2)+check(v,l,r-1,i+1));
   return dp[l][r]=ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    //freopen("1.txt","rt",stdin);
    //freopen("output.txt","wwt",stdout);

    ll t;
    t=1;
    //cin>>t;
    //ll t1=0;
    while(t--)
    {
       ll k,n;
       cin>>k>>n;
       ll a[n];
       for(ll i=0;i<n;i++)
        cin>>a[i];
       ll ans=a[n-1]-a[0];
       for(ll i=1;i<n;i++)
       {
           ll tmp=0;
           tmp+=k-a[i];
           tmp+=a[i-1];
           ans=min(ans,tmp);
       } 
       cout<<ans;
    }
}


Measured memory_bytes: 5208
import itertools
#再帰関数のときのRE予防
import sys
sys.setrecursionlimit(312467) 
N = int(input())
List = []
def dfs(S):
    List.append(S)
    if len(S) < N:
      for i in range(ord("a"), ord(max(S))+2):
        dfs(S+[chr(i)])
    return
dfs(["a"])
for i in List:
  if len(i) == N:
    print("".join(i))
  elif len(i) > N:
    break

Measured memory_bytes: 30304
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <string>
#include <cctype>
#include <cassert>
using namespace std;

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

string s;
size_t cur;

bool clause(){
  vector<int> nums;
  if(s[cur] == '~'){
    cur++;
    nums.push_back(-s[cur++]);
  }else{
    nums.push_back(s[cur++]);
  }
  assert(s[cur++] == '&');
  if(s[cur] == '~'){
    cur++;
    nums.push_back(-s[cur++]);
  }else{
    nums.push_back(s[cur++]);
  }
  assert(s[cur++] == '&');
  if(s[cur] == '~'){
    cur++;
    nums.push_back(-s[cur++]);
  }else{
    nums.push_back(s[cur++]);
  }
  rep(i, 3){
    rep(j, i){
      if(nums[i] + nums[j] == 0) return false;
    }
  }
  return true;
}

bool expression(){

  while(cur < s.size()){
    assert(s[cur] == '(');
    cur++;
    if(clause()) return true;
    assert(s[cur++] ==')');
    if(cur < s.size()){
      assert(s[cur++] == '|');
    }
  }
  return false;
}

int main(){
  while(getline(cin, s) && s != "#"){
    cur = 0;
    if(expression()) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
n=int(input())
s_o=input()
s_dot=[len(x) for x in s_o.replace("#"," ").split()]
s_sharp=[len(x) for x in s_o.replace("."," ").split()]
if s_o[0]==".":
  s_dot=s_dot[1:]
if s_o[-1]=="#":
  s_sharp=s_sharp[:-1]
length=len(s_dot)+1
if len(s_dot)==0 or len(s_sharp)==0:
  print(0)
  exit()
sum_sharp=[0]*length
sum_dot=[0]*length
for i in range(length):
  if i==0:
    sum_sharp[i]=0
  else:
    sum_sharp[i]=sum_sharp[i-1]+s_sharp[i-1]

for i in reversed(range(length)):
  if i==length-1:
    sum_dot[i]=0
  else:
    sum_dot[i]=sum_dot[i+1]+s_dot[i]
ans=[1000000]*(length)
for i in range(length):
  ans[i]=sum_sharp[i]+sum_dot[i]
print(min(ans))

Measured memory_bytes: 16904
#include<stdio.h>
#define N 100
void swap(int *,int *);
int main(){
  int i,j,mini;
  int A[N];
  int n,flag,cnt=0;

  scanf("%d",&n);

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

  for(i=0; i<n-1; i++){
    mini = i;
    for(j=i,flag=0; j<n; j++){
      if(A[j]<A[mini]){
         mini = j;
         flag=1;
       }
     }
  if(flag==0) continue;
  swap(&A[i],&A[mini]);
  cnt++;
  }

  for(i=0; i<n; i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",cnt);


  return 0;
}

void swap(int *a,int *b)
{
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

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

int main(){
	
	string s; cin>>s;
	if(s[2] == s[3] && s[4] == s[5]) cout<<"Yes"<<"\n";
	else cout<<"No"<<"\n";
	
	
	
	
	
	
}


















Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
var H int

func parent(i int) int {
	return i / 2
}

func left(i int) int {
	return 2 * i
}

func right(i int) int {
	return 2*i + 1
}

func maxHeapify(A []int, i int) {
	l := left(i)
	r := right(i)
	largest := i
	if l <= H && A[l] > A[i] {
		largest = l
	}
	if r <= H && A[r] > A[largest] {
		largest = r
	}
	if largest != i {
		A[i], A[largest] = A[largest], A[i]
		maxHeapify(A, largest)
	}
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	A := make([]int, 2*int(1e+6)+10)
	for {
		op := sc.nextStr()
		if op[0] == 'i' {
			H++
			A[H] = sc.nextInt()
			i := H
			for parent(i) > 0 {
				if A[parent(i)] < A[i] {
					A[parent(i)], A[i] = A[i], A[parent(i)]
					i = parent(i)
				} else {
					break
				}
			}
		} else if op[len(op)-1] == 't' {
			mx := A[1]
			A[1] = A[H]
			H--
			maxHeapify(A, 1)
			fmt.Fprintln(wtr, mx)
		} else {
			break
		}
	}
	wtr.Flush()
}




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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

R = inputI()

print(R*3.1415926535*2)


Measured memory_bytes: 72852
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
using mp = map<int,int>;
const int MN = 1e5+2, MOD = 1e9+7;
int deg[MN];
int ans[MN];
vector<pii> adj[MN];
void dfs (int cur, int p = -1, int pc = -1) {
	int color = 0;
		for (pii i : adj[cur]) if (i.first != p) {
			if (++color == pc) ++color;
			ans[i.second] = color;
			dfs(i.first,cur,color); 
		}
}
int main () { //its a tree so...greedy?
	int n;
	scanf ("%d",&n);
	for (int i = 1; i < n; i++) {
		int a,b;
		scanf ("%d %d",&a,&b);
		adj[a].push_back({b,i});
		adj[b].push_back({a,i});
		++deg[a]; ++deg[b];
	}
	int ret = 0;
	for (int i = 0; i < n; i++) ret = max(ret,deg[i]);
	printf ("%d\n",ret);
	dfs(1);
	for (int i = 1; i < n; i++) printf ("%d\n",ans[i]), assert(ans[i] <= ret);
    return 0;
}


Measured memory_bytes: 8576
package main

import (
	"bufio"
	"fmt"
	"os"

	"github.com/emirpasic/gods/lists/arraylist"
	"github.com/emirpasic/gods/utils"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var n, l int
	fmt.Fscan(r, &n, &l)

	list := arraylist.New()
	var s string
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &s)
		list.Add(s)
	}

	list.Sort(utils.StringComparator)
	for i := 0; i < list.Size(); i++ {
		out, _ := list.Get(i)
		fmt.Fprint(w, out)
	}
	fmt.Fprintf(w, "\n")
}


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

// 

public class Program_ABC113_A // ←Class名変更！！
{
    public static void Main()
    {
        var xy = ReadLine().Split(' ');
        var maxX = int.Parse(xy[0]);  //x,y なのか y,xなのか注意
        var maxY = int.Parse(xy[1]);



        var result = maxX + maxY / 2;
        WriteLine($"{result}");
        return;

    } // Main

}     // Class


Measured memory_bytes: 13268
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int binsearch(vector<int>& vec, int val) {
  int low = 0;            // 範囲の下限
  int high = vec.size();  // 範囲の上限。解はあれば [low, high] の中に存在する
  while(low > high){
    int mid = (low +high) /2;
    int midval = vec[mid];
    if(midval > val){
      high = mid;
    }else{
      low = mid;
    }
  }
  return low;
}

int main(){

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

  vector<int> a, b, c;
  REP(i,n){
    int t;
    scanf("%d", &t);
    a.pb(t);
  }

  REP(i,n){
    int t;
    scanf("%d", &t);
    b.pb(t);
  }

  REP(i,n){
    int t;
    scanf("%d", &t);
    c.pb(t);
  }

  SORTV(a); SORTV(b); SORTV(c);

  llong res = 0;
  REP(i,n){
    vector<int>::iterator itr1, itr2;
    itr1 = lower_bound(ALL(a), b[i]);
    itr2 = upper_bound(ALL(c), b[i]);
    llong index = (distance(a.begin(), itr1));
    if(index == 0){
      if(a[index] < b[i]){
        index = n;
      }else{
        index=-1;
      }
    }
    if(index != -1){
      //printf("%d %d\n", index, *itr1);
      res += index * (n - distance(c.begin(), itr2)); 
    }
  }

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



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

namespace ConsoleApp15
{
    class Class223
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var B = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            var C = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            Array.Sort(A);
            Array.Sort(B);
            Array.Sort(C);

            var a = new long[N+1];
            var b = new long[N];
            for(int i = 0; i < N; i++)
            {
                int ub = N, lb = -1;
                while (ub - lb > 1)
                {
                    int mid = (ub + lb) / 2;
                    if (B[mid] < C[i])
                        lb = mid;
                    else ub = mid;
                }
                b[i] = ub;
            }
            for(int i = 0; i < N; i++)
            {
                int ub = N, lb = -1;
                while (ub - lb > 1)
                {
                    int mid = (ub + lb) / 2;
                    if (A[mid] < B[i])
                        lb = mid;
                    else
                        ub = mid;
                }
                a[i + 1] = a[i] + ub;
            }
            long ans = 0;
            for (int i = 0; i < N; i++)
                ans += a[b[i]];
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 40248
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;

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

    int m = max(A,max(B,C));
    int mi = min(A,min(B,C));
    if ((m == B && mi == A) || (mi == B && m==A) ){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    int b[n];
    rep(i,n){
        b[i]=0;
        cin>>a[i];
    }
    rep(i,n){
        b[a[i]-1]++;
    }
    sort(b,b+n);
    reverse(b,b+n);
    int ans=0;
    for(int i=k;i<n;i++){
        ans+=b[i];
    }
    cout<<ans<<endl;
}


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

typedef long long ll;
const int NMAX = 2e5 + 10;
const int MOD = 1e9 + 7;
int main(int argc, char const *argv[])
{
	char ch;
	ch = getchar();
	if(ch >= 'A' && ch <= 'Z')
		puts("A");
	else
		puts("a");
	return 0;
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;

class C
{
	static void Main()
	{
		var s = Console.ReadLine();

		var q = new Stack<char>();
		foreach (var c in s)
			if (q.Count == 0 || q.Peek() == c) q.Push(c);
			else q.Pop();
		Console.WriteLine(s.Length - q.Count);
	}
}


Measured memory_bytes: 13232
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=INT()
    print(n**2-a)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include <iostream>
    #include <algorithm>
     
    using namespace std;
     
    int main(){
        int n;
        cin >> n;
     
        pair<pair<string,int>,int> s[n];
        for(int i=0; i<n; i++){
            string str;
            int num;
            cin >> str >> num;
            s[i] = make_pair(make_pair(str, num * (-1)),i+1);
        }
     
       sort(s, s+n);
        for(int i=0;i<n;i++){
            cout <<s[i].second << endl;
        }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  int n;
  cin>>n;
  in m10=1,m9=1,m8=1;
  rep(i,n){
    m10*=10;
    m9*=9;
    m8*=8;
    m10=m10%MOD;
    m9=m9%MOD;
    m8=m8%MOD;
  }
  in ans=0;
  ans=m10+m8-2*m9;
  ans+=2*MOD;
  ans=ans%MOD;
  cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
ll n,k,v[500001],prod=1,remain,negativ;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>k;
    for(ll i=1;i<=n;i++)
    {
        cin>>v[i];
        if(v[i]<0)
            negativ++;
    }
    sort(v+1,v+n+1);
    if((k%2==1&&negativ==n)||(k==n&&negativ%2==1))
    {
        for(ll i=1;i<=n;i++)
            v[i]=abs(v[i]);
        sort(v+1,v+n+1);
        prod=mod-1;
        for(ll i=1;i<=k;i++)
        {
            prod=(prod*v[i])%mod;
            if(prod<0)
                prod+=mod;
        }
        cout<<prod;
        return 0;
    }
    remain=k;
    ll st=1;
    ll dr=n;
    while(remain)
    {
        if(remain>=2)
        {
            if(v[st]*v[st+1]>=v[dr]*v[dr-1])
            {
                prod=(prod*((v[st]*v[st+1])%mod))%mod;
                st+=2;
            }
            else
            {
                prod=(prod*((v[dr]*v[dr-1])%mod))%mod;
                dr-=2;
            }
            remain-=2;
        }
        else
        {
            prod=(prod*v[dr])%mod;
            remain--;
            break;
        }
        if(prod<0)
            prod+=mod;
    }
    cout<<prod;
    return 0;
}


Measured memory_bytes: 5200
#include <cassert>
#include <iostream>
#include <vector>

int main(int argc, char const* argv[])
{
    uint64_t n;
    std::cin >> n;

    uint64_t l_1 = 1;
    uint64_t l_0 = 2;

    for (int i = 0; i < n - 1; ++i) {
        uint64_t tmp = l_0 + l_1;
        l_0 = l_1;
        l_1 = tmp;
    }
    std::cout << l_1 << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);
int main() {
  int d, n;
  cin >> d >> n;
  if (n == 100) n++;
  cout << n * int(pow(100, d)) << endl;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
sp = [ list(input().split()) for _ in range(n) ]
for i in range(n):
    sp[i][1] = int(sp[i][1])
    sp[i].append(i+1)
# print(sp)

sp.sort(key=lambda x:x[1],reverse=True)
# print(sp)

sp.sort(key=lambda x:x[0])
# print(sp)

for i in range(n):
    print(sp[i][2])



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

int main() {
   int n, m;
   cin >> n >> m;
   vector<vector<int>>A(n,vector<int>(m));
   for(int i=0; i<n; i++){
       for(int j=0; j<m; j++){
           cin >> A.at(i).at(j);
       }
   }
   vector<int> b(m);
   for(int &x : b){
       cin >> x;
   }
   vector<int> c(n);
   for(int i=0; i<n; i++){
       for(int j=0; j<m; j++){
           c.at(i)+= A.at(i).at(j) * b.at(j);
       }
   }
for(int i=0; i<n; i++){
    cout << c.at(i) << endl;
}
    return 0;
}




Measured memory_bytes: 3172
#include <iostream>
#include <map>
typedef long long ll;
using namespace std;

int main(void) {
    ll N;cin>>N;
    map<ll, ll> mp;
    for (int i = 0; i < N; i++) {
        ll A,B;cin>>A>>B;
        if (mp.find(B) != mp.end()) mp[B] += A;
        else mp[B] = A;
    }
    ll cur = 0;
    for (map<ll,ll>::iterator it = mp.begin(); it != mp.end(); ++it) {
        cur += it->second;
        if (cur > it->first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y, int m) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y, int m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

const int mod = 1000000007;

string s, t;
int d[2010][2010];
int snex[2010][26], tnex[2010][26];
int ans;

signed main() {
	cin >> s;
	int n = (int)s.size();
	for (int i = n - 1; i >= 0; i--)t += s[i];
	for (int i = 0; i < 26; i++)snex[n][i] = n;
	for (int i = n - 1; i >= 0; i--)for (int j = 0; j < 26; j++) {
		snex[i][j] = snex[i + 1][j];
		snex[i][s[i] - 'a'] = i;
	}
	for (int i = 0; i < 26; i++)tnex[n][i] = n;
	for (int i = n - 1; i >= 0; i--)for (int j = 0; j < 26; j++) {
		tnex[i][j] = tnex[i + 1][j];
		tnex[i][t[i] - 'a'] = i;
	}
	d[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < 26; k++) {
				int p = snex[i][k] + 1;
				int q = tnex[j][k] + 1;
				if (p + q > n)continue;
				d[p][q] = (d[p][q] + d[i][j]) % mod;
			}
		}
	}
	for (int i = 0; i <= n; i++)for (int j = 0; i + j <= n; j++) {
		int cnt = 1;
		for (int k = 0; k < 26; k++) {
			int x = snex[i][k] + 1;
			if (x + j <= n)cnt++;
		}
		ans = (ans + d[i][j] * cnt) % mod;
	}
	ans--;
	cout << ans << endl;
}


Measured memory_bytes: 26584
fun main() {
    val s = readLine() ?: return
    var t = s.toLong()

    fun count(str: String, plus: Int): Pair<Long, Int> {
        var c = 0L
        var p = 0
        if (plus == 1) {
            1.until(str.length).forEach {
                val a = str.take(it).toLong()
                val b = str.takeLast(str.length - it).toLong()
                c += a + b
                p++
            }
        } else {
            1.until(str.length - plus + 1).forEach {
                val r = count(str.drop(it), plus - 1)
                c += str.take(it).toLong() * r.second + r.first
                p += r.second
            }
        }
        return Pair(c, p)
    }

    1.until(s.length).forEach {
        t += count(s, it).first
    }
    println(t.toString())
}


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

int main(void){
  const double g = 9.8;
  const double height = 5.0;
  double v, y;
  int N;
  while(cin >> v){
    y = (v * v) / (2 * g);
    N = y / height + 1;
    if(y - ((N - 1) * height) != 0)
      N++;
    
    cout << N << endl;
  }
  return 0;
}

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

using namespace std;
const int nax = 105;
const int mod = 1e9 + 7;

string s;
int d;

void add_self(int &a, int b)
{
    a += b;

    if(a >= mod)
        a -= mod;
}


int main()
{
    cin >> s;
    cin >> d;

    vector<vector<int>>dp(nax, vector<int>(2));
    int n = s.length();
    dp[0][0] = 1;

    for(int where = 0; where < n; ++where)
    {
        vector<vector<int>>new_dp(nax, vector<int>(2));

        for(int sum = 0; sum < d; ++sum)
            for(int digit = 0; digit < 10; ++digit)
                for(bool is_smaller : {false, true})
                {
                    if(!is_smaller && digit > s[where] - '0')
                        continue;

                    add_self(new_dp[(sum + digit) % d][is_smaller || digit < s[where] - '0'], dp[sum][is_smaller]);
                }

        dp = new_dp;
    }

    int answer = (dp[0][false] + dp[0][true]) % mod;
    --answer;

    if(answer < 0)
        answer += mod;

    cout << answer;

    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <utility>
#include <map>
#include <set>
#include <string>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
bool scan(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
vo(string &s){for (char c: s) pcu(c);}
vo(const string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo


int main() {
	map<string, set<int>> m;
	for (string s; scan(s);)
		m[s].insert(in());

	for (auto i: m) {
		out(i.first, '\n');
		int c = 0;
		for (int n: i.second)
			out(c++ ? " ": "", n);
		out('\n');
	}
}


Measured memory_bytes: 2708
#include <iostream>

using namespace std;

int main()
{
  int l;
  int b;
  int a;
  int p;
  cin >> l;
  cin >> b;
  a=l*b;
  p=2*(l+b);
  cout << a << " " << p << endl;
  return 0;

  
   
}


Measured memory_bytes: 3040
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/



int main() {
int W,H,N;
cin>>W>>H>>N;
char grid[H][W];
rep(i,H){
    rep(j,W){
        grid[i][j]='.';
    }
}
int x,y,a;

rep(i,N){
    cin>>x>>y>>a;
    if(a==1){
        rep(j,H){
            repr(k,x){
                grid[j][k]='#';
            }
        }
    }
    else if(a==2){
        rep(j,H){
            rep4(k,x,W-1){
                grid[j][k]='#';

            }
        }
    }
    else if(a==3){
        repr(j,y){
            rep(k,W){
                grid[j][k]='#';
            }
        }
    }
    else{
        rep4(j,y,H-1){
            rep(k,W){
                grid[j][k]='#';
            }
        }
    }


}
int count=0;
rep(i,H){
    rep(j,W){
        if(grid[i][j]=='.'){
            count++;
        }
    }
}
cout<<count<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
int a[310];
double d[310][310][310];
int xt,yt,zt;
double dfs(int x,int y,int z,double r)
{
	if (d[x][y][z]!=0.0) return d[x][y][z];
	if (!x && !y && !z) return 0.0;
	double t=0,ri=0;
	if (x)
	{
		t+=x;
		ri+=dfs(x-1,y,z,r*(double)(x+y+z)/(double)(x+y+z-1))*x;
	}
	if (y)
	{
		t+=y;
		ri+=dfs(x+1,y-1,z,r)*y;
	}
	if (z)
	{
		t+=z;
		ri+=dfs(x,y+1,z-1,r)*z;
	}
	d[x][y][z]=r+ri/t;
	//cout <<x<<" "<<y<<" "<<z<<" "<<d[x][y][z]<<" ##\n"; 
	return r+ri/t;
}
int main()
{
	cin >>n;
	for (int i=0;i<n;i++) 
	{
		cin >>a[i];
		if (a[i]==1) xt++;
		else if (a[i]==2) yt++;
		else zt++;
	}
	cout <<setprecision(15);
	cout <<dfs(xt,yt,zt,1.0);
	return 0;
} 

Measured memory_bytes: 225536
from scipy.sparse.csgraph import floyd_warshall

H, W = map(int, input().split())
S = []
for i in range(H):
    s1 = list(input())
    S.append(s1)
    
graph = [[0 for _ in range(H*W)] for _ in range(H*W)]

for i in range(H-1):
    for j in range(W):
        if S[i][j] == "." and S[i+1][j] == ".":
            graph[j+(i*W)][j+(W*(i+1))] = 1
            graph[j+(W*(i+1))][j+(i*W)] = 1
for i in range(H):
    for j in range(W-1):
        if S[i][j] == "." and S[i][j+1] == ".":
            graph[j+(i*W)][j+(W*i)+1] = 1
            graph[j+(W*i)+1][j+(i*W)] = 1
            
d = floyd_warshall(graph)

ans = 0
for i in range(H*W):
    for j in range(i+1,H*W):
        if d[i][j] != float("inf"):
            ans = max(ans, d[i][j])

print(int(ans))

Measured memory_bytes: 21596
#include<bits/stdc++.h>
using namespace std;
const int INF=INT_MAX;
const long long LLINF=LONG_MAX;
typedef long long ll;
const ll mod=998244353;
const int MX=2e5+7;
ll qpow(ll a ,ll b,int MOD=mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=ans*a%MOD;
        }
        a=a*a%MOD;
        b>>=1;
    }
    return ans;
}
bool cmp(int a ,int b)
{
    return a>b;
}
int a[MX];
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    ll ans=0;
    int h,k;
    cin>>h>>k;
    for(int i=1;i<=h;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+h+1,cmp);
    for(int i=k+1;i<=h;i++)
    {
        ans+=a[i];
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    char S[100001];

    scanf("%s", S);

    int c['z'-'a'+1] = {0};

    int len = strlen(S);

    for(int i = 0; i < len; i++){
        c[S[i]-'a']++;
    }

    int f = 1;

    for(int i = 0; i <= 'z'-'a'; i++){
        if(c[i] == 0){
            f = 0;
            printf("%c\n", 'a'+i);
            break;
        }
    }

    if(f == 1){
        printf("None\n");
    }

    return 0;
}

Measured memory_bytes: 1760
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int check[10000];
int main(){
    string S;
    getline(cin,S);
    int a=-1;
    while(S.find("apple",a+1)!=-1){
        a=S.find("apple",a+1);
        S.replace(a,5,"peach");
        check[a]=1;
    }
    a=-1;
    while(S.find("peach",a+1)!=-1){
        a=S.find("peach",a+1);
        if(!check[a])S.replace(a,5,"apple");
    }
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <vector>
using namespace std;
#define int long long int
#define pb push_back
vector<int> divisors;
int g(int x)
{
    int digits = 0;
    while (x > 0)
    {
        x /= 10;
        digits++;
    }
    return digits;
}
signed main()
{
    int ans = 100, n;
    cin >> n;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            divisors.pb(i);
            divisors.pb(n / i);
            ans = min(ans, g(n / i));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int const nmax = 1e5;
int dp[1 + nmax];
int v[1 + nmax];

int main() {

  int n;
  cin >> n;
  v[0] = - 1e4;
  cin >> v[1];
  for(int i = 2;i <= n;i++){
    cin >> v[i];
    dp[i] = min(dp[i-1] + abs(v[i] - v[i-1]), dp[i-2] + abs(v[i] - v[i-2]));
    //cerr << dp[i] << ' ';
  }
  cout << dp[n];
  return 0;
}


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

int main() {
    string s; cin >> s;
    string ans;
    for (int i = 0, N = s.size(); i < N; i+=2)
    {
        ans.push_back(s[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
n = gets.strip.to_i
v = gets.strip.split.map(&:to_f)

v = v.sort!
(1..v.length-1).each do |i|
  v[i - 1 + 1] = (v[i -1 ] + v[i -1 +1])/2
end

puts v[v.length - 1].to_s

Measured memory_bytes: 1788
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;
	cin>>n;
	while(true){
		int f = 1;
		for(int i = 2;i < sqrt(n)+2&&i<n;i++){
			if(n%i == 0){f = 0;break;}
		}
		if(f){
			cout << n << endl;
			return 0;
		}
		n++;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
ll mod=1e9+7;
int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    bool dp[k+1];
    dp[0]=false;
    for(int i=1;i<=k;i++){
        dp[i]=false;
        for(int j=0;j<n;j++){
            if(i-a[j]>=0){
                if(!dp[i-a[j]]){
                    dp[i]=true; break;
                }
            }
        }
    }
    if(dp[k]) cout<<"First";
    else cout<<"Second";
}

Measured memory_bytes: 384
def solve(s):
  s = list(s)
  n = len(s)
  ans = check_palindrome(s) & check_palindrome(s[:int(((n-1)//2))]) & check_palindrome(s[int(((n+3)//2)-1):])
  return "Yes" if ans else "No"


def check_palindrome(st):
  a = list(st)
  b = list(reversed(st))
  return a == b




s = str(input())
# n, m = [int(s) for s in input().split(" ")]
print(solve(s))


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

using namespace std;

typedef long long ll;

#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define INF 1000000000

int main() {

	string s;
	cin >> s;
	int len = s.length(), a = 0, b = 0;

	FOR(i, len) {
		if (s[i] == '0')a++;
		else b++;
	}
	cout << min(a, b) * 2 << endl;

	return 0;
}


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

int n;
vector<pair<pair<int, int>, int>> xy;

//素集合データ構造
// ref:https://ei1333.github.io/luzhiled/snippets/structure/union-find.html
struct union_find {
    // parent[v]==w(>=0):vの親はw
    // parent[v]==k(<0):vは根&&vの属するグループの要素数は-k
    vector<long long int> parent;
    //コンストラクタ
    union_find(long long int n) {
        parent.assign(n, -1);
    }
    // vの根を求める
    //求めると同時に親を根に置き換える(木の圧縮)
    long long int root(long long int v) {
        if (parent[v] < 0) {
            return v;
        } else {
            parent[v] = root(parent[v]);
            return parent[v];
        }
    }
    // vが属するグループの要素数を求める
    long long int size(long long int v) {
        return -parent[root(v)];
    }
    // vとwを繋げる
    void unite(long long int v, long long int w) {
        v = root(v);
        w = root(w);
        if (v == w) return;
        if (parent[v] < parent[w]) swap(v, w);
        parent[w] += parent[v];
        parent[v] = w;
    }
    // vとwが同値か判定
    bool isSame(long long int v, long long int w) {
        return root(v) == root(w);
    }
};

int main() {
    cin >> n;
    xy.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> xy[i].first.first >> xy[i].first.second;
        xy[i].second = i;
    }
    sort(xy.begin(), xy.end());
    union_find uf(n);
    // first:y,second:index
    set<pair<int, int>> st;
    for (int i = 0; i < n; i++) {
        vector<pair<int, int>> connected;
        for (auto e : st) {
            if (e.first < xy[i].first.second) {
                uf.unite(e.second, i);
                connected.push_back(e);
            } else {
                break;
            }
        }
        if (connected.empty()) {
            st.insert({xy[i].first.second, i});
        } else {
            pair<int, int> repr = {INT_MAX, -1};
            for (auto g : connected) {
                if (repr.first > g.first) {
                    repr = g;
                }
            }
            for (auto g : connected) {
                if (g != repr) {
                    st.erase(g);
                }
            }
        }
    }
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        ans[xy[i].second] = uf.size(i);
    }
    for (int i = 0; i < n; i++) {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 12616
N=int(input())
T,A=[int(i) for i in input().split()]
H=[int(i) for i in input().split()]
dic=None
p=0

for i in range(N):
	ti=T-(H[i]*0.006)
	
	if dic is not None:
		if dic > abs(A-ti):
			dic = abs(A-ti)
			p=i
	else:
		dic = abs(A-ti)
		p=i
print(p+1)
		
	

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

typedef long long ll;
int cnt = 0;
ll n;

void solve(ll curr, int f1, int f2, int f3)
{
    if(curr > n)
        return;
    if(f1 && f2 && f3)
        cnt++;
    solve(curr * 10 + 3, 1, f2, f3);
    solve(curr * 10 + 5, f1, 1, f3);
    solve(curr * 10 + 7, f1, f2, 1);
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    cin>>n;

    solve(0, 0, 0, 0);

    cout<<cnt<<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    ans=0
    for i in range(1,N+1):
        temp=1/N
        score=i
        while score<K:
            score*=2
            temp/=2
        ans+=temp
        
    print(ans)
    

main()


Measured memory_bytes: 63968