akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    rep(i,s.size()){
        if(i%2 == 0) cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n, k;
	cin >> n >> k;
	
	vector<ll> x(n);
	for(int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	
	int ans = 1e9;
	for(int i = 0; i < n - k + 1; ++i) {
		int l = x[i];
		int r = x[i + k - 1];
		int tmp;
		
		if( r < 0 ) { 
			tmp = -l;
		} 
		else if( l >= 0 ) {
			tmp = r;
		} 
		else {
			tmp = min(2 * (-l) + r, -l + 2 * r);
		}
		
		ans = min(ans, tmp);
	}

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


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;

VI v[100005];


struct UnionFind {
	vector<int> par;
	int cnt;
	UnionFind(int size_) : par(size_, -1), cnt(size_) { }
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (par[y] < par[x]) swap(x, y);
			par[x] += par[y]; par[y] = x;
			cnt--;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int find(int x) {
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}
	int size(int x) {
		return -par[find(x)];
	}
	int size() {
		return cnt;
	}
};

int main() {


	int n, m;
	cin >> n >> m;
	UnionFind uf(n);

	VI a(n);
	REP(i, n)cin >> a[i];

	REP(i, m) {
		int b, c;
		cin >> b >> c;
		uf.unite(b, c);
	}

	if (2 * (n - 1 - m) > n) {
		cout << "Impossible" << endl;
		return 0;
	}

	if (uf.size() == 1) {
		cout << 0 << endl;
		return 0;
	}
	

	

	REP(i, n) {
		v[uf.find(i)].push_back(a[i]);
	}
	REP(i, n) {
		sort(ALL(v[i]));
	}


	VI c, d;

	ll sum = 0;

	REP(i, n) {
		if (v[i].size() == 0)continue;
		REP(j, v[i].size()) {
			if (j == 0) {
				c.push_back(v[i][j]);
				sum += v[i][j];
			}
			else d.push_back(v[i][j]);
		}
	}
	sort(ALL(d));

	int loop = uf.size() * 2 - 2;
	loop -= c.size();


	REP(i, loop) {
		sum += d[i];
	}

	cout << sum << endl;




}




Measured memory_bytes: 5756
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int>X(N);
    cin >> X;

    vector<int> Y(X);
    SORT(Y);

    int M1 = Y[N / 2 - 1];
    int M2 = Y[N / 2];

    REP(i, N) {
        if (X[i] < M2) {
            cout << M2 << endl;
        }
        else {
            cout << M1 << endl;
        }
    }
    return 0;

}

Measured memory_bytes: 3840
N = int(input())
Dams = list(map(int,input().split()))
sum = 0

for i in range(N):
    sum += Dams[i]

non1 = 0
for j in range(1,N // 2 + 1):
    non1 += 2 * Dams[2*j-1]

ans = [0 for i in range(N)]
ans[0] = sum - non1

for j in range(1,N):
    ans[j] = 2 * Dams[j-1] - ans[j-1]

for k in range(N):
    print(ans[k],end=" ")

Measured memory_bytes: 14028
N = gets.to_i
hs = gets.split.map(&:to_i)
$ans = 0

def zero_partition(x)
    list = []
    tmp = []
    x.each{|num|
        if num != 0
            tmp.push(num)
        else
            list.push(tmp) if tmp != []
            tmp = []
        end
    }
    list.push(tmp) if tmp != []
    return list
end

def loop(hs)
    min = hs.min
    tmp = hs.map{|x| x - min}
    $ans = $ans + min
    target = zero_partition(tmp)
    if target != []
        target.each{|arr|
            loop(arr)
        }
    end
end
loop(hs)
puts $ans


Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int n;
  cin>>n;
  long long a[3*n+1];//1-indexedで考える
  REPP(i,3*n){
    cin>>a[i];
  }
  
  long long fs[2*n+1];//n~2*nの範囲だけ使う
  long long bs[3*n+1];//(n+1)~(2*n+1)の範囲だけ使う
  
  priority_queue<long long,vector<long long>,greater<long long>> fq;
  priority_queue<long long> bq;
  
  fs[n] = 0;
  bs[2*n+1] = 0;
  REPP(i,n){
    fs[n] += a[i];
    fq.push(a[i]);
  }
  for(int i=2*n+1;i<=3*n;i++){
    bs[2*n+1] += a[i];
    bq.push(a[i]);
  }
  
  for(int i=n+1;i<=2*n;i++){
    if(fq.top()<a[i]){
      fs[i] = fs[i-1]+a[i]-fq.top();
      fq.pop();
      fq.push(a[i]);
    }else{
      fs[i] = fs[i-1];
    }
  }
  
  for(int i=2*n;i>=n+1;i--){
    if(bq.top()>a[i]){
      bs[i] = bs[i+1]-bq.top()+a[i];
      bq.pop();
      bq.push(a[i]);
    }else{
      bs[i] = bs[i+1];
    }
  }
  
  long long ans = -INF;
  for(int i=n;i<=2*n;i++){
    ans = max(ans, fs[i]-bs[i+1]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5876
#include<iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int a[N];
    double k=1.0;
    for(int i=0;i<N;i++){
        cin >> a[i];
        k = k+a[i];
    }
    double d=0.0;
    for(int i=0;i<N;i++){
        d = d + k/a[i];
    }
    cout << (k/d) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int A, B, C;

int main(void){
    
    scanf("%d %d %d", &A, &B, &C);
    
    if(A == B) printf("%d\n", C);
    else if(A == C) printf("%d\n", B);
    else printf("%d\n", A);
    
    return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


bool comp( int a, int b ) {
    if ( !(a % 10) ) return true;
    if ( !(b % 10) ) return false;
    return (10 - (a % 10)) < (10 - (b % 10));
}


int main() {

    vi abcde(5);
    fo(i, 5) cin >> abcde[i];

    sort(all(abcde), comp);
    int at = 0;

    fo(i, 5) {
        if ( at % 10 ) at += (10 - (at % 10));
        at += abcde[i];
        // cout << at << endl;
    }

    cout << at << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if (n == 2) {
        int a;
        cin >> a;
        cout << -1 << endl;
        return 0;
    }
    vector<int> a(n), b(n, -1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }
    b[0] = 0;
    priority_queue<int, vector<int>, greater<int>> pq;
    for (int i = 1; i < n; i++) pq.push(i);
    for (int i = 1; i < n - 1; i++) {
        int s = pq.top();
        pq.pop();
        int t = pq.top();
        if (a[b[i - 1]] == s) {
            b[i] = t;
            pq.pop();
            pq.push(s);
        } else {
            b[i] = s;
        }
    }
    int c = pq.top();
    pq.pop();
    if (a[b[n - 2]] != c) {
        b[n - 1] = c;
        for (int i : b) {
            cout << i + 1 << " ";
        }
        cout << endl;
        return 0;
    }
    int pos = n - 2;
    while (pos && a[b[pos - 1]] == c) pos--;
    if (pos == n - 2) {
        vector<int> x = {b[n - 3], b[n - 2], c};
        sort(x.begin(), x.end());
        do {
            if (a[b[n - 4]] == x[0] || a[x[0]] == x[1] || a[x[1]] == x[2]) continue;
            for (int i = 0; i < 3; i++) {
                b[n - 3 + i] = x[i];
            }
            break;
        } while (next_permutation(x.begin(), x.end()));
        for (int i : b) {
            cout << i + 1 << " ";
        }
        cout << endl;
        return 0;
    }
    vector<int> x;
    for (int i = pos; i < n - 1; i++) x.emplace_back(b[i]);
    b[pos] = c;
    sort(x.begin(), x.end());
    for (int i = pos + 1; i < n; i++) b[i] = x[i - pos - 1];
    if (a[c] == b[pos + 1]) swap(b[pos + 1], b[pos + 2]);
    for (int i : b) {
        cout << i + 1 << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 2552
fun main(args: Array<String>) {
    val (h, w) = readLine()!!.split(' ').map(String::toInt)
    val a = Array(h) { readLine()!! }.filterNot { it.all { it == '.' }}
    val b = (0 until w).filterNot { x -> a.all { it[x] == '.' }}
    a.forEach { row ->
        b.forEach { print(row[it]) }
        println()
    }
}


Measured memory_bytes: 37872
N = int(input())
h = [int(i) for i in input().split()]

def rec(h) :
    m = min(h)
    for i in range(len(h)) :
        h[i] -= m
    
    ret = m
    pre = 0
    for i in range(len(h)) :
        if h[i] == 0 :
            if i - pre > 0 :
                ret += rec(h[pre:i])
            pre = i + 1
        elif i == len(h) - 1 :
            ret += rec(h[pre:])
    return ret
    
print(rec(h))

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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;





int main() {

	ll n, m;
	cin >> n >> m;
	vector<pair<int, int>> v;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		//a = m - a;
		v.push_back({ a,b });
	}

	priority_queue<int> q;

	ll ans = 0;

	int j = 0;

	sort(ALL(v));

	


	FOR(i, 1, m + 1) {
		if (j != n) {
			while (v[j].first <= i) {
				q.push(v[j].second);
				j++;
				if (j == n)break;
			}
		}
		if (!q.empty()) {
			ll a = q.top();
			q.pop();
			ans += a;
		}
	}

	cout << ans << endl;



}

Measured memory_bytes: 1908
//22
#include<iostream>
#include<deque>

using namespace std;

struct S{
  int y,x,d,p,q;
};

int main(){
  int N,M,A;
  cin>>N>>M>>A;
  char g[100][100];
  S is={0,0,2,0,0};
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      cin>>g[i][j];
      if(g[i][j]=='S'){
	is.y=i;
	is.x=j;
      }
    }
  }
  static bool p[100][100][4][11][11];
  deque<S> deq(1,is);
  while(!deq.empty()){
    S c=deq.front();
    if(g[c.y][c.x]=='G')break;
    deq.pop_front();
    if(p[c.y][c.x][c.d][c.p][c.q]++)continue;
    for(int i=0;i<((g[c.y][c.x]=='S')?1:3);i++){
      static int dy[]={-1,0,1,0};
      static int dx[]={0,1,0,-1};
      S n=c;
      if(i==1){
	n.d^=1;
	n.p++;
      }else if(i==2){
	n.d=3-n.d;
	n.q++;
      }
      n.y+=dy[n.d];
      n.x+=dx[n.d];
      if(0<=n.y&&n.y<N&&0<=n.x&&n.x<M&&n.p<=A&&n.q<=A&&g[c.y][c.x]!='#'&&!(g[c.y][c.x]=='S'&&n.d==0)){
	if(i==0){
	  deq.push_front(n);
	}else{
	  deq.push_back(n);
	}
      }
    }
  }
  cout<<(deq.empty()?-1:deq.front().p+deq.front().q)<<endl;
  return 0;
}

Measured memory_bytes: 5616
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    int n;
    read(n);
    vector<pair<int,int>> d(n);
    REP(i,n){
        int a, b;
        read(a,b);
        d[i] = make_pair(a,b);
    }
    bool ans = false;
    int count = 0;
    REP(i,n){
        if(d[i].first == d[i].second){
            count++;
            if( count == 3){
                ans = true;
                break;
            }
        }else{
            count = 0;
        }
    }

    if(ans){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var a, b, c, d int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d %d %d %d", &a, &b, &c, &d)

	if abs(a-b) <= d && abs(c-b) <= d || abs(a-c) <= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}


Measured memory_bytes: 640
h,w = map(int, input().split())
a = []
yoko = [False]*h
tate = [False]*w
for i in range(h):
    a.append(list(str(input())))

for x in range(h):
    for y in range(w):
        if a[x][y] == '#':
            yoko[x] = True
            tate[y] = True

for x in range(h):
    if yoko[x]:
        for y in range(w):
            if tate[y]:
                print(a[x][y], end="")
        else:
            print("")


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

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

    int r, g;
    cin >> r >> g;

    cout << g + g - r << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int c = sc.nextInt();
      if (a < b && b < c)
         System.out.println("Yes");
      else
         System.out.println("No");
   }
}

Measured memory_bytes: 17160
#pragma warning(disable:4996)
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
using mint = boost::multiprecision::cpp_int; //int1024_t etc...
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;

TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value, void>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value, void>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int N;
	cin >> N;
	vec<int> H(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i];
	}

	int ans = 1;
	for (int i = 1; i < N; ++i) {
		bool check = true;
		for (int j = 0; j < i; ++j) {
			if (H[j] > H[i])check = false;
		}
		if (check)++ans;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
using namespace std;
int main(){
	
	int n,a;
	
	while(cin>>n,n!=0){
		int b;
		long long int p[7]={0};
		for(int i=0;i<n;i++){
			cin>>a;
			if(a<10)
				b=0;
			else if(a<20)
				b=1;
			else if(a<30)
				b=2;
			else if(a<40)
				b=3;
			else if(a<50)
				b=4;
			else if(a<60)
				b=5;
			else 
				b=6;
			
			p[b]++;
				
		}
		
		for(int i=0;i<7;i++)
			cout<<p[i]<<endl;
	}
	
	
	
	

}

Measured memory_bytes: 1156
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int h = Integer.parseInt(sc.next());
        int w = Integer.parseInt(sc.next());

        char[][] s = new char[h][w];
        for (int i = 0; i < h; i++) {
            s[i] = sc.next().toCharArray();
        }

        // 全ての座標をスタートとして、ゴールまでにかかる移動回数の最大を求める
        int result = 0;
        for (int k = 0; k < h; k++) {
            for (int l = 0; l < w; l++) {
                int maxDistance = getMaxDistanceWithBfs(s, k, l);
                result = Math.max(result, maxDistance);
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }

    private static int getMaxDistanceWithBfs(char[][] s, int startY, int startX) {

        // スタート座標を設定
        if (s[startY][startX] != '.') {
            return -1;
        }
        int start[] = new int[] { startY, startX };

        // 探索対象を保持する
        Deque<int[]> todo = new ArrayDeque<>();
        todo.add(start); // スタート座標を設定

        // 探索済みの位置を保持する（0を未探索と判定）
        int h = s.length;
        int w = s[0].length;
        int[][] distance = new int[h][w];
        distance[start[0]][start[1]] = 1; // スタート座標を設定

        // 探索対象の相対座標を設定（上下左右）
        // 探索をforループで実施するために必要
        int[] x = new int[] { 0, 0, -1, 1 };
        int[] y = new int[] { -1, 1, 0, 0 };

        // 探索を開始
        int maxDistance = 0; // スタートからゴールまでの距離が格納される
        while (!todo.isEmpty()) {

            // 探索元の位置を設定
            int[] point = todo.poll();
            int pointY = point[0];
            int pointX = point[1];

            // 上下左右を探索する
            for (int i = 0; i < 4; i++) {

                // 探索対象の位置
                int nextPointY = pointY + y[i];
                int nextPointX = pointX + x[i];

                // 場外判定
                boolean isOutside = nextPointX < 0 || w <= nextPointX || nextPointY < 0 || h <= nextPointY;
                if (isOutside) {
                    continue;
                }

                boolean wasVisit = 0 < distance[nextPointY][nextPointX]; // 探索済み判定
                boolean isWall = s[nextPointY][nextPointX] == '#'; // 壁判定
                if (wasVisit || isWall) {
                    continue;
                }

                // 探索対象に追加
                todo.add(new int[] { nextPointY, nextPointX });
                distance[nextPointY][nextPointX] = distance[pointY][pointX] + 1;
                maxDistance = distance[nextPointY][nextPointX] - 1; // 初期値の1を引く
            }
        }
        return maxDistance;
    }
}


Measured memory_bytes: 26808
#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++)
typedef long long ll;

int main() {
  string S; cin >> S;
  ll n = S.size() - 1;
  ll ans = 0;
  vector<ll> N(n+1);
  rep(i, n+1) {
    // - '0'はstringを数値として扱うため
    N[i] = S[i] - '0';
  }
  ll dig;
  // bit全探索でbitにはbitの状態が入る
  for (ll bit = 0; bit < (1<<n); ++bit) {
    // 一桁ごとに足していくから必要
    dig = 1;
    rep(i, n+1) {
      ans += dig * N[n-i];
      // bitのi番目（後ろから）が１かどうか、つまり'+'であるかどうかを示している
      if ((bit>>i) & 1) {
        dig = 1;
      }
      else {
        dig *= 10;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
s=input()
t=input()
ans=''

for i in range(min(len(s),len(t))):
    ans+=s[i]
    ans+=t[i]

if len(s)==len(t):
    print(ans)

elif len(s)>len(t):
    ans+=s[-1]
    print(ans)

else:
    ans+=t[-1]
    print(ans)

Measured memory_bytes: 38384
// ProblemURL : https://atcoder.jp/contests/abc133/tasks/abc133_c
// ---------------------------------------------
package main

import "fmt"

const inf = 1 << 60

func chmin(a *int, b int) bool {
	if *a > b {
		*a = b
		return true
	}
	return false
}

func main() {
	var l, r int
	fmt.Scan(&l, &r)

	if r-l >= 2019 {
		fmt.Println(0)
		return
	}

	ans := inf
	for i := l; i < r; i++ {
		for j := l + 1; j <= r; j++ {
			chmin(&ans, (i*j)%2019)
		}
	}
	fmt.Println(ans)
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            for(var i = 0; i * 4 <= N; i++)
            {
                if ((N - i * 4) % 7 == 0)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 11092
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll r;
    cin >> r;


    //本文
    ll ans = 3*pow(r,2);
    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
#include <unordered_map>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
# define INF 0x3f3f3f3f 
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];

vl primeFactors(ll n)  
{  
    // Print the number of 2s that divide n 
    vl res; 
    while (n % 2 == 0)  
    {  
        // cout << 2 << " ";
        res.pb(2);
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            // cout << i << " ";  
            res.pb(i);
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        res.pb(n);
        // cout << n << " ";  
    return res;
}  
vl precmp(10000);
void solve()
{
    ll n;
    cin>>n;

    ll ans = 0;
    vl res = primeFactors(n);
    if(res.size() == 1)
    {
        cout<<1<<endl;
        return;
    }
    if(res.size() == 0)
    {
        cout<<0<<endl;
        return;
    }

    ll cnt = 1;
    // rep(i, res.size())
    // {
    //     cout<<res[i]<<" ";
    // }
    // cout<<endl;

    for(int i = 1; i < res.size(); i++)
    {
        if(res[i] == res[i-1])
        {
            cnt++;
        }
        else
        {
            auto it = upper_bound(all(precmp), cnt);
            ans += (it - precmp.begin() - 1);
            cnt = 1;
        }
    }

    auto it1 = upper_bound(all(precmp), cnt);
    ans += (it1 - precmp.begin() - 1);

    cout<<ans<<endl;

}

int main()
{
    
    precmp[0] = 0;

    for(int i = 1;i<10000;i++)
    {
        precmp[i] = i + precmp[i-1];
    }
    // rep(i, 10)
    // {
    //     cout<<precmp[i]<<" ";
    // }
    // cout<<endl;

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    // cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 15472
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<queue>
#include<deque>
#include<cstdio>
#include<climits>
#include<numeric>
#include<cassert>
#include<functional>
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define fi(i,j,k) fill(i[0],i[0]+j*j,k)
#define INF 1<<27
#define F first
#define S second
static const double eps=1e-10;
typedef long long ll;
using namespace std;
typedef pair<int,int> P;
int h,w;
char cmap[110][110];
P pos[110];
int index,matrix[110][110];
int imap[110][110];
static const int dx[4] = {0,1,0,-1};
static const int dy[4] = {1,0,-1,0};
static const int dx8[8] = {0,1,1,1,0,-1,-1,-1};
static const int dy8[8] = {-1,-1,0,1,1,1,0,-1};
static const int dx16[16] = {0,1,2,2,2,2,2,1,0,-1,-2,-2,-2,-2,-2,-1};
static const int dy16[16] = {-2,-2,-2,-1,0,1,2,2,2,2,2,1,0,-1,-2,-2};
 
int D[110][110];
bool used[110][110];
 
void bfs(P s,P g){
  rep(i,h)rep(j,w){
    D[i][j] = INF;
    used[i][j] = false;
  }
  queue<P> que;
  que.push(s);
  D[s.S][s.F] = 0;
  used[s.S][s.F] = true;
 
  while(!que.empty()){
    P p = que.front(); que.pop();
 
    for(int i=0;i<4;i++){
      int nx = p.F+dx[i],ny = p.S+dy[i];
      if(0<= nx && nx < w && 0<= ny && ny < h && cmap[ny][nx] != '#' && D[ny][nx] > D[p.S][p.F] +imap[ny][nx]){
    D[ny][nx] = min(D[p.S][p.F] + imap[ny][nx],D[ny][nx]);
 
    que.push(P(nx,ny));
      }
    }
  }
}
 
int main(){
 
  scanf("%d %d",&w,&h);
    int sindex,lim = 1;
    index = 1;
   
    rep(i,h)rep(j,w)imap[i][j] = 1;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
    
	cin >> cmap[i][j];
    matrix[i][j] = INF;
    if(cmap[i][j] == 'S'){
      lim++;
    }
    else if(cmap[i][j] == 'M')lim++;
    else if(cmap[i][j] == 'G'){
      pos[0] = P(j,i);
    }
      }
    }
  
    rep(i,h){
      rep(j,w){
       
    if(cmap[i][j] == 'S'){
      pos[lim-1] = P(j,i);
    }
    else if(cmap[i][j] == 'M'){
      assert(index != lim-1);
      pos[index++] = P(j,i);
    }
    else if(cmap[i][j] == '#'){
      for(int k=0;k<8;k++){
       
        int nx = j+dx8[k],ny = i+dy8[k];
        if(0<=nx && nx<w && 0<=ny && ny <h && cmap[ny][nx] != '#'){
          imap[ny][nx] = 3;
        }
      }
      for(int k=0;k<16;k++){
        int nx = j+dx16[k],ny = i+dy16[k];
        if(0<=nx && nx<w && 0<=ny && ny <h && cmap[ny][nx] != '#'){
          imap[ny][nx] = max(imap[ny][nx],2);
        }
      }
    }
      }
    }
 
 
    index = lim;
 
    for(int i=0;i<index;i++){
      rep(j,index){
     
    if(i == j){
      matrix[i][j] = 0;
      continue;
    }
    bfs(pos[i],pos[j]);
    matrix[i][j] = D[pos[j].S][pos[j].F];
      }
    }
    int per[110];
    rep(i,index-1)per[i] = i+1;
 
    int sum;
    int ans=INF;
    do{
      sum=0;
      sum+=matrix[0][per[0]];
 
      int posi=-1;    
      for(int i=1;i<index-1;i++){
    if(i == index-2)posi = per[i];
    sum+=matrix[per[i-1]][per[i]];
      }
     
      if(posi != -1 && posi != lim-1)sum += matrix[posi][lim-1];
     
      ans=min(ans,sum);
    }while(next_permutation(per,per+(index-1)));
    printf("%d\n",ans);
  return 0;
}

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

typedef long long ll;

int calc(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    ll sum = 0;
    for (int i = 1;i<=n;i++) {
        if (calc(i) >= a && calc(i) <= b) {
            sum += i;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


template<typename T, typename U>
ostream& operator << (ostream& os, const pair<T, U>& p)
{
	os<<'('<<p.first<<", "<<p.second<<')';
	return os;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


template<unsigned int N> struct IsPrime {
	static const int size=(N>>5) + 1;
	unsigned int is_prime[size];
	constexpr IsPrime() : is_prime() {
		is_prime[0]=0x3;
		for(unsigned int i=2;i<N;i++)
		{
			if((is_prime[i>>5] & (1u<<(i&0x1f))) > 0)  continue;
			for(int j=i+i;j<N;j+=i)
				is_prime[j>>5]|=(1u<<(j&0x1f));
		}
	}
	constexpr bool operator[] (const int p) const
	{
		return (is_prime[p>>5] & (1u<<(p&0x1f))) == 0;
	}
};

template<int N> struct LikelyPrime {
	unsigned short sum[N+1];
	constexpr LikelyPrime(const IsPrime<N> pr) : sum() {
		for(int i=3;i<N;i++)
			sum[i+1]=sum[i]+(unsigned short)((pr[i] && pr[(i+1)/2])?1:0 );
	}
};

int q;
int l,r;
int main()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	constexpr IsPrime<100001> pr;
	constexpr LikelyPrime<100001> s(pr);
	cin>>q;
	while(q--)
	{
		cin>>l>>r;
		cout<<s.sum[r+1]-s.sum[l]<<endl;
	}
}


Measured memory_bytes: 896
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[])
{
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  cout << setprecision(20) << sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0)) << endl;
  return 0;
}



Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
long long dp[3000][3000], cs[3000];
int a[3000];
long long calc(int l, int r)
{

    int t = a[l];
    if(l==r) return t;

    if(dp[l][r] != -1) return dp[l][r];

    long long seg = cs[r] - (l?cs[l-1]:0);
    long long A = seg - calc(l+1, r), b = seg - calc(l, r-1);
    dp[l][r] = max(A, b);
    return dp[l][r];


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

    for (int i = 0; i < 3000; ++i) {
        memset(dp[i], -1, sizeof(dp[i]));
    }
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        cs[i] = a[i] + cs[i- bool(i)];
    }
    cout << 2*calc(0, n-1) - cs[n-1];
    return 0;
}

Measured memory_bytes: 70784
#include<iostream>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a;
        cin>>a;
        n-=a;
        if(n<0)
        {
            cout<<"-1";
            return 0;
        }
    }
    cout<<n;
}

Measured memory_bytes: 3616
N,Q = map(int,input().split())
S = input()
AC_cnt = [0] * N
for i in range(N-1):
  if S[i] == 'A' and  S[i+1] == 'C':
    AC_cnt[i+1] = AC_cnt[i] + 1
  else:
    AC_cnt[i+1] = AC_cnt[i]

for i in range(Q):
  begin, end = map(int,input().split())
  print(AC_cnt[end-1]-AC_cnt[begin-1])

Measured memory_bytes: 6060
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	string s;
	while(cin>>N) {
		ll ans = 0;
		for(int i=N;i>=1;i--) {
//			DD(i);
			RANGE(v, 1, N+1) {
				RANGE(m, 2, max(2LL, N)+1) {
					ll w = (ll)pow(v, m);
//					DD(v);
//					DD(m);
//					DD(w);
					if(i==w) {
						ans = i;
						goto END;
					}
					if(i<w) break;
				}
			}
		}
		END:
		cout<<ans<<endl;
//		break;
	}
	
	return 0;
}


Measured memory_bytes: 384
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	string s;
	cin >> s;
	char m = s[s.size() - 1];
	string ans = "";
	if (m == 's') {
		ans = s + "es";
	}
	else {
		ans = s + "s";
	}
	cout << ans << endl;
	//cout << fixed << setprecision(10) << ans << endl;
	system("pause");
}


Measured memory_bytes: 3652
#include<stdio.h>
#define mMax 100

int insertionSort(int A[], int n, int g)
{
	int i, j;
	int cnt = 0;
	for(i = g; i < n; ++i) {
		int v = A[i];
		j = i - g;
		while(j >= 0 && A[j] > v) {
			A[j+g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j+g] = v;
	}
	return cnt;
}

int main()
{
	int i, j, g, m, n;
	int cnt;
	scanf("%d\n", &n);

	int A[n];
	int G[mMax];
	for(i = 0; i < n; ++i)
		scanf("%d", &A[i]);

	cnt = 0;
	G[0] = g = 1;
	for(i = 1, m = 1; 3*g + 1 <= n; ++i) {
		g = 3*g + 1;
			for(j = i; j > 0; --j)
			G[j] = G[j-1];
		G[0] = g;
		m++;
	}

	for(i = 0; i < m; ++i)
		cnt += insertionSort(A, n, G[i]);

	printf("%d\n", m);
	for(i = 0; i < m; ++i) {
		if(i == m-1)
			printf("%d\n", G[i]);
		else
			printf("%d ", G[i]);
	}
	printf("%d\n", cnt);
	for(i = 0; i < n; ++i) {
		printf("%d\n", A[i]);
	}
    return 0;
}

Measured memory_bytes: 4504
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
  string s,t;
  cin >> s >> t;
  rep(i,3){
    if(s[i] != t[2-i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("ip1.txt", "r", stdin);
  freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
  return (a.second < b.second);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int prime(int n) {
  int flag = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {flag = 0; break;}
  }
  return flag;
}
int power(int x, int y)
{
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
  else
    return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}

int32_t main()
{
  k_007();
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5])
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3600
#include<iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int a = N % 1000;
	if (a%111==0){
		cout << "Yes" << endl;
	}
	else if (N % 1110 <= 9) {
		cout << "Yes" << endl;
	}
	else if (N % 1111 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
const ll mod=1000000007; // 998244353 = (119<<23)+1
ll powmod(ll a,ll b) {ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
// head
ll n,a,b,c,d,e;
int main() {
	  ios::sync_with_stdio(false);
  	cin.tie(0);
		cin>>n>>a>>b>>c>>d>>e;
		ll bot=min(a,min(b,min(c,min(d,e))));
		if(n%bot==0) cout<<4LL+n/bot;
		else cout<<5LL+n/bot;
		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define C

#ifdef A
int main(void)
{
	const int thousand = 1000;
	string hello = "Hello World\n";
	for (size_t i = 0; i < thousand; i++)
	{
		cout << hello;

	}
	return 0;
}


#endif // A

#ifdef B
#define _MAX 10000
int main(void)
{
	vector<int> arr(_MAX);
	int in = -1;
	for (size_t i = 0; i < _MAX && in != 0; i++)
	{
		cin >> in;
		arr[i] = in;

	}

	for (size_t i = 0; i < _MAX; i++)
	{
		if (arr[i] == 0)break;
		cout << "Case " << i + 1 << ": " << arr[i] << endl;
	}

	return 0;
}
#endif // B


#ifdef C
#define _MAX 10000
int main(void)
{
	int x, y;
	vector<pair<int, int> > arr(_MAX);
	pair<int, int> dis;
	dis.first = -1;
	for (size_t i = 0; i < _MAX && (dis.first != 0 || dis.second != 0); ++i)
	{
		cin >> dis.first >> dis.second;
		if (dis.first > dis.second)
			swap(dis.first, dis.second);
		arr[i] = dis;
	}
	for (size_t i = 0; i < _MAX && (arr[i].first != 0 || arr[i].second != 0); ++i)
	{
		cout << arr[i].first << " " << arr[i].second << endl;

	}


	return 0;
}
#endif // C

#ifdef D

#endif // D

Measured memory_bytes: 3048