akhauriyash/Code-Regression huggingface dataset:
import sys
import itertools
# import numpy as np
import time

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = readline().split()
a = int(a)
b = int(float(b) * 100 + 0.5)
print(a * b // 100)

Measured memory_bytes: 9516
# X/Y mod(10**9+7) == X*(Y**(10**9+7-2)) mod(10**9+7)

MOD = 10**9+7

def mod_prod(l, mod=MOD):
    p = 1
    for x in l:
        p = (p * x) % mod
    return p

n, *ab = list(map(int, input().split()))

m = pow(2, n, MOD) - 1
# print(m)

for k in ab:
    # print(f"k: {k}")
    x = mod_prod(range(n-k+1, n+1))
    y = mod_prod(range(1, k+1))
    z = x * pow(y, MOD-2, MOD)
    # print(z)
    m = (m - z) % MOD

print(m)


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

using namespace std;

#define INF 1e9
const int MAX_N = 1<<17;
typedef pair<int,int> pii;

class RMQ{
public:
  int n;
  pii dat[2*MAX_N-1];

  void init(int n_){
    n = 1;
    while(n < n_){ n *= 2; }
    for(int i = 0 ; i < 2*n-1 ; i++){
      dat[i] = pii(-INF,-INF);
    }
    for(int i = 0 ; i < n_ ; i++){
      update(i,0);
    }
  }

  void update(int k,int a){
    int tk = k;
    k += n - 1;
    dat[k] = pii(a,-tk);
    while(k > 0){
      k = (k - 1) / 2;
      dat[k] = max(dat[k*2+1],dat[k*2+2]);
    }
  }

  pii query(int a,int b,int k,int l,int r){
    if(r <= a || b <= l){ return pii(-INF,-INF); }
    if(a <= l && r <= b){
      return dat[k];
    }else{
      pii vl = query(a,b,k*2+1,l,(l+r)/2);
      pii vr = query(a,b,k*2+2,(l+r)/2,r);
      return max(vl,vr);
    }
  }
};

int main(){
  int N,R,L;
  RMQ rmq;
  cin >> N >> R >> L;
  rmq.init(N);
  int d,t,x,pt = 0;
  vector<int> point(N,0);
  for(int i = 0 ; i < R ; i++){
    cin >> d >> t >> x; d--;
    point[-rmq.query(0,N,0,0,rmq.n).second] += t - pt;
    rmq.update(d,x+rmq.dat[d+rmq.n-1].first);
    pt = t;
  }
  point[-rmq.query(0,N,0,0,rmq.n).second] += L - pt;
  int res = -1, max = -INF;
  for(int i = 0 ; i < N ; i++){
    if(max < point[i]){
      max = point[i];
      res = i+1;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3380
N, K = map(int, input().split())
ai = list(map(int, input().split()))
for i in range(N):
    ai[i] -= 1
    
import math
dv = []
dv.append(ai)
for k in range(1, int(math.log2(K)) + 1):
    l = [0] * N
    dv.append(l)
    for n in range(N):
        dv[k][n] = dv[k - 1][dv[k - 1][n]]
        
a = []
for i in range(int(math.log2(K)) + 1):
    if K >> i & 1:
        a.append(i)
        
now = 0
for i in a:
    now = dv[i][now]
print(now + 1)

Measured memory_bytes: 173924
#include <stdio.h>

int main() {
  int base, hun, ten, one;
  
  scanf("%d", &base);
  
  one = base % 10;
  base = base / 10;
  ten = base % 10;
  base = base / 10;
  hun = base % 10;
  
  printf("%d", one + ten + hun);
  
  return 0;
}

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF INT_MAX/2 //(1<<(4*4-1))
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

bool comp(string a,string b){ //a<b
  if(a=="-")return true;
  if(a.size()<b.size())return true;
  else if(a.size()==b.size()){
    if(a<b)return true;
    else return false;
  }
  else return false;
}

vector<string>dp(11000,"-");

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

  int N,M;
  cin>>N>>M;
  vector<int>A(M);
  for(int i=0;i<M;i++)cin>>A[i];

  int cost[10] = {0,2,5,5,4,5,6,3,7,6};
  string c = "0123456789";

  /*
  string a="11";
  string b="11";
  cout<<comp(a,b)<<endl;
  */

  dp[0]="";
  for(int i=0;i<=N;i++){
    for(int j=0;j<M;j++){

      if(i-cost[A[j]]>=0){
          if(dp[i-cost[A[j]]]=="-")continue;
          if(comp(dp[i],dp[i-cost[A[j]]]+c[A[j]])){
            dp[i]=dp[i-cost[A[j]]]+c[A[j]];
          }
      }

    }
  }

  cout<<dp[N]<<endl;

  return 0;

}



Measured memory_bytes: 41600
N,x=map(int, input().split())
A=list(map(int, input().split()))

ans=0
A=sorted(A)
for i in range(N):
    a=A[i]
    if x>=a:
        x-=a
        ans+=1
    else:
        i-=1
        break

if x>0 and i==N-1:
    ans-=1
print(ans)

Measured memory_bytes: 61888
<?php
  list($s) = explode(" ", trim(fgets(STDIN)));

  $n = strlen($s);
  $ans = 0;
  for ($i=0; $i<$n; $i++) {
    for ($j=$i; $j<$n; $j++) {
      $a = substr($s, $i, $j-$i+1);
      // 左側のパターン
      $left = 1;
      if($i >= 2){
        $left = pow(2, $i-1);
      }
      $right = 1;
      if($j < $n-2){
        $right = pow(2, $n-$j-2);
      }
      $ans += ($left * $right * $a);
    }
  }

  echo $ans;

Measured memory_bytes: 16104
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;
const int mod = 1000000009;
ll P = 301;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  ll l;
  cin >> n >> l;
  vs s(n);
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); ++j) s[i][j] -= '0';
  }
  sort(s.begin(), s.end());
  set<pii> bad, good;
  for (const string& v : s) {
    ll sum = 0;
    for (int i = 0; i < v.size(); ++i) {
      good.insert(pii((sum * P + 1 - (int)v[i]) % mod, i + 1));
      sum = (sum * P + v[i]) % mod;
      bad.insert(pii(sum, i + 1));
//      cerr << "bad: " << sum << ' ' << i + 1 << endl;
    }
  }
  vi c(100001);
  for (pii p : good) {
//    cerr << p.first << ' ' << p.second << endl;
    if (!bad.count(p)) {
      c[p.second] ^= 1;
    }
  }
  ll xr = 0;
  for (int i = 0; i < c.size(); ++i) if (c[i]) {
    ll d = l - i + 1;
    for (int b = 0; b < 64; ++b) if (d & (1LL << b)) {
      xr ^= 1LL << b;
      break;
    }
//    cerr << i << ' ' << d << ' ' << xr << endl;
  }
  if (xr) cout << "Alice\n";
  else cout << "Bob\n";
  return 0;
}

