akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 100007

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front
// structure
#define ii pair<int, int>
#define iii pair<ii, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vi>

// get value
#define FF first
#define SS second

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

// const value
#define pi 3.14159265358979323846264338327950288419716939937510

using namespace std;

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T min(T a, T b, T c, T d) {
    return min(a, min(b, min(c, d)));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

template <class T>
T max(T a, T b, T c, T d) {
    return max(a, max(b, max(c, d)));
}

bool cmp(const ii& a, const ii& b) {return (a.FF > b.FF || (a.FF == b.FF && a.SS >= b.SS));}
ll GCD(ll a, ll b) {return (a%b) ? GCD(b, a%b) : b;}

const string namePro = "tmp";

int main() {
    string a, b;
    cin >> a >> b;

    if ((a.size() < b.size()) || (a.size() == b.size() && a < b)) cout << "LESS";
    else if (a == b) cout << "EQUAL";
    else cout << "GREATER";

    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int x;
  cin >> x;
  int sum = 0;
  while(x>=500){
    sum+=1000;
    x-=500;
  }
  while(x>=5){
    sum+=5;
    x-=5;
  }
  cout << sum << endl;
}






Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: chars,
    }
    for c in n {
        if c == '7' {
            return puts!("{}\n", "Yes");
        }
    }
    puts!("{}\n", "No");
}


Measured memory_bytes: 2168
#include <iostream>
#include <string>
#include <vector>
#include <cmath>


using namespace std;
int main()
{
	string rsp = "RSP";
	
	string t;
	int n, k,r,s,p;
	cin >> n >> k;
	
	
	cin >> r >> s >> p;


	cin >> t;

	for (int i = 0; i <n; i++) {
		if (t[i] == 'r') {
			t[i] = 'P';
		}
		else if (t[i] == 's') {
			t[i] = 'R';

		}
		else {
			t[i] = 'S';
		}

		if (i >=k&& t[i] == t[i - k]) {
			t[i] = ' ';
		}
	}

	

	
	int score = 0;
	for (int i = 0; i < n; i++) {
		if (t[i] == 'R') {
			//printf("R");
			score += r;
		}
		else if (t[i] == 'S') {
			//printf("S");
			score += s;
		}
		else if(t[i] == 'P'){
			//printf("P");
			score += p;
		}
	}
	
	std::cout << score << endl;
	
	return 0;


}

Measured memory_bytes: 512
import sys

N = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()
K = int(sys.stdin.readline())


temp = S[K-1]

ans = ""
for i in range(len(S)):
    if temp == S[i]:
        ans = ans + temp
    else:
        ans = ans + "*"

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	bool ans = true;
	for (int i = 0; i < n; ++i){
		int in;
		cin >> in;
		if (in % 2 == 0){
			if (in % 3 && in % 5){
				ans = false;
				break;
			}
		}
	}
	cout << (ans ? "APPROVED" : "DENIED");
}


Measured memory_bytes: 256
$d = [[[-1, -1], [0, -1], [1, -1], [1, 0], [0, 1], [-1, 0]],
      [ [-1, 0], [0, -1],  [1, 0], [1, 1], [0, 1], [-1, 1]]]
     
def bfs(fld, w, h)
  prt = (h+2).times.map{ [false]*(w+2) }
  arr = []
  arr << [0, 0]
  until arr.empty?
    y, x = arr.pop
    prt[y][x] = true
    $d[y%2].each do |dy, dx|
      u = y + dy; v = x + dx
      next if u < 0 || u > h+1 || v < 0 || v > w+1
      if !fld[u][v] && !prt[u][v] && !arr.include?([u, v]) then arr << [u, v]
      end
    end
  end
  (1..h).each do |k|
    (1..w).each do |m|
      fld[k][m] = true unless prt[k][m]
    end
  end
  fld
end

