akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n;
  cin >> n;
    vector<long long> L(n+2);
  L[0] = 2;
  L[1] = 1;
  if(n == 0){
    cout << L[0] << endl;
  }else if(n == 1){
    cout << L[1] << endl;
  }else{
    for(int i=2;i<=n;i++){
      L[i] = L[i-1] + L[i-2];
    }
    cout << L[n] << endl;
  }
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

ll INF = (1ll<<60);
vector<pll> dir = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};


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

    ll H, W;
    cin >> H >> W;
    bool A[1010][1010];
    queue<pair<pll, ll>> qu;
    REP(i, H){
        REP(j, W){
            char tmp;
            cin >> tmp;
            if(tmp == '#'){
                A[i][j] = true;
                qu.push({{i, j}, 0});
            }else{
                A[i][j] = false;
            }
        }
    }
    ll res = -1;
    while(!qu.empty()){
        auto now = qu.front();
        qu.pop();
        res = max(now.second, res);
        REP(i, 4){
            ll nex = now.first.first + dir[i].first;
            ll ney = now.first.second + dir[i].second;
            ll nedist = now.second + 1;
            if(nex < 0 || nex > H-1 || ney < 0 || ney > W-1) continue;
            if(A[nex][ney]) continue;
            A[nex][ney] = true;
            qu.push({{nex, ney}, nedist});
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 25396
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;

const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 1000;
const int N = 150;

int dp[MAX+1][MAX+1];

int lcs(string X, string Y) {
	rep(i, X.size()+1) { rep(j, Y.size()+1) {
		if (i == 0 || j == 0)
			dp[i][j] = 0;
		else if (X[i-1] == Y[j-1])
			dp[i][j] = dp[i-1][j-1] + 1;
		else
			dp[i][j] = max(dp[i][j-1], dp[i-1][j]);
	} }
	return dp[X.size()][Y.size()];
}

int main() {
	int q; cin >> q;
	string X, Y;
	rep(i, q) {
		cin >> X >> Y;
		cout << lcs(X, Y) << endl;
	}
}



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

int main() {
	string S;
	cin >> S;
	int MAX = 0, now=0;
	for (char c : S) {
		if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
			now++;
			MAX = max(MAX, now);
		}
		else now = 0;
	}
	cout << MAX << endl;
}

Measured memory_bytes: 256
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define mp make_pair

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
    return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
    int sign = 1;
    T ret = 0;
    char c;

    do{
        c = getc();
    }while(c == ' ' || c == '\n');
    if(c == '-')sign = -1;
    else ret = c-'0';
    while(1){
        c = getc();
        if(c < '0' || c > '9')break;
        ret = 10*ret + c-'0';
    }
    return sign * ret;
}

inline void ini(int& x){
    x = getnum<int>();
}

inline void scani(int& x){
    scanf("%d",&x);
}

//end of macro

int n;
vii vec;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>n;
    REP(i,1,n){
        int a,b;
        cin>>a>>b;
        vec.pb(mp(b,a));
    }
    sort(vec.begin(), vec.end());

    int curr = 0;
    bool fail = false;
    FOR(i,vec.size()){
        curr += vec[i].S;
        if(curr > vec[i].F){
            fail = true;
        }
    }

    cout << (fail ? "No" : "Yes") << endl;

    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <ctime>


#ifndef M_PI
#define M_PI 3.141592653589
#endif
#define int long long
#define double long double
#define f(variable, start, end) for (int variable = start; variable < end; ++variable)
#define be(a) a.begin(), a.end()
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define nor cout << "NO\n"; return
#define yesr cout << "YES\n"; return
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>


using namespace std;


template<typename T, typename E>
vector<T> &operator>>(vector<T> &v, E a) {
    v.push_back(a);
    return v;
}

//pair output
template<typename E>
ostream &operator<<(ostream &os, pair<E, E> &t) {
    os << t.first << ' ' << t.second;
    return os;
}

//"map" pair output
template<typename E>
ostream &operator<<(ostream &os, pair<const E, E> &t) {
    os << t.first << ' ' << t.second;
    return os;
}

//vector output
template<typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
    for (T i : vec) {
        os << i << ' ';
    }
    return os;
}

//2 dimensional vector output
template<typename T>
ostream &operator<<(ostream &os, vector<vector<T> > &vec) {
    for (vector<T> i : vec) {
        os << i << '\n';
    }
    return os;
}