Measured memory_bytes: 10192
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports, dead_code)]

use std::collections::{HashMap, BinaryHeap, BTreeMap};

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($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<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (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! p {
    ($t:expr) => {
        println!("{}", $t);
    };
}
macro_rules! debug {
    ($t:expr) => {
        println!("{:?}", $t);
    };
}
fn gcd(a:usize, b:usize) -> usize {
    if b == 0 {return a};
    gcd(b, a % b)
}
fn lcm(a:usize, b:usize) -> usize {
    a / gcd(a, b) * b
}

// エントリーポイント
fn main() {
    input! {
        S : chars
    }
    let (mut r, mut b) = (0usize, 0usize);
    for s in S {
        if s == '0' {r += 1;}
        else {b += 1;}
    }
    p!(std::cmp::min(r, b) * 2);
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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 (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int N;
int A[200010];
int ans[200010];

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

	int N;
	cin >> N;

	fill(ans, ans + N + 1, INF);

	rep(i, 1, N + 1)
	{
		cin >> A[i];
	}

	rrep(i, 1, N + 1)
	{
		int p = N / i * i;
		int sum = 0;
		while (0 < p)
		{
			if (ans[p] == INF)
			{
				ans[p] = (sum+A[i]) % 2;
				break;
			}
			else
			{
				sum += ans[p];
			}
			p -= i;
		}
	}

	int c = count(ans, ans + N + 1, 1);
	cout << c << endl;
	if (c > 0)
	{
		rep(i, 1, N + 1)
		{
			if (ans[i] == 1)
			{
				cout << i << " ";
			}
		}

		cout << endl;
	}

	return 0;
}

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

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

fn main() {
    let n = read::<i64>();
    let sum = (1..n as i64 + 1).sum::<i64>();
    let v = read_vec::<i64>();
    if v.iter().sum::<i64>() % sum != 0 {
        println!("NO");
        return;
    }
    let k = v.iter().sum::<i64>() / sum;
    let diff = (0..n as usize)
        .map(|x| v[(x + 1) % n as usize] - v[x])
        .collect::<Vec<_>>();
    for i in 0..n as usize {
        if (k - diff[i]) % n != 0 || diff[i] > k {
            println!("NO");
            return;
        }
    }
    println!("YES");
}

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()
}


Measured memory_bytes: 8444
package main

import (
	"fmt"
)

func main() {
	request := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scanf("%d", &request[i])
	}

	var result int
	for number := 1; number <= request[0]; number++ {
		sums := recurcive_sum(number)
		if request[1] <= sums && sums <= request[2] {
			result += number
		}
	}
	fmt.Printf("%d\n", result)
}

func recurcive_sum(number int) int {
	if number == 0 {
		return 0
	}
	return number%10 + recurcive_sum(number / 10)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define int long long
#define ld long double
#define vi vector<long long>
#define mkp make_pair
#define sz(x) (int)x.size()
#define pi pair<long long, long long>
#define watch(x) cout << (#x) << " is " << (x) << endl; cout.flush()
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define max4(a, b, c, d) max(max(a, d), max(b, c))
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> idxset;
//find_by_order(i) : iterator to the value at index i, order_of_key(x) : the index of value x


int n, sum=0;
vector<int> v(1000001);

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("A.txt", "r", stdin);
    #endif
    cin >> n;
    int s=0, x, ans=0;
    for(int i=0; i<n; i++)
    {
        cin >> v[s];
        sum += v[s++];
        while(s>=3&&v[s-3]<=v[s-2]&&v[s-2]>=v[s-1])
        {
            v[s-3] = v[s-3] - v[s-2] + v[s-1];
            s -= 2;
        }
    }
    int sgn = 1, i=0, j=s-1;
    while(i<=j)
    {
        if(v[i]>v[j]) ans += sgn * v[i++];
        else ans += sgn * v[j--];
        sgn *= -1;
    }
    cout << ans; //cout << (ans + sum)/2;
    return 0;
}


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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (long long)1e18 + 1;

template<typename T>
std::vector<T> pick_up_LIS(const vector<T>& origin, bool continuous) {
    std::vector<T> lis;
    if(continuous) {
        auto max_val = *max_element(origin.begin(), origin.end());
        auto min_val = *min_element(origin.begin(), origin.end());
        auto range   = max_val - min_val + 1;
        auto offset  = min_val - 1;
        std::vector<T> buf(range + 1, 0);
        for(T i = 0; i < (T)origin.size(); i++) {
            T p    = origin[i] - offset;
            buf[p] = buf[p - 1] + 1;
        }
        std::cout << std::endl;
        auto itr = max_element(buf.begin(), buf.end());
        auto r = distance(buf.begin(), itr);
        lis.reserve(*itr);
        for(T i = *itr - 1; i >= 0; i--) {
            lis.push_back(r + offset - i);
        }
    }
    else {
        std::vector<T> buf(origin.size() + 1, std::numeric_limits<T>::max());
        buf[0] = std::numeric_limits<T>::min();
        for(const auto& v : origin) {
            auto itr   = lower_bound(buf.begin(), buf.end(), v);
            auto index = distance(buf.begin(), itr);
            buf[index] = (v < buf[index]) ? v : buf[index];
        }
        auto itr = lower_bound(buf.begin(), buf.end(), std::numeric_limits<T>::max());
        std::move(buf.begin() + 1, itr, std::back_inserter(lis));
    }
    return lis;
}

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

    int N;
    std::cin >> N;

    vector<int> P(N);
    REP(i, N) {
        std::cin >> P[i];
    }

    auto lis = pick_up_LIS(P, true);
    std::cout << N - lis.size() << std::endl;

    return 0;
}


