akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>

using namespace std;

long long int N;
long long int M;
long long int A[200007];
long long int B[200007];

map <int, vector<int> > m;

bool Fl[100007];
long long int D[100007]; //最初の部屋からの距離

//
// BFS
//
void solve(){
    long long p = 0;
    queue < long long int > q;
    q.push(1);
    D[1] = 0;
    Fl[1] = true;

    while(!q.empty()){
        p = q.front(); q.pop();

        for(int i = 0;i < m[p].size();i++){
            
            int nr = m[p][i];
            if(Fl[nr] == false){
                q.push(nr);
                Fl[nr] = true;
                D[nr] = D[p] + 1;
            }

        }
    }
}

int main(){
    cin >> N >> M;
    for(int i = 1;i < M+1;i++){
        cin >> A[i];
        cin >> B[i];

        m[A[i]].push_back(B[i]);
        m[B[i]].push_back(A[i]);
    }

    solve();

    // 出力
    cout << "Yes" << endl;
    for(int i = 2;i < N+1;i++){

        for(int j = 0;j < m[i].size();j++){
            if(D[i] - 1 == D[m[i][j]]){
                cout << m[i][j] << endl;
            }else{
                continue;
            }
        
            break;
        }

    }
}

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


int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long n, d, c = 0;
	cin >> n >> d;
	while (n--)
	{
		long long a, b;
		cin >> a >> b;
		double long res = sqrt(a * a + b * b);
		//cout << ceil(res) << "\n";
		if (res <= d)
			c++;
	}
	cout << c;
}

Measured memory_bytes: 3676
use proconio::input;

fn main() {
    input!{
        x: u64,
    }
    let x = x as f64;
    let mut sum = 100f64;
    let mut y = 0;
    loop {
        y += 1;
        sum = (sum * 1.01).floor();
        if sum >= x {
            break;
        }
    }
    println!("{}", y);
}


Measured memory_bytes: 2660
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

ll n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

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

#define MAX 10000