//vector<pair<T, E>> output
template<typename T, typename E>
ostream &operator<<(ostream &os, vector<pair<T, E>> &vec) {
    for (pair<T, E> i : vec) {
        os << i.first << ' ' << i.second << '\n';
    }
    return os;
}


int32_t main() {
    cin.tie(NULL);
    cout.tie(NULL);
    cout.setf(ios::fixed);
    cout.precision(10);
    ios_base::sync_with_stdio(false);
#ifdef TIME
    int32_t start = clock();
#endif

    int n, k, h;
    cin >> n >> k;
    vector<pair<int, int>> a(n);

    f(i, 0, n) {
        cin >> h;
        a[i] = {h, i + 1};
    }

    sort(be(a));

    int sum = 0;

    f(i, 0, k) {
        sum +=  a[i].first;
    }

    cout << sum;

#ifdef TIME
    cout << "\ntime: " << (clock() - start) / (CLOCKS_PER_SEC * 1.0);
#endif

    return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>

int main(void){
  long long int X, Y;
  scanf("%lld %lld", &X, &Y);
  long long int cnt = 1;
  long long int tmp = X;
  //printf("%lld\n", X);
  while (tmp*2 <= Y) {
    tmp = tmp*2;
    //printf("%lld\n", tmp);
    cnt++;
  }
  
  printf("%lld", cnt);
  return 0;
  
}


Measured memory_bytes: 128
x = int(input())
l = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313]

l = [ i for i in l if i < x]

m = [x % i for i in l]

while True:
    if not any(t == 0 for t in m):
        break
    m = [(i + 1) % l[n] for n, i in enumerate(m)]
    x += 1
print(x)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 1e9+7;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int n,k; cin >> n >> k;
  vi a(n); rep(i,n) cin >> a[i];
  int l = 0, r = INF;
  while(1 < r-l){
    int mid = (l+r)/2;
    auto f = [&](int x){
      ll cnt = 0;
      rep(i,n) cnt += (a[i]-1)/x;
      return cnt <= k;
    };
    if(f(mid)) r = mid;
    else l = mid;
  }
  cout << r;
  return 0;
}


Measured memory_bytes: 3880
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX = 1000, INF = 1e9;
int dp[MAX+1][MAX+1];

int main() {
  string str1, str2;
  cin >> str1 >> str2;

  int s1 = (int)str1.size(), s2 = (int)str2.size();

  rep(j,s2+1) dp[0][j] = j;
  rep(i,s1+1) dp[i][0] = i;
  
  for (int i = 1; i <= s1; ++i) {
    for (int j = 1; j <= s2; ++j) {
      int t = INF;
      if (str1[i-1] == str2[j-1]) t = min(t, dp[i-1][j-1]);
      else t = min(t, dp[i-1][j-1]+1);
      t = min(t, dp[i-1][j]+1);
      t = min(t, dp[i][j-1]+1);
      dp[i][j] = t;
    }
  }

  cout << dp[s1][s2] << endl;

  return 0;
}

Measured memory_bytes: 7136
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)&&islower(c));}

int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

signed main (){
    int n;cin>>n;
    vector<int> v(n);
    rep(i,0,n)cin>>v[i];
    int GCD=v[0];
    rep(i,1,n){
        int a=GCD;
        int b=v[i];
        if(a<b)swap(a,b);
        GCD=gcd(a,b);
    }
    cout<<GCD<<endl;
}
    
/*
00001
00110
00011

00122
*/


Measured memory_bytes: 1024
#[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)*}
    };
}

#[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::Write;

