akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#define Len 10001 
int main()
{
    int n;
    int cnt[Len];
    for (int i = 0; i < Len; i++){
        cnt[i] = 0;
    }

    scanf("%d", &n);

    int a[n + 1];

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

    int k = 0;

    for (int i = 0; i < Len; i++){
        for (int j = 0; j < cnt[i]; j ++){
            a[k++] = i;
        }
    }

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

    return 0;
}   


Measured memory_bytes: 10608
a = input().split()
v = 2
while int(v) >= 1:
    if int(a[int(v)-1]) < int(a[int(v)]):
        pass
    else:
        b = int(a[int(v)-1])
        a[int(v)-1] = int(a[int(v)])
        a[int(v)] = int(b)
    v = int(v) - 1

if int(a[1]) < int(a[2]):
    pass
else:
    b = int(a[1])
    a[1] = int(a[2])
    a[2] = int(b)
print('%d %d %d' % (int(a[0]),int(a[1]),int(a[2])))


Measured memory_bytes: 5604
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            System.out.println(A >= 13 ? B : (A >= 6 ? B / 2 : 0));
        }
    }
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) (m*n)/GCD(m,n)
# define mod 1000000007

int main()
{
    IOS;
    ll i,j,k,t,n,sum=0,prod=1,flag=0;
    cin >> n;
    if(n%2==0)
        cout << -1 ;
    else
    {
        prod=0;
        for(i=1;i<10000000;i++)
        {
            prod=(prod*10+7)%n;
            if(prod==0)
            {
                cout << i;
                return 0;
            }
        }
            cout << -1;
    }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define vec vector 


int main(){
  int N, K;
  cin >> N >> K;
  
  int digit = 1;
  int temp_number = 1;
    
  while(temp_number <= N){
    temp_number *= K;
    digit++;
  }
  
  cout << digit-1;
  
  

}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	int r, g, b,temp;
	cin >> r >> g >> b;
	temp = r * 100 + g * 10 + b;
	if (temp %4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

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

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

    int n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   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;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    }    

  int main(){
  lint n,k;
  cin>>n>>k;
  lint x=n/k;
 lint ans=min({n,abs(n-k*x),abs(n-k*(x+1))});
  cout<<ans;
  }
     
  

Measured memory_bytes: 256
local s = io.read()
local n = #s
local f = false
for i = 1, n - 1 do
  if s:sub(i, i) == s:sub(i + 1, i + 1) then
    f = true
    print(i .. " " .. i + 1)
    break
  end
end
if not f then
  for i = 1, n - 2 do
    if s:sub(i, i) == s:sub(i + 2, i + 2) then
      f = true
      print(i .. " " .. i + 2)
      break
    end
  end
end
if not f then print("-1 -1") end


Measured memory_bytes: 760
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let i = 0;
  while (true) {
    const n = lines[i++] - 0;
    if (!n) break;
    const nn = lines[i++].split(" ").map(Number);
    const av = nn.reduce((a, b) => a + b, 0) / n;
    console.log(
      Math.sqrt(nn.reduce((p, c) => p + Math.pow(c - av, 2), 0) / n).toFixed(5)
    );
  }
});



Measured memory_bytes: 17020
/*#include<iostream>
int main(){
int a,b;
int x,y,z,count;
while(true){
std::cin>>a>>b;
count=0;
if(a==0&&b==0)break;
x=1;y=0;z=0;
for(int i=1;i<=a-2;i++){
for(int j=i+1;j<=a-1;j++){
for(int k=j+1;k<=a;k++){
if(i+j+k==b){
count++;
break;
}
}
}
}
std::cout<<count<<std::endl;
    }

    return 0;

}*//*
#include<iostream>
int main(){
    int a,count=0,ans=0;
    std::cin>>a;
    for(int i=1;i<=a;i+=2){
        count=0;
        for(int j=1;j<=i;j++){
            if(i%j==0)count++;
            if(count>8)break;
        }
//        std::cout<<"i:"<<i<<" count:"<<count<<std::endl;
        if(count==8)ans++;
        
    }
    std::cout<<ans<<std::endl;
    return 0;
}
#include<iostream>
#include<string>
int main(){
  std::string str;
  std::cin>>str;
    int count=0;
  for(int i=0;i<str.length();i++){
      int sub=0;
      for(int j=i;j<str.length();j++){
          if(str[j]=='A'||str[j]=='G'||str[j]=='C'||str[j]=='T'){
              sub++;
          }else break;
      }
      count=std::max(count,sub);
  }
    std::cout<<count<<std::endl;
    return 0;
}*/
#include<iostream>