Measured memory_bytes: 2560
#include <stdio.h>

int main(){
	int n, m, npar=0, nimpar=0;
	scanf("%d%d", &n, &m);
	for(int i=1; i<n; ++i)
			npar+=i;

	for(int j=1; j<m ; ++j)
		nimpar+=j;

	printf("%d\n", npar+nimpar);
	return 0;
}

Measured memory_bytes: 128
import Control.Monad

main = do
	_ <- readLn :: IO Int
	times <- map read.words <$> getLine
	m <- readLn
	drinks <- replicateM m getLine
	mapM_ (putStrLn.show) $ map (calc times.map read.words) drinks

calc times [p,x] = sum times - (times !! (p-1)) + x

Measured memory_bytes: 1020
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(void)
{
	int d,l,x,y,z;
	cin>>d>>l;
	x=d/l;
	y=d%l;
	z=x+y;
	cout<<z<<endl;
	
	return 0;
}



Measured memory_bytes: 3116
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug cout<<"Hello\n";
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(),(x).end()
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	long double x;
    cin>>x;
	long double amt = 100;
	ll cnt = 0;
	while(amt<x)
	{
		amt = floor(amt * 1.01);
		++cnt;
	}	
	cout<<cnt;
	return 0;
}


Measured memory_bytes: 3724
def main():
    a, b, c = map(int,input().split())
    k = int(input())

    tmp = 0
    while b <= a:
        b *= 2
        tmp += 1
    while c <= b:
        c *= 2
        tmp += 1
    
    if tmp <= k:
        print('Yes')
    else:
        print('No')
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9168
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const ll INF = 1e9;
const ll LINF = ll(1e18) + 1;
const ll MOD = 1000000007;
const ll dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const ll Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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 (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll n;
vector<ll> a;
struct fenwick_tree {
    typedef ll T;
    T n;
    vector<T> bit;

    // 各要素の初期値は 0
    fenwick_tree(T num) : bit(num+1, 0) { n = num; }

    // a_i += w
    void add(T i, T w) {
        for (T x = i; x <= n; x += x & -x) {
            bit[x] += w;
        }
    }
    // [1, i] の和を計算.
    T sum(T i) {
        T ret = 0;
        for (T x = i; x > 0; x -= x & -x) {
            ret += bit[x];
        }
        return ret;
    }
    // [left+1, right] の和を計算.
    T sum(T left, T right) {
        return sum(right) - sum(left);
    }
};long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k;
    cin >> n>>k;
    map<ll,ll>m;
    fenwick_tree f_tree(2001);
    for (ll i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
        m[temp]++;
    }
    vector<ll> tentou(n);
    for (ll j = 0; j < n; j++) {
    tentou[j] = j - f_tree.sum(a[j]);
    f_tree.add(a[j], 1);
    }
    ll sumt=0;
    vector<ll> sum(2001);
    for(ll i=0;i<=2000;i++){
        sum[i]=sumt;
        sumt+=m[i];
    }
    ll ans=0;
    for(ll i=0;i<n;i++){
        ll temp=(2*tentou[i]+(k-1)*sum[a[i]]);
        temp%=MOD;
        temp*=k;
        temp%=MOD;
        temp*=modinv(2,MOD);
        temp%=MOD;
        ans+=temp;
        ans%=MOD;

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<set>
#include<map>
#include<bitset>
#define rep(i,a,b)  for(i=a;i<b;i++)
#define itrep(at)	for(auto it=at.begin();it!=at.end();it++)
#define lli long long int
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db double
#define M 1000000007
#define pi 3.1415926535897932384626433832795028841971

#define MAX 100005

using namespace std;
lli min(lli a,lli b){return a<b?a:b;}
lli min(lli a,lli b,lli c){a=min(a,b);a=min(a,c);return a;}
lli max(lli a,lli b){return a>b?a:b;}
lli max(lli a,lli b,lli c){a=max(a,b);a=max(a,c);return a;}
lli dsum(lli n){lli ans=0;while(n){ans+=(n%10);n/=10;}return ans;}

struct pll{
	lli x,y;
};
bool comp(pll a,pll b){
	if(a.x==b.x)	return a.y<b.y;
	else	return a.x<b.x;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	char ch;
	db aa,bb,cc;
	string s1,s2,s3,str;
    lli i,j,k,a,b,c,n,m,sum=0,ans=0,temp,t;
    cin >> str;
    if(str[2]==str[3] && str[4]==str[5])	cout << "Yes";
    else	cout << "No";
    
    
    return 0;
}

















/* UJJWAL KESHRI */

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

sum_a = sum(A)

d = dict()

for a in A:
    d[a] = d.get(a, 0) + 1

for _ in range(int(input())):
    b, c = map(int, input().split())
    if d.get(b, 0) != 0:

        temp = d[b]         
        d[b] -= temp
        d[c] = d.get(c, 0) + temp

        sum_a += (c - b) * temp
    print(sum_a)
        



Measured memory_bytes: 21108
import os
import sys

import numpy as np
from scipy.misc import comb

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N, A, B = list(map(int, sys.stdin.readline().split()))
V = list(map(int, sys.stdin.readline().split()))

V.sort(reverse=True)
V = np.array(V)
cs = V.cumsum()
averages = cs / (np.arange(N) + 1)

# 最大の平均
max_average = averages[A - 1:B].max()
# 選ぶべき数
count = averages[A - 1:B].argmax() + A

# しきい値になってるのが何個あるか
threshold = V[count - 1]
threshold_cnt = (V == threshold).sum()

print(float(max_average))
if np.all(V[:count] == V[0]):
    # しきい値 t 個のとき、tCa + tC(a+1) + ... + tCb
    ans = 0
    for r in range(A, B + 1):
        ans += comb(threshold_cnt, r, exact=True)
    print(ans)
else:
    gt_cnt = (V > threshold).sum()
    print(comb(threshold_cnt, count - gt_cnt, exact=True))


Measured memory_bytes: 14472
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

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

    ll a,b,c;
    cin >> a >> b >> c;

    vector<ll> x(n);
    for(int i = 0; i < n; i++){
        cin >> x[i];
    }

    ll ans = INF;

    for(int i = 1; i < (1 << n); i++){
        for(int j = 1; j < (1 << n); j++){
            for(int k = 1; k < (1 << n); k++){
                if(((i&j) == 0) && ((j&k) == 0) && ((k&i) == 0)){

                    ll Atmp = 0;
                    ll Btmp = 0;
                    ll Ctmp = 0;

                    ll mix = -3;

                    for(int l = 0; l < n; l++){
                        if(i&(1 << l)){
                            Atmp += x[l];
                            mix++;
                        }
                        if(j&(1 << l)){
                            Btmp += x[l];
                            mix++;
                        }
                        if(k&(1 << l)){
                            Ctmp += x[l];
                            mix++;
                        }
                    }

                    ans = min(ans,abs(Atmp - a) + abs(Btmp - b) + abs(Ctmp - c) + mix*10);
                }

            }
        }
    }

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

Measured memory_bytes: 256
# coding:utf-8

import sys

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, m = LI()
    AB = [LI_() for _ in range(m)]
    AB.reverse()

    # マージテク
    par = [i for i in range(n)]  # 連結しているグループのリーダ
    node = [set([i]) for i in range(n)]  # グループに所属しているノードの集合

    def merge(x, y):
        # 既に連結済みなら何もしない
        if par[x] == par[y]:
            return 0
        x, y = par[x], par[y]
        size_x, size_y = len(node[x]), len(node[y])

        # 小さいグループを大きいグループにマージする. O(log(n))
        if size_x < size_y:
            x, y = y, x

        # ノードの移動とリーダの更新
        while node[y]:
            v = node[y].pop()
            par[v] = x
            node[x].add(v)

        # (xの連結数)*(yの連結数)だけ不満度が解消される
        return size_x * size_y

    res = [n * (n - 1) // 2]
    for a, b in AB:
        sub = merge(a, b)
        res.append(res[-1] - sub)

    res.pop()
    res.reverse()

    print(*res, sep='\n')


main()


Measured memory_bytes: 85520
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef unsigned long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)

int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) {
    cin >> v[i];
  }
  int ans;
  ans=v[0];
  int cnt=1;
  for(int j=1;j < n;j++){
    if (ans > v[j]) cnt++;
    ans=min(ans,v[j]);
  }
  cout << cnt << endl;
  
  return 0;
}


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