w, h = gets.split.map(&:to_i)
fld = Array.new(h+2)
(1..h).each{ |i| fld[i] = gets.split(" ") }
(1..h).map{ |i| (0...w).map{ |j| fld[i][j] = fld[i][j] == "1" ? true : false } }
fld[1,h].each{ |arr| arr.unshift(false); arr << false }
fld[0] = [false]*(w+2); fld[h+1] = [false]*(w+2)
fld = bfs(fld, w, h)
sum = 0
(1..h).each do |i|
  (1..w).each do |j|
    if fld[i][j]
      $d[i%2].each do |y, x|
        sum += 1 if !fld[i+y][j+x]
      end
    end
  end
end
p sum

Measured memory_bytes: 8940
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int h,w;
  cin >> h >> w;
  
  vector<string> cont(h);
  
  for(int i = 0 ; i < h ; i++){
      cin >> cont.at(i);
  }
  
  vector<bool> a(h,false);
  vector<bool> b(w,false);
  
  for(int i = 0 ; i < h ; i++){
    for(int j = 0 ; j < w ; j++){
      if(cont.at(i).at(j) == '#'){
        a.at(i) = true;
        b.at(j) = true;
      }
    }
  }
    
    for(int i = 0 ; i < h ; i++){
      if(a.at(i)){
        for(int j = 0 ; j < w ; j++){
          if(b.at(j)){
            cout << cont.at(i).at(j);
          }
        }
        cout << endl;
      }
    }
}

Measured memory_bytes: 256
// ================
// Himanshu Lal
// MNIT Jaipur
// ================
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define TEZ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define INF 1e18
#define vi vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp map<ll,ll>
#define test ll tp; cin>>tp; while(tp--)
#define srt(v) sort(v.begin(),v.end())
double pi=acos(-1);
void OJ(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
}
int main(){
    TEZ;
    long double a,b;
    cin>>a>>b;
    cout<<(ll)trunc(a*b);
}

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

int main() {
  int64_t N,ans=1;
  cin >> N;
  vector<int64_t> a(N);
  
  for(int i=0;i<N;i++){
    cin >> a.at(i);
    if(a.at(i)==0) ans=0;
  }
    for(int i=0;i<N;i++){
      if(ans!=0 && (a.at(i) > (int64_t(pow(10,18))/ans)) ) {
        //cout << int64_t(pow(10,18))/ans << endl;
        ans = -1;
        break;
      }
      ans = ans*a.at(i);
      if(ans>int64_t(pow(10,18))) {
        ans = -1;
        //cout << 2 << endl;
        break;
      }
    }

  cout << ans << endl;
}



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

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    
    int cnt = 1;
    int n;
    cin >> n;
    vector<int> arr;
    for (int i = 0; i < n; i ++){
        int t;
        cin >> t;
        arr.push_back(t);
    }


    int tmpMin = INT_MAX;
    for (int i = 0; i < arr.size() - 1; i ++) {
        if (tmpMin > arr[i])
            tmpMin = arr[i];
        
        if (arr[i + 1] <= tmpMin) {
            tmpMin = arr[i + 1];
            cnt ++;
        }
    }

    cout << cnt;

    return 0;
}

Measured memory_bytes: 1400
/* Coached by Dukkha */
#include <stdio.h>

#define N 100000

int check(char p, char o, char q, char a) {
	return ((o == 'S') == (a == 'o')) == (p == q);
}

char s[N + 1], t[N + 1];
int n;

int solve(char c1, char c2) {
	int i, sw = 'S' ^ 'W';

	t[0] = c1, t[1] = c2;
	for (i = 1; i < n - 1; i++)
		t[i + 1] = (t[i] == 'S') == (s[i] == 'o') ? t[i - 1] : t[i - 1] ^ sw;
	return check(t[n - 1], t[0], t[1], s[0]) && check(t[n - 2], t[n - 1], t[0], s[n - 1]);
}