int main(void) {
  vll a;
  ll x = 0;
  ll y = 0;

  cin >> n;

  FOR(i, 0, n) {
	cin >> temp;
	a.push_back(temp);
  }

  sort(ALL(a));
  
  flag = true;

  RFOR(i, 0, n) {
	if (flag) {
	  x += a[i];
	  flag = false;
	}
	else {
	  y += a[i];
	  flag = true;
	}
  }

  cout << x - y << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

string S;
void input() { cin >> S; }

void solve() {
  if (S.size() == 26) {
    string T = S;
    next_permutation(all(T));
    if (T > S) {
      string st;
      for (auto x : T) {
        if (st < S) st += x;
      }
      cout << st;
      cout << endl;
      return;
    } else {
      cout << -1 << endl;
      return;
    }

  } else {
    set<char> st;
    for (auto x : S) {
      st.insert(x);
    }
    rep(i, 0, 25) {
      char c = i + 'a';
      if (st.find(c) == st.end()) {
        S += char(c);
        break;
      }
    }
    cout << S << endl;
  }
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%lld\n",a)
inline ll read(){
    char c=getchar();ll f=1,x=0;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
    return x*f;
}
#define mod 1000000007
void MOD(int &x){if(x>=mod)x-=mod;}
#define maxn 100010
#define inf (1<<30)
char s[maxn];
int main(){
	scanf("%s",s+1);
	if(s[1]=='S')puts("Cloudy");
	if(s[1]=='C')puts("Rainy");
	if(s[1]=='R')puts("Sunny");
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
    int h,w;
    cin>>h>>w;
    map<char,int>mp;
    rep(i,h)rep(j,w){
        char s;
        cin>>s;
        mp[s]++;
    }
    int four=(h/2)*(w/2);
    int a=four;
    if(four)for(auto x:mp){
        if(x.second>=4){
            four-=x.second/4;
            mp[x.first]-=4*(x.second/4);
        }
    }
    int two=(h*w-4*a)/2;
    if(two)for(auto x:mp){
        if(x.second>=2){
            two-=x.second/2;
            mp[x.first]-=2*(x.second/2);
        }
    }
    int one=(h*w-4*a)%2;
    if(one)for(auto x:mp){
        if(x.second>=1){
            one-=x.second;
            mp[x.first]-=x.second;
        }
    }
    if(one!=0||two!=0||four!=0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
    }


Measured memory_bytes: 256
function main() {
  var
  i,
  word, longer, words,
  max, maxStr,
  words = input[0].split(' '),
  len = words.length,
  dict = {};
  for(i = 0; i < len; i++) {
    word = words[i].toLowerCase();
    dict[word] = (dict[word] || 0) + 1;
  }
  max = 0;
  longer = '';
  Object.keys(dict).forEach(function(word) {
    if(dict[word] > max) {
      max = dict[word];
      maxStr = word;
    }
    if(word.length > longer.length) {
      longer = word;
    }
  });
  console.log('%s %s', maxStr, longer);
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 7648
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int main(){
	double x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	printf("%lf\n",a);

}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
 
#define MOD (1000000007)
#define f first
#define s second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
#define input(vec,N) for(int i = 0; i < (N); i++) cin >> vec[i];
typedef long long int ll;
#define ld long double
const int N = 2e5+30;
//https://codeforces.com/problemset/page/2?tags=1700-1700
 
 
void solve(){
   int n;
   cin>>n;
   int hap[n+3][5];
   for(int i=1;i<=n;i++){
     for(int j=1;j<=3;j++){
       cin>>hap[i][j];
     }
   }
   ll dp[n+3][4];
   memset(dp,0,sizeof(dp));
   for(int i=1;i<=n;i++){
     for(int j=1;j<=3;j++){
       for(int k=1;k<=3;k++){
         if(k!=j){
           dp[i][j] = max(dp[i][j],dp[i-1][k]+hap[i][k]);
         }
       }
     }
   }
   cout<<*max_element(dp[n]+1,dp[n]+3)<<'\n';
}
 
 
int main(){
 	ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	int T;
  //cin >> T;
  //cout<<prs.size()<<'\n';
	 T = 1;
  //visited[1]=1;
	while(T--){
		solve();
	}
}

Measured memory_bytes: 8680
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

int main() {
	ll K, A, B;
	cin >> K >> A >> B;

	ll k = K, n = 1 + K;
	ll x = 1;

	if (k > A) {
		x = B;
		k -= A+1;

		ll temp = k / 2;
		x += temp * (B-A);
		k -= temp * 2;

		while (k > 0) {
			k -= 1;
			x += 1;
		}
	}

	cout << (max({n, x})) << endl;
	return 0;
}


Measured memory_bytes: 256
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random

def main():
    w,h,x,y = map(int, input().strip().split())
    print(w*h/2,end=" ")
    if float(w/2)==float(x) and float(h/2)==float(y):
        print(1)
    else:
        print(0)

    
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 38896
import java.util.Arrays
import java.util.ArrayList
import java.util.ArrayDeque

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

data class Move(val y1: Int, val x1: Int, val y2: Int, val x2: Int)
fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val n = reader.readLine()!!.toInt()
    val s = reader.readLine()!!

    val right = Array(n, {0})
    val left = Array(n, {0})
    for (i in 1..n-1) {
        right[i] = right[i-1] + if (s[i-1] == 'W') 1 else 0
    }
    for (i in n-2 downTo 0) {
        left[i] = left[i+1] + if (s[i+1] == 'E') 1 else 0
    }

    println(right.zip(left, {a, b -> a+b}).min())
}


Measured memory_bytes: 66792
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int  n = in.nextInt();
		int  rem = n%1000;
	//	int div = n%1000;
		if(n%1000==0){
			System.out.println(0);
			}
			else{
				int div = n/1000+1;
				int ans= div*1000 - n;
					System.out.println(ans);
				}
	
	}
}

Measured memory_bytes: 27056
#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 a, b, c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b;
    return 0;
}

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