fn main() {
    input!{
      n: usize,
      ps: [usize; n],
    }
    let mut ps = ps;
    let mut ans = 0;
    for i in 0..n {
        if i+1 == ps[i] {
            ans += 1;
            if i < n-1 {
                ps[i] = ps[i+1];
                ps[i+1] = i+1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int K = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int count = 1;
        int flag = 0;   

        int Kbai = K;

        while (Kbai <= B) {
            if(Kbai >= A && Kbai <= B){
                flag = 1;
                break;
            }
            count += 1;
            Kbai = K*count;
        }

        if(flag == 1){
            System.out.println("OK");
        }else{
            System.out.println("NG");
        }
    }
}

Measured memory_bytes: 27036
// abc093_a
#include <iostream>
using namespace std;

template<class T> bool contain(const std::string& s, const T& v) {
  return s.find(v) != std::string::npos;
}

int main(int argc, char *argv[])
{
  string s;
  cin >> s;
  if(contain(s, 'a') && contain(s, 'b') && contain(s, 'c')){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
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, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
    input!{
        n: usize,
        x: i64,
        d: i64
    }
    if d == 0 {
        if x == 0 {
            println!("1");
        } else {
            println!("{}", n + 1);
        }
        return;
    }
    let g = gcd(x.abs() as usize, d.abs() as usize);
    let x = x / g as i64 * if d < 0 {-1} else {1};
    let d = d.abs() / g as i64;
    let mut map = HashMap::new();
    for i in 0..n as i64 + 1 {
        let m = (i * x % d + d) % d;
        let v = map.entry(m).or_insert(vec![]);
        v.push(((i * x - m) / d + i * (i - 1) / 2, 1));
        v.push(((i * x - m) / d + i * (2 * n as i64 - i - 1) / 2, -1));
    }
    let mut ans: usize = 0;
    for v in map.values() {
        let mut w = v.clone();
        w.sort_by(|x, y| if x.0 == y.0 {y.1.cmp(&x.1)} else {x.0.cmp(&y.0)});
        let mut s = 0;
        let mut c = 0;
        for &(p, f) in &w {
            if c == 0 {
                s = p;
            }
            c += f;
            if c == 0 {
                ans += (p + 1 - s) as usize;
            }
        }
    }
    println!("{}", ans);
}

fn gcd(n: usize, m: usize) -> usize {
    let mut l = min(n, m);
    let mut r = max(n, m);
    while l > 0 {
        let t = l;
        l = r % l;
        r = t;
    }
    r
}


Measured memory_bytes: 26824
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
4 3
2 3 1 4
)");
#define cin input
#endif

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

	cout << ((n - 2) / (k - 1) + 1) << endl;

	return 0;
}


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

ll X;
ll A_5fac = 0;
ll A, B;

ll mp(ll a, ll x){
  ll res = 1;
  for(int i = 0; i < x; i++) res *= a;
  return res;
}

int main(){
  cin >> X;

  long long uA = 0;  //Aの最大値
  while(mp(uA+1, 5) <= X) ++uA;

  for(int i = 0; i <= uA; i++){  //正:負
    ll xt = X % 10; //Xの末尾
    ll at = i % 10;
    ll bt;
    if(at < xt) bt = xt - at;
    else bt = (xt+10-at) % 10;

    while(mp(i, 5) + mp(bt, 5) < X) bt += 10;
    if(mp(i, 5) + mp(bt, 5) == X){ A = i; B = -bt; break; }
  }

  while(5 * mp(uA, 4) + 10 * mp(uA, 3) + 10 * mp(uA, 2)+ 5 * mp(uA, 1) + 1 <= X) ++uA;
  uA += 1;

  for(int i = 0; i <= uA; i++){
    ll xt = X % 10;
    ll at = i % 10;
    ll bt;
    if(at >= xt) bt = at - xt;
    else bt = 10 + at - xt;

    while(i > bt){
      if(mp(i, 5) - mp(bt, 5) < X) break;
      else if(mp(i, 5) - mp(bt, 5) == X){ A = i; B = bt; break; }
      else if(mp(i, 5) - mp(bt, 5) > X) bt += 10;
    }
  }


  cout << A << " " << B << endl;
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;

typedef complex<double> P;

struct L : public vector<P>{//???´???
    L(const P &a, const P &b){
        push_back(a);push_back(b);
    }
};

struct C{//???
    P c; double r;
    C(const P &c,double r): c(c),r(r){}
};

namespace std{//??????????????????
    bool operator < (const P& a,const P& b){
        return real(a)!= real(b) ? real(a) < real(b) : imag(a) < imag(b);
        //return imag(a) != imag(b) ? imag(a) < imag(b) : real(a) < real(b)
    }
    bool operator == (const P& a,const P& b){
        return a.real()==b.real()&&a.imag()==b.imag();
    }
}

double dot(P a,P b){
    return real(conj(a)*b);
}

double cross(P a,P b){
    return imag(conj(a)*b);
}

int ccw(P a, P b, P c){
    b-=a;c-=a;
    if(cross(b,c)>0)   return +1;// counter clockwise
    if(cross(b,c)<0)   return -1;// clockwise
    if(dot(b,c)<0)     return +2;// c-a-b on line
    if(norm(b)<norm(c))return -2;// a-b-c on line
    return 0;                    // a-c-b on lone
}

int main()
{
    double xp1,yp1,xp2,yp2;
    int q;
    int i,j;
    
    cin>>xp1>>yp1>>xp2>>yp2;
    cin>>q;
    
    P p1(xp1,yp1),p2(xp2,yp2);
    
    rep(i,q){
        double xp,yp;
        cin>>xp>>yp;
        P p(xp,yp);
        P t=dot(p2-p1,p-p1)/norm(p2-p1)*(p2-p1);
        P ans=p1+t;
        printf("%.10f %.10f\n",ans.real(),ans.imag());
    }
    
}

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

int main() {
int n;
  cin >> n;
  
  vector<vector<int>> xy(n,vector<int>(2));
  for(int i=0; i<n; i++){
  cin >> xy[i][0] >> xy[i][1];
  }

   vector<vector<long double>> a(n,vector<long double>(n));
  for(int j=0; j<n; j++){
    for(int k=0; k<n; k++){
      a[j][k]=sqrt((xy[j][0]-xy[k][0])*(xy[j][0]-xy[k][0]) + (xy[j][1]-xy[k][1])*(xy[j][1]-xy[k][1]));
    }
  }
  

  
  long double sum=0;
  for(int b=0; b<n; b++){
    for(int c=0; c<n; c++){
      sum=sum+a[b][c];
    }
  }
  
  
    cout << fixed << setprecision(15);
  
  cout << sum/n << endl;
  
}


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

using namespace std;

int main(){
        string str;
        cin>>str;
        int len=(int)str.length();
        if(str[0]==str[len-1]){
                len--;
        }
        if(len%2==0){
                cout<<"Second"<<endl;
        }
        else{
                cout<<"First"<<endl;
        }
        return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long long alla = 0,allb = 0,ope = 0;
    vector<long long> a(n),b(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        alla += a[i];
    }
    for(int i = 0;i < n;i++){
        cin >> b[i];
        allb += b[i];
        if(a[i] < b[i])ope += (b[i] - a[i] + 1) / 2;

    }
    if((allb - alla) < ope)cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    int N, P;
    cin >> N >> P;

    int odd=0;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        if (a & 1) {
            odd = 1;
            break;
        }
    }

    if (odd == 0 && P == 1) {
        cout << 0 << endl;
    }else if (odd == 0 && P == 0) {
        cout << (ll)pow(2, N) << endl;
    }else{
        cout << (ll)pow(2,N-1) << endl;
    }



    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
N = int(input())
s = sorted([sorted(list(input())) for i in [0]*N])

p = 1
i = 0
j = 1
ans = 0
while(j < N):
	if s[i]==s[j]:
		p += 1
		j = j + 1
	else:
		ans += p*(p-1)//2
		p = 1
		i = j
		j = j + 1
ans += p*(p-1)//2
print(ans)






Measured memory_bytes: 25344
// https://atcoder.jp/contests/abc170/tasks/abc170_a

#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define endl '\n' 

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

    for(int i = 1; i <= 5; i++) {
        int a;
        cin >> a;

        if(a==0) {
            cout << i << endl;
        }
    }   
}

Measured memory_bytes: 3516
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	int q;
	cin >> s >> q;
	deque<char> qu;
	for(int i = 0; i < s.length(); i++){
		qu.push_back(s[i]);
	}
	bool reversed = false;
	for(int i = 0; i < q; i++){
		int t;
		cin >> t;
		if(t == 1){
			reversed = !reversed;
		} else {
			int f;
			char c;
			cin >> f >> c;
			if((f == 1 && !reversed) || (f == 2 && reversed)){
				qu.push_front(c);
			} else {
				qu.push_back(c);
			}
		}
	}
	if(reversed){
		while(!qu.empty()){
			cout << qu.back();
			qu.pop_back();
		}
		cout << endl;
	} else {
		while(!qu.empty()){
			cout << qu.front();
			qu.pop_front();
		}
		cout << endl;
	}
}