int main() {
	scanf("%d%s", &n, s);
	printf("%s\n", solve('S', 'S') || solve('S', 'W') || solve('W', 'S') || solve('W', 'W') ? t : "-1");
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    string s;
    cin >> s;
    int N = s.size();
    bool res = true;
    rep(i, N){
        if(s[i] != s[N-1-i]) res = false;
    }
    rep(i, (N-1)/2){
        if(s[i] != s[(N-3)/2 - i]) res = false;
    }
    if(res) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

class LazySegTree {
 private:
  const ll def_val_ = 0;
  vl val_, lazy_;
  ll n_;

  ll comp(ll l, ll r) { return max(l, r); }

  ll getr(ll x, ll y, ll k, ll l, ll r) {
    if (y <= l || r <= x) return def_val_;

    // lazy evaluation
    eval(k, l, r);

    if (x <= l && r <= y) return val_[k];
    auto vl = getr(x, y, 2 * k + 1, l, (l + r) / 2);
    auto vr = getr(x, y, 2 * k + 2, (l + r) / 2, r);
    return comp(vl, vr);
  }

  void eval(ll k, ll l, ll r) {
    if (lazy_[k] != 0) {
      val_[k] += lazy_[k];
      if (r - l > 1) {
        // has children
        lazy_[2 * k + 1] += lazy_[k] / 2;
        lazy_[2 * k + 2] += lazy_[k] / 2;
      }
      lazy_[k] = 0;
    }
  }

  void add(ll x, ll y, ll v, ll k, ll l, ll r) {
    eval(k, l, r);
    if (y <= l || r <= x) return;
    if (x <= l && r <= y) {
      lazy_[k] += (r - l) * v;
      eval(k, l, r);
    } else {
      add(x, y, v, 2 * k + 1, l, (l + r) / 2);
      add(x, y, v, 2 * k + 2, (l + r) / 2, r);
      val_[k] = comp(val_[2 * k + 1], val_[2 * k + 2]);
    }
  }

 public:
  LazySegTree(ll size) {
    n_ = 1;
    while (n_ < size) n_ *= 2;
    val_ = vl(2 * n_, def_val_);
    lazy_ = vl(2 * n_, 0);
  }

  void update(ll i, ll v) {
    i += (n_ - 1);
    val_[i] = v;
    while (i > 0) {
      i = (i - 1) / 2;
      val_[i] = comp(val_[2 * i + 1], val_[2 * i + 2]);
    }
  }

  void addRange(ll x, ll y, ll v) { add(x, y, v, 0, 0, n_); }

  // get XXX value between [x,y)
  ll getRange(ll x, ll y) { return getr(x, y, 0, 0, n_); }
};

ll pos(pll& m) { return m.first; }

ll bomb(ll hp, ll a) {
  ll tmp = hp / a;
  if (hp % a) tmp++;
  return tmp;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, d, a;
  cin >> n >> d >> a;
  vector<pll> x;
  rep(i, n) {
    ll p, q;
    cin >> p >> q;
    x.push_back({p, q});
  }
  sort(ALL(x));
  map<ll, ll> p;
  ll idx = 0;
  rep(i, n) { p[x[i].first] = idx++; }
  LazySegTree st(n);
  rep(i, n) {
    ll idx = p[x[i].first];
    ll hp = x[i].second;
    st.update(i, hp);
  }
  ll ans = 0;
  rep(i, n) {
    ll ps = pos(x[i]);
    ll idx = p[x[i].first];
    ll hp = st.getRange(idx, idx + 1);
    if (hp < 0) continue;
    ll cnt = bomb(hp, a);
    ans += cnt;
    ll damage = a * cnt;
    map<ll, ll>::iterator it = p.upper_bound(ps + 2 * d);
    ll end = n;
    if (it != p.end()) end = it->second;
    st.addRange(idx, end, -damage);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 24556
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define out(x) cout << x << '\n'
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
//---------------------------------------------------------------------------------------------------
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
void solve()
{
  lli a = 0, b = 0, c = 0, h = 0, x, k, d, n = 0, w = 0, ans = 0, count = 0;
  string s = "", t = "";
  vector<pair<lli, lli>> pr;
  map<lli, lli> mp;
  set<lli> st;

  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> x >> k >> d;
  if (d <= abs(x) / k)
  {
    out(abs(x) - k * d);
  }
  else
  {
    count = abs(x) / d;
    a = abs(x) - (count * d);
    if (count % 2 == k % 2)
    {
      out(a);
    }
    else
    {
      b = abs(a - d);
      c = abs(a + d);
      if (b < c)
      {
        out(b);
      }
      else
      {
        out(c);
      }
    }
  }
}

//---------------------------------------------------------------------------------------------------
signed main()
{
  solve();
}

Measured memory_bytes: 3596
N, K = (int(x) for x in input().split())

S = [s for s in range(1, N+1)]
dS = []

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for j in A:
        if j in S:
            S.remove(j)
    
print(len(S))

Measured memory_bytes: 9196
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    sort(all(a));

    int ans = 1;
    rep(i, n) {
        if (a[i] == 0) {
            cout << 0 << endl;
            return;
        }
        if (ans > ll(1e18) / a[i]) {
            cout << -1 << endl;
            return;
        }
        ans *= a[i];
    }

    if (ans > ll(1e18))
        cout << -1 << endl;
    else
        cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3996
// Problem : B - Some Sums
// Contest : AtCoder - AtCoder Beginner Contest 083
// URL : https://atcoder.jp/contests/abc083/tasks/abc083_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

void solve()
{
	int n,a,b;cin>>n>>a>>b;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		string x=to_string(i);
		int sum=0;
		for(char c:x)
		sum+=(c-'0');
		if(sum>=a and sum<=b)
		ans+=i;
	}
	cout<<ans;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
int main() {
	int L;
	cin >> L;
	vector<long long> A(L);
	for (auto& x : A) cin >> x;

	vector<vector<long long>> a(L+1, vector<long long>(5));
	for (int i = 0; i < L; ++ i) {
		auto m = 1LL<<60;
		for (int j = 0; j < 5; ++ j) {
			m = min(m, a[i][j]);
			if (j == 0 || j == 4) {
				a[i+1][j] = m + A[i];
			} else {
				auto k = (A[i] + j + 1) % 2;
				if (A[i] == 0 && j%2 == 1) k = 2;
				a[i+1][j] = m + k;
			}
		}
	}
	/*for (int i = 0; i < L+1; ++ i) {
		for (int j = 0; j < 5; ++ j) {
			cerr << a[i][j] << " ";
		}
		cerr << endl;
	}*/
	auto r = 1LL<<60;
	for (int j = 0; j < 5; ++ j) r = min(r, a[L][j]);
	cout << r << endl;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int n,a;
	set<int> st;
	
	cin>>n;
	REP(i,n){
		cin>>a;
		st.insert(a);
	}
	print(st.size());
	return 0;
}


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



int main (){
    int N;
    string S;
    cin>>N>>S;
    int Size=N;
    for(int i=0; i<N-1;i++){
        if(S.at(i)==S.at(i+1)){
            Size --;
        }
    }
    cout<<Size<<endl;
}

Measured memory_bytes: 512
import math

N = int(input())
# A = list(map(int, input().split()))
A = [int(x) for x in input().split(' ')]


a_max = [0] * (N+1)
a_min = [0] * (N+1)
a = [0] * (N+1)

#１．可・不可の判定
# 最下段からとりうる個数の範囲を考える
#0段目の範囲に１が含まれないならば”不可”(根＝１)

for i in range(N+1):
    if i == 0:
        a_max[N-i] = A[N-i]
        a_min[N-i] = A[N-i]
    else:
        a_max[N-i] = a_max[N-i+1] + A[N-i]
        a_min[N-i] = math.ceil(a_min[N-i+1]/2) + A[N-i]

#check print
# for i in range(N+1):
#     print(str(i) + ':----')
#     print(a_min[i],a_max[i])

#最上段から個数のカウント
for i in range(N+1):
    if i == 0:
        a[i] = 1
    else:
        a[i] = min((a[i-1] - A[i-1])*2 , a_max[i])

#不可は-1を、可は個数の合計を
if a_min[0] > 1:
    print(-1)
else:
    print(sum(a))


Measured memory_bytes: 654684
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <sstream>
#include <bitset>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","r",stdin);
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
    {
        printf("Yes\n");
    } else
    {
        printf("No\n");
    }

    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

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

	vector<int> v(N);
	double a = 0;

	for (int i = 0; i < N; i++) {
		int n;
		cin >> n;
		a += (double)1 / n;
	}

	double ans = 1 / a;

	cout << fixed << setprecision(10) << ans << endl;
}

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

    cout << bitset<32>(x) << endl;
    cout << bitset<32>(~x) << endl;
    cout << bitset<32>(x<<1) << endl;
    cout << bitset<32>(x>>1) << endl;

    return 0;
}


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

#define int long long 
#define dou double 
#define endl "\n"

const int MOD=1e9+7;

void solve()
{
	int i,n,k,sum=0;
	cin >> n >> k;
	vector<int> v(n);
	for(i=0;i<n;i++)
		cin >> v[i];
	sort(v.begin(),v.end());
	for(i=0;i<k;i++)
		sum += v[i];
	cout << sum << endl;
}

main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	solve();
	return 0;
}

Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define MAXN 1000002
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod=1e9+7;

