akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var w string
	fmt.Scan(&w)
	dict := make(map[rune]int)
	for _, c := range w {
		dict[c]++
	}
	for _, count := range dict {
		if count%2 == 1 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}
const int N = 100;

int n, l;
string a[N + 1];

inline bool compare(string a, string b)
{
	return a < b;
}
int main()
{
	n = read();
	l = read();
	for (int i = 1; i <= n; i++)
		cin >> a[i];

	sort(a + 1, a + n + 1, compare);

	for (int i = 1; i <= n; i++)
		cout << a[i];
	printf("\n");
	return 0;
}


Measured memory_bytes: 3576
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()
	M := sc.i()
	if N == M {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

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

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

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

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

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

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

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

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


Measured memory_bytes: 640
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, r: f64);
    println!("{}", 2. * r * std::f64::consts::PI);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


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

int main() {
    int n;
    cin >> n;
    int c2 = 0, c1 = 0, c0 = 0;
    for (int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        if (temp % 4 == 0){
            c2++;
        }
        else if (temp % 2 == 0){
            c1++;
        }
        else{
            c0++;
        }
    }
    if (c2 >= c0){
        cout << "Yes" << endl;
    } 
    else if ((c2 == (c0 - 1)) && c1 == 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

long long maxprofit(vector<int> w,vector<int> v,int n,int c)
{
	vector<vector<long long> > dp(n+1,vector<long long>(c+1));
	for (int i = 0; i <=n; i++){
		for (int j = 0; j <=c; j++){
 
			if(i==0 || j==0) dp[i][j] = 0;
			else if(w[i-1]>j) dp[i][j] = dp[i-1][j];
			else dp[i][j] = max(v[i-1]+dp[i-1][j-w[i-1]],dp[i-1][j]);	 
		}
	}
	return dp[n][c];
}
int main()
{
	int n,c;
	cin>>n>>c;
	vector<int> w(n),v(n);
	for(int i=0;i<n;i++){ cin>>w[i]>>v[i];}
	cout<<maxprofit(w,v,n,c)<<endl;

 
}



Measured memory_bytes: 80256
MOD = 10 ** 9 + 7
n = gets.to_s.to_i
a = gets.to_s.split.map { |v| v.to_i }
cnt = Array.new(60, 0)

a.each do |v|
  60.times do |i|
    cnt[i] += 1 if v >> i & 1 == 1
  end
end

ans = 0
cnt.each_with_index do |v, i|
  ans += 2 ** i * v * (n - v)
  ans %= MOD
end
puts ans


Measured memory_bytes: 37312
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV



readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)

readTuple4 :: IO (Int, Int, Int, Int)
readTuple4 = do
    [a, b, c, d] <- readInts
    return (a, b, c, d)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las


solve :: Int -> Int -> [(Int, [Int])] -> Int
solve m x cx = case calcPrize <$> filter isOk allp of 
        [] -> -1
        px -> minimum $ px
    where
    allp = replicateM (length cx) [True, False]
    isOk p = let
        books = fmap snd $ filter fst $ zip p $ snd <$> cx
        algos = foldl1 (zipWith (+)) books
        in 
        case books of 
            [] -> False
            ax -> all (>=x) algos
    calcPrize p = let
        prices = fmap snd $ filter fst $ zip p $ fst <$> cx
        in
        sum prices



main = do
    (n, m, x) <- readTuple3
    cx <- replicateM n $ do
        (price:argos) <- readInts
        pure (price, argos)
    print $ solve m x cx


Measured memory_bytes: 5036
def shuffle(cards):
    index,cut_num = map(int,input().split()) 
    pop = cards[index-1 :index + cut_num-1 ]
    del cards[index-1:index + cut_num-1]
    return pop + cards 

while True:
  num_card,challange = map(int,input().split()) 
  if num_card == 0 and challange == 0:
      break

  cards = list(reversed(range(1,num_card+1)))
  for i in range(challange):
      cards = shuffle(cards)
  print(cards[0])




Measured memory_bytes: 5616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <functional>
#include <cmath>
#define REP(i,n) for(lint i{}, i##_len=(n); i<i##_len; ++i)
#define DOUBLE_LOOP(i, h, j, w) for(lint i{}; i < (lint)(h); ++i)for(lint j{}; j < (lint)(w); ++j)
#define DOUBLE_LOOP2(i, j, n) for(lint i{}; i < (lint)(n - 1); ++i)for(lint j{i + 1}; j < (lint)(n); ++j)
#define SZ(x) ((lint)(x).size())
using lint = long long; lint N, M, H, W;
using namespace std;
const long long INF{ 1LL << 60 };
const long double PI{ 3.1415926535897932 };
const long long NUM97{ 1000000007 };
template<class T> inline bool chmax(T& x, T y) { if (x < y) { x = y; return 1; } return 0; }
template<class T> inline bool chmin(T& x, T y) { if (x > y) { x = y; return 1; } return 0; }
std::vector<std::string> field;
std::vector<std::vector<bool>> seen(H, std::vector<bool>(W));
const std::vector<int> dx { 1, 0, -1, 0 };
const std::vector<int> dy { 0, 1, 0, -1 };
lint DP_1_Memoization(lint i, std::vector<lint> dp, std::vector<lint> h) {
	if (dp[i] < INF) { return dp[i]; } if (i == 0) { return 0; }
	lint ans{ INF }; chmin(ans, DP_1_Memoization(i - 1, dp, h) + std::abs(h[i] - h[i - 1]));
	if (i > 1) { chmin(ans, DP_1_Memoization(i - 2, dp, h) + std::abs(h[i] - h[i - 2])); }
	return dp[i] = ans;} // memoization
void DP_1(){lint n;  std::cin >> n;
	std::vector<lint> dp; dp.resize(N);  for (auto& r : dp) r = INF;
	std::vector<lint> h; h.resize(n); for (auto& r : h) std::cin >> r;
	dp[0] = 0; for (int i = 1; i < N; ++i) {
		chmin(dp[i], dp[i - 1] + std::abs(h[i] - h[i - 1]));
		if (i > 1) { chmin(dp[i], dp[i - 2] + std::abs(h[i] - h[i - 2])); }}
	std::cout << dp[N - 1] << DP_1_Memoization(N - 1, dp, h) << std::endl;}
void DP_stairs() { lint N, M; std::cin >> N >> M;
	std::vector<bool> issafe(N + 1, true); std::vector<lint> dp(N + 1, 0);
	for (int i = 0; i < M; ++i) { int a; cin >> a; issafe[a] = false; }
	dp[0] = 1; if (issafe[1] == true) dp[1] = 1;
	for (int i = 2; i <= N; ++i) { if (issafe[i - 1]) dp[i] += dp[i - 1]; 
	if (issafe[i - 2]) dp[i] += dp[i - 2]; dp[i] %= NUM97;}
	std::cout << dp[N] << std::endl;}

int main() {
	lint n, K;  std::cin >> n >> K;
	std::vector<lint> dp; dp.resize(100000);  for (auto& r : dp) r = INF;
	std::vector<lint> h; h.resize(1000000); for (auto& r : h) std::cin >> r;
	dp[0] = 0; 
	for (int i = 0; i < n; ++i) {
		for (int j = 1; j <= K; ++j) {
			chmin(dp[i + j], dp[i] + std::abs(h[i] - h[i + j]));
		}
	}
	std::cout << dp[n - 1]  << std::endl;
}

Measured memory_bytes: 11976
#include <iostream>
#include <vector>

int main()
{
    int N, M, C;
    std::cin >> N >> M >> C;
    std::vector<std::vector<int>> A;
    A.resize(N);
    std::vector<int> B;
    B.resize(M);
    for (auto& it : B) {std::cin >> it;}
    for (auto& itN : A) 
    {
        itN.resize(M);
        for (auto& itM : itN) {std::cin >> itM;}
    }

    int count = 0;
    int temp;
    for (auto Ait : A)
    {
        temp = 0;
        for (int i=0; i<M; ++i)
        {
            temp += Ait[i] * B[i];
            // std::cout << Ait[i] << "*" << B[i] << std::endl;
        }
        temp += C;
        // std::cout << temp << std::endl;
        if (0 < temp) {++count;}
    }

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}


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

  if(n == 1) {
    cout << 0 << endl;
    return 0;
  }

  const auto &res = prime_factorize(n);

  const auto r_size = res.size();

  // for(auto p : res) {
  //   for(int i = 0; i < p.second; i++) cout << p.first << ' ';
  // }

  ll ans = 0;

  rep(i,r_size) {
    ll tmp = res.at(i).second;
    ll count = 1;
    
    while(tmp >= count) {
      tmp -= count;
      count++;
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define inf 20021225
#define ll long long
#define mxn 100010
using namespace std;

int a[mxn],n,l;

int main()
{
	int pos=0;
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]+a[i-1]>=l) 	pos=i;
	}
	if(!pos)	printf("Impossible\n");
	else
	{
		printf("Possible\n");
		for(int i=n-1;i>=pos;i--)	printf("%d\n",i);
		for(int i=1;i<pos;i++)	printf("%d\n",i);
	}
	return 0;
}

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