Measured memory_bytes: 896
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);



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

	string S, T;
	cin >> S >> T;

	string U = S;
	while (1) {
		if (T == U) {
			cout << "Yes" << endl;
			return 0;
		}
		string V = U;
		V[0] = U[U.size() - 1];
		REP(i, 1, U.size())V[i] = U[i - 1];
		U = V;
		if (U == S)break;
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long n,k;
    cin >> n >> k;
    int val=1;
    for(int a = 0; a < n; a++)
    {
        if(val*2<val+k)
            val*=2;
        else
            val+=k;
    }
    cout << val;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n,i,x,min = 1000000,max = -1000000;
    long int sum=0;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        
        scanf("%d",&x);
        sum=sum+x;
        
        if(x>=max){
            max=x;
        }
        if(x<=min){
            min=x;
        }
    }
    printf("%d %d %ld\n",min,max,sum);
    return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
ll a,b,ans;
int c;
int main(){
	SF("%d",&c);
	while(c--){
		SF("%lld %lld",&a,&b);
		ll t=(ll)sqrt(a*b)-1;
		ans=t*2ll;
		if(a<=t)
			ans--;
		if(b<=t)
			ans--;
		if((t+1ll)*(t+2ll)<a*b){
			ans+=2;
			if(a==t+1ll||a==t+2ll)
				ans--;
			if(b==t+1ll||b==t+2ll)
				ans--;
		}
		else if((t+1ll)*(t+1ll)<a*b){
			ans++;
			if(a==t+1ll||b==t+1ll)
				ans--;
		}
		PF("%lld\n",ans);
	} 
}

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