int main() {
	string s;
	cin >> s;
	set<string> t = {"KIHBR", "KIHBRA", "KIHBAR", "KIHBARA", "KIHABR", "KIHABRA", "KIHABAR", "KIHABARA", "AKIHBR", "AKIHBRA", "AKIHBAR", "AKIHBARA", "AKIHABR", "AKIHABRA", "AKIHABAR", "AKIHABARA"};
	cout << (t.count(s) ? "YES" : "NO") << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;


class Main {
    static int n,time = 1;

    static int[][] graph;

    static int[] d,f,fin;

    static void dfs(int id){
        d[id] = time++;
        fin[id] = 1;
        for(int i = 0;i < graph[id].length;i++){
            if(fin[graph[id][i]] == 0){
                dfs(graph[id][i]);
            }
        }
        f[id] = time++;
    }

    public static void main(String args[]) {
        Scanner input = new Scanner(System.in);
        n = input.nextInt();

        graph = new int[n][];
        d = new int[n];
        f = new int[n];
        fin = new int[n];
        for(int i = 0;i < n;i++){
            fin[i] = 0;
        }

        for(int i = 0;i < n;i++){
            int u = input.nextInt();
            int k = input.nextInt();
            graph[u - 1] = new int[k];
            for(int j = 0;j < k;j++){
                graph[u - 1][j] = input.nextInt() - 1;
            }
            Arrays.sort(graph[u - 1]);
        }

        while(true){
            int iii;
            for( iii = 0;iii < n;iii++){
                if(fin[iii] == 0){
                    dfs(iii);
                    break;
                }
            }
            if(iii == n)
                break;
        }
        for(int i = 0;i < n;i++){
            System.out.println((i + 1) + " " + d[i] + " " + f[i]);
        }
    }
}

Measured memory_bytes: 28324
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define x real()
#define y imag()
typedef complex<double> point;


string Farhad(point a, point b, point c)
{
   point k=conj(b-a)*(c-a);
   if(k.y>0) return "COUNTER_CLOCKWISE";
   if(k.y<0) return "CLOCKWISE";
   if(k.x<0)return "ONLINE_BACK";
   if(abs(b-a)<abs(c-a) )return "ONLINE_FRONT";
   return "ON_SEGMENT";
}

int main()
{
    ll m,n;
    double  ax, ay, bx,by, cx,cy;
    cin>>ax>>ay>>bx>>by>>n;
    while(n--)
    {
        cin>>cx>>cy;
        cout<<Farhad(point(ax, ay), point(bx,by), point(cx, cy) )<<endl;
    }

}




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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

LL x;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> x;
	double a = (x + 5) / 11.0;
	cout << (a + (a - 1) == LL(a + (a - 1))? LL(a + (a - 1)) : LL(a + (a - 1) + 1))  << endl;
	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int a,b,c;
  scanf("%d\n",&a);
  scanf("%d\n",&b);
  scanf("%d\n",&c);

  if(0 <= a && a <=100 && 0 <= b && b <=100 && 0 <= c && c <=100)
  {
    if(a<b&&b<c)
      printf("Yes\n");
    else
      printf("No\n");  
  }

}

