akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = read_vec::<i64>();
    let n2 = 1 << n;
    a.sort();
    let mut s = vec![];
    s.push(a[a.len() - 1]);
    let idx = a.len() - 1;
    a[idx] = -1;
    for i in 0..n {
        let mut p = s.clone();
        p.sort();
        let mut ai = n2 - 1;
        while p.len() > 0 {
            if a[ai] == -1 {
                if ai == 0 {
                    break;
                }
                ai -= 1;
                continue;
            }
            if a[ai] < *p.last().unwrap() {
                s.push(a[ai]);
                p.pop();
                a[ai] = -1;
            }
            if ai == 0 {
                break;
            }
            ai -= 1;
        }
        if p.len() > 0 {
            println!("No");
            return;
        }
    }
    println!("Yes");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 13560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
int H,A,ans;
cin>>H>>A;
if(H%A==0){
  ans=H/A;
}
else{
  ans=H/A+1;
}
cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    ll n = s.size();
    bool ok = true;
    if(s[0] == '0' || s[n-1] == '1') ok = false;
    rep(i,0,n/2){
        if(s[i] != s[n-2-i]) ok = false;
    }
    if(!ok){
        print(-1);
        return 0;
    }
    ll pos = 1, num = 2;;
    vector<lpair> lp;
    rep(i,0,n-1){
        if(s[i] == '1'){
            lp.push_back(make_pair(pos, num));
            pos = num;
            num++;
        }else{
            lp.push_back(make_pair(pos,num));
            num++;
        }
    }
    rep(i,0,n-1){
        cout << lp[i].first << " " << lp[i].second << endl;
    }
}


Measured memory_bytes: 3264
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int dis(int x1, int y1, int x2, int y2) {
    return abs(x1 - x2) + abs(y1 - y2);
}