using ll = long long;

int main() {
	ll n; cin >> n;
	vector<ll>a(n + 1); rep(i, n + 1) { cin >> a[i]; }
	vector<ll>b(n); rep(i, n) { cin >> b[i]; }

	ll c = 0;
	for (ll i = n; i >= 1; i--) {
		if (b[i - 1] > a[i]) {
			b[i - 1] -= a[i]; c += a[i];
			a[i] = 0;
			if (b[i - 1] > a[i - 1]) {
				b[i - 1] = 0; c += a[i - 1];
				a[i - 1] = 0;
			}
			else {
				a[i - 1] -= b[i - 1]; c += b[i - 1];
				b[i - 1] = 0;
			}
		}
		else {
			a[i] -= b[i - 1]; c += b[i - 1];
			b[i - 1] = 0;
		}
	}

	cout << c << endl;
}


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

long long mod = 1000000007;

int main(){
	string s;
	cin >> s;
	long long n = s.length();

	long long dp[13] = {0};
	long long _dp[13] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

	long long base = 1;
	
	for (long long i = n - 1; i >= 0; i--) {
		for (long long j = 0; j < 13; j++) {
			dp[j] = _dp[j];
			_dp[j] = 0;
		}
		
		if(s[i] == '?') {
			for (long long si = 0; si < 10; si++)
			{
				long long shift = (si * base) % 13;
				for (long long m = 0; m < 13; m++)
				{
					_dp[(m + shift) % 13] += dp[m];
					_dp[(m + shift) % 13] %= mod;
				}
			}
			
		} else {
			long long si = s[i] - '0';
			long long shift = (si * base) % 13;
			for (long long m = 0; m < 13; m++)
			{
				_dp[(m + shift) % 13] = dp[m];
			}
		}

		base = (base * 10) % 13;
	}
	

	cout << _dp[5] << endl;
	return 0;
}


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

using namespace std;
long long mod(long long x)
{
    return (x%(1000000007));
}
int main()
{
    long long n;
    cin>>n;
    long long pow10 = 1;
    long long pow9 = 1;
    long long pow8 = 1;
    long long ans;
    for(int i = 0;i<n;i++)
    {
        pow10 = mod(pow10*10);
        pow9 = mod(pow9*9);
        pow8 = mod(pow8*8);
    }
    ans = mod(pow10 + pow8 - 2*pow9);
    if(ans<0)
    {
        ans+=1000000007;
    }
    cout<<ans<<endl;
    return 0;
}


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