int main(){
  long long int M,c,d,ans,count;
  std::cin>>M;
  ans=0;
//  long long int sub=0;
    count=0;
  for(long long int i=0;i<M;i++){
    std::cin>>d>>c;
    ans+=c;
    count+=c*d;
  }
//    long long int waru=10;
//    long long int count_b=count;
    /*while(true){
        count_b=count_b+count/waru;
        waru*=10;
        if(waru>count_b||waru>100000000000000000)break;
    }*/
  ans=ans+(count-1)/9-1;
  std::cout<<ans<<std::endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	long long A,B,C;
	cin>>A>>B>>C;
	
	if(A>B)swap(A,B);
	if(B>C)swap(B,C);
	
	int K;
	cin>>K;
	
	for(int i=0;i<K;i++)C*=2;
	
	cout<<A+B+C<<endl;
		
    return 0;
}


Measured memory_bytes: 256
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

int H, W;

void input()
{
    read(H); read(W);
}

LL calc(LL n, LL m)
{
    LL ret = 1e18;
    for (int i = 1; i < n; ++i) {
        vector<LL> t;
        t.push_back(m * i);
        t.push_back((m / 2) * (n - i));
        t.push_back(((m + 1) / 2) * (n - i));
        std::sort(ALL(t));
        chkmin(ret, t[2] - t[0]);
        t.clear();
        t.push_back(m * i);
        t.push_back(m * ((n - i) / 2));
        t.push_back(m * ((n - i + 1) / 2));
        std::sort(ALL(t));
        chkmin(ret, t[2] - t[0]);
    }
    return ret;
}