void solve()
{
  int k;
  string str;
  cin>>k>>str;
  int n=str.length();
  if(n<=k)
  cout<<str;
  else
  {
    string res="";
    for(int i=0;i<k;i++)
    res+=str[i];
    res=res+"...";
    cout<<res<<endl;
  }
}

int main()
{
  fastio
  solve();
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
typedef long long ll;
typedef long double ld;
#define trace(x)  cerr << #x << ": " << x << endl;
const ll N=1e15+5;
ll n;
int main()
{
	fast;
	cin>>n;vector<ll> vec;
	while(n>0)
	{
		vec.push_back(n%26);
		if(n%26)n/=26;
		else {n/=26;n--;}
	}
	reverse(vec.begin(),vec.end());
	for(ll i=0;i<(ll)vec.size();i++)
	{
		ll z=vec[i];if(!z)z=26;
		cout<<char('a'+z-1);
	}

	
}

Measured memory_bytes: 3592
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  string s,t;
  cin >> s >> t;
  sort(all(s));
  sort(all(t));
  reverse(all(t));
  for(int i=0;i<min(s.size(),t.size());i++){
    if(s[i]<t[i]){
      cout << "Yes" << endl;
      return 0;
    }
    else if(t[i]<s[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s.size()<t.size()){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }


return 0;
}
///....


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int, int> pi;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MKP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
const int INF = 999999;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll MOD = 1000000007;

ll n, k,ans=0;
int main(){   
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>n>>k;
  if(2*n<k){
    cout<<0<<endl;
    return 0;
  }
  if(k%2==1){
    long long p=n/k;
    ans=p*p*p;
  }
  else{
    long long p=(n-k/2)/k+1;
    long long q=n/k;
    ans=p*p*p+q*q*q;
  }
  cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"container/list"
	"fmt"
)

func main() {
	var n, k int
	var s string
	fmt.Scan(&n, &k, &s)

	itemList := list.New()
	cur := &Item{s: s[0], cnt: 1}
	itemList.PushBack(cur)

	for i := 1; i < n; i++ {
		if cur.s == s[i] {
			cur.cnt++
		} else {
			cur = &Item{s: s[i], cnt: 1}
			itemList.PushBack(cur)
		}
	}

	// fmt.Println(listToString(itemList))
	// dumpList(itemList)

	ce := itemList.Front()
	for e := ce.Next(); e != nil; e = ce.Next() {
		item1 := ce.Value.(*Item)
		item2 := e.Value.(*Item)
		item1.cnt += item2.cnt
		itemList.Remove(e)

		e3 := ce.Next()
		if e3 != nil {
			item3 := e3.Value.(*Item)
			item1.cnt += item3.cnt
			itemList.Remove(e3)
		}

		k--
		if k == 0 {
			break
		}
	}

	// fmt.Println(listToString(itemList))
	// dumpList(itemList)

	ans := 0
	for e := itemList.Front(); e != nil; e = e.Next() {
		item := e.Value.(*Item)
		ans += item.cnt - 1
	}
	fmt.Println(ans)
}

// Item .
type Item struct {
	s   byte
	cnt int
}

func dumpList(l *list.List) {
	for e := l.Front(); e != nil; e = e.Next() {
		it := e.Value.(*Item)
		fmt.Printf("{%s%d} ", string(it.s), it.cnt)
	}
	fmt.Println()
}

func listToString(l *list.List) string {
	s := ""
	for e := l.Front(); e != nil; e = e.Next() {
		item := e.Value.(*Item)
		for i := 0; i < item.cnt; i++ {
			s += string(item.s)
		}
	}

	return s
}


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

string s;
bool ch(int l,int r)
{
    while(l<r&&s[l]==s[r])
    {
        l++;
        r--;
    }
    return l>=r;
}
int main()
{
    cin>>s;
    int n=s.length();
    if(ch(0,n-1)&&ch(0,(n-1)/2-1)&&ch((n+3)/2-1,n-1))
        cout<<"Yes";
    else 
        cout<<"No";
}

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

using namespace std;

using ll = long long;

constexpr char endl('\n');

#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define INF 100000000000ULL

size_t d, g;

vector<size_t> p;
vector<size_t> c;

size_t dfs(size_t l, size_t n, size_t r, size_t res) {
    if (l == d) {
        if (res >= g) {
            return n;
        }
        else {
            size_t res1 = res + (p.at(r) - 1) * (r + 1);
            if (res1 >= g) {
                size_t i = p.at(r);
                while (res1 >= g) {
                    i--;
                    res1 -= r + 1;
                }
                return n + i;
            }
            else {
                return INF;
            }
        }
    }
    else {
        size_t res1 = dfs(l + 1, n, l, res);
        size_t res2 = dfs(l + 1, n + p.at(l), r, res + p.at(l) * (l + 1) + c.at(l));
        return min(res1, res2);
    }
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    cin >> d >> g;
    g /= 100;
    p.resize(d);
    c.resize(d);

    REP(i, d) {
        cin >> p.at(i) >> c.at(i);
        c.at(i) /= 100;
    }

    cout << dfs(0, 0, 0, 0) << ::endl;

    return 0;
}


Measured memory_bytes: 256
using System;

public class nine
{
	static public void Main(string[] args)
	{
		string input = Console.ReadLine();
		char[] hoge = new char[3];
		int[] num = new int[3];

		for(int i = 0; i < 3; i++)
		{
			hoge[i] = input[i];

			num[i] = (int) char.GetNumericValue(hoge[i]);
		}

		for(int t = 0; t < 3; t++)
		{
			if(num[t] == 1)
			{
				num[t] = 9;

				//Console.Write(num[t]);
			}
			else if(num[t] == 9)
			{
				num[t] = 1;

				//Console.Write(num[t]);
			}
		}


		foreach(int s in num)
		{
			Console.Write(s);
		}

		

		return;
	}
}

Measured memory_bytes: 13268
//#define NDEBUG

#include <bits/stdc++.h>
#include <bits/extc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define mp(a, b) make_pair(a, b)
#define F first
#define S second
#define mt make_tuple
#define gt(t, i) get<i>(t)
#define iceil(a, b) ((a + b - 1) / b)
#define tomax(a, b) (a = max(a, b))
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}

//#define TEST

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tiii = tuple<int, int, int>;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.F << ',' << p.S << ')';
}

