akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> xy;
double eps = 1e-9;
double dot_product(xy a,xy b) {return (conj(a)*b).real();}
double cross_product(xy a,xy b) {return (conj(a)*b).imag();}
double dist_lp(xy a1,xy a2,xy p){
    if(dot_product(a2-a1,p-a1)<eps) return abs(p-a1);
    if(dot_product(a1-a2,p-a2)<eps) return abs(p-a2);
    return abs(cross_product(a2-a1,p-a1))/abs(a2-a1);
}
xy projection(xy p,xy b) {return b*dot_product(p,b)/norm(b);}
xy projection2(xy p1,xy p2,xy p){
    p -= p1; p2 -= p1;
    xy proj = projection(p,p2);
    return p1+proj;
}

bool is_online(xy a1,xy a2,xy p){
    return abs(a1-p)+abs(a2-p)<=abs(a1-a2)+eps;    
}

bool is_intersected(xy a1, xy a2, xy b1, xy b2){
    if(is_online(a1,a2,b1) || is_online(a1,a2,b2)) return true;
    if(is_online(b1,b2,a1) || is_online(b1,b2,a2)) return true;
    return (cross_product(a2-a1,b1-a1)*cross_product(a2-a1,b2-a1)<-eps) && 
    (cross_product(b2-b1,a1-b1)*cross_product(b2-b1,a2-b1))<-eps;
}

double dist_ll(xy a1,xy a2,xy b1,xy b2){
    if(is_intersected(a1,a2,b1,b2)) return 0;
    return min({dist_lp(a1,a2,b1),dist_lp(a1,a2,b2),dist_lp(b1,b2,a1),dist_lp(b1,b2,a1)
    ,abs(a1-b1),abs(a1-b2),abs(a2-b1),abs(a2-b2)});   
}

double area_of_polygon(vector<xy>& v){
    int n = v.size();
    double res = 0;
    for(int i=0;i+2<n;i++){
        res += cross_product(v[i+1]-v[0],v[i+2]-v[0]);
    }
    return res/2;
}

bool is_convex(vector<xy>& v){
    int n = v.size();
    for(int i=0;i<n;i++){
        xy a = v[i%n],b = v[(i+1)%n],c = v[(i+2)%n];
        if(cross_product(b-a,c-a)<-eps) return false;
    }
    return true;
}

int N;
vector<xy> v;
int main(){
    cin >> N;
    double x,y;
    for(int i=0;i<N;i++){
        cin >> x >> y;
        v.push_back(xy(x,y));
    }
    cout << (is_convex(v)? 1:0) << endl;
}


Measured memory_bytes: 3228
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	if (n <= 599) printf("8\n");
	else if (n <= 799) printf("7\n");
	else if (n <= 999) printf("6\n");
	else if (n <= 1199) printf("5\n");
	else if (n <= 1399) printf("4\n");
	else if (n <= 1599) printf("3\n");
	else if (n <= 1799) printf("2\n");
	else if (n <= 1999) printf("1\n");
}


Measured memory_bytes: 1604
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  
  sort(a.begin(), a.end());
  vector<int> b = {5, 5, 7};
  cout << ((a == b) ? "YES" : "NO") << endl;


  
  return 0;
}

Measured memory_bytes: 256
N, Y = list(map(int,input().split()))
def s():
    for i in range(N + 1):
        for j in range(N + 1):
            k = N - i - j
            if k >= 0 and 1000 * i + 5000 * j + 10000 * k  == Y:  print(k, j, i); return
    print(-1, -1, -1)
s()

Measured memory_bytes: 73192
import math
s = input()
n = int(input())

if len(set(s[:])) == 1:
    print(round(len(s) * n / 2.0))
else:
    current_ch = start_ch = s[0]
    end_ch = s[-1]
    counter = 1
    px = prev_max_len = 0

    for i in s[1:]:
        if i == current_ch:
            counter += 1
        else:
            if prev_max_len == 0:
                prev_max_len = counter

            current_ch = i
            px += math.floor(counter/2.0)
            counter = 1

    px += math.floor(counter/2.0)
    ans = px * n
    if start_ch == end_ch and prev_max_len % 2 == 1 and counter % 2 == 1:
        ans += n - 1

    print(ans)

Measured memory_bytes: 3064
fn main() {
    let x = read();
    let ans = solve(x);
    write(ans);
}

fn read() -> u64 {
    let mut l1 = String::new();
    std::io::stdin().read_line(&mut l1).ok();
    let x: u64 = l1.trim().parse().unwrap();

    x
}

fn write(x: u64) {
    println!("{}", x);
}

fn solve(x: u64) -> u64 {
    let mut y = 0u64;
    let mut a = 100u64;
    loop {
        y += 1;
        a += a / 100;
        if a >= x {
            break y
        }
    }
}

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