int main() {
  int h, w;

  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      // cout << endl;
      break;
    }

    for (int i=0; i<h; i++) {
      for (int j=0; j<w; j++) {
        if (i == 0 || i == h - 1)
          cout << "#";
        else {
          if (j == 0 || j == w-1)
            cout << "#";
          else
            cout << ".";
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
# 2019/06/29
# AtCoder Beginner Contest 132 - A

# Input
s = input()
s1 = s[0]
s2 = ""
c1 = 1
c2 = 1

# Calc
for i in range(1, 4):
    if s[i] == s1:
        c1 += 1
    elif s[i] == s2:
        c2 += 1
    elif s2 == "":
        s2 = s[i]

if c1 == 2 and c2 == 2:
    ans = "Yes"
else:
    ans = "No"

# Output
print(ans)


Measured memory_bytes: 3060
import scala.io.StdIn

object Main {

  def main(args: Array[String]) = {

    val Array(w, h, x, y) = StdIn.readLine().split(' ').map(_.toLong)
    val ans = (w * h).toDouble / 2.0
    val multi = if (x == w / 2 && w % 2 == 0 && y == h / 2 && h % 2 == 0) 1 else 0
    println(s"$ans $multi")

  }

}


Measured memory_bytes: 25412
// #include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <map>
#include <math.h>
#include <algorithm> // std::sort, std::min, std::next_permutation, std::lower_bound
#include <iomanip> // std::setprecision
#include <cmath> // std::ceil
#include <numeric> // std::gcd, std::lcm
#include <limits> // std::numeric_limits<long int>::max()
#include <unordered_map>
#include <map>
#include <cmath> // std::atan2

using namespace std;
typedef long long ll;
#define INF 1999999999
#define MODA 1000000007 
#define rep(i,n) for (long long i = 0; i < (n); ++i)

template<typename T>
T powint (const T& x, const T& y) {
  T ret = 1;
  for(int i=0; i<y; ++i) ret *= x;
  return ret;
}

long long factorial(long long X) {
  long long ans = 1;
  for(int i=1; i<X+1 ; ++i) ans *= i;
  return ans;
}

std::map<long long, long long> prime_factor(long long n) {
  std::map<long long, long long> ret;
  for(long long i = 2; i * i <= n; ++i) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1; // if n is prime number.
  return ret;
}

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() {
  ll A, B;
  cin >> A >> B;

  map<ll, ll> A_primes = prime_factor(A);
  map<ll, ll> B_primes = prime_factor(B);
  ll ans = 1; // 1 is common divisor.
  map<ll, ll> com_primes;
  for (const auto A_prime : A_primes) {
    if (B_primes.find(A_prime.first) != B_primes.end()) {
      com_primes[A_prime.first] = 1;
    }
  }
  for (const auto com_prime : com_primes) {
    ans += com_prime.second;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define F first
#define S second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int MX=2e5+9;
const ll inf=(1ll<<60);
const ll mod=1e9+7;
ll X,i=1,j=1;
map<pll,bool>vis;
int main(){
    scanf("%lld",&X);
    if(X==1){
        puts("1");
        return 0;
    }
    while(i<=X){i+=j;j++;}
    printf("%lld\n",j-1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main() {
      int64_t H,W;
      int64_t count=0;
      cin >> H >> W;
      count =H*W;
      if(H==1||W==1)
        count=1;
      else if(count%2==0)
        count=count/2;
      else
        count = count/2+1;
          
      cout << count << endl;
      return 0;
    }

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define maxn 100
#define int long long int
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M)  //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) {           //bit計算
    if (x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) {   //素数判定
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

signed main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int w[N], b[N];
    rep(i, N) {
        w[i] = 0;
        b[i] = 0;
    }
    for (int i = 0; i < N; i++) {
        if (S[i] == '#') {
            b[i]++;
        }
        if (i > 0)
            b[i] += b[i - 1];
    }
    for (int i = N - 1; i >= 0; i--) {
        if (S[i] == '.') {
            w[i]++;
        }
        if (i < N - 1)
            w[i] += w[i + 1];
    }
    int ans = min(b[N - 1], w[0]);
    rep(i, N - 1) {
        int count = w[i + 1] + b[i];
        ans = min(count, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3716
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
#include <limits>
#include <climits>
#include <sstream>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;



ll v;
graph g;
ll cnt;
ll odd;
ll even;
ll vis[1002];
ll space;

ll dfs(ll from, ll to){
  ll ret = 0;
  vis[to] = 1;
  for(auto y : g[to]){
    if(vis[y.first]) continue;
    ret += dfs(to,y.first);
  }
  return ret+1;
}

int main(){
  cin >> v;
  for(ll i = 0;i < v;i++){
    string s;
    cin >> s;
    for(ll j = 0;j < v;j++){
      if(s[j] == 'Y') g[i][j] = 1;
      if(s[j] == 'Y') cnt++;
    }
  }
  for(ll i = 0;i < v;i++){
    if(vis[i] == 0){
      ll x = dfs(-1,i);
      space += x*(x-1)/2;
      // cerr << x << endl;
      if(x%2 == 1){
        odd++;
      }else{
        even++;
      }
    }
  }
  cnt /= 2;
  space -= cnt;
  // cerr << odd << " " << even << " " << cnt << " " << space << endl;
  if(odd%2 == 1){
    ll less = v*(v-1)/2-cnt;
    if(less%2 == 0) cout << "Hanako" << endl;
    else cout << "Taro" << endl;
    return 0;
  }else{
    ll less = v*(v-1)/2-cnt;
    if(less%2 == 0){
      //taro ha kisuu wo tukuritai
      if(even == 0){
        if(odd == 2){
          cout << "Taro" << endl;
        }else if(odd == 4){
          if(space%2 == 0){
            cout << "Hanako" << endl;
          }else{
            cout << "Taro" << endl;
          }
        }else{
          cout << "Hanako" << endl;
        }
      }else if(even == 1){
        if(odd == 2){
          cout << "Taro" << endl;
        }else if(odd == 4){
          if(space%2 == 0){
            cout << "Hanako" << endl;
          }else{
            cout << "Taro" << endl;
          }
        }else{
          cout << "Hanako" << endl;
        }
      }else{
        cout << "Hanako" << endl;
      }

    }else{
      if(even == 0){
        if(odd == 2){
          cout << "Hanako" << endl;
        }else if(odd == 4){
          if(space%2 == 0){
            cout << "Hanako" << endl;
          }else{
            cout << "Taro" << endl;
          }
        }else{
          cout << "Taro" << endl;
        }
      }else{
        cout << "Taro" << endl;
      }
    }
  }
}



Measured memory_bytes: 3312
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll N;
ll A[100000];
int cnt[3];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    cnt[0] = -1; cnt[1] = -1; cnt[2] = -1;
    ll ans = 1;
    for(int i = 0; i < N; i++){
        int c = 0;
        int idx;
        for(int j = 0; j < 3; j++){
            if(cnt[j] == A[i]-1) {
                c++;
                idx = j;
            }
        }
        if(c == 0){
            cout << 0 << endl;
            return 0;
        }
        ans *= c;
        ans %= MOD;
        cnt[idx] = A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007;

ll ans[220000];

int main() {
  ll n, k;
  cin >> n >> k;
  ll a = 0;
  ll b = 0;
  for(ll i = 1; i<=n+1; i++) {
    a += (n-i+1);
    b += i-1;
    ll m = (a-b+1)%mod;
    ans[i] = m;
  }
  ll sum = 0;
  for(ll i = k; i<=n+1; i++) {
    sum += ans[i];
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 5124
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define N 100005
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<22,stdin),p1 == p2)?EOF:*p1++)
using namespace std ;
//char buf[(1 << 22)] , *p1 = buf , *p2 = buf ;
inline int read ()
{
    char c = getchar () ; int x = 0 , f = 1 ;
    while (c < '0' || c > '9') { if (c == '-') f = -1 ; c = getchar () ; }
    while (c >= '0' && c <= '9'){ x = x * 10 + c - '0' ; c = getchar () ; }
    return x * f ;
}
map <int , int> mp[N << 3] ; //mp[u][w]:u属性为w的虚点编号
vector <pair <int , int> > edge[N << 3] ;
int dis[N << 3] , vis[N << 3] , n , m ;
queue <int> q ;
void spfa (int s)
{
    int tim = 0 ;
    for (int i = 0 ; i <= (N << 3) - 5 ; i ++) dis[i] = 1e9 ;
	// fill (dis , dis + (N << 2) , 1e9) ;
	dis[s] = 0 ;
	vis[s] = 1 ;
	q.push (s) ;
	while (! q.empty ())
	{
        // printf ("The %d time\n" , ++ tim) ;
		int x = q.front () ;
		q.pop () ;
		for (int i = 0 ; i < edge[x].size () ; i ++)
		{
			int y = edge[x][i].first ;
			if (dis[y] > dis[x] + edge[x][i].second)
			{
				dis[y] = dis[x] + edge[x][i].second ;
				if (! vis[y])
				{
					vis[y] = 1 ;
					q.push (y) ;
				}
			}
		}
        vis[x] = 0 ;
	}
}
int main ()
{
//    freopen (".in" , "r" , stdin) ; freopen (".out" , "w" , stdout) ;
	n = read () , m = read () ;
    int tot = n ;
	for (int i = 1 ; i <= m ; i ++)
	{
		int u = read () , v = read () , w = read () ;
        if (! mp[u].count (w))
        {
            mp[u][w] = ++ tot ;
            edge[u].push_back (make_pair (tot , 1)) ;
            edge[tot].push_back (make_pair (u , 1)) ;
        }
        if (! mp[v].count (w))
        {
            mp[v][w] = ++ tot ;
            edge[v].push_back (make_pair (tot , 1)) ;
            edge[tot].push_back (make_pair (v , 1)) ;
        }
        edge[mp[u][w]].push_back (make_pair (mp[v][w] , 0)) ;
        edge[mp[v][w]].push_back (make_pair (mp[u][w] , 0)) ;
    }
    spfa (1) ;
    if (dis[n] == 1e9) return puts ("-1") , 0 ;
    cout << dis[n] / 2 ;
}


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


#define mod 1000000007
#define ull unsigned long long int
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
/* TYPE DEFINITIONS */
typedef     long long int        ll;
typedef     vector<ll>     vi;
typedef     pair<ll,ll>   pi;
 
 
 
/* MATH */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return true; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll pow(ll a,ll b,ll m)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

ll ncr(int n, int k)  
{  
	if(k>n)return 0;
    ll res = 1;  
    if ( k > n - k )  
        k = n - k;  
    for (int i = 0; i < k; ++i)  
    {  
        res *= (n - i);  
        res /= (i + 1);  
    }  
  
    return res;  
} 
  
//
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
#define  deb(x)       cout << '>' << #x << ':' << x << endl;

ll h,n;
ll A[10000],B[10000];
void  solve()
{
	cin>>h>>n;
	forn(i,n)
	{
		cin>>A[i]>>B[i];
	}
	ll dp[h+1];
	fora(i,0,h)dp[i]=1e8;
	dp[0]=0;
	fora(i,0,h)
	{
		fora(j,0,n-1)
		{
			if(i>A[j])dp[i]=min(dp[i],dp[i-A[j]]+B[j]);
			else dp[i]=min(dp[i],B[j]);
		}
	}
	//fora(i,0,h)cout<<dp[i]<<" ";
	//cout<<endl;
	cout<<dp[h]<<endl;
}


int main()
{
 
    FastIO;
    ll t=1;
   	//bcin>>t;
    while(t--)
    {
        solve();
    }
}

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

using namespace std;
#define ll long long

const int N = 1e5 + 5;
ll INF = 998244353;


int main(){

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

    int k;
    cin>>k;

    while(k--)
        cout<<"ACL";
    cout<<endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=1e5,mod=1e9+7;
typedef ll fuko[yuzu|10];
int n=read();
fuko cnt,jic={1},inv;

ll kasumi(ll a,ll b=mod-2){
ll s=1;
for (;b;b>>=1,a=a*a%mod) if (b&1) s=s*a%mod;
return s;
}

int main(){
int i,p,q;
for (i=1;i<=n+1;++i) jic[i]=jic[i-1]*i%mod;
inv[n+1]=kasumi(jic[n+1]);
for (i=n;~i;--i) inv[i]=inv[i+1]*(i+1)%mod;
for (i=1;i<=n+1;++i){
  int x=read();
  cnt[x]?p=n-i+cnt[x]:cnt[x]=i;
  }
for (i=1;i<=n+1;++i){
  ll ans=jic[n+1]*inv[i]%mod*inv[n-i+1]%mod;
  if (i<=p+1) ans-=jic[p]*inv[i-1]%mod*inv[p-i+1]%mod;
  write((ans%mod+mod)%mod),pl;
  }
}

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

#define fi first
#define se second

using namespace std;

typedef pair<int, int> ii;

int n, h[100005], dp[100005];

int recur(int d)
{
	if(d == n)
		return 0;
	else if(d == n - 1)
		return abs(h[d + 1] - h[d]);
	else
		return min(abs(h[d + 2] - h[d]) + recur(d + 2), abs(h[d + 1] - h[d]) + recur(d + 1));
}
int main()
{
	cin >> n;
	for(int i = 1; i <= n; ++i)
		cin >> h[i];
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	for(int i = 3; i <= n; ++i)
	{
		dp[i] = min(abs(h[i] - h[i - 2]) + dp[i - 2], abs(h[i] - h[i - 1]) + dp[i - 1]);
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author david yepes buitrago
 * @date 01-08-2017
 * @time 0.000 ms
 */
public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		for (String line; (line = tec.readLine()) != null;) {
			int n = Integer.parseInt(line.trim());
			int[] arr = new int[n];
			StringTokenizer st = new StringTokenizer(tec.readLine());
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(st.nextToken());
			if (n == 1) {
				out.println(1);
				break;
			}
			int cont = 1;

			for (int indice = 0; indice < arr.length; indice++) {

				boolean bool = true;
				boolean decidido = false;
				// true ascendente
				boolean cambio = false;
				for (int i = indice; i < arr.length - 1; i++) {
					if (arr[i] < arr[i + 1] && !decidido) {
						decidido = true;
						bool = true;
					}
					if (arr[i] > arr[i + 1] && !decidido) {
						decidido = true;
						bool = false;
					}
					if (arr[i] < arr[i + 1] && !bool && decidido) {
						cont++;
						bool = !bool;
						indice = i;
						cambio = true;
						break;
					}
					if (arr[i] > arr[i + 1] && bool && decidido) {
						cont++;
						bool = !bool;
						indice = i;
						cambio = true;
						break;
					}
				}
				if (!cambio) {
					break;
				}
			}
			out.println(cont);
		}
		out.close();
	}
}


Measured memory_bytes: 36380
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        s: Chars,
    }

    let mut a_min: isize = -1;
    let mut z_max: isize = -1;
    for i in 0..s.len() {
        match s[i] {
            'A' => { if a_min == -1 { a_min = i as isize } },
            'Z' => z_max = std::cmp::max(z_max, i as isize),
            _ => continue,
        }
    }

    println!("{}", z_max - a_min + 1);
}


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

int n, m;
int a[12], b[12];
int dp[13][1 << 12];

int calc(int i, int j)
{
	int d = abs(a[i] - b[j]);
	return d * (d - 30) * (d - 30);
}

int dfs(int i, int bit)
{
	if (i == n) return 0;
	if (~dp[i][bit]) return dp[i][bit];
	int res = dfs(i + 1, bit);
	for (int j = 0; j < m; j++){
		if (bit & (1 << j)) continue;
		res = max(res, calc(i, j) + dfs(i + 1, bit | (1 << j)));
	}
	return dp[i][bit] = res;
}

int main()
{
	while (cin >> n >> m, n){
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}
		for (int i = 0; i < m; i++){
			cin >> b[i];
		}
		memset(dp, -1, sizeof dp);
		cout << dfs(0, 0) << endl;
	}
}

Measured memory_bytes: 1376
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>

using namespace std;

#define rep(i , n) for(int i=0 ; i<n ; i++)
#define rep1(i , n) for(int i=1 ; i<=n ; i++)

typedef long long int ll;


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

	int arr[101],n;
	cin >> n;
	rep(i , n)
		cin >> arr[i];

    int min1 = INT_MAX;
    int max1 = INT_MIN;
	rep(i , n)
	{
	    min1 = min(arr[i] , min1);
	    max1 = max(arr[i] , max1);
	}
	cout << max1-min1;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define bufsize 1<<22
char ibuf[bufsize];
char *ptr=ibuf;

int read()
{
    int i=0;
    while(*ptr>='0')
    {
        i=i*10+*ptr-'0';
        ++ptr;
    }
    ++ptr;
    return i;
}

int h,w;
#define obs(i,j) ptr[i*(w+1)+j]=='@'

main()
{
    fread(ibuf,1,bufsize,stdin);

    h=read(),w=read();
    int k=read(),sx=read()-1,sy=read()-1,tx=read()-1,ty=read()-1;

    struct po {int x,y;};
    struct po qu[1<<20];
    struct po *beg=qu,*end=qu+1;
    beg->x=sx,beg->y=sy;
    unsigned int dist[1<<20];
    memset(dist,-1,sizeof(dist));
    dist[sx*w+sy]=0;
    while(beg!=end)
    {
        int x=beg->x,y=beg->y;
        unsigned int d=dist[x*w+y];
        ++beg;
        char *pt=ptr+x*(w+1)+y;
        char *const pcp=pt;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a++,z+=w;
            pt+=w+1;
            if(a==h||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b++,z++;
            pt++;
            if(b==w||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            a--,z-=w;
            pt-=w+1;
            if(a<0||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
        pt=pcp;
        for(int i=1,a=x,b=y,z=a*w+y; i<=k; i++)
        {
            b--,z--;
            pt--;
            if(b<0||*pt=='@'||dist[z]<=d) break;
            if(a==tx && b==ty)
            {
                printf("%u\n",d+1);
                return 0;
            }
            if(dist[z]!=d+1)
            {
                end->x=a,end->y=b;
                dist[z]=d+1;
                ++end;
            }
        }
    }
    puts("-1");
}


Measured memory_bytes: 11352
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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


const int MAX_PRIME = 1000;
bool is_prime[MAX_PRIME + 1];
void sieve()
{
	fill_n(is_prime, MAX_PRIME + 1, true);
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i * i <= MAX_PRIME; ++i)
	{
		if (is_prime[i])
		{
			for (int j = 2 * i; j <= MAX_PRIME; j += i)
				is_prime[j] = false;
		}
	}
}
int key(int n)
{
	int sum = 0, last;
	for (int i = 2; i <= MAX_PRIME; ++i)
	{
		if (is_prime[i] && n % i == 0)
			sum += i, last = i;
		while (n % i == 0)
			n /= i;
	}
	if (n > 1)
		sum += n, last = n;
	return last * 2 - sum;
}
int main()
{
	sieve();

	int a, b;
	while (scanf("%d%d", &a, &b), a | b)
		puts(key(a) > key(b) ? "a" : "b");
}

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

int main(void){
   int N;
   cin>>N;
   vector<long long> A(N);
   for(int i=0;i<N;i++){
      cin>>A[i];
   }
   sort(A.begin(),A.end());
   long long result=0;
   for(int i=1;i<N;i++){
      result+=A[N-1-i/2];
   }
   cout<<result<<endl;
   return 0;
}


Measured memory_bytes: 4844
#include <stdio.h>

int pow_(int a, int n){
  if(n == 0) return 1;
  else{
    return a * pow_(a, n - 1);
  }
}

int g(int n){
  if(n > 3) return 3 * g(n - 1) + pow_(2, n - 1) * 3 - 6;
  if(n == 3) return 6;
  else return 0;
}

int h(int a, int b){
  int x = 0;
  for(int i = a; i <= b; i++){
    int s = 0, t = 0, f = 0, z = 0, temp;
	temp = i;
	while(temp > 0){
	  if(temp % 10 == 3) t++;
	  else if(temp % 10 == 5) f++;
	  else if(temp % 10 == 7) s++;
	  else {z++; break;}
	  temp /= 10;
	}
	if(s*t*f > 0 && z == 0)x++;
  }
  return x;
}

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);

  int ans = 0;

  if(n <= 999) ans = h(1, n);
  else{
    
    int d = 0, r, temp = n;
    
    while(temp > 0){
      r = temp % 10;
      temp /= 10;
      d++;
    }
    
    for(int i = 3; i < d; i++) ans += g(i);
    
    switch(r){
      case 3:
        ans += h(3 * pow_(10, d - 1), n);
        break;
 
      case 4:
        ans += pow_(2, d - 1)  - 2 + g(d - 1);
        break;
    
      case 5:
        ans += h(5 * pow_(10, d - 1), n) + g(d) / 3;
        break;
    
      case 6:
        ans += 2*(pow_(2, d - 1) - 2 + g(d - 1));
        break;
    
      case 7:
        ans += h(7 * pow_(10, d - 1), n) + 2 * g(d) / 3;
        break;
    
      default:
        ans += (r / 8) * g(d);
    }
  }

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


Measured memory_bytes: 128
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	vector<int> h(n);
	rep(i, 0, n) cin >> h[i];

	double sub = 1e5;
	int ans;
	rep(i, 0, n) {
		double c = t - h[i] * 0.006;
		c = abs(c - a);
		if (c < sub) {
			ans = i + 1;
		}
		sub = min(sub, c);
	}

	cout << ans << endl;

	return 0;
}

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

 

int main()
{
   int a, b;     
   cin >> a >> b;
   
   if (a == b)
      cout << "a == b" << endl;
   else if(a > b)
      cout << "a > b" << endl;
   else
      cout << "a < b" << endl;
   
   return 0;
}


Measured memory_bytes: 3028
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define ubo upper_bound
#define lbo lower_bound
#define VI vector<int>
#define VL vector<ll>
#define VP vector<pll >
#define all(x) x.begin(), x.end()
#define M vector<VI >

const int N = 3030;

using namespace std;

int r, c, k;
ll dp[4][N][N], v[N][N];

int main(){

	cin >> r >> c >> k;
	for(int i=0; i<k; i++){
		int a, b, h;
		cin >> a >> b >> h;
		v[a][b] = h;
	}

	for(int i=1; i<=r; i++){
		for(int j=1; j<=c; j++){
			ll mx = 0;
			for(int h=0; h<4; h++) mx = max(mx, dp[h][i-1][j]);

			dp[0][i][j] = max(mx, dp[0][i][j-1]);

			for(int h=1; h<4; h++){
				dp[h][i][j] = max(mx+v[i][j], dp[h-1][i][j-1]+v[i][j]);
				dp[h][i][j] = max(dp[h][i][j], dp[h][i][j-1]);
			}
		}
	}

	ll ans = 0;
	for(int i=0; i<4; i++) ans = max(ans, dp[i][r][c]);

	cout << ans << endl;

	return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> n >> a;
       n%=500;
       Yes(n<=a);
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int solve(vector<vector<int>>&dp,int i,int j,vector<int>s){
  if(i==j)return 0;
  if(dp[i][j]!=-1)return dp[i][j];
  int mn=INT_MAX;
  for(int k=i;k<j;k++){
    mn=min(mn,solve(dp,i,k,s)+solve(dp,k+1,j,s));
  }
  int cost=s[j];
  if(i>0)cost-=s[i-1];
  return dp[i][j]=(mn+cost);

}
int32_t main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  vector<vector<int>>dp(n,vector<int>(n,0));
  vector<int>s(n);
  s[0]=a[0];
  for(int i=1;i<n;i++)s[i]=s[i-1]+a[i];


  for(int t=2;t<=n;t++){
    for(int i=0;i<=(n-t);i++){
      int j=i+t-1;
      int mn=LLONG_MAX;
      for(int k=i;k<j;k++){
        mn=min(mn,dp[i][k]+dp[k+1][j]);
      }
      int cost=s[j];
      if(i>0)cost-=s[i-1];
      dp[i][j]=mn+cost;
    }
  }
  // for(int i=0;i<n;i++){
  //   for(int j=0;j<n;j++){
  //     cout<<dp[i][j]<<" ";
  //   }
  //   cout<<"\n";
  // }
  // cout<<solve(dp,0,n-1,s);
  cout<<dp[0][n-1];


}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
          
			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			var N = inputArray[0];

			//各頂点から、どんな→が生えているかを格納する
			var inputInfo = new List<Tuple<long,long>>[N];

			for (int i = 0; i < N; i++) {
				inputInfo[i] = new List<Tuple<long, long>>();
			}

			for (int i = 0; i < N-1; i++) {
				var input = retreiveLongArray();
				var kiten = input[0]-1;
				var shuten = input[1]-1;

				inputInfo[kiten].Add(new Tuple<long, long>(shuten,i));
				inputInfo[shuten].Add(new Tuple<long, long>(kiten, i));

			}
			_ansList = new long[N-1];

			dfs(0, -1, -1, inputInfo);

			var K = _ansList.Max();


			//答えの出力
			Console.WriteLine(K);
			for (int i = 0; i < N-1; i++) {
				Console.WriteLine(_ansList[i]);
			}
		}

		private static void dfs(long currentNode, long fromNode,long fromColor, List<Tuple<long, long>>[] inputInfo) {

			var color = 1;

			foreach (var line in inputInfo[currentNode]) {

				var nextNode = line.Item1;
				var currentLine = line.Item2;

				if (nextNode == fromNode) {
					continue;
				}
				if (color == fromColor) {
					color++;
				}
				_ansList[currentLine] = color;
				dfs(nextNode, currentNode, color, inputInfo);
				color++;

			}

		}
		private static long[] _ansList;

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 34712
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<numeric>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(lli i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
int main(void){
	lli n; cin >> n;
	vector<int> b(n+1);
	set<int> s;
	rep(i, n){
		int t; cin >> t;
		b[t] = i+1;
	}
	s.insert(0);
	s.insert(n+1);
	lli ans = 0;
	reg(i, 1, n){
		int t = b[i];
		s.insert(t);
		auto itr = s.find(t);
		lli l = *(--itr); ++itr;
		lli r = *(++itr);
		ans += (r-t)*(t-l) * i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10368
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int N;
    cin >> N;
    vector<ll> A(N);
    ll ma = 0, cnt = 0;
    rep(i, N) {
        cin >> A[i];
        ma = max(ma, A[i]);
        cnt += abs(ma - A[i]);
    }

    cout << cnt << endl;
}

Measured memory_bytes: 4764
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

int mod_p_exp(int n, int e, int p){
    long ret = 1;
    for(int i = 0; i < e; ++i) ret = ret * n % p;
    return (int) ret;
}

int main(void){
    int n, p = 1000000007;
    std::cin >> n;
    int ret = (mod_p_exp(10, n, p) + mod_p_exp(8, n, p)) % p;
    if(ret < 0) ret += p;
    ret = (ret - 2 * mod_p_exp(9, n, p)) % p;
    if(ret < 0) ret += p;
    std::cout << ret << std::endl;

    return 0;
}

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

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a+b+c >= 22)
		printf("bust\n");
	else
		printf("win\n");

	return 0;
}

Measured memory_bytes: 128