int main(){
    StarBurstStream

    ll n;
    cin >> n;
    n--;

    ll tmp = 1, sum = 0;
    while(sum + tmp * 26 <= n) tmp *= 26, sum += tmp;
    if(tmp > 1 && n > 1) n -= sum;
//    cerr << tmp << " " << sum << ' ' << n << "\n";

    string ans;
    do{
        ans += 'a' + n % 26;
        n /= 26;
        tmp /= 26;
    }
    while(tmp >= 1);
    reverse(iter(ans));
    cout << ans << "\n";

    return 0;
}

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

#include <algorithm>
#include <array>
#include <cmath>
#include <cstring>
#include <iostream>
#include <numeric>
#include <string>
#include <utility>
#include <vector>

int gcd(int x, int y) {
  x = std::abs(x); y = std::abs(y);
  int a = std::max(x,y), b = std::min(x,y);
  int r = a % b;
  while(r!=0){ a = b; b = r; r = a % b; }
  return b;
}

long long lcm(int x, int y) {
  return (long long)x * y / gcd(x, y);
}

int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  std::vector<std::pair<int, int>> cities(M);
  for (int i = 0; i < M; ++i) {
    scanf("%d %d", &(cities[i].first), &(cities[i].second));
  }
  std::vector<std::pair<int, int>> sorted(cities);
  sort(sorted.begin(), sorted.end());
  int c = 0, n = 0;
  std::vector<std::pair<int, int>> ids(M);
  for (int i = 0; i < M; ++i) {
    if (sorted[i].first != c) {
      c = sorted[i].first;
      n = 0;
    }
    ids[i].first = c; ids[i].second = ++n;
  }
  for (int i = 0; i < M; ++i) {
    std::vector<std::pair<int, int>>::iterator it = std::lower_bound(sorted.begin(), sorted.end(), cities[i]);
    int idx = it - sorted.begin();
    printf("%06d%06d\n", ids[idx].first, ids[idx].second);
  }

  return 0;
}