Measured memory_bytes: 1808
#include <iostream>
using namespace std;
 
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}

int main() {
	string N;
	cin >> N;

	int f=0,g = stoi(N);

	for(int i=0; i< N.size(); i++){
		f += ctoi(N.at(i));
	}

	if(g % f == 0 )
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

}

Measured memory_bytes: 256
def solve():
    A = [list(map(int, input().split())) for _ in range(3)]
    N = int(input())
    
    for _ in range(N):
        b = int(input())
        for i in range(3):
            for j in range(3):
                if A[i][j] == b:
                    A[i][j] = -1
    
    for i in range(3):
        if A[i][0] == -1 and A[i][1] == -1 and A[i][2] == -1:
            return "Yes"
    for j in range(3):
        if A[0][j] == -1 and A[1][j] == -1 and A[2][j] == -1:
            return "Yes"
    if A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1:
        return "Yes"
    if A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1:
        return "Yes"
    return "No"

print(solve())

Measured memory_bytes: 3064
from collections import Counter

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

acnt = Counter(a)
num = [0,0]
for i in acnt:
    if acnt[i] >= 4:
        num.append(i)
    if acnt[i] >= 2:
        num.append(i)
num.sort()
print(num[-1] * num[-2])


Measured memory_bytes: 22016
#include<bits/stdc++.h>
#define int long long int
#define nitro ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD 1000000007
#define DEBUG false
#pragma GCC optimize "trapv"