int data[121][121];
int dx[6] = {0,1,-1,1,-1,0};
int dy[6] = {1,1,0,0,-1,-1};
int check(int m,int i,int j){
	int ans = 0;
	for(int k = 0;k < 6;k++){
		if(i+dx[k] < 121 && i+dx[k] > -1 && j+dy[k] < 121 && j+dy[k] > -1){
			if(data[j+dy[k]][i+dx[k]] == 0){
				data[j+dy[k]][i+dx[k]] = m + 1;
				ans++;
			}
		}
	}
	return ans;
}
int main(){
	int t,n,x,y,result;
	while(1){
		cin >> t >> n;
		if(t == 0)break;
		result = 1;
		for(int i = 0;i < 121;i++){
			for(int j = 0;j < 121;j++){
				data[i][j] = 0;
			}
		}
		for(int i = 0;i < n;i++){
			cin >> x >> y;
			data[y+60][x+60] = -1;
		}
		cin >> x >> y;
		data[y+60][x+60] = 1;
		for(int m = 0;m < t;m++){
			for(int i = 0;i < 121;i++){
				for(int j = 0;j < 121;j++){
					if(data[j][i] == m+1){
						result += check(m+1,i,j);
					}
				}
			}
		}
		/*
		for(int i = 0;i < 61;i++){
			for(int j = 0;j < 61;j++){
				cout << data[j][i] <<" ";
			}
			cout << endl;
		}
		*/
		cout << result << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){ 
    ll n; cin >> n;
    ll dp[200000];
    rep(i, 200000)dp[i] = INFINITY;
    dp[0] = 0;

    rep(i, n + 1){
        rep(j , 7){
            ll m = pow(6, j);
            dp[i + m] = min(dp[i] + 1, dp[i + m]);
        }
        rep(j, 6){
            ll l = pow(9, j);
            dp[i + l] = min(dp[i] + 1, dp[i + l]);
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1920
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        
        if(a < b){
            System.out.println("a < b");
        }else if(a > b){
            System.out.println("a > b");
        }else{
            System.out.println("a == b");
        }
        
    }
 
}



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

int main(){
    int N;
    cin>>N;
    vector<int64_t> A(N),B(N);
    for(auto &a:A) cin>>a;
    for(auto &b:B) cin>>b;
    int64_t n=0;
    for(int i=0;i<N;i++){
        if(B[i]>=A[i]) n+=(B[i]-A[i])/2;
        else n+=B[i]-A[i];
    }
    if(n>=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] a_asArgs)
		{
			byte[][] l_aaiPattern = new byte[][] {
				new byte[] {0x00, 0x01},
				new byte[] {0x00, 0x01, 0x02},
				new byte[] {0x00, 0x01, 0x02, 0x04, 0x05},
				new byte[] {0x00, 0x01, 0x02, 0x04, 0x05, 0x08, 0x09, 0x0a},
				new byte[] {0x00, 0x01, 0x02, 0x04, 0x05, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12, 0x14, 0x15},
				new byte[] {0x00, 0x01, 0x02, 0x04, 0x05, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12, 0x14, 0x15, 0x20, 0x21, 0x22, 0x24, 0x25, 0x28, 0x29, 0x2a},
				new byte[] {0x00, 0x01, 0x02, 0x04, 0x05, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12, 0x14, 0x15, 0x20, 0x21, 0x22, 0x24, 0x25, 0x28, 0x29, 0x2a, 0x40, 0x41, 0x42, 0x44, 0x45, 0x48, 0x49, 0x4a, 0x50, 0x51, 0x52, 0x54, 0x55}
			};

			int[] l_aiInput = Console.ReadLine().Split(' ').Select(l_sItem => int.Parse(l_sItem)).ToArray();
			int l_iH = l_aiInput[0];
			int l_iW = l_aiInput[1];
			int l_iK = l_aiInput[2];

			if (l_iW == 1)
			{
				Console.WriteLine("1");
				return;
			}

			byte[] l_aiPattern = l_aaiPattern[l_iW - 2];

			uint[] l_aiUpper = new uint[l_iW];
			uint[] l_aiLower = new uint[l_iW];
			l_aiUpper[0] = 1;

			for (int l_iY = 0; l_iY < l_iH; l_iY++)
			{
				foreach (byte l_iPattern in l_aiPattern)
				{
					for (int l_iX = 0; l_iX < l_iW; l_iX++)
					{
						if (l_iX > 0 && (l_iPattern & (1 << l_iX - 1)) != 0)
						{
							l_aiLower[l_iX] += l_aiUpper[l_iX - 1];
						}
						else if (l_iX < l_iW - 1 && (l_iPattern & (1 << l_iX)) != 0)
						{
							l_aiLower[l_iX] += l_aiUpper[l_iX + 1];
						}
						else
						{
							l_aiLower[l_iX] += l_aiUpper[l_iX];
						}
						l_aiLower[l_iX] %= 1000000007;
					}
				}
				l_aiLower.CopyTo(l_aiUpper, 0);
				Array.Clear(l_aiLower, 0, l_iW);
			}
			Console.WriteLine(l_aiUpper[l_iK - 1]);
		}
	}
}


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

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int n;
    cin >> n;
    vector<long long> t(n);
    for (int i = 0; i < n; i++) {
        cin >> t.at(i);
    }

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

    long long l = t.at(0) / gcd(t.at(0), t.at(1)) * t.at(1);

    for (int i = 2; i < n; i++) {
        l = l / gcd(l, t.at(i)) * t.at(i);
    }

    cout << l << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,d;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b){
       d=a;
       a=b;
       b=d;
    }
    if(b>c){
        d=b;
        b=c;
        c=d;
    }
    if(a>b){
        d=a;
        a=b;
        b=d;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}