Measured memory_bytes: 3840
#include <stdio.h>
#include <math.h>
int main(){
  int a, b, c, d, l, z ;
  int e, f;
  scanf("%d %d %d %d %d", &l, &a, &b, &c, &d);
  e = ceil((double)a/(double)c);
  f = ceil((double)b/(double)d);
  if(e>=f){
   z = l-e;
  }else{
     z =l-f;
  }
  printf("%d\n", z);
  return 0;
}

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

int a[10001];

int main(){
	double num = 0,minn;
	int mini,n,m,i,j,k,t,s;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		num += a[i];
	}
	num = num / (int)n;
	mini = 0;minn = abs(a[0]-num);
	for(i=1;i<n;i++){
		double nn = abs((double)a[i]-num);
		if(nn<minn){
			minn = nn;
			mini = i;
		}
	}
	printf("%d",mini);
	return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

void main() {
    string s;

    void input() {
        s = readln.chomp;
    }
    void solve() {
        auto t = s.map!((c)=> cast(int)(c - '0')).array;
        int x = 0;
        while (t.length > 1) {
            int a = t.back; t.popBack;
            int b = t.back; t.popBack;
            int c = a + b;
            if (c >= 10) {
                t ~= 1;
                c -= 10;
            }
            t ~= c;
            x++;
        }
        writeln((x % 2 == 0 ? "Audrey" : "Fabre"), " wins.");
    }

    int T; scanf("%d\n", &T);
    foreach (t; 0 .. T) {
        input; solve;
    }
}