using namespace std;

int32_t main()
{
    nitro;
    int n,k;
    cin>>n>>k;
    std::vector<int> v(n);
    for(int& x:v)
    cin>>x;
    vector<bool> dp(k+1);
    for(int stones=0;stones<=k;++stones)
    {
        for(int x:v)
        {
            if(stones>=x && !dp[stones-x])
            dp[stones]=true;
        }
    }
    puts(dp[k]?"First":"Second");
return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem (B) in C++
// MAIN IDEA   : brute force on length + divisors
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 2e6 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
string s;
int main() {
#ifdef ONLINE_JUDGE
    FAST
#endif
	cin >> s;
	lp(i,1,s.size()-1)
		if (s[i] == s[i - 1])
			return cout << i << " " << i + 1 << "\n", 0;
	lp(i,2,s.size()-1)
		if (s[i] == s[i - 2])
			return cout << i - 1 << " " << i + 1 << "\n", 0;
	cout << -1 << " " << -1 << "\n";
	return 0;
}

Measured memory_bytes: 512
n = int(input())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i] = int(input())
    b[i] = a[i]
max_a = max(a)
max_idx = a.index(max_a)
b[max_idx] = 0
max_b = max(b)
for i in range(n):
    if i != max_idx:
        print(max_a)
    else:
        print(max_b)

Measured memory_bytes: 58328
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    int n=(int)s.size();
    int m=(int)t.size();
    s+=s;
    vector<vector<int>> list(26);
    rep(i,0,2*n)  list[s[i]-'a'].push_back(i);
    
    ll ans=0;
    int pos=0;
    rep(i,0,m){
        int c=t[i]-'a';
        if(list[c].size()==0){
            cout<<-1<<endl;
            return 0;
        }
        pos=*lower_bound(all(list[c]),pos)+1;
        if(pos>=n){
            pos-=n;
            ans+=n;
        }
    }
    ans+=pos;
    cout<<ans<<endl;
}


Measured memory_bytes: 1788
#include<iostream>

using namespace std;