void solve()
{
    LL ans = std::min(calc(H, W), calc(W, H));
    printf("%lld\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("C.in", "r", stdin);
    freopen("C.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 劳歌一曲解行舟，红叶青山水急流。
//     -- 许浑《谢亭送别》


Measured memory_bytes: 256
n = gets.to_i

sum = 0
i = 1
while sum <= n
    sum += i
    i += 1
end
i -= 2
sum = i * (i + 1) / 2

f = (1..i).to_a
(n - sum).times do |j|
    f[i-j-1] += 1
end

puts f

Measured memory_bytes: 1788
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mx = 1e18;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    vector<ll> a(n);
    ll ans = 1;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (!a[i]) return cout << "0\n", 0;
    }
    for (int i = 0; i < n; ++i) {
        if (ans > mx / a[i]) return cout << "-1\n", 0;
        ans *= a[i];
    }
    cout << ans << '\n';
}

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

int main() {
  int a, b, n;
  cin >> a >> b >> n;
  int s, f;
  int i;
  for (i = 0; i < n; i++) {
    cin >> s >> f;
    if ((s < b && b <= f) || (s <= a && a < f) || (s <= a && b <= f) || (a <= s && f <= b)) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}



Measured memory_bytes: 3092
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


int main() {
	int n;
	cin >> n;
	vector<int> vec(n);
	rep(i, n) cin >> vec[i];
	sort(vec.begin(), vec.end(), greater<int>());
	int sum = 0;
	for (int i=1; i<n; i++) sum += vec[i];
	if (sum <= vec[0]) cout << "No" << endl;
	else cout << "Yes" << endl;
}

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

int main() {
  int N,K; cin >> N >> K;
  vector<long> A(N);
  for (int i =0; i<N; i++) cin >> A.at(i);
  
  for (int i =0; i<N-K; i++) {
    if (A.at(i+K) > A.at(i)) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; }
template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
typedef pair<ll, ll> P;
const ll INF=1LL<<60;
ll gcd(ll x,ll y){return y? gcd(y,x%y) :x;}

int n,q,u,v;
int main(){
    cin>>n>>q;
    dsu d(n);
    rep(i,q){
        cin>>n>>u>>v;
        if(n)cout<<d.same(u,v)<<endl;
        else d.merge(u,v);
    }
}

Measured memory_bytes: 3836
#pragma GCC optimize ("O3")
// #pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL A[311];

LL dp[61][2][2];

void MAIN() {

    scanf("%d", &N);
    REP (i, N) scanf("%lld", A+i);

    LL sum = 0;
    REP (i, N) sum ^= A[i];

    sum ^= A[0];
    sum ^= A[1];


    LL ans = -1;
    memset(dp, -1, sizeof dp);

    dp[0][0][0] = 0;
    REP (t, 60) REP (x, 2) REP (y, 2) {

	LL cur = dp[t][x][y];
	if (cur == -1) continue;

	if (cur < A[0] && ((A[0]-cur) ^ (A[1]+cur) ^ sum) == 0) {
	    if (ans == -1 || ans > cur) ans = cur;
	}


	LL mask = (1LL<<(t+1))-1;
	LL a = A[0] & mask;
	LL b = A[1] & mask;

	REP (z, 2) {
	    if ((((a-cur)^(b+cur)^sum)&mask) == 0) {
		int nx = a < cur;
		int ny = (b + cur) > mask;
		if (dp[t+1][nx][ny] == -1 || dp[t+1][nx][ny] > cur) {
		    dp[t+1][nx][ny] = cur;
		}
	    }

	    cur += 1LL<<t;
	}
    }

    printf("%lld\n", ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3824
#include<iostream>
#include<algorithm>
using namespace std;
main(){
  int pasta=0,a,b;
  cin>>pasta;
  cin>>a;
  pasta=min(pasta,a);
  cin>>a;
  pasta=min(pasta,a);
  cin>>a>>b;
  cout<<pasta+min(a,b)-50<<endl;
}
  

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main() {
	int a4;
	int b[1001];
	int x;
	for (int j = 0;; j++){
		cin >> a4;
		if (a4 == 0){
			x = j;
			break;
		}
		for (int i = 0; i < a4/4; i++)
		{
			int y;
			cin >> y;
			b[j] += y;
		}
	}
	for (int i = 0; i < x; i++){
		cout << b[i] << endl;
	}
}

Measured memory_bytes: 3060
n,m = map(int,input().split())

check = [1]*(n+1)
check.append(0)
check.append(0)
for i in range(m):
    a = int(input())
    check[a] = 0
    

count = [0]*(n+2)

mod = 10**9+7
if check[0]==1:
    count[0] = 1
    
elif count[0] == 0:
    count[1] = 1

for i in range(1,n+2):
    count[i] += count[i-1] + count[i-2]
    count[i] %= mod
    if check[i] == 0:
        count[i] = 0
    
    
print(count[n]%mod)

Measured memory_bytes: 7668
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    C = collections.Counter(A)

    ans = 0
    for v in C.keys():
        ans += C[v] * (C[v] - 1) // 2

    for a in A:
        tmp = ans
        tmp -= C[a] * (C[a] - 1) // 2
        tmp += (C[a] - 1) * (C[a] - 2) // 2
        print(tmp)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26048
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
#include <cctype>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

locale l = locale::classic();

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

Measured memory_bytes: 256
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int N;
int A[110];

int main()
{
  scanf( "%d", &N );
  rep( i, N )
    scanf( "%d", A+i );

  bool fl = true;

  rep( i, N )
  {
    if( A[i]%2 == 0 )
    {
      fl &= A[i]%3==0 || A[i]%5==0;
    }
  }

  puts( fl ? "APPROVED" : "DENIED" );

  return 0;
}

Measured memory_bytes: 128
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let m: usize = iterator.next().unwrap().parse().unwrap();

    let mut counts: Vec<isize> = vec![1; n];
    let mut has_red: Vec<bool> = vec![false; n];
    has_red[0] = true;

    for _ in 0..m {
        let x: usize = iterator.next().unwrap().parse().unwrap();
        let y: usize = iterator.next().unwrap().parse().unwrap();
        let x = x - 1;
        let y = y - 1;

        if has_red[x] {
            has_red[y] = true;
        }
        counts[x] -= 1;
        counts[y] += 1;
        if counts[x] == 0 {
            has_red[x] = false;
        }
    }

    let ans = has_red.iter().filter(|it| **it).count();
    return ans.to_string();
}


Measured memory_bytes: 6396
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int n = sc.nextInt();
        int k = sc.nextInt();
        int q = sc.nextInt();
        
        int[] point;
        point = new int[n];
      
        for (int i = 0; i <n; i++) {
          point[i] = k;
        }
      
        for (int i = 0; i < q; i++) {
          int number = sc.nextInt();
          point[number - 1] = point[number - 1] + 1;
        }
        
      
        int border = q;
        for (int i = 0; i <n; i++) {
          if (point[i] > border) {
            System.out.println("Yes");
          } else {
            System.out.println("No");
          }
        }
    }
}   

Measured memory_bytes: 69272
def main():
    n=int(input())
    w=list(map(int,input().split(' ')))
    tmp = 10000
    left = 0
    w_sum=sum(w)
    for i in w:
        left += i
        if tmp >= abs(left*2 - w_sum):
            tmp = abs(left*2 - w_sum)
    print(tmp)

if __name__=='__main__':
    main()

Measured memory_bytes: 3060
import java.util.HashMap;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.lang.Math;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();

        int ans = 0;
        for(int i = 0; i < n; i++){
            double key = sc.nextDouble();
            double value = sc.nextDouble();
            double r = Math.pow(key, 2) + Math.pow(value, 2);
            double a = Math.sqrt(r);
            if(a <= d){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64308
# coding: utf-8
pref_num, city_num = gets.chomp.split(' ').map(&:to_i)

City = Struct.new(:number, :pref, :year)
cities = (0...city_num).reduce([]) do |result, i|
  p, y = gets.chomp.split(' ').map(&:to_i)
  result << City.new(i, p, y)
end

city_count = Hash.new(0) # pref. に属する city の個数

ids = cities.sort_by { |city| city.year }.reduce({}) do |hash, city|
  city_count[city.pref] += 1
  hash[city.number] = sprintf("%06d", city.pref) + sprintf("%06d", city_count[city.pref])
  hash
end

ids.sort.each { |_, id| puts id }


Measured memory_bytes: 35540
#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse4,sse4.2,popcnt,abm,mmx,avx")
#endif
#include <bits/stdc++.h>

using namespace std;

#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
typedef long long Long;
typedef double Double;

template <class U, class V>
istream& operator>>(istream& is, pair<U, V>& p) {
  is >> p.first >> p.second;
  return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (auto& x : v) {
    is >> x;
  }
  return is;
}

template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto& x : v) {
    os << x << " ";
  }
  return os;
}

const int OO = INT_MAX - 10;

int mn_x = OO, mx_x = -OO;
int mn_y = OO, mx_y = -OO;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int n;
  cin >> n;
  while (n--) {
    int x, y;
    cin >> x >> y;
    x -= y;
    y += x + y;

    mn_x = min(mn_x, x);
    mx_x = max(mx_x, x);

    mn_y = min(mn_y, y);
    mx_y = max(mx_y, y);
  }

  cout << max(mx_y - mn_y, mx_x - mn_x) << endl;

  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define sz(a)           (int)(a).size()
#define all(x)          (x).begin(), (x).end()
#define fore(i,a,b)     for(int i=a; i<b; i+=1)
#define forr(i,a)       for(int i=a; i>=0; i--)
#define F first
#define S second

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<string, int> si;
typedef pair<int, string> is;
typedef vector<string> vs;
const int MAX=1e5+10;

ll sum(ll n){
    return (n*(n+1))/2;
}

bool isPal(string cad){
    int p2=sz(cad)-1;
    fore(i,0,sz(cad)/2){
        if(cad[i]!=cad[p2]) return false;
        p2--;
    }
    return true;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    string cad; cin>>cad;
    int n=sz(cad);
    if(n%2==1 && isPal(cad)){
        string a1=cad.substr(0,(n-1)/2);
        string a2=cad.substr(((n+3)/2)-1);
        if(isPal(a1) && isPal(a2)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;
    
    
    return 0;
}

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

int main(void){
    int m,a,b,d,count = 0;
    cin >> m >> d;
    for(int i = 1;i <= m;i++){
        for(int j = 22;j <= d;j++){
            a = j % 10;
            b = j / 10;
            if(a * b == i && a >= 2)count++;
        }
    }
    cout << count;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
struct int2{
  int x;
  int y;
};
int h,w;
int a[]={1,1,1,0,0,-1,-1,-1};
int b[]={-1,0,1,-1,1,1,0,-1};
queue<int2> q1;
queue<int2> q2;
string beach1;
int beach[1000][1000];
int sarachi[1000][1000];
int main(){
  cin>>h>>w;
  int count=0;
  for(int i=0;i<h;i++){
    cin>>beach1;
    for(int j=0;j<w;j++){
      sarachi[i][j]=0;
      if(beach1[j]=='.')beach[i][j]=10;
      else beach[i][j]=beach1[j]-'0';
    }
  }
  for(int i=1;i<h-1;i++){
    for(int j=1;j<w-1;j++){
      FOR(k,8){
        if(beach[i+a[k]][j+b[k]]==10)sarachi[i][j]++;
      }
      if(sarachi[i][j]>=beach[i][j]){
        int2 num;
        num.x=i;
        num.y=j;
        q1.push(num);
      }
    }
  }
  while(!q1.empty()){
    int2 num=q1.front();
    q1.pop();
    beach[num.x][num.y]=10;
    q2.push(num);
  }
  count = 0;
  while(!q2.empty()){
    while(!q2.empty()){
      int2 num=q2.front();
      q2.pop();
      FOR(i,8){
        sarachi[num.x+a[i]][num.y+b[i]]++;
          if(sarachi[num.x+a[i]][num.y+b[i]]>=beach[num.x+a[i]][num.y+b[i]]){
            int2 num2;
            num2.x=num.x+a[i];
            num2.y=num.y+b[i];
            beach[num.x+a[i]][num.y+b[i]]=10;
            q1.push(num2);
          }
        }
      }
    while(!q1.empty()){
      int2 num=q1.front();
      q1.pop();
      q2.push(num);
    }
    count++;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 11044
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll arr[3][3];

bool check1(ll a , ll b , ll c , ll* arr , ll n){
	sort(arr , arr+n);
	if(binary_search(arr , arr+n , a) && binary_search(arr , arr+n , b ) && binary_search(arr , arr+n , c)){
		return 1 ;
	}
	return 0;
}

bool check(ll* brr , ll n ){
	for(ll i=0;i< 3 ;i++){
		if(check1(arr[i][0],arr[i][1],arr[i][2],brr, n)){
			return 1 ;
		}
		if(check1(arr[0][i],arr[1][i],arr[2][i],brr, n)){
			return 1;
		}
		if(check1(arr[0][0],arr[1][1],arr[2][2],brr, n))return 1;

		if(check1(arr[2][0],arr[1][1],arr[0][2],brr , n))return 1;
	}
	return 0 ;
}

int main(){
	//mahakal(),fast;
	// ll arr[3][3];
	for(ll i=0;i<3;i++)for(ll j=0;j<3;j++)cin>>arr[i][j];
	ll n ;cin>> n ;
	ll brr[n];
	for(ll i=0;i< n ;i++)cin>>brr[i];
	if(check(brr  , n))cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    const int M = 300000;
    array<int, M> is_composite{};
    vector<int> prime;
    for (int i = 2; i < M; ++i) {
        if(!is_composite[i]) prime.emplace_back(i);
        for (int j : prime) {
            if(i*j >= M) break;
            is_composite[i*j] = true;
            if(i%j == 0) break;
        }
    }
    for (int i = 1; i < M-1; ++i) {
        is_composite[i+1] = is_composite[i] + 1 - is_composite[i+1];
    }
    int n;
    while(cin >> n, n){
        cout << is_composite[2*n]-is_composite[n] << "\n";
    }
    return 0;
}



Measured memory_bytes: 4444
import sys

def machi(k,W):
    visited = set()
    t = 0
    time = 0
    result = []
    while not t in visited:
        if time > k:
            return -1, result
        visited.add(t)
        result.append(t)
        t = W[t] - 1
        time += 1
    bp = result.index(t)
    return bp,result

        

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')


n,k = nm()
a = nl()
bp,roop = machi(k,a)
if bp == -1:
    print(roop[-1]+1)
    exit()

l_dist = len(roop[bp:])
f_dist = bp
fs = k - f_dist
arp = f_dist + (fs % l_dist)
print(roop[arp]+1)

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

int main(){
  int n,l;
  cin >> n >> l;
  int ans=100000;
  int x=100000;
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=l+i;
  }
  for(int i=0;i<n;i++){
    int point=sum-l-i;
    if(x>abs(sum-point)){
      ans=point;
      x=abs(sum-point);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
 
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
 
using namespace std;
 
int main(void) {
	int x, y, z;
	int total = 0;
	int count = 0;
 
	cin >> x >> y >> z;
	total += z;
 
	while (1) {
		if (x - total >= y+z) {
			total += y + z;
			count++;
		}
		else {
			break;
		}
	}
	cout << count << endl;
 
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] odd = new int[100001];
        int[] even = new int[100001];
        Arrays.fill(odd, 0);
        Arrays.fill(even, 0);
        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                odd[sc.nextInt()]++;
            } else {
                even[sc.nextInt()]++;
            }
        }
        int[] max_o = new int[2];
        int[] max_even =new int[2];
        int c = 0;
        for (int i = 0; i <=100000; i++) {
            if(max_o[0]<odd[i]){
                max_o[0]=odd[i];
                max_o[1]=i;
            }
            if(max_even[0]<even[i]){
                max_even[0]=even[i];
                max_even[1]=i;
            }
        }
        if(max_even[1]==max_o[1]){
            if(max_o[0]>max_even[0]){
                Arrays.sort(even);
                max_even[0]=even[99999];
            }else if(max_o[0]<max_even[0]){
                Arrays.sort(odd);
                max_o[0]=odd[99999];
            }else{
                Arrays.sort(odd);
                Arrays.sort(even);
                max_even[0]=Math.max(even[99999], odd[99999]);
            }
        }
        System.out.println(n-max_o[0]-max_even[0]);
    }
}

Measured memory_bytes: 59124
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<climits>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#include<algorithm>
#include<utility>

using namespace std;
typedef long long int lld;

template<typename T>
void input_vector(vector<T>& v, lld n, lld start=0) {
	for(lld i=start; i<n; ++i) 
		cin>>v[i];
}

template<typename T>
void display_vector(vector<T> v, lld start=0, string sep=" ") {
	for(lld i=start; i<v.size(); ++i)
		cout<<v[i]<<sep;
	cout<<"\n";
}

void solve(lld n) {
	lld unit;
	unit = 1/10;
	unit = n%10;
	
	if(unit==3)
		cout<<"bon\n";
	if(unit==0 || unit==1 || unit==6 || unit==8)
		cout<<"pon\n";
	if(unit==2 || unit==4 || unit==5 || unit==7 || unit==9)
		cout<<"hon\n";
}

int main() {
	lld t;
	t=1;
	
	for (lld cs=1; cs<=t; ++cs) {
		lld n;
		cin>>n;
		solve(n);
	}
	
	return 0;
}

Measured memory_bytes: 3636
N,M = map(int,input().split())
L = list(map(int,input().split()))

from itertools import accumulate
accumulated =  [0]+list(accumulate(L))
accumulated = map(lambda x:x%M,accumulated)
def counter(array):
    from collections import Counter
    return list(Counter(array).most_common())
c = counter(accumulated)
ans = 0
for x in c:
    ans += x[1] * (x[1]-1) //2

print(ans)



Measured memory_bytes: 63768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int pasNum = sc.nextInt();
	int ans = (int) Math.pow(pasNum,3);
	System.out.println(ans);

    // Scannerクラスのインスタンスをクローズ
	sc.close();
	}
}


Measured memory_bytes: 21716
import collections

n=int(input())
m=n//2
a=list(map(int,input().split()))
g=[]
k=[]
for x in range(n):
  if (x+1)%2==1:
    k.append(a[x])
  else:
    g.append(a[x])
    
gg=collections.Counter(g)
kk=collections.Counter(k)
aa=collections.Counter(a)

if len(aa)==1:
  print(n//2)
  
else:
  if gg.most_common()[0]==kk.most_common()[0]:
    if len(gg)>1 and len(kk)>1:
      print(min(m-gg.most_common()[0][1]+m-kk.most_common()[1][1],m-kk.most_common()[0][1]+m-gg.most_common()[1][1]))
    elif len(gg)==1:
      print(m-kk.most_common()[1][1])
    else:
      print(m-gg.most_common()[1][1])
  else:
    print(n-gg.most_common()[0][1]-kk.most_common()[0][1])
 

Measured memory_bytes: 31208
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>

using namespace std;

int main()
{
    map<string, int> M;
    int query, command, value;
    string key, L, R;
    map<string, int>::iterator itr, itrlow, itrup;
    scanf("%d", &query);
    for (int i = 0; i < query; i++)
    {
        scanf("%d", &command);
        switch (command) {
        case 0:
            cin >> key >> value;
            M[key] = value;
            break;
        case 1:
            cin >> key;
            if (M.find(key) == M.end())
            {
                printf("%d\n", 0);
            }
            else
            {
                printf("%d\n", M[key]);
            }

            break;
        case 2:
            cin >> key;
            M.erase(key);
            break;
        case 3:
            cin >> L >> R;
            itrlow = M.lower_bound(L);
            itrup = M.upper_bound(R);
            while (itrlow != itrup) {
                cout << itrlow->first << " " << itrlow->second << "\n";
                itrlow++;
            }

        default:
            break;
        }
    }
    return 0;
}


// erasing from map
#include <iostream>
#include <map>
#include <string>

int main1()
{
  map<string, int> map1;
  map<string, int>::iterator itr;
  string str1 = "aaa";
  string str2 = "bbb";
  string str3 = "ccc";
  map1[str1] = 10;
  map1[str2] = 20;
  map1[str3] = 30;
  map1.erase(str1);
  for (itr=map1.begin(); itr!=map1.end(); ++itr)
    std::cout << itr->first << " => " << itr->second << '\n';

  return 0;
}



Measured memory_bytes: 27856
H, W, D = map(int,input().split())
A = [[int(e)-1 for e in input().split()] for _ in range(H)]
Q = int(input())
query = [[int(e)-1 for e in input().split()] for _ in range(Q)]

mp = [0]*(H*W)
x = [-1]*(H*W)
y = [-1]*(H*W)

for i, line in enumerate(A):
    for j, a in enumerate(line):
        x[a] = i
        y[a] = j

for i in range(D,H*W):
    mp[i] = mp[i-D] + abs(x[i]-x[i-D]) + abs(y[i]-y[i-D])

for l, r in query:
    print(mp[r]-mp[l])

Measured memory_bytes: 30944
n = int(input())
h = list(map(int,input().split()))

if len(h) == 1 :
    print("Yes")
else :
    h.reverse()
    for i in range(n-1):
        if h[i] < h[i+1] :
            h[i+1] -= 1
            if h[i] < h[i+1] :
                print("No")
                break
    else :
        print("Yes")


Measured memory_bytes: 20784
# coding: utf-8
# Your code here!

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

# print(N)
# print(K)

# print(N // K)
# print(N % K)

# print((N // K) + (N % K) >= K)

if (N // 2) + (N % 2) >= K:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    int n=0;
    cin>>n;
    if(n==(double)(1)){
        cout<<(double)1;
        return 0;
    }

    if(n%2!=0){
        cout<<(double)(n/2+1)/n;
    }
    else
        cout<<(double)(n/2)/n;
    return 0;
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  string s[3];
  REP(i, 3) cin >> s[i];
  cout << s[0][0] << s[1][1] << s[2][2] << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6+7;
const ll mod = 1e9 + 9;
const int sz = 25;
#define afdafafafdafaf y1;
int n,m;
int ar[maxn];
char ch[maxn];
int main()
{
    scanf("%s", ch+1);
    ll k;
    scanf("%lld", &k);
    n = strlen(ch+1);
    int ins = 1;
    vector<int> v;
    for(int i=2;i<=n+1;i++){
        if(ch[i] != ch[i-1]){
            v.push_back(ins);
            ins = 1;
        }
        else{
            ins++;
        }
    }
    if(v.size() == 1){
        k *= n;
        printf("%lld\n", k/2);
        return 0;
    }
    if(ch[1] != ch[n]){
        ll ans = 0;
        for(int x:v){
            ans += x/2;
        }
        printf("%lld\n", ans * k);
        return 0;
    }
    ll ans = 0;
    for(int x:v){
        ans += x/2;
    }
    ans *= k;
    ans += (k - 1) * ((v[0] + v.back()) / 2 - v[0] / 2 - v.back() / 2);
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
import numpy as np
import sys

input = sys.stdin.readline

S = input()
Q = int(input())

left = []
right = []
rev = False

for i in range(Q):
    l = input().split()
    if l[0] == '1':
        rev = not rev
    else:
        if (l[1] == '1' and not rev) or (l[1] == '2' and rev):
            left.append(l[2])
        else:
            right.append(l[2])

S = ''.join(left[::-1]) + S + ''.join(right)

if rev:
    print(S[::-1].replace('\n',''))
else:
    print(S.replace('\n',''))


Measured memory_bytes: 15664
#include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=505;
int line[N][N];
int girl[N],used[N],a[N],b[N],c[N],d[N];
int n;
bool found(int x)
{
    for(int i=1; i<=n; i++)
    {
        if(line[x][i]&&!used[i])
        {
            used[i]=1;
            if(girl[i]==0||found(girl[i]))
            {
                girl[i]=x;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
    int x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d",&a[i],&b[i]);
    for(int i=1;i<=n;i++)
    	scanf("%d%d",&c[i],&d[i]);
    for(int i=1;i<=n;i++)
    	for(int j=1;j<=n;j++)
    		if(a[i]<c[j]&&b[i]<d[j])line[i][j]=1;
    int sum=0;
    for(int i=1; i<=n; i++)
    {
           memset(used,0,sizeof(used));
           if(found(i)) sum++;
    }
    printf("%d\n",sum);
}


Measured memory_bytes: 512
def insertionSort(data):
	for old in range(len(data)):
		new = old
		while new>0 and data[old]<data[max(0,new-1)]:
			new -= 1
		i = data.pop(old)
		data.insert(new,i)
		yield data

input()
data = [int(s) for s in input().split()]
[print(' '.join([str(i) for i in d])) for d in insertionSort(data)]

Measured memory_bytes: 7724
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        _n:usize,
        m:usize,
        mut war:[(usize,usize);m],
    }

    war.sort_by_key(|&(_l, r)| r);

    let mut now_right = 0;
    let mut ans = 0;

    for (l, r) in war {
        if l >= now_right {
            now_right = r;
            ans += 1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 5464
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int k,n,a[200005],res;


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

  cin>>k>>n;

  for(int i=0;i<n;i++){
        cin>>a[i];
  }  
  res=a[0]+k-a[n-1];

  for(int i=0;i<n-1;i++){
    res=max(a[i+1]-a[i],res);
  }

  cout<<k-res<<"\n";
  return 0;
    
}

Measured memory_bytes: 1024
using System;
using System.Linq;
class A
{
    static void Main()
    {
        while (true)
        {
            int n = int.Parse(Console.ReadLine());
            if (n == 0) { break; }
            ///
            int HUman = 0;
            double Abs = double.MaxValue;
            for (int i = 0; i < n; i++)
            {
                int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
                double mae = Math.Abs(s[2] / (double)((s[1] / (double)100) * (s[1] / (double)100) )- 22);
                if (mae < Abs) { Abs = mae; HUman = s[0]; }
            }
            Console.WriteLine(HUman);     
            //
        }


    }
}

Measured memory_bytes: 9700
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define Rep(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int
const int MAX = 510000;


using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    multiset<int> S;
    int a[n];
    rep(i, n){
        cin >> a[i];
    }
    //int ans = 1;
    reverse(a, a + n);
    //S.insert(a[0]);
    rep(i, n){
        auto ii = S.upper_bound(a[i]);
        if(ii == S.end()) S.insert(a[i]);
        else{
            S.erase(ii);
            S.insert(a[i]);
        }
    }
    cout << S.size() << endl;


    /*
    priority_queue<P, vector<P>, greater<P>> G;
    G.push(a[n - 1]);
    for(int i = n - 2; i >= 0; i --){
        priority_queue<P, vector<P>, greater<P>> G_1;
        bool update = false;
        while(!G.empty()){
            P c = G.top();
            G.pop();
            if(c.first > a[i].first){
                P jj; jj.first = a[i].first;
                jj.second = c.second;
                G.push(jj);
                while(!G_1.empty()){
                    P gg = G_1.top();
                    G.push(gg);
                    G_1.pop();
                }
                update = true;
                break;
            }else{G_1.push(c);
            }
        }
        if(!update){
            G.push(a[i]);
            while(!G_1.empty()){
                P gg = G_1.top();
                G.push(gg);
                G_1.pop();
            }break;
        }

    }
    cout << G.size() << endl;
    //cout << G.top().first << endl;*/
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
const int ms = 2e5+9;
string str;
int v1[ms],v2[ms];
int a,b,c,d,n;

int main(){
  cin >> n >> a >> b >> c >> d;
  a--;b--;c--;d--;  
  cin >> str;
  v1[a] = 1;
  v2[b] = 1;
  
  for(int i = 0;i<str.size();i++){
    int l = i + 1;
    int r = i + 2;
    if(v1[i]){
     if(l < str.size() and str[l]=='.')
    		v1[l] =1;
      if(r < str.size() and str[r] =='.')
        v1[r] =1;
      
    }
  }
  
  for(int i = 0;i<str.size();i++){
    int l = i + 1;
    int r = i + 2;
    if(v2[i]){
     if(l < str.size() and str[l]=='.')
    		v2[l] =1;
      if(r < str.size() and str[r] =='.')
        v2[r] =1;
    }
  }
  bool f = (v1[c] and v2[d]);
 // cout<<f<<endl;
  bool f2 = 0;
  if( c > d){
  for(int i = b;i<=d;i++){
    if(str[i]=='.' and str[i+1]=='.' and str[i-1]=='.')
    	f2 = 1;
  }
    f= f and f2;
  }
  if(f)
    cout<<"Yes";
	else
    cout<<"No";
  
  
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n+1;i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> vv;

int main(){
  int x,y,z;
  cin >> x >> y >> z;
  cout << (x-z)/(y+z) << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define LL long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)
#define YES "Yes"
#define NO "No"

using namespace std;

typedef pair<int, int> P;

class AStationAndBus {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        string s;
        cin >> s;
        cout << (s.compare("AAA") == 0 || s.compare("BBB") == 0 ? NO : YES);
    }
};

int main() {
	AStationAndBus solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	int n,W; cin >> n >> W;
	vector<llong> v(n),w(n);
	for(int i = 0; i < n; i++){
		cin >> w[i] >> v[i];
	}
	vector<vector<llong> > dp(2,vector<llong>(W+1, 0));
	vector<llong> &now = dp[0], &prev = dp[1];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < w[i]; j++){
			now[j] = prev[j];
		}
		for(int j = w[i]; j <= W; j++){
			now[j] = max(prev[j], prev[j-w[i]]+v[i]);
		}
		swap(now, prev);
	}
	llong ans = 0;
	for(auto e : prev)ans = max(ans, e);
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
    double w,h,x,y;
    scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
    if(x!=w/2.0)
    {double yy0=(-x)*(y-h/2.0)/(x-w/2.0)+y;
    double yy1=(w-x)*(y-h/2.0)/(x-w/2.0)+y;
    printf("%lf 0\n",w*(yy0+yy1)/2.0);}
    else if(y==h/2.0)
     printf("%lf 1\n",w*h/2.0);
    else printf("%lf 0\n",w*h/2.0);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int a[n];
    int b[n];
    int f=0;
    for(int i=0;i<n;i++){
        cin >>a[i];
        if(a[i]%2==0){
            if(a[i]%3!=0&&a[i]%5!=0){
                f=1;
            }
        }
        if(f==1)break;
    }
    if(f==1){
        cout<<"DENIED"<<endl;
        
    }else{
        cout<<"APPROVED"<<endl;
    }
    
}


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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    if (i % 3 == 0 || i % 5 == 0) continue;
    ans += i;
  }

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

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



int main() {
    int n;
    long int d;
    cin >> n >> d;
    
    vector<long int> x(n), y(n);
    rep(i,n) {
        cin >> x[i] >> y[i];
    }
    
    int cnt = 0;
    rep(i,n) {
        long int dx, dy;
        dx = x[i] * x[i];
        dy = y[i] * y[i];
        if(dx + dy <= d*d)
            cnt++;
    }
    
    cout << cnt << endl;
    
    
    return 0;
}




Measured memory_bytes: 6420