Measured memory_bytes: 3084
#include <iostream>
#include <set>

using namespace std;
typedef pair<int, int> P;
static const int INF = 1e9;

void solve()
{
	int a[2], c;
	cin >> a[0] >> a[1] >> c;
	if (a[0] >= c)
	{
		cout << c << endl;
		return;
	}
	set<P> Set;
	int diff = INF;
	int now = a[0];
	int cnt = 0;
	while (true)
	{
		int preDiff = diff;
		diff = c - now;
		if (Set.find(make_pair(diff, preDiff)) != Set.end())
		{
			cout << -1 << endl;
			return;
		}
		Set.insert(P(diff, preDiff));
		while (now < c)
		{
			++cnt;
			now += a[cnt % 2];
			if (now >= c)
			{
				if (cnt % 2 == 1)
				{
					break;
				}
				else
				{
					cout << c << endl;
					return;
				}
			}
		}
		c += 60;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1200
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
int n,ans;
int read()
{
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
int cal(int x,int k)
{
	//cout<<"cal:"<<x<<' '<<k<<endl;
	if(x%k==0) return x/k;
	if(x<k) return 0;
	int b=(x%k)/(x/k+1);
	return cal(x-max(b,1)*(x/k+1),k);
}
int main()
{
	n=read();
//	for(int i=0;i<=n;i++)
//	{
//		if(i%k==0) cout<<"||";
//		cout<<cal(i,k)<<' ';	
//	}
ans=0;
	for(int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		ans^=cal(x,y);
	}
	if(ans==0) puts("Aoki");
	else puts("Takahashi");
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
#include<math.h>
#include <iomanip>  
using namespace std;
int main() {
	int n;
	string s, t;
	cin >> n >> s >> t;
	for (int i = 0; i < n; ++i) {
		cout << s[i] << t[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, p, maxp, maxv, d1, d2;
	while (cin >> n && n) {
		maxv = -1;
		for (int i = 0; i < n; i++) {
			cin >> p >> d1 >> d2;
			if (maxv < d1 + d2) {
				maxp = p;
				maxv = d1 + d2;
			}
		}
		cout << maxp << " " << maxv << endl;
	}
	return 0;
}

Measured memory_bytes: 2964
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

typedef pair<int, int> pp;
typedef pair<pp, int> ppp;
typedef pair<ppp, char> pppp;

const int W = 0, L = 1;

int main()
{
    int n;
    while(cin >> n && n)
    {
        vector<pppp> ans;
        REP(n)
        {
            int w = 0, l = 0, r = 0;
            char t; cin >> t;
            rep(j,n- 1)
            {
                cin >> r;
                if(r == W) w++;
                if(r == L) l++;
            }
            ans.push_back(pppp(ppp(pp(-w, l),i), t));
        }
        sort(all(ans));

        REP(n) cout << ans[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void){
    int a[1000];
    int n,i,j;
    scanf("%d\n",&n);
    for(i=0;i<n;i++){
        scanf("%d ",&a[i]);
    }
    for(j=n-1;j>=0;j--){
        printf("%d",a[j]);
        if(j!=0)printf(" ");
    }
    printf("\n");
    return 0;
}


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

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

    for(int i=0;i<3;i++){
        if(n.at(i)=='1') n.at(i)='9';
        else if(n.at(i)=='9') n.at(i)='1';
    }
    cout<<n<<endl;
}

Measured memory_bytes: 256
s = int(input())
done = set()
done.add(s)
cnt = 1
curr = s
while True:
  if curr % 2 == 0:
    curr = curr//2
    if curr in done:
      print(cnt+1)
      break
    done.add(curr)
  else:
    curr = curr * 3 + 1
    if curr in done:
      print(cnt+1)
      break
    done.add(curr)  
  cnt = cnt+1



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    double W,H,x,y; cin >> W >> H >> x >> y;
    long double ans = H*W/2;
    int ans2 = (x + x  == W && y + y == H ? 1 :0);
    cout << setprecision(9) << ans ;
    cout << " " << ans2;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long int n, count = 0;
    cin >> n;
    long long int h[n];
    for (int i = 0; i < n; i++){
      cin >> h[i];
    }
    if (n > 1){
    	for (int i=0;i<n-1;i++){
    		if (h[i-1]< h[i]||i==0){
    			h[i]--;
            }
    	}
    	for (int i = 0; i<n-1; i++){
    		if (h[i] > h[i+1]){
    			cout << "No";
    			count=1;
    			break;
            }
    	}
    	if (count==0)
    		cout << "Yes";
        
}
	else
      cout << "Yes" ;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void) {
  for(int i = 0; i < 10007; i++) {
    int x, y;
    cin >> x >> y;
    if(x == 0 && y == 0)
      break;
    cout << min(x, y) << " " << max(x, y) << endl;
  }
  return 0;
}



Measured memory_bytes: 2984