int main(){
    int n;cin>>n;
    deque<int> d;
    int tmp;
    for(int i=0;i<n;++i){
        cin>>tmp;
        if(i%2==0) d.push_back(tmp);
        else d.push_front(tmp);
    }
    if(n%2==0){
        for(int i=0;i<n;++i){
            tmp=d.front();
            d.pop_front();
            cout<<tmp;
            if(i!=n-1)cout<<" ";
        }
    }
    else{
        for(int i=0;i<n;++i){
            tmp=d.back();
            d.pop_back();
            cout<<tmp;
            if(i!=n-1)cout<<" ";
        }
    }
    cout<<endl;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n;
map<int, int> ma;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    FOR(i,1,n) {
        int x;
        cin >> x;
        ma[x]++;
    }
    int res = 0;
    FORALL(it, ma) {
        int cnt = it->SE;
        int val = it->FI;
        if (cnt >= val) res += cnt - val;
        else res += cnt;
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 4736
/*
[abc165] E - Rotation Matching
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

int N, M;

void solve() {
    for (int i = 0; i < M; i++) {
        int a = i + 1, b = N - i;
        if (N % 2 == 0 && i >= (M + 1) / 2) {
            a++;
        }
        cout << a << " " << b << endl;
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3636
import java.util.*;
import java.io.*;

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

    long n = sc.nextLong();
    long tmp = 1;
    String ans = "";

    while (true) {
      if ((n-tmp) % (tmp*(-2)) == 0) {
        ans += "1";
        n -= tmp;
      } else {
        ans += "0";
      }

      if (n == 0) break;
      tmp *= -2;
    }

    StringBuffer sb = new StringBuffer(ans);
		String dst = sb.reverse().toString();
		System.out.println(""+dst);
  }
}


Measured memory_bytes: 23764
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: u64,
        mov: [u64; 5],
    }
    let m = mov.iter().min().unwrap();
    let ans = (n + m - 1) / m + 4;

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


Measured memory_bytes: 4352
def main():
    b = input()
    argc = len(b)
    data = []
    for i in range(argc):
#       print(b[i])
      if (b[i]=='A'):
        data.append('T')
      elif (b[i]=='T'):
        data.append('A')
      elif (b[i]=='C'):
        data.append('G')
      else:
        data.append('C')
    result = ''.join(data)
    print(result)
main()


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, K, X[30], ANS = 0;
	static long long A[100000], B[100000];
	cin >> N >> K;
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
	long long P = (1 << 30) - 1 - K;
	for (int i = 0; i < 30; i++) X[i] = K % 2, K /= 2;
	for (int i = 0; i < N; i++) {
		if ((A[i] & P) == 0) ANS += B[i];
	}
	for (int i = 29; i >= 0; i--) {
		if (X[i] == 0) continue;
		long long Y[30] = {}, Z = 0, COUNT = 0;
		for (int j = 29; j > i; j--) Y[j] = 1 - X[j];
		Y[i] = 1;
		for (int j = 29; j >= 0; j--) Z *= 2, Z += Y[j];
		for (int j = 0; j < N; j++) {
			if ((A[j] & Z) == 0) COUNT += B[j];
		}
		ANS = max(ANS, COUNT);
	}
	cout << ANS << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int N_MAX = 200001;
int main()
{
  int n,i,t,m=1;
  string s[N_MAX];
  vector<string> v;
  cin >> n;
  for(i=0;i<n;i++)
    cin >> s[i+1];
  sort(s+1,s+n+1);
  for(i=0;i<n;i++){
    if(s[i+1]!=s[i]){
      t=1;
    }else{
      t++;
    }
    if(t>m){
      m=t;
      v.clear();
      v.push_back(s[i+1]);
    }else if(t==m){
      v.push_back(s[i+1]);
    }
  }
  for(i=0;i<v.size();i++)
    cout << v[i] << endl;
  return 0;
}

Measured memory_bytes: 15988
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        // cout << " " << *t++;
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

template <class T> using vec_alias = ::std::vector<T>;
template <template <class> class Container> class union_find {
  protected:
    class node_type;

  public:
    using container_type = Container<node_type>;
    using size_type = typename container_type::size_type;

  protected:
    class node_type {
      public:
        typename union_find::size_type parent;
        typename union_find::size_type size;
    };

    container_type tree;

  public:
    union_find() : tree() {}
    explicit union_find(const size_type size) : tree(size, {0, 1}) {
        for(size_type i = 0; i < size; ++i)
            tree[i].parent = i;
    }

    bool empty() const { return tree.empty(); }
    size_type size() const { return tree.size(); }

    size_type find(size_type x) {
        assert(x < size());
        while(tree[x].parent != x)
            x = tree[x].parent = tree[tree[x].parent].parent;
        return x;
    }
    bool same(const size_type x, const size_type y) {
        assert(x < size());
        assert(y < size());
        return find(x) == find(y);
    }
    size_type size(const size_type x) {
        assert(x < size());
        return tree[find(x)].size;
    }

    ::std::pair<size_type, size_type> unite(size_type x, size_type y) {
        assert(x < size());
        assert(y < size());
        x = find(x);
        y = find(y);
        if(x != y) {
            if(tree[x].size < tree[y].size) ::std::swap(x, y);
            tree[x].size += tree[y].size;
            tree[y].parent = x;
        }
        return {x, y};
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, t = 0;
    cin >> n >> m;
    union_find<vec_alias> uf(n + 1);
    vector<int> p(n + 1);
    rep(i, 1, n + 1) cin >> p[i];
    int x, y;
    rep(i, m) {
        cin >> x >> y;
        uf.unite(x, y);
    }
    rep(i, 1, n + 1) if(uf.same(i, p[i])) t++;
    cout << t << endl;
}


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

ll gcd(ll a, ll b) {
	if (!b)return a;
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll i = gcd(max(a, b), min(a, b));
	return i*(a / i)*(b / i);
}
int main() {
	ll a1, m1, a2, m2, a3, m3;
	while (cin >> a1 >> m1 >> a2 >> m2 >> a3 >> m3, a1) {
		ll a = a1, x = 1; while (a != 1) { a = (a*a1) % m1; x++; }
		ll b = a2, y = 1; while (b != 1) { b = (b*a2) % m2; y++; }
		ll c = a3, z = 1; while (c != 1) { c = (c*a3) % m3; z++; }
		cout << min(lcm(x, lcm(y, z)), min(lcm(y, lcm(x, z)), lcm(z, lcm(x, y)))) << endl;
	}
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int A,B;cin>>A>>B;
  
  if(max(A,B)==2&&min(A,B)==1){
    cout<<3<<endl;
  }
  else if(max(A,B)==3&&min(A,B)==2){
    cout<<1<<endl;
  }
  else{
    cout<<2<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>

using namespace std;

int main()
{
  int N, M;
  int a[60], b[60], c[60], d[60];
  int ans[60];
  int ans1[60];

  cin >> N >> M;
  
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  
  for (int j = 0; j < M; j++) {
    cin >> c[j] >> d[j];
  }

  for (int i = 0; i < N; i++) {
    ans[i] = abs(a[i] - c[0]) + abs(b[i] - d[0]);
    ans1[i] = 1;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 1; j < M; j++) {
      int foo = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (ans[i] > foo) {
	ans[i] = foo;
	ans1[i] = j + 1;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << ans1[i] << endl;
  }

  return 0;
  
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        n: usize,
        c: Chars
    };
    let mut c_r = 0;
    let mut c_w = 0;
    for &c_i in c.iter() {
        match c_i {
            'R' => c_r += 1,
            'W' => c_w += 1,
            _ => unreachable!(),
        }
    }
    let mut ans = 0;
    for (i, &c_i) in c.iter().enumerate() {
        if i < c_r && c_i == 'W' {
            ans += 1;
        }
    }

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


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
	int n,m;
	while(cin>>n>>m){
		int ans=0;
		for(int i=0;i<n;i++){
			int cnt=0;
			for(int j=0;j<m;j++){
				int x;
				cin>>x;
				cnt+=x;
			}
			ans=max(ans,cnt);
		}
		cout<<ans<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=2000005,INF=1<<30;

vector<int> prime;//i番目の素数
bool is_prime[MAX+1];

void sieve(int n){
    for(int i=0;i<=n;i++){
        is_prime[i]=true;
    }
    
    is_prime[0]=is_prime[1]=false;
    
    for(int i=2;i<=n;i++){
        if(is_prime[i]){
            prime.push_back(i);
            for(int j=2*i;j<=n;j+=i){
                is_prime[j] = false;
            }
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll A;
    string B;cin>>A>>B;
    ll C=(B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0');
    A*=C;
    A/=100;
    
    cout<<A<<endl;
    
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  if (b==0) return a;
  return gcd(b, a%b);
}
int main() {
  ll a, b;
  cin >> a >> b;
  cout << a*b/gcd(a, b) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,d,x,y;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	x=0;
	y=0;
	while(1){
		c=c-b;
		if(c<=0) break;
			x++;
		a=a-d;
		if(a<=0) break;
			y++;
	}
	if(x>y) printf("No\n");
	else printf("Yes\n");
	return 0;
}


Measured memory_bytes: 1580
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> sum = new List<int>();
            for (int i = 0; i > -1; i++)
            {
                string line = Console.ReadLine();
                if (int.Parse(line[0].ToString()) == 0)
                {
                    break;
                }
                else
                {
                    int number = 0;
                    for (int j = 0; j < line.Length; j++)
                    {
                        number += int.Parse(line[j].ToString());
                    }
                    sum.Add(number);
                }
            }

            foreach (int item in sum)
                Console.WriteLine(item);                    
        }

    }
}


Measured memory_bytes: 15980
#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <algorithm>
#include <array>
#include <string.h>
#include <vector>



int main() {
	int N,M,X;
	scanf("%d %d %d", &N,&M,&X);

	int Ai[200] = {0};

	int tmp;
	for (int i = 0; i < M; i++) {
		scanf("%d", &tmp);
		Ai[tmp] = 1;
	}

	
	int cost1, cost2;
	cost1 = 0;
	cost2 = 0;
	//+houkou
	for (int i = X; i < N; i++) {
		cost1 += Ai[i];
	}

	//-houkou
	for (int i = X; i > 0; i--) {
		cost2 += Ai[i];
	}

	int kekka = std::min(cost1,cost2);

	printf("%d", kekka);

	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::{i32, i64, i128, u32, u64, u128, f64};
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use proconio::marker::{Isize1, Usize1, Bytes, Chars};

#[proconio::fastout]
fn main() {
    proconio::input!{
        n: usize,
        mut arr: [i64; n],
    }
    let m = n - 2;
    arr.sort();
    arr.reverse();
    let mut ans = arr[0];
    for i in 1..=m / 2 { ans += arr[i] * 2; }
    if m % 2 == 1 { ans += arr[(m / 2) + 1]; }
    println!("{}", ans);
}


Measured memory_bytes: 6276
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void InsertionSort(vector<int> &A, int g, int &cnt)
{
    for (int i = g; i < A.size(); i++)
    {
        int v = A.at(i);
        int j = i - g;

        while (j >= 0 && A.at(j) > v)
        {
            A.at(j + g) = A.at(j);
            j = j - g;
            cnt++;
        }
        A.at(j + g) = v;
    }
}
vector<int> sequence_g(int n)
{
    vector<int> G;
    G.push_back(1);

    int next = G.back() * 3 + 1;
    while (next < n)
    {
        G.push_back(next);
        next = G.back() * 3 + 1;
    }
    reverse(G.begin(), G.end());

    return G;
}
vector<int> shellSort(vector<int> &A, int &cnt)
{
    vector<int> G = sequence_g(A.size());
    std::vector<int>::size_type m = G.size();
    for (std::vector<int>::size_type i = 0; i < m; i++)
    {
        InsertionSort(A, G.at(i), cnt);
    }

    return G;
}
int main()
{
    int N;
    int cnt = 0;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    vector<int> G = shellSort(A, cnt);
    cout << G.size() << endl;

    for (std::vector<int>::size_type i = 0; i < G.size() - 1; i++)
    {
        cout << G.at(i) << ' ';
    }

    cout << G.back() << endl;

    cout << cnt << endl;
    for (std::vector<int>::size_type i = 0; i < A.size(); i++)
    {
        cout << A.at(i) << endl;
    }
}


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

int main() {
    string S;
    cin >> S;
    int K = S.size();
    vector<vector<ll>> dp(K+1, vector<ll>(2, 0));
    dp[0][1] = 1;
    for (int i = 1; i <= K; i++) {
        int d = S[i-1]-'0';
        dp[i][0] = min(dp[i-1][0]+d, dp[i-1][1]+10-d);
        if (d <= 8) {
            dp[i][1] = min(dp[i-1][0]+d+1, dp[i-1][1]+9-d);
        }else {
            dp[i][1] = dp[i-1][1];
        }
    }
    cout << dp[K][0] << endl;
    return 0;
}

Measured memory_bytes: 55940
memo = dict()

def dp(n):
  if n == 0: return 1
  if n in memo: return memo[n]
  ans = 0
  mod = pow(10, 9) + 7
  for i in range(n-2):
    ans = (ans + dp(i)) % mod
  memo[n] = ans
  return ans

s = int(input())
ans = dp(s)
print(ans)

Measured memory_bytes: 67712
/* Simplicity and Goodness */

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

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B)
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int maxN = 2e5+2;


void solve()
{
    int n;
    scn(n);

    for(ll a = 1; a <= 3500; a ++) {
        for(ll b = 1; b <= 3500; b ++) {
            ll x = n * a * b;
            ll y = 4 * a * b - n * a - n * b;

            if(y > 0 and x % y == 0) {
                ll c = x / y;
                cout << a << ' ' << b << ' ' << c;
                exit(0); 
            }
        }
    }
}

int main()
{
    int t = 1;
    // scn(t);
    while(t --) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3676
#include<iostream>

using namespace std;
int main() {
	int num[100];
	int n;
	cin >>n;
	int count = 0;
	for (int i = 0; i < n; i ++) {
		cin >> num[i];
	}
	for (int i = 0; i <n ; i+=2) {
		if (num[i] % 2 != 0) {
			count++;
		}
	}
	cout << count;
}

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

int main(){
	int H, W;
	while(1){
		
	cin >> H >> W;
	if (H == 0 && W == 0)break;
	else{
		for (int i = 1; i <= H; i++){
			for (int j = 1; j <= W; j++){
				if (i % 2 == 0 && j % 2 == 0) cout << '#';
				if (i % 2 == 1 && j % 2 == 0) cout << '.';
				if (i % 2 == 0 && j % 2 == 1) cout << '.';
				if (i % 2 == 1 && j % 2 == 1) cout << '#';
			}
			cout << endl;
		}
		cout << endl;
	}
}

		return 0;
	}






Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <queue>

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

using namespace std;

int main() {
  while(1){
    int w,h;
    cin >> w >> h;
    if(!w) break;
    vector<vector<int>> s(h,vector<int>(w));
    for(int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        cin >> s[i][j];
      }
    }
    int c[4];
    for(int i = 0; i < 4; ++i) {
      cin >> c[i];
    }
    typedef vector<tuple<int,int,int>> edge;
    vector<vector<vector<edge>>> to(h,vector<vector<edge>>(w,vector<edge>(4)));
    vector<vector<vector<vector<int>>>> cost(h,vector<vector<vector<int>>>(w,vector<vector<int>>(4)));
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        int di[] = {1,0,-1,0};
        int dj[] = {0,1,0,-1};
        for (int k = 0; k < 4; ++k) {
          int ni=i+di[k];
          int nj=j+dj[k];
          if(ni<0||nj<0||ni>=h||nj>=w)continue;
          for (int l = 0; l < 4; ++l) {
            to[i][j][l].push_back(make_tuple(ni,nj,k));
            if ((l - k + 4) % 4 == s[i][j]) {
              cost[i][j][l].push_back(0);
            } else {
              cost[i][j][l].push_back(c[(l - k + 4) % 4]);
            }
          }
        }
      }
    }
    priority_queue<tuple<int,int,int,int>, vector<tuple<int,int,int,int>>, greater<tuple<int,int,int,int>>> q;
    q.push(make_tuple(0,0,0,1));
    vector<vector<vector<int>>> d(h,vector<vector<int>>(w,vector<int>(4,1000000000)));
    d[0][0][1] = 0;
    while(!q.empty()) {
      auto p = q.top(); q.pop();
      int c,i,j,k;
      tie(c,i,j,k) = p;
      if (c > d[i][j][k]) continue;
      for (int l = 0; l < to[i][j][k].size(); ++l) {
        int ni,nj,nk;
        tie(ni,nj,nk) = to[i][j][k][l];
        if (d[ni][nj][nk] > d[i][j][k] + cost[i][j][k][l]) {
          d[ni][nj][nk] = d[i][j][k] + cost[i][j][k][l];
          q.push(make_tuple(d[ni][nj][nk],ni,nj,nk));
        }
      }
    }
    int minc = 1000000000;
    for (int i = 0; i < 4; ++i) {
      minc = min(minc,d[h-1][w-1][i]);
    }
    cout << minc << endl;
  }
  return 0;
}