const int MAX_N = 2*100000;
ll fact[MAX_N];
ll factinv[MAX_N];
long long mod_pow(long long x, long long n, long long mod){
	long long res = 1;
	while(n > 0){
		if(n & 1) res = res * x % mod;
		x = x*x % mod;
		n >>= 1;
	}
	return res;
}

//階乗のリストを作る
void make_fact_tbl(long long n, long long mod){
	fact[0] = 1;
	for(long long i=1; i<=n; i++){
		fact[i] = fact[i-1] * i;
		fact[i] %= mod;
	}
}

//階乗の逆元のリストを作る
void make_factinv_tbl(long long n, long long mod){
	factinv[0] = 1; //0の逆元は存在しない
	for(long long i=1; i<=n; i++){
		factinv[i] = mod_pow(fact[i], mod-2, mod);
	}
}

//組み合わせの計算に必要な情報の作成
void comb_init(long long n, long long mod){
	make_fact_tbl(n, mod);
	make_factinv_tbl(n, mod);
}

//組み合わせの計算
long long comb(long long n, long long k, long long mod){
	if(n < k) return 0;
	if(k == 0 || n-k == 0) return 1;
	//printf("n:%lld k:%lld n-k:%lld\n", fact[n], factinv[k], factinv[n-k]);
	return ((fact[n] * factinv[k]) % mod) * factinv[n-k] % mod;
}

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	comb_init(MAX_N-1, MOD);
	
	int w, h, a, b;
	cin >> h >> w >> a >> b;

	ll ans = 0;
	for(int i=b+1; i<=w; i++){
		//cout << i << endl;
		int ww = i-1;
		int hh = h-a-1;
		ll tmp1 = fact[ww+hh] * factinv[ww] % MOD;
		tmp1 = tmp1 * factinv[hh] % MOD;
		//cout << tmp1 << endl;

		ww = w-i;
		hh = a-1;
		ll tmp2 = fact[ww+hh] * factinv[ww] % MOD;
		tmp2 = tmp2 * factinv[hh] % MOD;
		//cout << tmp2 << endl;
		
		ans += tmp1 * tmp2;
		ans %= MOD;
	}

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


Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2; 
    cout << endl;
    return 0;
}

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