Measured memory_bytes: 2048
from sys import stdin

A = int(stdin.readline().rstrip())
B = int(stdin.readline().rstrip())

if A == 1:
    if B == 2:
        print(3)
        exit()
    else:
        print(2)
        exit()
elif A == 2:
    if B == 1:
        print(3)
        exit()
    else:
        print(1)
        exit()
else:
    if B == 1:
        print(2)
        exit()
    else:
        print(1)
        exit()


Measured memory_bytes: 3060
def read_input():
    n = int(input())
    hs = list(map(int, input().split()))

    return n, hs


# indexまでの要素で最大を求め、index目が>=か調べる
def check_max(hs, index):
    check_hs = hs[:index + 1]
    max_hight = max(check_hs)
    return hs[index] >= max_hight

if __name__ == '__main__':
    n, hs = read_input()

    count = 0
    for i in range(n):
        if check_max(hs, i):
            count += 1

    print(count)


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

bool g[100][100];

void clear(int n) {
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      g[i][j] = false;
    }
  }
}

void draw(int n) {
  int i = 0, j = 0, k = n-1;
  bool b = true;
  for (int l=0; l<n; l++) g[l][0] = true;
  while (k > 0) {
    if (b) {
      for (int l=0; l<k; l++) g[i][++j] = true;
      if (k>1) {
        for (int l=0; l<k; l++) g[++i][j] = true;
      }
    } else {
      for (int l=0; l<k; l++) g[i][--j] = true;
      if (k>1) {
        for (int l=0; l<k; l++) g[--i][j] = true;
      }
    }
    k -= 2;
    b = !b;
  }
}

void print(int n) {
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      putchar(g[i][j] ? '#' : ' ');
    }
    putchar('\n');
  }
}

int main() {
  int d, n;
  scanf("%d", &d);
  for (int i=0; i<d; i++) {
    scanf("%d", &n);
    if (i) putchar('\n');
    clear(n);
    draw(n);
    print(n);
  }
  return 0;
}

Measured memory_bytes: 1004
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 100000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	ll n;
	cin>>n;
	unordered_map<ll,ll> mp1, mp2;
	vector<ll> v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		if(mp1.find(v[i]) == mp1.end())
			mp1[v[i]] = 1;
		else
			mp1[v[i]]++;
	}
	ll sum=0;
	for(auto it: mp1)
	{
		mp2[it.fi] = it.se*(it.se-1)/2;
		sum += mp2[it.fi];
	}
	for(int i=0;i<n;i++)
        v[i] = sum-mp2[v[i]]+((mp1[v[i]]-1)*(mp1[v[i]]-2))/2;
	for(ll it: v)
		cout<<it<<"\n";
	return 0;
}