Measured memory_bytes: 1940
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1000000007;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define fs first
#define sc second
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

const int INF = 1e9;
const ll LLINF = 1e16;
 
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
 
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n;
    cin >> n;
    vector<string> s(n);
    map<string, ll> num;
    rep(i,n) cin >> s[i], num[s[i]]++;
    ll count = 0;
    for(auto x : num){
      chmax(count, x.sc);
    }
    for(auto x : num){
      if(x.sc == count) print(x.fs);
    }
}


Measured memory_bytes: 25472
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define in insert
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n, l;
    cin >> n >> l;
    int m = INF;
    int sum = 0;    
    forn(i, n) sum += l + i;
    int x;
    forn(i, n){
        if(m > abs((l+i))){
            m = abs((l+i));
            x = i;
        }
    }
    forn(i, n){
        if(x == i){
            cout << sum - l-i;
            return 0;
        }
    }
}

Measured memory_bytes: 256
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let a: Vec<usize> = sc.read_vec(n);

    let mut ans: usize = a[0] - 1;
    let mut hole: usize = 1;
    for i in 1..n {
        if a[i] == hole + 1 {
            hole += 1;
        } else {
            ans += (a[i] - 1) / (hole + 1);
        }
    }

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

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

int n, num1[100005], num2[100005];