int main() {
    int N;
    cin >> N;
    vector<int>t(N+1), x(N+1), y(N+1);
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }

    bool ok = true;
    for (int i = 1; i <= N; i++) {
        int time = t[i] - t[i - 1];
        int distance_ = dis(x[i - 1], y[i - 1], x[i], y[i]);
        if (time < distance_ || (time - distance_) % 2 != 0) {
            ok = false;
            break;
        }
    }
    cout << ((ok) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 1408
class in{struct myIterator{int it;const bool rev;explicit constexpr myIterator(int it_, bool rev=false):it(it_),rev(rev){}int operator*(){return it;}bool operator!=(myIterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const myIterator i,n;public:explicit constexpr in(int n):i(0),n(n){}explicit constexpr in(int i,int n):i(i,n<i),n(n){}const myIterator& begin(){return i;}const myIterator& end(){return n;}};

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

using i64 = long long;
const i64 MOD = 1e9 + 7;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> h1(n), h2(n);
    for(int& x : h1) cin >> x;
    for(int& x : h2) cin >> x;
    vector<int> mi(n, 1), ma(n, 1e9);
    for(int i : in(n)) {
        ma[i] = min(ma[i], h1[i]);
        if(i == 0 || h1[i] > h1[i - 1])
          mi[i] = max(mi[i], h1[i]);
    }
    for(int i : in(n - 1, -1)) {
        ma[i] = min(ma[i], h2[i]);
        if(i == n - 1 || h2[i] > h2[i + 1])
          mi[i] = max(mi[i], h2[i]);
    }
    i64 ans = 1LL;
    for(int i : in(n)) {
        i64 sa = ma[i] - mi[i] + 1LL;
        if(sa < 0LL) sa = 0LL;
        ans = (ans * sa) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
 int n,s=0,t=0,p=0,x,i;
  cin>>n;
  for(i=0;i<n;i++)
  {
  	cin>>x;
  	s+=x;
  	p+=x*x;
  }
  t=s;
  s/=n;
  
  x=p+n*s*s-2*t*s;
  s++;
  x=min(x,p+n*s*s-2*t*s);
  cout<<x;
  
  
  return 0;
}

Measured memory_bytes: 256
mod = 10**9+7
def main():
	ans =1
	n = int(input())
	arr = list(map(int , input().split()))
	col=[0 for i in range(0 , 6)]
	for i in range(0 , n):
		cnt , cur =0 , -1
		if arr[i]==col[0]:
			cnt = cnt+1
			cur = 0
		if arr[i]==col[1]:
			cnt = cnt+1
			cur = 1
		if arr[i]==col[2]:
			cnt = cnt+1
			cur = 2
		if cur ==-1:
			print(0)
			exit()
		col[cur]=col[cur]+1
		ans = (ans*cnt)%mod
		ans = ans%mod
	print(ans)

if __name__ =="__main__":
	main()

Measured memory_bytes: 84056
while True:
    a,b = map(int,input().split())
    if a == 0 and b == 0: break
    for i in range(1, a+1):
        for j in range(1, b+1):
            if i%2 == 1:
                if j%2 == 1:
                    print('#',end='')
                else:
                    print('.',end='')
            else:
                if j%2 == 1:
                    print('.',end='')
                else:
                    print('#',end='')
        print()
    print()


Measured memory_bytes: 7008
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <math.h>
#include <deque>
#include <queue>
#include <map>
#include <iterator>
#include <set>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

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

	int r;
	cin >> r;
	cout << r * r << endl;
}

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

int main(){
int c1,c5,c10,c50,c100,c500;
cin>>c1>>c5>>c10>>c50>>c100>>c500;
int g;
g=c1+5*c5+10*c10+50*c50+100*c100+500*c500;
if(g>=1000)
cout<<1<<endl;
else
cout<<0<<endl;

return 0;

}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;

int main(){
    
    string s;
    cin>>s;
    
    string ans;
    REP(i,s.size()){
        if(s[i]=='1')ans+='1';
        if(s[i]=='0')ans+='0';
        if(s[i]=='B'){
            if(ans.size()!=0){
                ans=ans.substr(0,ans.size()-1);
            }
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
while 1:
    try:
        a =[int(i) for i in input().split()]
        b =[int(i) for i in input().split()]
        hit=0
        bro=0
        for i in range(4):
            if a[i]==b[i]:
                hit=hit+1
            for j in range(4):
                if a[i]==b[j]:
                    bro=bro+1
        print(hit,bro-hit)
    except:break

Measured memory_bytes: 5604
import sys
from itertools import combinations_with_replacement

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X = int(rl())
    
    five_pow = [0]
    i = 1
    while five_pow[-1] < 10 ** 18:
        five_pow.append(i ** 5)
        i += 1
    
    for a, b in combinations_with_replacement(range(len(five_pow)), 2):
        p_of_a, p_of_b = five_pow[a], five_pow[b]
        if p_of_a - p_of_b == X:
            print(a, b)
            exit()
        if p_of_a + p_of_b == X:
            print(a, -b)
            exit()
        if p_of_b - p_of_a == X:
            print(b, a)
            exit()
        if p_of_b + p_of_a == X:
            print(b, -a)
            exit()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 67988
n, q = map(int, input().split())

p = []
time = 0

for i in range(n):
	p.append(input().split())
	p[i][1] = int(p[i][1])

while(len(p) > 0):
	if (p[0][1]<= q):
		time += p[0][1]
		print("{0} {1}".format(p[0][0], time))
		p.pop(0)
	else:
		time += q
		p[0][1] -= q
		p.append(p[0])
		p.pop(0)

Measured memory_bytes: 19428
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;


int32_t main()
{

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int product,q,r,s;
    product=a*c;
    q=b*c;
    s=b*d;
    r=a*d;
    product=max(product,q);
    product=max(product,r);
    product=max(product,s);
    cout<<product<<endl;
    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    long sum = 0;
    long[] a = new long[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextLong();
      sum += a[i];
    }

    long ret = 0;
    for (int i=0;i<n-1;i++){
      sum -= a[i];
      long t1 = (long) sum%1000000007;
      long app =  (long) t1 * a[i];
      long app1 = (long) app%1000000007;
      ret += app1;
    }

    System.out.println(ret%1000000007);
  }
}


Measured memory_bytes: 60896
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		int i = 0;

		while(true) {
			int x = sc.nextInt();
			int y = sc.nextInt();

			if((x == 0 && y == 0) || i > 3000) {
				break;
			}
			if(x < y) {
				System.out.println(x + " " + y);
			} else {
				System.out.println(y + " " + x);
			}
			i++;
		}
	}

}


Measured memory_bytes: 36004
#include <vector>
#include <iostream>
#include <stack>
#include <string>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <queue>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<ll, ll> P;

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

int main(void)
{
	int n;
	cin >> n;
	vector<ll> as(n + 1, 0);
	vector<ll> bs(n + 1, 0);
	vector<ll> ms;
	rep(i, n) {
		cin >> as[i + 1];
		bs[i + 1] = 0;
	}
	for (int i = n; i > 0; i--) {
		ll sum = 0;
		for (int j = i * 2; j <= n; j += i) {
			sum += bs[j];
		}
		bs[i] = ((sum - as[i]) % 2 == 0) ? 0 : 1;
		if(bs[i]) ms.push_back(i);
	}
	cout << ms.size() << endl;
	for (auto e : ms) {
		cout << e << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int i=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int i=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 998244353

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

long long dp[3333][3333];
long long tab[3333][3333];
long long hoge[3333][3333];

long long A, B, C, D;


long long dfs(long long a, long long b){
    if(dp[a][b] != -1) return dp[a][b];
    if(a==C){
        long long ret = tab[a][D-b];
        dp[a][b] = ret;
        return ret;
    }
    if(b==D){
        long long ret = 1;
        REP(i, C-a){
            ret *= b;
            ret %= MOD;
        }
        dp[a][b] = ret;
        return ret;
    }

    long long ab=(a*b)%MOD;
    long long ret = (a * dfs(a, b+1)) % MOD;
    ret %= MOD;
    ret += (b*dfs(a+1, b)) % MOD;;
    ret %= MOD;
    ret += (MOD - (ab*dfs(a+1, b+1)) % MOD) % MOD;;
    ret %= MOD;
    dp[a][b] = ret;
    return ret;
}

int main(){
    REP(i, 3333) REP(j, 3333) dp[i][j] = -1;
    REP(i, 3333) REP(j, 3333) hoge[i][j] = -1;
    REP(i, 3333) tab[i][0] = 1;
    REP(i, 3333){
        for(int j=1; j<3333; j++){
            tab[i][j] = (tab[i][j-1] * i) % MOD;
        }
    }


    cin >> A >> B >> C >> D;
    dp[C][D] = 1;
    dfs(A, B);
    cout << dp[A][B] << endl;

    return 0;
}

Measured memory_bytes: 264388
#91B
n = int(input())
s = list(map(str,[input() for i in range(n)]))
m = int(input())
t = list(map(str,[input() for i in range(m)]))
answer = 0

for i in range(n):
	aka = s.count(s[i])
	ao = t.count(s[i])
	answer = max(answer, (aka-ao))
print(answer)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        //freopen("input.txt","r",stdin);
    #endif // TarekHasan
    int n; cin >> n;
    int arr[n];
    for(int i=0;i<n;i++) cin >> arr[i];
    int counter = 0;
    for(int i=0;i<n;i++)
    {
        if((i+1)%2 && arr[i]%2)
            counter++;
    }
    cout << counter << endl;
    //main();
    return 0;
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		while(scan.hasNext()){
			int a = scan.nextInt();
			int b = scan.nextInt();
			int n = scan.nextInt();
			a%=b;
			int s = 0;
			for (int i = 0; i < n; i++) {
				s+=a*10/b;
				a=a*10%b;
			}
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 20060
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
    FIO;
    ll n;
    cin >> n;
    ll arr[n+1], ans[n+1];
    for(ll i = 1 ; i <= n ; i++){
        cin >> arr[i];
        ans[i] = 0;
    }
    ll cnt = 0;
    for(ll i = n ; i >= 1 ; i--){
        ll sum = 0;
        for(ll k = i ; k <= n ; k += i){
            sum += ans[k];
        }
        if(sum%2 != arr[i]){
            ans[i] = 1;
        }
        if(ans[i] > 0){
            cnt++;
        }
    }
    cout << cnt << endl;
    for(ll i = 1 ; i <= n ; i++){
        if(ans[i] > 0){
            cout << i << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 3968
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v[1000];

int vec[1000];
int dp[2][5001];

pii go(int o) {
	if (v[o].empty()) return pii(vec[o], 0);

	int flag = 0;
	int t = 0;
	vector<pii> vv;
	for (int i = 0; i < sz(v[o]); i++) {
		vv.push_back(go(v[o][i]));
		t += vv.back().first + vv.back().second;
		flag |= (vv.back().first != 0) && (vv.back().second != 0);
	}

	memset(dp, 0, sizeof(dp));
	dp[1][0] = 1;

	int mav = 0;
	for (int i = 0; i < sz(vv); i++) {
		memset(dp[i & 1], 0, sizeof(dp[i & 1]));
		for (int j = vec[o]; j >= 0; j--) {
			if (j - vv[i].first >= 0) dp[i & 1][j] |= dp[(i + 1) & 1][j - vv[i].first];
			if (j - vv[i].second >= 0) dp[i & 1][j] |= dp[(i + 1) & 1][j - vv[i].second];
		}
	}

	for (int j = vec[o]; j >= 0; j--)
		if (dp[(sz(vv) + 1) & 1][j]) {
			mav = j;
			break;
		}

	if (flag && mav == 0) {
		printf("IMPOSSIBLE");
		exit(0);
	}

	// printf("%d : %d %d\n", o + 1, vec[o], t - mav);
	return pii(vec[o], t - mav);
}

int main() {
	int n, t;
	scanf("%d", &n);

	for (int i = 1; i < n; i++) {
		scanf("%d", &t);
		v[--t].push_back(i);
	}

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

	go(0);
	printf("POSSIBLE");
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define ld long double
#define ft first
#define sd second
using namespace std;

const int N = 1e5 + 9;
ll a[109];
ll f[109][N], pre[109][N];

signed main() {

    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, k; cin >> n >> k;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    // f[0][0] = pre[0][0] = 1;
    for(int j = 0; j <= k; j++) {
        if(j <= a[1]) f[1][j] = 1;
        pre[1][j] = (j > 0 ? pre[1][j-1] : 0) + f[1][j];
    }
    for(int i = 2; i <= n; i++) {
        pre[i][0] = f[i][0] = 1;
        for(int j = 1; j <= k; j++) {
            f[i][j] = pre[i-1][j] - (j-a[i]-1 < 0 ? 0 : pre[i-1][j-a[i]-1]);
            if(f[i][j] < 0) f[i][j] += mod;
            pre[i][j] = pre[i][j-1] + f[i][j];
            if(pre[i][j] >= mod) pre[i][j] -= mod;
        }
    }
    cout << f[n][k] << endl;
    
    return 0;
}

Measured memory_bytes: 161280
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
#define N 200001
#define ll long long
int main(){
	ll int n;
	cin >> n;
	vector< pair<ll int ,ll int>> a(n);
	for(ll int i=0;i<n;i++){
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a.begin(),a.end());

	for(ll int i=0;i<n;i++){
		ll int index=n-1;
		while(index>0){
			if(a[index].second!=i){
				break;
			}
			index--;
		}
		cout << a[index].first << endl;
	}
}


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

typedef long long ll;
const int N = 1009;
int n, x[N], y[N], vis = -1, maxn, cnt;
ll a[45];
char ans[45], dir[4] = {'L', 'R', 'D', 'U'};
double dis[4];

void read(int &x) {
	char c; int f = 1;
	for (c = getchar(); c < '0' || c > '9'; c = getchar()) if (c == '-') f = 0;
	for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
	x = f ? x : -x;
}

inline int Log(int x) {
	int t = (int)(log(x) / log(2));
	if ((1 << t) == x) return t;
	return t + 1;
}

inline double get_dis(ll x1, ll Y1, ll x2, ll y2) {return sqrt((x1 - x2) * (x1 - x2) + (Y1 - y2) * (Y1 - y2));}

int main() {
	read(n);
	for (int i = 1; i <= n; ++ i) {
		read(x[i]), read(y[i]);
		if (((x[i] + y[i]) % 2 && vis == 0) || ((x[i] + y[i]) % 2 == 0 && vis == 1)) return puts("-1"), 0;
		vis = (x[i] + y[i]) % 2;
		maxn = max(maxn, abs(x[i]) + abs(y[i]));
	}
	if (vis == 0) a[++ cnt] = 1;
	for (int i = 1; i <= Log(maxn); ++ i) a[++ cnt] = 1LL << i - 1;
	printf("%d\n", cnt);
	for (int i = 1; i <= cnt; ++ i) printf("%lld ", a[i]); putchar('\n');
	for (int i = 1; i <= n; ++ i) {
		ll nx = 0, ny = 0;
		for (int j = cnt; j; -- j) {
			dis[0] = get_dis(nx - a[j], ny, x[i], y[i]);
			dis[1] = get_dis(nx + a[j], ny, x[i], y[i]);
			dis[2] = get_dis(nx, ny - a[j], x[i], y[i]);
			dis[3] = get_dis(nx, ny + a[j], x[i], y[i]);
			int minnum = 0;
			for (int k = 0; k < 4; ++ k) if (dis[minnum] > dis[k]) minnum = k;
			if (minnum == 0) nx -= a[j];
			if (minnum == 1) nx += a[j];
			if (minnum == 2) ny -= a[j];
			if (minnum == 3) ny += a[j];
			ans[j] = dir[minnum];
		}
		for (int j = 1; j <= cnt; ++ j) putchar(ans[j]); putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 3948
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
prev_x = prev_y = prev_t = 0

for _ in range(N):
    t, x, y = map(int, readline().split())

    time = t - prev_t
    dist = abs(x - prev_x) + abs(y - prev_y)

    if dist > time or dist % 2 != time % 2:
        print("No")
        break

    prev_x, prev_y, prev_t = x, y, t

else:
    print('Yes')


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

int main(void){
    int a, b, c, d, e, f, sai[6][6], n, x, y;
    cin >> a >> b >> c >> d >> e >> f;
    sai[a][b]=c;
    sai[a][c]=e;
    sai[a][d]=b;
    sai[a][e]=d;
    sai[b][a]=d;
    sai[b][c]=a;
    sai[b][d]=f;
    sai[b][f]=c;
    sai[c][a]=b;
    sai[c][b]=f;
    sai[c][e]=a;
    sai[c][f]=e;
    sai[d][a]=e;
    sai[d][b]=a;
    sai[d][e]=f;
    sai[d][f]=b;
    sai[e][a]=c;
    sai[e][c]=f;
    sai[e][d]=a;
    sai[e][f]=d;
    sai[f][b]=d;
    sai[f][c]=b;
    sai[f][d]=e;
    sai[f][e]=c;
    
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> x >> y;
        cout << sai[x][y] << endl;
    }
    return 0;
}



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

#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)


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

    string ans;
    while(N > 0){
        --N;
        ans += 'a' + N%26;
        N /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>

int main(){
    long N,min[2]={1,1},data[2],a,b,i;
    scanf("%ld",&N);
    for(i=0;i<N;i++){
        scanf("%ld",&data[0]);
        scanf("%ld",&data[1]);
        if(min[0]%data[0]==0){
            a=min[0]/data[0];
        }
        else{
            a=min[0]/data[0]+1;
        }
        if(min[1]%data[1]==0){
            b=min[1]/data[1];
    }
        else{
            b=min[1]/data[1]+1;
        }
        if(a<b){
            a=b;
        }
        min[0]=data[0]*a;
        min[1]=data[1]*a;
    }
    printf("%ld\n",min[0]+min[1]);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll i;
    for(i=0;i<b;i++)
        c*=a;
    return c;
}
ll hell=998244353;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int vis[405][405];
string s[405];
ll ans1;
ll ans2;
ll h,w,i,j;
void dfs(pair<ll,ll> p)
{
    ll x=p.F;
    ll y=p.S;
    vis[x][y]=1;
    if(s[x][y]=='#')
        ans1++;
    else
        {ans2++;

        }
    if((!vis[x-1][y])&&(x>1)&&(s[x-1][y]!=s[x][y]))
        dfs(mp(x-1,y));
    if((!vis[x+1][y])&&((x+1)<=h)&&(s[x+1][y]!=s[x][y]))
        dfs(mp(x+1,y));
    if((!vis[x][y-1])&&(y>1)&&(s[x][y-1]!=s[x][y]))
        dfs(mp(x,y-1));
    if((!vis[x][y+1])&&((y+1)<=w)&&(s[x][y+1]!=s[x][y]))
        dfs(mp(x,y+1));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>h>>w;
    for(i=1;i<=h;i++)
        {cin>>s[i];
        s[i]="&"+s[i];
        }
    ll fans=0;
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++)
        {
            if(s[i][j]=='#')
            {
                if(!vis[i][j])
                {
                    dfs(mp(i,j));
                    fans+=ans1*ans2;
                    //cout<<ans1<<" "<<ans2<<"\n";
                    ans1=0;
                    ans2=0;

                }
            }
        }
    }
    cout<<fans;
    return 0;
}






Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<int> v(4);
  for(int i = 0; i < 4; i++)v[i] = s[i] - '0';

  for(int j = 0; j < (1 << 3); j++){
    int tmp = v[0];
    for(int k = 0; k < 3; k++){
      if(j & (1 << k)) tmp += v[k+1];
      else tmp -= v[k+1];
    }
    if(tmp == 7){
      cout << v[0];
      for(int k = 0; k < 3; k++){
        if(j & (1 << k)) cout << '+';
        else cout << '-';
        cout << v[k+1];
      }
      cout << "=7" << endl;
      return 0;
    }
  }
}

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

using namespace std;

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

    int target = atoi(c.c_str());
    
    int min = int(floor(pow(target, 0.5)));
    int max = int(ceil(pow(target, 0.5)));

    int val = min;
    while(val <= max){
        if(val*val == target){
            cout << "Yes" << endl;
            return 0;
        }
        val += 1;
    }
    cout << "No" << endl;
    return 0;

}

Measured memory_bytes: 3984
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
  VI p(n); rep(i,n) cin>>p[i];
  // vector<PII> a,b;
  VI a, b;
  const int c = 30000;
  rep(i,n){
    a.PB(c*(i+1));
    b.PB(c*(n-i));
  }
  rep(i,n) a[p[i]-1] += i;
  rep(i,n) cout << a[i] << ' ';
  cout << endl;
  rep(i,n) cout << b[i] << ' ';
  cout << endl;

  return 0;
}


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

const int N = 1e6 + 50;

inline void read(int &x) {
  x = 0; char ch;
  while (!isdigit(ch = getchar()));
  do { x = (x << 1) + (x << 3) + ch - '0'; }
  while (isdigit(ch = getchar()));
}

struct edge {
  int nxt, to;
} e[N << 1];
int fir[N], cnt = 1;

inline void addedge(int x, int y) {
  e[++ cnt] = (edge) { fir[x], y }; fir[x] = cnt;
}

int n, dp[N], ans = N;
bool z[N];

inline void Dfs(int x, int f) {
  int son = 0, tot = 0;
  bool tmp = 0;
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != f) {
      son ++;
      Dfs(e[i].to, x);
      tot += dp[e[i].to];
      tmp |= z[e[i].to];
    }
  if (son == 0) dp[x] = z[x] = 1;
  else if (son == 1) dp[x] = tot, z[x] = tmp;
  else dp[x] = tot - tmp;
}

inline void solve(int x, int f, int gift, bool zz) {
  int son = 0, tot = gift, Max = zz;
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != f) {
      son ++;
      tot += dp[e[i].to];
      Max += z[e[i].to];
    }
  if (son == 0) {
    ans = min(ans, gift + 1 - zz);
    return;
  }
  ans = min(ans, tot - (Max > 0) + 1);
  for (int i = fir[x]; i; i = e[i].nxt)
    if (e[i].to != f) {
      if (son == 1)
	solve(e[i].to, x, gift, zz);
      else
	solve(e[i].to, x, tot - (Max > z[e[i].to]) - dp[e[i].to], 0);
    }
}

int deg[N];
      
int main() {
  read(n);
  if (n == 1) return 0 * puts("0");
  for (int i = 1, x, y; i < n; i ++) {
    read(x); read(y);
x ++; y ++;
    addedge(x, y); addedge(y, x);
    deg[x] ++; deg[y] ++;
  }
  int rt = 0;
  for (int i = 1; i <= n; i ++)
    if (deg[i] == 1) { rt = i; break; }
  Dfs(rt, 0);
  ans = dp[rt] + 1;
  solve(e[fir[rt]].to, rt, 1, 1);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 35328
#include <iostream>
#include <string>
#include <vector>

int main()
{
    std::string str;
    std::cin >> str;

    int p = -1, q = -1;
    for (int i = 0; i < str.size() - 1; ++i)
    {
        if (str[i] == str[i + 1])
        {
            p = i + 1;
            q = i + 2;
            break;
        }
        else if (i < str.size() - 2 && str[i] == str[i + 2])
        {
            p = i + 1;
            q = i + 3;
            break;
        }
    }

    std::cout << p << ' ' << q << std::endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;
static const ll INF = 1000000000000000000ll;

int main(){
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	ll answer = INF;
	for(int i = 0; i < (1 << n); ++i){
		if(__builtin_popcount(i) != k){ continue; }
		ll last = 0, sum = 0;
		for(int j = 0; j < n; ++j){
			if(i & (1 << j)){
				const ll t = max(last + 1, a[j]);
				sum += t - a[j];
				last = t;
			}else{
				last = max(last, a[j]);
			}
		}
		answer = min(answer, sum);
	}
	cout << answer << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    ll res=0;
    rep(i,n){
        ll a;cin>>a;
        if(i%2==1)continue;
        if(a%2==1)res++;
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

const ll mod = 1000000007;

int main() {
	int a,b,c,k;

	cin >> a >> b >> c >> k;

	if (a >= k) {
		cout << k << endl;
		return 0;
	}

	if (a + b >= k) {
		cout << a << endl;
		return 0;
	}

	int left = k - (a + b);
	cout << a - left << endl;

	return 0;
}


Measured memory_bytes: 3196
N, K = list(map(int, input().split()))
S = input()
 
S += "X"
i = 0
j = 0
max_len = 0
change = 0 if S[0] != "0" else 1
while j < len(S)-1:
  if change <= K:
    #print(i, j)
    max_len = max([j-i+1, max_len])
    if S[j:j+2] == "10":
      change += 1
    j += 1
  else:
    if S[i:i+2] == "01":
      change -= 1
    i += 1

print(max_len)
  

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

typedef long long ll;

int n, k;
ll res;

int main()
{
	scanf("%d %d", &n, &k);
	for (int b = k + 1; b <= n; b++)
		for (int a = 0; a <= n; a += b) {
			int from = a + k, to = min(n + 1, a + b);
			if (from == 0) from++;
			if (from < to) res += to - from;
		}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
const int INFTY =2147483647;

int n,m,x;
int A[13][13];
int C[13];


int solve(int i,int c,int O[]){
    if(i==n){
        bool z=true;
        REP(j,m) if(O[j]<x) z=false;
        if(z==true){
            return c;
        } 
        else return INFTY;

    }
    else{
        int a=solve(i+1,c,O);
        REP(j,m)O[j]+=A[i][j];
        int b=solve(i+1,c+C[i],O);
        REP(j,m)O[j]-=A[i][j];
        return min(a,b);
    }
}

int main(){
    int B[13]={};
    cin>>n>>m>>x;
    REP(i,n) {
        cin>>C[i];
        REP(j,m) cin>>A[i][j];
    }
    int ans=solve(0,0,B);
    if(ans==INFTY) cout<<-1<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 3668
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();

        int ans = b;
        if (a < 6) {
            ans = 0;
        } else if (a < 13) {
            ans /= 2;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b)
{
    int *x;
    int *y;
    
    x = (int *)a;
    y = (int *)b;
    
    return (*y - *x);
}

int main(void)
{
    int n, m;
    int point[1001];
    static int sum[1002001];
    int s;
    int i, j, k;
    int left, right, center;
    int temp, ans;
    
    while (1){
        scanf("%d%d", &n, &m);
        
        if (n + m == 0){
            break;
        }
        
        point[0] = 0;
        for (i = 1; i <= n; i++){
            scanf("%d", &point[i]);
        }
        n++;
        
        k = 0;
        for (i = 0; i < n; i++){
            for (j = i; j < n; j++){
                sum[k++] = point[i] + point[j];
            }
        }
        
        qsort(sum, k, sizeof(int), compare);
        
        ans = 0;
        for (i = 0; i < k; i++){
            if (sum[i] <= m){
                temp = sum[i];
                left = 0;
                right = k - 1;
                while (left != right){
                    center = (left + right) / 2;
                    if (temp + sum[center] <= m){
                        right = center;
                    }
                    else {
                        left = center + 1;
                    }
                }
                ans = ans < (temp + sum[right]) ? (temp + sum[right]) : ans;
            }
        }
        
        printf("%d\n", ans);
    }
    
    return (0);
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,ll> P;
typedef pair<ll,P> PP;

//-----------------------------------------------------------------------------

string s[3];

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

	REP(i,3) cin>>s[i];
	REP(i,3) cout<<s[i][i];
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
V=list(map(int,input().split()))

from collections import Counter
V_1=V[::2]
V_2=V[1::2]

V_1_counter=Counter(V_1).most_common()
V_2_counter=Counter(V_2).most_common()
c1 = V_1_counter
c2 = V_2_counter

if c1[0][0]!=c2[0][0]:
    print(n-c1[0][1]-c2[0][1])
if c1[0][0]==c2[0][0]:
    if len(c1)==len(c2)==1:
        print(n//2)
    if len(c1)==1 and len(c2)!=1:
        print(n-c1[0][1]-c2[1][1])
    if len(c2)==1 and len(c1)!=1:
        print(n-c1[1][1]-c2[0][1])    
    if len(c1)>1 and len(c2)>1:    
        print(n-max(c1[1][1]+c2[0][1],c1[0][1]+c2[1][1]))

Measured memory_bytes: 95648
<?php
  fscanf(STDIN, "%d", $n);
  $a = [];
  for ($i=0; $i<$n; $i++) {
    fscanf(STDIN, "%d", $a_);
    $a[] = $a_;
  }

  $b = $a;
  rsort($b);

  for ($i=0; $i<$n; $i++) {
    if ($a[$i] == $b[0]) echo $b[1] ."\n";
    else echo $b[0] ."\n";
  }

?>

Measured memory_bytes: 22388
#define _GLIBCXX_DEBUG
#include"bits/stdc++.h"

using namespace std;

//loops
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(int i=(ll)(n)-1;i>=0;i--)
#define OneToN(i,n) for(int i=1;i<(ll)(n+1);i++)
#define ZeroToN(i,n) for(int i=0;i<(ll)(n+1);i++)
#define AToB(i,a,b) for(int i=a;i<(ll)(b+1);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

//bitsearch
#define BITSEARCH(bit, n) for (int bit = 0; bit < (1<<n); ++bit)
#define isOne(bit, i) bit & (1<<i)

//arrays
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define add push_back


#define remove_unique(v) v.erase(unique(ALL(v)), v.end())

//pair
#define fir first
#define sec second

//types
#define ll long long
#define vec vector
#define cord2d pair<int,int>
//UNCOMMENT WHEN NEEDED
//#define int ll

//input
template <class T> T get(){ T s; cin >> s; return(s);}
#define gi get<int>()
#define gs get<string>()

template <class T> vector<T> getv(int n) { vec<T> v(n); REP(i, n) cin >> v[i]; return v; }
#define gim(n) getv<int>(n)
#define gsm(n) getv<string>(n)

//output
void print(int a){ cout << a << endl; }
void print(string a){ cout << a << endl; }
void print(char a){ cout << a << endl; }
void print(double a){ cout << a << endl; }
void print(double a, int dig){ cout << std::setprecision(dig) << a << endl; }

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T = int>
void print(vec<T> v){ cout << v << endl; }

template <class T = int>
void print2dVec(vec<vec<T>> v2d){for(vec<T> v: v2d) {print(v);}}

void YesNo1(bool i = true){ return print(i?"Yes":"No"); }
void YESNO2(bool i = true){ return print(i?"YES":"NO"); }

//debug output
#define var_name(var) #var
template <class T> void debug(T &var, int nest = 0, string before = "") { cout << string("          ", nest) << before; print(var); }

//name replacement
#define y0 y0__
#define y1 y1__
#define j0 j0__
#define j1 j1__
#define next next__
#define prev prev__

//bool lambdas
#define lamb(exp) [](auto i){return exp;}
#define isEven [](int i){return i % 2 == 0;}
#define isOdd [](int i){return i % 2 != 0;}

//constants
const ll INF = 1e18;
const int MOD = 10000007;

//maths
int factorial(int k){ int sum = 1; for (int i = 1; i <= k; ++i) { sum *= i; } return sum; }

void Main() {
    //code here
    int n = gi;
    vec<int> p = gim(n);
    vec<int> q = gim(n);
    if (p>q) {
        p.swap(q);
    }

    int count = 0;
    do {
        if (p == q) {
            break;
        }
        count ++;
    } while (next_permutation(ALL(p)));
    print(count);
}

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

Measured memory_bytes: 256
N = int(input())
l = [[0] * 10 for i in range(10)]
ans = 0
for i in range(1, N+1):
  if str(i)[-1] == "0":
    continue
  else:
    l[int(str(i)[0])][int(str(i)[-1])] += 1
for i in range(10):
  for j in range(10):
    ans += l[i][j] * l[j][i]
print(ans)
    

Measured memory_bytes: 3060
def execute(s):
    w = 'a'
    while True:
        if len(s[w]) == 0:
            return w.upper()
        t = s[w][0]
        s[w] = s[w][1:]
        w = t


if __name__ == '__main__':
    s = {}
    s['a'] = input()
    s['b'] = input()
    s['c'] = input()
    print(execute(s))


Measured memory_bytes: 2940
import java.io.*;
import java.util.*;
import java.lang.Math;
 
class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader re =
         new BufferedReader(new InputStreamReader(System.in));       
        String line = re.readLine();       
         
        double r = Double.valueOf(line);       
        
        double square= r * r * Math.PI;
        double circle= 2 * r * Math.PI;
        
        System.out.printf("%.5f %.5f \n",square,circle);
        re.close();
    }
}

Measured memory_bytes: 24584
#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));}
void printvi(vector<int> v){rep(i,0,v.size()){if(i)cout<<" ";cout<<v[i];}cout<<endl;}
void printvil(vector<int> v){rep(i,0,v.size()){cout<<v[i]<<endl;}}
void printvvi(vector<vector<int>> v){
    rep(i,0,v.size()){
        rep(j,0,v[i].size())cout<<v[i][j];
        cout<<endl;
    }
}
void printvstr(vector<string> v){
    rep(i,0,v.size()){
        cout<<v[i]<<endl;
    }
}

signed main (){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<min(c,b/a)<<endl;

    
}
/*

*/


Measured memory_bytes: 256
/*  
     author : masaow    
     g++ : 17.3.20 
*/        
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- "
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long  
#define p(x) 			   cout << x << "\n" ; 
#define MOD                998244353
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"
#define mi                 map <int,int> 
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             x.begin(),x.end() 
using namespace std ; 
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set; 
const int MAX = 3e5+7;  
/*  
    time : 09 : 50    
    date : 20.01.2020
*/    
// int L,R,mid,target,q,idx ;
int n,s,e,w ; 
int solve() {
    string S ;
    cin >> S ; 
    for(auto c : S) 
        if(c == 'N')
           n++ ; 
        else if(c == 'S')
           s++ ; 
           
        else if(c == 'E')
           e++ ; 
           
        else if(c == 'W')
           w++ ;
    if(n)
        if(!s)
            return cout << "No\n",0 ; 
    
    if(!n)
        if(s)
            return cout << "No\n",0 ;

    if(e)
        if(!w)
            return cout << "No\n",0 ; 
    
    if(!e)
        if(w)
            return cout << "No\n",0 ;
        
    cout << "Yes\n"; 
    return 0 ;  
}
signed main(){
    I__O ;  
    int cases = 1 ;
 	// cin >> cases;  
    while(cases--)
	    solve(); 
	return 0 ; 
}

Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/




#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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);

    double n, d; cin >> n >> d;
    cout << ceil(n / ((d*2) + 1)) << endl;
}


Measured memory_bytes: 256