Measured memory_bytes: 16072
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ll n; cin >> n;
    ll num = n/11;
    if(n%11==0) cout << num*2 << endl;
    else if(n%11<=6) cout << num*2+1 << endl;
    else cout << num*2+2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int H,W,N,i,j,m,x;
  scanf("%d %d",&H,&W);
  scanf("%d",&N);
  int a[H*W];
  m=0;
  for(i=0;i<N;i++){
    scanf("%d",&x);
    for(j=0;j<x;j++){
      a[m]=i+1;
      m++;
    }
  }
  for(i=0;i<H;i++){
    if(i%2==0){
      for(j=0;j<W;j++){
	printf("%d ",a[i*W+j]);
      }
    }
    else{
      for(j=0;j<W;j++){
	printf("%d ",a[i*W-j+W-1]);
      }
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<cstring>
#include<string>
using namespace std;
map<int,int> s;
vector<int> v;
int main(){
    int n,ans;
    scanf("%d",&n);
    int num;
    for(int i=1;i<=n;i++){
        scanf("%d",&num);
        if(s[num]==0)v.push_back(num);
        s[num]++;
    }
    for(int i=0;i<v.size();i++)
		if(s[v[i]]>=v[i])ans+=s[v[i]]-v[i];
			else ans+=s[v[i]];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 5112
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
     
fn main() {
    let mut a: i64 = read();
    let mut b: i64 = read();
    let k: i64 = read();

	if a >= k {
		a = a - k
	} else {
		let diff = k - a;
		a = 0;
		if diff > b {
			b = 0;
		} else {
			b = b - diff;
		}
	}
	println!("{} {}", a, b);
}


Measured memory_bytes: 4352
n = int(input())
csf = [[int(i) for i in input().split()] for _ in range(n - 1)]


def get(i):
    ans = 0
    for c, s, f in csf[i:]:
        ans = max(ans, s)
        ans = (ans + f - 1) // f * f
        ans += c
    return ans


for i in range(n):
    print(get(i))


Measured memory_bytes: 40048
import java.util.*;

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

 int []a = new int[10];
 for(int i=0; i<a.length; i++){
  a[i] = s.nextInt();
}
 Arrays.sort(a);
 for(int i=9; i>6; i--){
  System.out.println(a[i]);
}
}
}

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

public class Main {
	public static void main(String[] args) throws Exception {

		int n;
		int m;
		int[] pArr = new int[1];

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String line;

			line = br.readLine();
			{
				String[] tokens = line.split(" ");
				n = Integer.parseInt(tokens[0]);
				m = Integer.parseInt(tokens[1]);
			}

			pArr = new int[n];
			for (int i = 0; i < n; i++) {
				pArr[i] = 0;
			}

			while ((line = br.readLine()) != null) {
				String[] tokens = line.split(" ");
				int a = Integer.parseInt(tokens[0]);
				int b = Integer.parseInt(tokens[1]);

				pArr[a - 1]++;
				pArr[b - 1]++;
			}
		}

		for (int i = 0; i < n; i++) {
			if (pArr[i] % 2 == 1) {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");
	}
}

Measured memory_bytes: 49436
from math import log10 as log

N = int(input())
A = [int(a) for a in input().split()]
ans = 1
if min(A) == 0:
    ans = 0
else:
    for a in A:
        ans *= a
        if ans > 10**18:
            ans = -1
            break
print(ans)    


Measured memory_bytes: 22672
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n); i++)

int main(){

    double D,T,S;
    cin>>D>>T>>S;

    if(D/T <= S)    cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
    
using namespace std;
int x,xx,xxx;
int main( ) {

    cin >> x;
    if (x>=500){
        xx = x/500;
        xxx= x%500/5;
        printf("%d", xxx*5+xx*2*500);
    }
    else{
        xxx = x/5;
        printf("%d", xxx*5);
    }
    return 0;
}

Measured memory_bytes: 256
/*************************************************************************
    > File Name: A.cpp
    > Author: HandsomeHow
    > Mail: handsomehowyxh@gmail.com 
    > Created Time: 2017/6/24 19:59:09
 ************************************************************************/

#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define cl(a) memset((a),0,sizeof(a))
#ifdef HandsomeHow
#define dbg(x) cerr << #x << " = " << x << endl
#else
#define dbg(x)
#endif
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1.0);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
ll gcd(ll a,ll b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
// (づ°ω°)づe★------------------------------------------------
const int maxn = 1e5+5;
ll fa[maxn];
ll calc(int x, int y){
    if(x<y)return 0;
    if(x-y>1)return 0;
    return (fa[x] * fa[y]) % mod;
}
int main(){
#ifdef HandsomeHow
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
#endif
    fa[1] = 1;
    rep(i,2,100000)fa[i]=(fa[i-1]*i)%mod;
    int n, m;
    gn(n);gn(m);
    printf("%lld\n",(calc(n,m) + calc(m,n))%mod);
    return 0;
}



Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

template<class T>
vector<bool> getPrimeTable(T max)
{
	vector<bool> table(max + 1);
	fill(table.begin(), table.end(), false);

	table[2] = true;

	for(T i = 3; i <= max; i++)
	{
		table[i] = true;
		for(T j = 2; j*j <= i; j++)
		{
			if(!(i % j))
			{
				table[i] = false;
				break;
			}
		}
	}

	return table;
}

int main()
{
	vector<bool> prime = getPrimeTable(50000);

	int n;
	while(cin >> n && n)
	{
		int res = 0;
		REP(i, 1, n / 2 + 1)
			if(prime[i] && prime[n-i])
				res++;
		cout << res << endl;
	}
}

Measured memory_bytes: 912
#include <stdio.h>

int main(void)
{
        int a, b, tmp;
        
        for (;;) {
                scanf("%d%d", &a, &b);
                if ( a == 0 && b == 0) break;
                if (a > b) {
                        printf("%d %d\n", b, a);
                } else {
                        printf("%d %d\n", a, b);
                }
        }
        return 0;
}

Measured memory_bytes: 600