mod = 1e9+7
S = int(input())

a = [None]*S

if S == 1 or S == 2:
    print(0)
    exit()
if S == 3:
    print(1)
    exit()

a[0] = 0
a[1] = 0
a[2] = 1

for i in range(3,S):
    a[i] = a[i-1] + a[i-3]
    a[i] %= mod

print(int(a[S-1]))


Measured memory_bytes: 63768
n, d = map(int, input().split())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))
count = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        distance = 0
        for k in range(d):
            distance += (x[i][k] - x[j][k]) ** 2
        if distance ** 0.5 == int(distance ** 0.5):
            count += 1
print(count)

Measured memory_bytes: 3188
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
  string s;
  cin >> s;
  int n = s.length(), ans=0;
  for(int i = 0; i < n/2; i++)
  {
    if(s[i] != s[n-i-1]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
from collections import Counter, defaultdict
def main():
    n = int(input())
    S = list(input())
    c = Counter(S)
    d = dict(c)
    for _ in range(n - 1):
        S = list(input())
        c = Counter(S)
        for key in d.keys():
            d[key] = min(d[key], c[key])
    ans = []
    for key, value in d.items():
        ans.append(key * value)
    print(''.join(sorted(ans)))

if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

ll N, ans;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> N;
	ans = N - 1;
	for(ll i = 1; i <= sqrt(N); i++) {

		if (floor((double)N / i) == ceil((double)N / i)) {
			ans = min(ans, (i - 1) + ((N / i) - 1));
		}
	}
	
	cout << ans;
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

ll my_min(ll a, ll b) {
    if(a < b) return a;
    else return b;
}

int main() {
    string s; cin >> s;
    ll k; cin >> k;
    vector<string> ans;
    set<string> se;
    rep(i, s.size()) {
        frep(j, 1, my_min(k, s.size()-i)) {
            string tmp = s.substr(i, j);
            if(!se.count(tmp)) {
                se.insert(tmp);
                ans.push_back(tmp);
            }
        }
    }
    sort(ALL(ans));
    cout << ans[k-1] << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

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

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
using namespace std;

typedef long long ll;
ll MOD = 1e9+7;

int number[10]={-1,2,5,5,4,5,6,3,7,6};
string dp[10100];//i本のマッチ棒で作ることのできる最大の数の組

int main()
{
	int n,m;
	char a[9];
	int ans=0;
	cin>>n>>m;
	for(int i=0;i<m;i++)
		cin>>a[i];
	sort(a,a+m);
	fill(dp,dp+10100,"0");
	//初期値は1ケタの整数
	for(int i=0;i<m;i++)
		dp[number[a[i]-'0']]=a[i];
	//ここからdp
	for(int i=1;i<10001;i++)
	{
		if(dp[i]!="0")
		{
			for(int j=0;j<m;j++)
			{
				int targetindex=i+number[a[j]-'0'];
				string temp=dp[i]+a[j];
				sort(temp.begin(),temp.end(), greater<>());
				if(temp.size()>dp[targetindex].size())
					dp[targetindex]=temp;
				else if(temp.size()==dp[targetindex].size() && temp>dp[targetindex])
					dp[targetindex]=temp;
			}
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}


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

int main()
{
    int N;
    cin >> N;
    int A, x, y;
    vector<vector<vector<int>>> xy(N, vector<vector<int>>(N, vector<int>(2, -1)));
    rep(i, 0, N)
    {
        cin >> A;
        rep(j, 0, A)
        {
            cin >> xy.at(i).at(j).at(0) >> xy.at(i).at(j).at(1);
        }
    }

    bool f = true;
    int ans = 0;
    for (int tmp = 0; tmp < (1 << N); tmp++)
    {
        bitset<15> bit(tmp);
        f = true;
        rep(i, 0, N)
        {
            if (bit.test(i) == 1)
            {
                rep(j, 0, N)
                {
                    if (xy.at(i).at(j).at(1) != -1)
                    {
                        if (bit.test(xy.at(i).at(j).at(0) - 1) != xy.at(i).at(j).at(1))
                        {
                            f = false;
                            break;
                        }
                    }
                }
            }
        }
        if (f && (bit.count() > ans))
        {
            ans = bit.count();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

#define ft first
#define sd second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long int ll;

const int MAXN = 100010;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

int N, M, Q;
vector<int> g[MAXN];
int v[MAXN], d[MAXN], c[MAXN];
int col[MAXN] = { 0 };
int dp[11][MAXN][11] = { 0 };

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
#endif

    scanf("%d %d", &N, &M);
    int a, b;
    for (int i = 0; i < M; ++i) {
        scanf("%d %d", &a, &b);
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    scanf("%d", &Q);
    for (int i = 0; i < Q; ++i) {
        scanf("%d %d %d", &v[i], &d[i], &c[i]);
        --v[i];
        dp[0][v[i]][d[i]] = i + 1;
        col[v[i]] = i + 1;
    }

    for (int i = 0; i < 10; ++i) {
        for (int u = 0; u < N; ++u) {
            for (int v : g[u]) {
                for (int l = 0; l < 10; ++l) {
                    dp[i + 1][u][l] = max(dp[i + 1][u][l], dp[i][v][l + 1]);
                    col[u] = max(col[u], dp[i + 1][u][l]);
                }
            }
        }
    }

    for (int i = 0; i < N; ++i) {
        printf("%d\n", col[i] ? c[col[i] - 1] : 0);
    }

    return 0;
}

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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

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

    int H, N;
    cin >> H >> N;

    ll sum = 0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        sum += a;
    }

    if (H <= sum) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let c = scn.chars();
        let mut red = 0;
        let mut white = 0;
        c.iter().for_each(|x| {
            if *x == 'R' {
                red += 1;
            } else {
                white += 1;
            }
        });
        let mut result = 0;
        c.iter().enumerate().for_each(|(idx, x)| {
            if *x == 'W' {
                if idx < red {
                    result += 1;
                }
            }
        });
        println!("{}", result);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

signed main(){
	int h,w;
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			string s;
			cin >> s;
			if(s == "snuke"){
				cout << (char)(j + 'A') << (i + 1) << endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 764
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += B[A[i] - 1]
    if i > 0 and A[i] == A[i - 1] + 1:
        ans += C[A[i - 1] - 1]

print(ans)


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

s = 1
break_count = 0
ans = 0
for a in A:
    if a == s:
        s += 1
        ans += break_count
        break_count = 0
    else:
        break_count += 1

ans += break_count

if s == 1:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int main()
{
    //cout << fixed << setprecision(10)
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    cin >> N;
    vector<pll> a(N), b(N);
    rep(i, N)
    {
        cin >> a[i].first >> a[i].second;
        b[i].first = a[i].second;
        b[i].second = a[i].first;
    }

    sort(ALL(a));
    sort(ALL(b));

    if (N % 2) {
        ll M = N / 2;

        cout << b[M].first - a[M].first + 1 << endl;

    } else {
        ll Ml = N / 2 - 1;
        ll Mr = N / 2;

        ll A = a[Mr].first + a[Ml].first;
        ll B = b[Mr].first + b[Ml].first;

        cout << -A + B + 1 << endl;
    }
}


Measured memory_bytes: 9536
package main

import (
	"fmt"
)

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	arr := make([]string, H)
	for i := 0; i < H; i++ {
		fmt.Scan(&arr[i])
	}

	dx := []int{-1, 0, 1, -1, 1, -1, 0, 1}
	dy := []int{-1, -1, -1, 0, 0, 1, 1, 1}
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if arr[i][j] == '#' {
				fmt.Print("#")
				continue
			}
			var count int
			for d := 0; d < 8; d++ {
				ni := i + dy[d]
				nj := j + dx[d]
				if 0 <= ni && ni < H && 0 <= nj && nj < W {
					if arr[ni][nj] == '#' {
						count++
					}
				}
			}
			fmt.Print(count)
		}
		fmt.Println()
	}
}


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

using namespace std;

int main(int argc, char **argv)
{
	int a[5];
	
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	
	sort(a, a+5);
	
	cout << a[4];
	for(int i = 3; i >= 0; i--){
		cout << " " << a[i];
	}
	cout << endl;
	
	return 0;
}

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  
  if (a.back() == b[0] && b.back() == c[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def f(i, j):
    global H, W, S
    t = [[-1] * W for _ in range(H)]
    t[i][j] = 0
    q = [(i, j)]
    while q:
        y, x = q.pop(0)
        if y - 1 >= 0 and S[y - 1][x] != '#' and t[y - 1][x] == -1:
            t[y - 1][x] = t[y][x] + 1
            q.append((y - 1, x))
        if y + 1 < H and S[y + 1][x] != '#' and t[y + 1][x] == -1:
            t[y + 1][x] = t[y][x] + 1
            q.append((y + 1, x))
        if x - 1 >= 0 and S[y][x - 1] != '#' and t[y][x - 1] == -1:
            t[y][x - 1] = t[y][x] + 1
            q.append((y, x - 1))
        if x + 1 < W and S[y][x + 1] != '#' and t[y][x + 1] == -1:
            t[y][x + 1] = t[y][x] + 1
            q.append((y, x + 1))
    return max(max(tt) for tt in t)


def main():
    global H, W, S
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]

    result = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] != '#':
                result = max(result, f(i, j))
    print(result)


if __name__ == "__main__":

    main()


Measured memory_bytes: 3188
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
int read()
{
	int ret=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret;
}
ll n,p,temp,cnt1,cnt2,ans;
ll quick_mod(ll x,ll n)
{
	ll res=1;
	while(n)
	{
		if(n&1)
		{
			res=res*x;
		}
		x*=x;
		n>>=1;
	}
	return res;
}
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	cnt1=cnt2=0;
	scanf("%lld%lld",&n,&p);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&temp);
		if(temp&1)
		{
			cnt1++;
		}
		else
		{
			cnt2++;
		}
	}
	if(p==1)
	{
		if(cnt1==0)
		{
			ans=0;
		}
		else
			ans=quick_mod(2,cnt1-1)*quick_mod(2,cnt2);
	}
	else
	{
		if(cnt1==0)
		{
			ans=quick_mod(2,cnt2);
		}
		else
			ans=quick_mod(2,cnt1-1)*quick_mod(2,cnt2);
	}
	printf("%lld\n",ans);
	return 0;
}



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


int main(void){
    //////////////////////////


    string S;
    cin >> S;
    int N = S.size();
    long long int ans = 0;
    
    for (int i = 0; i < pow(2, N-1); i++){
        long long int now_sum = 0;
        long long int reg = S[0] - '0';
        for (int k = 0; k < N-1; k++){
            if (i & (1 << k)){
                now_sum += reg;
                reg = 0;
            }
            reg *= 10;
            reg += S[k+1] - '0';
        }
        now_sum += reg;
        ans += now_sum;
    }
    
    cout << ans << endl;


    //////////////////////////
    return 0;
}

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

#define rep(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define repn(i, m, n) for (int (i) = (m) ; (i) < (int)(n) ; ++(i))
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define repn_rev(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= (m) ; --(i))

#define INF 2e9
#define ll long long
#define MOD 1e9+7

int main(){
    int n;
    cin>>n;
    int n2 = 1 << n;
    vector<int> a(n2);
    rep(i, n2) cin >> a[i];
    sort(a.begin(), a.end());
    vector<int> s;
    
    /* 最初のスライム */
    s.push_back(a.back());
    a.back() = -1; /* 使用済みには-1を入れる */
    
    rep(i, n){
        vector<int> p = s;
        sort(p.begin(), p.end());
        int ai = n2-1;

        while(p.size() > 0 && ai >= 0){
            if(a[ai] == -1){
                --ai;
                continue;
            }
            if(a[ai] < p.back()){
                s.push_back(a[ai]);
                p.pop_back();
                a[ai] = -1;
            }
            --ai;
        }
        if(p.size()>0){
            puts("No");
            return 0;
        }
    }

    puts("Yes");
    
    return 0;
}

Measured memory_bytes: 2932
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	char a;
	cin>>a;
	if(a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
	cout<<"vowel"<<endl;
	else
	cout<<"consonant"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int length = input.nextInt();
		int[] intList = new int[length];
		int k = 0;
		for(int i = 0; i < intList.length; i++) {
			intList[i] = input.nextInt();
		}
		for(int m = 0; m < intList.length - 1; m++) {
			System.out.print(intList[m] + " ");
		}
		System.out.println(intList[intList.length - 1]);
		for(int i = 1; i < intList.length; i++) {
			int key = intList[i];
			int j = i - 1;
			while(j >= 0 && intList[j] > key) {
				intList[j+1] = intList[j];
				j--;
			}
			intList[j+1] = key;
			for(int m = 0; m < intList.length - 1; m++) {
				System.out.print(intList[m] + " ");
			}
			System.out.println(intList[intList.length - 1]);
		}
	}
}


Measured memory_bytes: 32020
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt(), k = in.nextInt();
		int can = 0;
		for(int i = 0; i < n; i++)
			if(in.nextInt() >= k)
				can++;
		System.out.println(can);
	}
}

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

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