map<int,int> A, B;

signed main(){
  
  cin>>n;
  
  for(int i=0;i<n;i++){
    cin>>num1[i];
    num2[i] = num1[i];
  }
  
  reverse( num2, num2 + n );
  
  vector<int> ans;
  
  int cnt = 0;
  
  for(int i=0;i<n;i++){
    
    if( A[num1[i]] < B[num1[i]] ) cnt--;
    else cnt++;
    
    A[num1[i]]++;
    
    if( B[num2[i]] < A[num2[i]] ) cnt--;
    else cnt++;

    B[num2[i]]++;
    
    if( cnt == 0 ) ans.push_back( i + 1 );
    
  }
  
  for(int i=0;i<ans.size();i++){
    if(i) cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  
  return 0;
}



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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d.at(i);
  int m;
  cin >> m;
  vector<int> t(m);
  rep(i, m) cin >> t.at(i);
  // 問題案を map<点数, 数量> に詰め替え
  map<int, int> mp;
  rep(i, n) {
    mp[d.at(i)]++;
  }
  // 足りているか確認
  bool ok = true;
  for (int u : t) {
    if (mp[u] > 0) {
      mp[u]--;
    } else {
      ok = false;
      break;
    }
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 11136
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 510000;
ll const MOD = 1000000007;

int main() {
    ll H, W;
    cin >> H >> W;
    vector<string> a(H);
    rep(i, H) cin >> a[i];

    vector<string> ans;
    rep(i, H) {
        bool is_h = true;
        rep(j, W) {
            if (a[i][j] != '.') {
                is_h = false;
                break;
            }
        }

        if (!is_h) {
            // cout << a[i] << endl;
            ans.push_back(a[i]);
        }
    }

    vector<ll> ex;
    rep(j, W) {
        bool is_w = true;
        rep(i, ans.size()) {
            if (ans[i][j] != '.') {
                is_w = false;
                break;
            }
        }

        if (is_w) {
            ex.push_back(j);
        }
    }

    rep(i, ans.size()) {
        rep(j, W) {
            bool is_show = true;
            rep(k, ex.size()) {
                if (ex[k] == j) {
                    is_show = false;
                    break;
                }
            }
            if (is_show) cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N;

int cnt[1000];

void solve(){
    map<string,vector<pint>>M;
    rep(i,N){
        string s;cin>>s;
        int a,b;
        scanf("%lld:%lld",&a,&b);
        char c;int d;
        cin>>c>>d;
        M[s].pb(pint(a*60+b,d-1));
    }
    memset(cnt,0,sizeof(cnt));
    for(auto &v:M){
        map<int,vint>MM;
        for(auto &p:v.se)MM[p.se].pb(p.fi);
        bool ex[60*24]={0};
        for(auto &vv:MM){
            if(vv.fi==-1){
                rep(i,vv.se.size()/2){
                    reps(j,vv.se[i*2],vv.se[i*2+1])ex[j]=true;
                }
            }
            else{
                rep(i,vv.se.size()/2){
                    reps(j,vv.se[i*2],vv.se[i*2+1])cnt[vv.fi]+=ex[j];
                }
            }
        }
    }
    cout<<*max_element(cnt,cnt+1000)<<endl;
}

signed main(){
    while(cin>>N,N)solve();
    return 0;
}

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

using namespace std;

int n, k;
int MAX = 999999999;
vector<int> hi, memo, dp;

int jump(int position)
{
  if (position > n)
    return MAX;
  if (position == n)
    return 0;
  if (memo[position] != -1)
    return memo[position];
  int le = MAX;

  for (int i = 1; i <= k; i++)
    if (position + i <= n)
      le = min(le, abs(hi[position] - hi[position + i]) + jump(position + i));

  if (le < 0)
    le = 0;

  memo[position] = le;
  return le;
}

int main()
{

  cin >> n >> k;
  hi.resize(n + 1);
  memo.resize(n + 1, -1);
  for (int i = 0; i < n; i++)
    cin >> hi[i + 1];
  cout << jump(1) << endl;

  return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto&& e : a) {
    cin >> e;
  }
  if (n == 1) {
    cout << a[0] << '\n';
    exit(0);
  }
  vector<int> v;
  for (int x = 0; x < 1 << n; ++x) {
    if (__builtin_popcount(x) >= 2) {
      v.push_back(x);
    }
  }
  int m = v.size();
  long long res = 1e10, sum = accumulate(begin(a), end(a), 0LL);
  auto dfs = [&](auto&& self, int pos, int bt) -> void {
    if (pos == m) {
      long long cur = sum;
      for (int i = 0; i < m; ++i) {
        if (bt >> i & 1) {
          cur -= __builtin_popcount(v[i]) - 1;
        }
      }
      res = min(res, cur);
      return;
    }
    self(self, pos + 1, bt);
    for (int i = 0; i < pos; ++i) {
      if (bt >> i & 1) {
        if (__builtin_popcount(v[i] & v[pos]) >= 2) {
          return;
        }
      }
    }
    vector<int> c(n);
    for (int i = 0; i <= pos; ++i) {
      if ((bt >> i & 1) or i == pos) {
        for (int j = 0; j < n; ++j) {
          c[j] += v[i] >> j & 1;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      if (c[i] > a[i]) {
        return;
      }
    }
    self(self, pos + 1, bt | 1 << pos);
  };
  dfs(dfs, 0, 0);
  cout << res << '\n';
}



Measured memory_bytes: 3216
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;

int main() {
    string s, t;
    cin >> s >> t;

    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());

    int length = min(s.size(), t.size());

    bool can = true;
    int countOfEqual = 0;
    rep(i, length) {
        if (s.at(i) < t.at(i)) {
            break;
        } else if(t.at(i) < s.at(i)){
            can = false;
            break;
        } else if (s.at(i) == t.at(i)) {
            countOfEqual++;
        }
    }

    if (countOfEqual == length) {
        if (t.size() <= s.size()) {
            can = false;
        }
    }

    string ans = can ? "Yes" : "No";

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(input()) for i in range(N)]

A.sort()
sum = 0
sum2 = 0

if N % 2 == 0:
    A1 = A[:(N//2)]
    A2 = A[(N//2):]
    for i in range(N//2):
        sum += A2[i] - A1[i]
        if i+1 != N//2:
            sum += A2 [i+1] - A1[i]

else:
    A1 = A[:(N//2)]
    A2 = A[(N//2)+1:]
    A3 = A[(N//2)]

    for i in range(N//2):
        sum += A2[i] - A1[i]
        if i+1 != N//2:
            sum += A2 [i+1] - A1[i]
    sum += A3 - A1[N//2 -1]

    sum2 += A2[0] - A3
    for i in range(N // 2):
        sum2 += A2[i] - A1[i]
        if i + 1 != N // 2:
            sum2 += A2[i + 1] - A1[i]

    if sum2 > sum:  sum = sum2

print(sum)

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


int main(){
    string S;
    cin >> S;
    int n = S.size();
    vector<int> ans(n);
    rep(ri, 2){
        {
            int cnt = 0;
            rep(i, n) {
                if (S[i] == 'R') cnt++;
                else {
                    ans[i] += cnt/2;
                    ans[i - 1] += (cnt + 1) / 2;
                    cnt = 0;
                }
            }
        }
        reverse(ans.begin(), ans.end());
        reverse(S.begin(), S.end());
        rep(i, n){
            if(S[i] == 'L') S[i] = 'R';
            else S[i] = 'L';
        }
    }
    for(int i = 0; i < n; i++){
        if(i) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    return 0;

    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include<bits/stdc++.h>
#include<string>
#include<stdlib.h>
#include<stdio.h>

typedef long long ll;
using namespace std; 
int main(){
	ll n,m;
	cin>>n>>m;
	vector<pair<ll,ll>> a(n);
	for(int i=0;i<n;i++){
		cin>>a[i].first>>a[i].second;
	}
	sort(a.begin(),a.end());
	ll ans=0;
	for(int i=0;i<n;i++){
		if(m==0){
			break;
		}
		ans+=(min(m,a[i].second)*a[i].first);
		m-=min(m,a[i].second);
		
	}
	cout<<ans;
}

Measured memory_bytes: 4824
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define ll long long
#define vi vector <int>
#define vvi vector <vector<int> >
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>=b;i--)
#define init(i,k) memset(i,k,sizeof i)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 998244353
#define PI 3.14159265359
inline ll add(ll a, ll b){ return ((a%MOD)+(b%MOD))%MOD;}
inline ll mul(ll a, ll b){ return ((a%MOD)*(b%MOD))%MOD;}
inline ll sub(ll a, ll b){ return ((a%MOD)-(b%MOD)+MOD)%MOD;}
// const int N = 1e5+7;
 
#define deb(x) {x}
#ifndef local
	#define deb(x) ;
#endif
///---------------------------------------------------------------

void solve()
{
	int r;cin>>r;
	cout<<2*PI*r<<endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	
	#ifdef local
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	clock_t qwertyuiop = clock();
	#endif
 
	int t=1;
	// cin>>t;
	rep(a,0,t)
	{
		// cout<<"Case #"<<a+1<<": ";
		solve();
	}

	// solve();
	
	#ifdef local
	{qwertyuiop = clock() - qwertyuiop;
	double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;
	cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "
	<<time_taken<<" seconds\n";}
	#endif
}

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

int main(){
   string S, T;
   int A, B;
   string U;
   cin >> S >> T;
   cin >> A >> B;
   cin >> U;

   if (U == S)
      cout << A-1 << " " << B << endl;
   else
      cout << A << " " << B-1 << endl;
}



Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (mapAccumL)
import Data.Maybe (catMaybes)

main :: IO ()
main = do
  let
    go :: Int -> [Int] -> Int
    go c (x : x' : xs) = go c' xs
      where
        (q, r) = c `divMod` x
        c' = q * x' + r
    go c _             = c
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    ((b, a), cs) = fmap catMaybes . mapAccumL step (False, 200) $ as :: ((Bool, Int), [Int])
      where
        step :: (Bool, Int) -> Int -> ((Bool, Int), Maybe Int)
        step (False, old) new | old < new = ((True, new), Just old)
                              | otherwise = ((False, new), Nothing)
        step (True, old)  new | new < old = ((False, new), Just old)
                              | otherwise = ((True, new), Nothing)
    cs' :: [Int]
    cs' | b         = cs ++ [a]
        | otherwise = cs
  print . go 1000 $ cs'

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3844
program marks
  implicit none
  integer :: n, k, a(200000) = 0, i
  read(*,*) n, k
  read(*,*) a(1:n)
  do i = k + 1, n
    write(*,'(a)') trim(merge('Yes', 'No ', a(i) > a(i - k)))
  end do
end program marks

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

using namespace std;

const int mod = 1e9 + 7;

int pw(int x, int y) {
    int r = 1;
    while (y) {
        if (y & 1) r = 1ll * r * x % mod;
        x = 1ll * x * x % mod;
        y >>= 1;
    }
    return r;
}
int inv(int x) {
    return pw(x, mod - 2);
}

int n;
vector <int> adj[200005];
int dad[200005];
int sz[200005];
int ans[200005];
int add = 1;

void dfs(int u) {
    sz[u] = 1;
    for (auto v: adj[u]) {
        if (v == dad[u]) continue;
        dad[v] = u;
        dfs(v);
        sz[u] += sz[v];
    }
    add = 1ll * add * inv(sz[u]) % mod;
}
void dfs2(int u) {
    ans[u] = add;
    for (auto v: adj[u]) {
        if (v == dad[u]) continue;
        int save = add;
        add = 1ll * add * sz[v] % mod;
        add = 1ll * add * inv(n - sz[v]) % mod;
        dfs2(v);
        add = save;
    }
}

int main(void) {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 1; i <= n; ++i) add = 1ll * add * i % mod;
    dfs(1);
    dfs2(1);
    for(int i=1;i<=n;i++)cout<<ans[i]<<"\n";
    return 0;
}

Measured memory_bytes: 16244
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;

	vector<int> vec(n);
	for (int i = 0; i < n; i++) {
		cin >> vec.at(i);
	}
	sort(vec.rbegin(), vec.rend());

	long long int ans = 0;
	for (int i = k; i < n; i++) {
		ans += vec.at(i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);


int main(){
  string s;
  cin >> s;
  if(s[0] == 'S') cout << "Cloudy" << endl;
  else if(s[0] == 'C') cout << "Rainy" << endl;
  else if(s[0] == 'R') cout << "Sunny" << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct query{
	int a,b,c,d;
} qu[51];
int n,m,q,a[21],b[21];
int main()
{
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++)
		cin>>qu[i].a>>qu[i].b>>qu[i].c>>qu[i].d;
	a[1]=1;
	for(int i=2;i<=n+1;i++)
		a[i]=0;
	for(int i=n+2;i<=m+n;i++)
		a[i]=1;
	for(int i=1;i<=n;i++)
		b[i]=1;
	int ans=0,res=0;
	for(int i=1;i<=q;i++)
		if(b[qu[i].b]-b[qu[i].a]==qu[i].c)
			ans+=qu[i].d;
	do{
		res=0;
		int cnt=0,tot=0;
		for(int i=1;i<=n+m;i++)
			if(a[i])
				tot++;
			else
				b[++cnt]=tot;
		for(int i=1;i<=q;i++)
			if(b[qu[i].b]-b[qu[i].a]==qu[i].c)
				res+=qu[i].d;
		ans=max(ans,res);
	}while(next_permutation(a+1,a+n+m+1));
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define pii pair<ll,ll>
#define pi pair<int ,int> 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i,a,n) for(int i=a;i>=n;i-- )
int main() {
          
         
         
         ll x,k;
         cin>>x>>k;
         x=x*500;
         if(x>=k)
         {
             cout<<"Yes";
         }
         else
         {
             cout<<"No";
         }
    return 0;
}

Measured memory_bytes: 256
N=int(input())
T,A=map(int, input().split())
H=list(map(int, input().split()))
idx=0
min=abs(A-T+H[0]*0.006)
for i in range(2,len(H)):
  tmp=T-H[i]*0.006
  dist=abs(A-tmp)
  if min > dist:
    min=dist
    idx=i
print(idx+1)

Measured memory_bytes: 3064