int main() {
    long n;
    cin >> n;
    long a[5];
    for(int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    long min;
    for(int i = 0; i < 5; i++) {
        if(i == 0) {
            min = a[i];
        }
        else {
            if (min > a[i]) {
                min = a[i];
            }
        }
    }
    long s = 0;

    s = n / min;
    s += 5;
    if(n > min) {
        if(n % min == 0) {
            s--;
        }
    }
    cout << s << endl;
    return 0;
}


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


int main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	for (int i = a;i <= b;++i) {
		int resa = i / 10000;
		int resb = (i % 10000) / 1000;
		int resc = (i % 1000) / 100;
		int resd = (i % 100) / 10;
		int rese = i % 10;
		if (resa == rese && resb == resd) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+5;

ll ksm(ll x,ll y)
{
    ll ans=1;
    for(;y;x=(x*x)%mod,y>>=1) if(y&1) ans=(ans*x)%mod;
    return ans;
}

ll getcs(ll n,ll m)
{
    if(n<m) return 0;
    if(m>n-m) m=n-m;
    ll s1=1,s2=1;
    for(int i=0;i<m;i++)
    {
        s1=s1*(n-i)%mod;
        s2=s2*(i+1)%mod;
    }
    return s1*ksm(s2,mod-2)%mod;
}
ll lucas(ll n,ll m)
{
    if(m==0) return 1;
    return getcs(n%mod,m%mod)*lucas(n/mod,m/mod)%mod;
}
int main()
{
    ios::sync_with_stdio(false);
    ll n,a,b;cin>>n>>a>>b;
    ll reu=ksm(2,n)-getcs(n,a)-getcs(n,b)-1;
    while(reu<0)
        reu+=mod;

    cout<<reu<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc087.contest.atcoder.jp/tasks/arc087_a>
問題文============================================================
 長さ N の正整数の列 a=(a1,a2,…,aN) が与えられます。
 あなたの目標は、a のうちいくつかの要素を取り除き、a を 良い数列 にすることです。
 
 ここで、数列 b が 良い数列 であるとは、次の条件が成り立つことです。
 
 b の各要素 x について、b に値 x はちょうど x 個含まれる。
 例えば、(3,3,3), (4,2,4,1,4,2,4), () (空の数列) は良い数列です。
 一方、(3,3,3,3), (2,4,1,4,2) は良い数列ではありません。
 
 a を良い数列にするために取り除くべき要素の個数の最小値を求めてください。
=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    map<ll,ll> mp;
    for(int i = 0; i < N;i++){
        ll A; cin >> A;
        mp[A]++;
    }
    ll ans = 0;
    for(auto p:mp){
        if(p.first < p.second) ans += p.second - p.first;
        else if(p.first > p.second) ans += p.second;
    }
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6272
import sys
sys.setrecursionlimit(10000)

n, k = map(int,input().split())
nck = {}

def c(n, r):
    
    if n<r: return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

for j in range(1,k+1):
    r = (c(n-k+1,j)*c(k-1,j-1))%(10**9+7)
    print(r)

Measured memory_bytes: 3444
fun main(args: Array<String>) {
    val N = readLine()!!.split(' ').map(String::toInt).first()
    val rs = (1..N).mapIndexed { index, i ->
        val (s, pts) = readLine()!!.split(' ')
        Triple(i, s, pts.toInt())
    }
    rs.sortedByDescending { it.third }.sortedBy { it.second }.forEach {println(it.first)}
}


Measured memory_bytes: 36316
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;

string s;
int n;


int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> s;
    n = (int)s.size();
    s = "#" + s;
    for (int i = 0; i < 26; ++i) {
        int last = 0;
        int l = 1;
        for (int j = 1; j <= n; ++j) {
            if (s[j] - 'a' == i) ++last;
            else --last;
            if (last > 0 && l < j) {
                cout << l << " " << j << '\n';
                return 0;
            }
            if (last < 0) {
                l = j + 1;
                last = 0;
            }
        }
    }
    cout << "-1 -1\n";
    return 0;
}



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

int main() {
  int N, res = 100;
  cin >> N;
  rep(i, N) {
  	int a;
    cin >> a;
    int cnt=0;
    while(a%2 == 0) {
      a/=2;
      cnt++;
    }
    if(res > cnt) res = cnt;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x,odd = 0;
  cin >> n;
  for(int i=0;i<n;i++) {
    cin >> x;
    odd += x%2;
  }
  cout << (odd%2 == 0?"YES":"NO") << endl;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

string res = "";
void dfs(ll num){
    if(num <= 25){
        int num1 = num;
        char c = 'a'+num1;
        res = c + res;
        out(res);
        return;
    }
    int num2 = num % 26;
    char c1 = ('a'+ num2);
    res = c1 + res;
    dfs(num/26 -1);
}
signed main()
{   
    gearup;
    ll MAX = 1000000000000001;
    ll n; cin >> n;
    n--;
    dfs(n);
}

Measured memory_bytes: 3632
import numpy as np
from collections import Counter

length=int(input())
list=list(map(int,input().split()))
list.sort()

max=list[-1]
dp=[0]*(max+1)
dp=np.array(dp,int)

for num in list:
    dp[num]=1

for num in list:
    if dp[num]==1:
        dp[2*num::num]=0

count=Counter(list)

for num,cnt in count.items():
    if cnt>1:
        dp[num]=0

print(dp.sum())


Measured memory_bytes: 63328
import java.util.*;
public class Main{
    
    static final int MOD = (int)1e9 + 7;
    static int[] memo = new int[2020];
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int s = Integer.parseInt(sc.next());
        Arrays.fill(memo, -1);
        
        int ans = calc(s);
        System.out.println(ans);
    }
    
    public static int calc(int n){
        if(n<3){
            return 0;
        }else if(n==3){
            return 1;
        }else if(memo[n] != -1){
            return memo[n];
        }
        
        int res = 1;
        for(int i=3; i<=n; i++){
            res += calc(n-i);
            res %= MOD;
        }
        
        memo[n] = res;
        return res%MOD;
    }
}

Measured memory_bytes: 35524
#include<stdio.h>
#include<string.h>
int main()
{
	char c[5];
	int i=0;
    scanf("%s",c);
	if(c[i]==c[i+1]&&c[i+2]==c[i+3]&&c[i]!=c[i+2])
	printf("Yes\n");
	else if(c[i]==c[i+2]&&c[i+1]==c[i+3]&&c[i]!=c[i+1])
	printf("Yes\n");
	else if(c[i]==c[i+3]&&c[i+1]==c[i+2]&&c[i]!=c[i+1])
	printf("Yes\n"); 
	else printf("No\n");

	return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    double total = 0;
    rep(i, n) total += 1.0 / a[i];
    double ans = 0;
    ans = 1.0 / total;

    printf("%.10f\n",ans);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define ll long long 
inline ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            f=-1;
        }
        c=getchar();
    }
    while(c<='9'&&c>='0')
    {
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
int n;
struct node
{
    ll num,id;
    ll tot;
}s[100503];
inline bool cmp(node a,node b)
{
    return a.num<b.num;
}
ll ji,ou;
int main()
{
    n=read();
    for(rg int i=1;i<=n;++i)
        s[i].num=read(),s[i].id=i;
    stable_sort(s+1,s+1+n,cmp);
    for(rg int i=1;i<=n;++i)
        if(s[i].id%2==0)
            if(i%2==0)
                continue;
            else
                ou++;
        else 
            if(i%2!=0)
                continue;
            else
                ji++;
    ll h=min(ou,ji);
    cout<<h+abs(ou-ji);
}

Measured memory_bytes: 4864
#include <iostream>
#include <string>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    cout << (double)((double)n - n/2)/(double)n << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#include<functional>
#include<iostream>
#include<cfloat>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<time.h>
#include<vector>
using namespace std;
int main()
{
	int x,y,z,a,l;
	cin >> x >> y >> z;
	l=x-y;
	a=l%z;
	cout << a << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<stdio.h>

int main(){
  int a[100],flag,j,n,cnt=0,temp;

  scanf("%d",&n);

  for(j=0;j<n;j++){
    scanf("%d",&a[j]);
  }

  flag=1;

  while(flag){
    flag=0;
    for(j=n-1;j>0;j--){
      if(a[j]<a[j-1]){
	temp=a[j];
	a[j]=a[j-1];
	a[j-1]=temp;
	flag=1;
	cnt++;
      }
    }
  }
      
  for(j=0;j<n;j++){
    printf("%d",a[j]);
    if(j!=n-1)printf(" ");
  }

  printf("\n%d\n",cnt);

  return 0;
}
  
  



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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while (true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break; 
        }    
    }
}




Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>

using namespace std;

#define ll long long 
const int N = 1e6+7;

//ll n,k,a[N]; 

/*bool check(ll mid){
	ll tot = 0;
	int t;
	for(int i = 1; i <= n; i++){
		int j = mid / a[i];
		if(a[i]){
			if(a[i] < 0) t = upper_bound(a+i+1,a+n+1,j)-a;
			else t = lower_bound(a+i+1,a+i+n)-a	
			tot += t;
	}
		else if(mid > 0) tot += 
	}
}*/
string s;
ll dp[N][2];

int main(){
/*	in(n);in(k);
	for(int i = 1; i <= n; i++) in(a[i]);
	sort(a+1,a+1+n);
	ll l = -1e18,r=1e18;
	while(l < r){
		ll mid = (l+r+1)>>1;
		if(check(mid)) l = mid;
		else r = mid - 1;
	}*/
	cin >> s;
	int len = s.size();
	dp[len-1][0] = s[len-1]-'0';dp[len-1][1] = 11-s[len-1]+'0';
	for(int i = len-2; i >= 0; i--){
		dp[i][0] = min(dp[i+1][0]+s[i]-'0',dp[i+1][1]+s[i]-'0');
		dp[i][1] = min(dp[i+1][0]+11-s[i]+'0',dp[i+1][1]+11-s[i]+'0'-2);
	}
	cout << min(dp[0][0],dp[0][1]);	
}

Measured memory_bytes: 17028