int main() {
    ll N,K,r=0;
    cin >> N >> K;

    if(K == 0) {
        cout << N*N << endl;
        return 0;
    }

    rep(i,N-K) {
        r += (N/(i+K+1))*(i+1);
        r += max(N%(i+K+1)-K+1, (ll)0);
    }
    cout << r << endl;
}

Measured memory_bytes: 256
using System;

namespace CsTest
{
    class Program
    {
        static void Main()
        {
            long N = long.Parse(Console.ReadLine());
            Console.WriteLine(DigitsInMultiplication(N));
        }
        static int DigitsInMultiplication(long N)
        {
            for (long l = (long)Math.Sqrt(N); l > 1; l--) {
                long am;
                long dv = Math.DivRem(N, l, out am);
                if (am == 0)
                    return dv.ToString().Length;
            }
            return N.ToString().Length;
        }
    }
}

Measured memory_bytes: 13140
n=int(input())
c=[0]*n
mod=1000000007
l=list(map(int,input().split()))
for i in l:
    c[i]+=1
if n%2==0:
    for i in range(n):
        if i%2==1:
            if c[i]!=2:
                print(0)
                exit()
    print((2**(n//2))%mod)
else:
    for i in range(n):
        if i==0:
            if c[i]!=1:
                print(0)
                exit()
        elif i%2==0:
            if c[i]!=2:
                print(0)
                exit()
    print((2**(n//2))%mod)
    


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

using namespace std;

int main() {

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

	int counter = 0;
	for (int i = 0; i < n-1; i++) {
		if (p[i] == i+1) {
			counter++;
			swap(p[i], p[i + 1]);
			i++;
		}
		//else if (i == n - 2 && p[i + 1] == i + 2) {
		//	counter++;
		//}
	}
	if (p[n - 1] == n) { counter++; }
	cout << counter << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
using namespace std;

int main(void)
{	
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a < b && b < c) cout << "Yes";
	else cout << "No";
	
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll N;
  cin >> N;

  vector<ll> A(N);
  REP(i, N) cin >> A[i];
  vector<ll> B(N+1);
  B[0] = A[0];
  ll sum = abs(B[0]);
  FOR(i,1,N){
    B[i] = A[i]-A[i-1];
    sum+=abs(B[i]);
  }
  B[N]=A[N-1]*(-1);
  sum+=abs(B[N]);
  REP(i,N){
    ll ans = sum;
    if((B[i]>0 && B[i+1]<0)||(B[i]<0 && B[i+1]>0)){
      ans=sum-min(abs(B[i]),abs(B[i+1]))*2;
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn for(int i=0;i<n;i++)
#define pb push_back
#define pob pop.back()
int main()
{
   int n,t,a;
   cin>>n>>t>>a;
   int minn=1e6;
   int ans;
   int h;
   int diff;
   forn
   {
       cin>>h;
       diff=abs(1000*a - 1000*t + 6*h);
       if(minn>diff) { minn=diff; ans=i;}
   }
   cout<<ans+1;
   return 0;
    
    
}

Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n;
    ll t[100010],x[100010],y[100010];
    
    std::cin >> n;
    for (int i = 0; i < n; i++) {
        std::cin >> t[i]>>x[i]>>y[i];
    }
    pair<ll,ll> from = {0,0};
    ll nowt = 0;
    for (int i = 0; i < n; i++) {
        ll dis = (ll)abs(from.first - x[i]) + (ll)abs(from.second - y[i]);
        ll d = t[i]-nowt;
        if(dis<=d && (dis - d)%2 == 0){
            nowt = t[i];
            from = {x[i],y[i]};
            continue;
        }else{
            std::cout << "No" << std::endl;
            return 0;
        }
    }
    std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
std::vector<int> graph[10050];//graph頂点数のsize
const int N=200010;
const int P=1000000007;
using ll = long long;
vector<ll> prime;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/


/*
	string s;
	s.size()
*/

/*
	char s[N];
	strlen(s)
*/
/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/


int main(){
	string k;
	cin>>k;
rep(i,sz(k)){
  if(k.at(i)=='?'){
    k.at(i)='D';
  }
}

	cout<<k  <<endl;


}


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

using namespace std;

int main()
{
    int n;
    int a[1001];
    bool anser = true;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] % 2 == 0)
        {
            if (a[i] % 3 == 0 || a[i] % 5 == 0)
            {
            }
            else
            {
                anser = false;
                break;
            }
            
        }
    }
    if (anser)
    {
        cout << "APPROVED";
    }
    else
    {
        cout << "DENIED";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
bool ok(ll mid,ll k,vector<ll> ab,vector<ll> c){
    ll cnt=0;
    for(int i=0;i<ab.size();i++){
        ll need=mid-ab[i];
        ll add=c.end()-lower_bound(c.begin(),c.end(),need);
        cnt+=add;
    }
    return cnt<=k;
}
vector<ll> getAns(ll l,ll r, ll k,vector<ll> ab,vector<ll> c){
    vector<ll> res((int)ab.size()); 
    vector<ll> ans;
    for(int i=0;i<ab.size();i++){
        ll need=r-ab[i];
        res[i]=lower_bound(c.begin(),c.end(),need)-c.begin();
        for(int j=(int)c.size()-1;j>=res[i];j--){
            ans.push_back(ab[i]+c[j]);
        }
    }
    sort(ans.rbegin(),ans.rend());
    ll add=k-(ll)ans.size();   
    for(int i=0;i<add;i++){
        ans.push_back(l);
    }
    return ans;
}
int main(){
    int x,y,z;cin >> x >> y >> z;
    ll k;cin >> k;
    vector<ll> a(x),b(y),c(z);
    for(int i=0;i<x;i++) cin >> a[i];
    for(int i=0;i<y;i++) cin >> b[i];
    for(int i=0;i<z;i++) cin >> c[i];
    vector<ll> ab;
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            ab.push_back(a[i]+b[j]);
        }
    }
    sort(ab.begin(),ab.end());
    sort(c.begin(),c.end());
    ll r=30000000001;
    ll l=0;
    while(l+1<r){
        ll mid=(r+l)/2;
        if(ok(mid,k,ab,c)) r=mid;
        else l=mid;        
    }
    vector<ll> ans=getAns(l,r,k,ab,c);
    for(int i=0;i<ans.size();i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 24036
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
 
  int sum = 0;
  for (int i = 0; i < b-a; i++) {
    sum += i+1;
  }
  
  cout << sum - b << endl;
}

  

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

ll p = 1000000000 + 7;

#define MAX_N 100000
ll inv[MAX_N], fac[MAX_N], finv[MAX_N];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for(int i=2; i<MAX_N; i++) {
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    fac[i] = fac[i-1] * (ll)i % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}
ll perm(ll n, ll r) {
  if(n < 0)       return 0;
  else if(n < r)  return 0;
  else            return (fac[n] * finv[n-r]) % mod;
}
ll comb(ll n, ll r) {
  ll ans = 1;
  ans = perm(n, r); // n * (n-1) * ... * (n-r+1)
  ans = (ans * finv[r]) % mod; // フェルマーの小定理
  return ans;
}

ll combination(ll n, ll r) {
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  for ( ll i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return (dividend / divisor) % p;
}

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return (combi(n - 1, k - 1) + combi(n - 1, k)) % p;
  }
}

int main() {

  ll N, K;
  cin >> N;
  cin >> K;
  ll ans;

  make();
  REP(i, 1, K+1) { // 1 <= i <= K
    ll comb1 = comb( (N-K+1), i );
    comb1 = comb1 % p;
    ll comb2 = comb( K-1, i-1 );
    comb2 = comb2 % p;
    ans = comb1 * comb2;
    ans = ans % p;
    // cout << "i: " << i << ", combi: " << comb << endl;
    // cout << "mod_pow: " << ans << endl;
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

string key[] = {
    "AKIHABARA",
    "KIHABARA",
    "AKIHBARA",
    "AKIHABRA",
    "AKIHABAR",
    "KIHBARA",
    "KIHABRA",
    "KIHABAR",
    "AKIHBRA",
    "AKIHBAR",
    "AKIHABR",
    "AKIHBR",
    "KIHABR",
    "KIHBAR",
    "KIHBRA",
    "KIHBR",
};

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

	string S;
	cin >> S;

	bool flg = false;

	for (int i = 0; i < 16; i++) {
		if (S == key[i]) {
			flg = true;
		}
	}

	YN(flg);

	return 0;
}

Measured memory_bytes: 256