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

#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define let const auto
#define USE_T template <typename T>
#define USE_Ti template <typename T = int>
#define USE_TU template <typename T, typename U>

USE_Ti using duo = std::pair<T, T>;
USE_Ti using vec = std::vector<T>;
using ll = long long;
// clang-format off
USE_TU inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE_TU inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE_Ti inline T in(){T x;std::cin>>x;return x;}
USE_Ti inline vec<T> in(int n){vec<T> v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE_T inline void in(T*x,int n){rep(i,n)x[i]=in<T>();}
struct IoSetup {
  IoSetup(){
    using namespace std;
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(10);
    cerr<<setprecision(10);
  }
} iosetup;
// clang-format on
// }}}
using namespace std;
const int inf = 1001001001;
const ll infll = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

signed main() {
  int N = in(), M = in();
  auto A = in(N);
  FOR(k, 1, M + 1) {
    REP(i, N - 1) {
      if (A[i] % k > A[i + 1] % k) swap(A[i], A[i + 1]);
    }
  }
  for (int a : A) {
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 3168
// B - Two Colors Card Game
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

string in(){string x;cin>>x;return x;}

int main(){
	int n; cin>>n;
	map<string,int> s;
	rep(i, n) s[in()]++;
	int m; cin>>m;
	rep(i, m) s[in()]--;
	int ans = 0;
	for(auto x:s) ans = max(ans, x.second);
	cout<< ans <<endl;
}


Measured memory_bytes: 256
/*
  AtCoder Beginner Contest 103
  A - Task Scheduling Problem
*/

#include<iostream>
#include<algorithm>
using namespace std;

int A1, A2, A3;

int main() {
  scanf("%d%d%d", &A1, &A2, &A3);
  int ans = max({A1, A2, A3}) - min({A1, A2, A3});
  printf("%d\n", ans);
  return 0;
}

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

const int LIM = 1e5+10;
int Nusers, Nfriends, Nblocks;

int nFriends[LIM] = {};
vector<int> friends[LIM];
int par[LIM];

int find(int i){
    return par[i];
}

void join(int a, int b){
    a = find(a);
    b = find(b);
    if(a == b) return;
    if(friends[a].size() < friends[b].size()) swap(a, b);
    for(int u: friends[b]){
        friends[a].push_back(u);
        par[u] = a;
    }
}

vector<int> blocked[LIM];

int friendSize(int a){
    int cnt = friends[find(a)].size();
    for(int u: blocked[a]){
        if(find(u) == find(a)) cnt--;
    }
    return cnt - nFriends[a] - 1;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> Nusers >> Nfriends >> Nblocks;
    
    for(int i=1; i<=Nusers; i++){
        par[i] = i;
        friends[i].push_back(i);
    }
    
    for(int i=0, a, b; i<Nfriends; i++){
        cin >> a >> b;
        nFriends[a]++;
        nFriends[b]++;
        join(a, b);
    }
    
    for(int i=0, a, b; i<Nblocks; i++){
        cin >> a >> b;
        blocked[a].push_back(b);
        blocked[b].push_back(a);
    }
    
    for(int i=1; i<=Nusers; i++){
        cout << friendSize(i) << ' ';
    }
    
	return 0;
}

Measured memory_bytes: 13048
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define pb pop_back
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define Sim template<class n
Sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
Sim> auto operator << (ostream &p, n y) -> 
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
Sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
Sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
Sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " = ", (x), " "
#define A(a, i) #a "[" #i " = ", i, "] = ", a[i], " "
const LL mod = 998244353;
const int M = 303;

int n, sum;
VI V;
LL dp[M * M], dp2[M * M];

int main()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(NULL);
	scanf("%d", &n);
	FOR(i, 1, n)
	{
		int a;
		scanf("%d", &a);
		V.PB(a);
		sum += a;
	}
	LL r = 1, r2 = 1;
	FOR(i, 1, n)
	{
		r = (r * 3) % mod;
		r2 = (r2 * 2) % mod;
	}
	r = (r - 3 * r2 + 3 * mod) % mod;
	r += 3;
	r %= mod;
	int half = (sum - 1) / 2;
	dp[0] = 1;
	dp2[0] = 1;
	debug(sum, half, r);
	for (auto x : V)
	{
		FORD(i, sum, x)
		{
			dp[i] = (dp[i] * 2 + dp[i - x]) % mod;
			dp2[i] = (dp2[i] + dp2[i - x]) % mod;
		}
		FORD(i, x - 1, 0)
		{
			dp[i] *= 2;
			dp[i] %= mod;
		}
	}
	FOR(i, 0, sum)
	{
		debug(i, dp[i], dp2[i]);
	}
	FOR(i, half + 1, sum - 1)
	{
		LL qwe = (dp[i] - 2 * dp2[i] + 2 * mod) % mod;
		debug(i, qwe);
		r = (r - 3 * qwe + 3 * mod) % mod;
	}
	printf("%lld\n", r);
	return 0;
}


Measured memory_bytes: 1664
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        Map<Long, Long> l = new HashMap<>();
        for(int i = 0;i < N;i++){
            long a = sc.nextLong();
            if(l.containsKey(a))    l.put(a, l.get(a)+1);
            else    l.put(a, (long)1);
        }
        long m1 = 0;
        long m2 = 0;
        for(Long key : l.keySet()){
            long value = l.get(key);
            if(key > m1){
                if(value >= 4){
                    m1 = key;
                    m2 = key;
                }else if(value >= 2){
                    m2 = m1;
                    m1 = key;
                }
            }else if(key > m2 && value >= 2){
                m2 = key;
            }
        }
        System.out.println(m1*m2);
    }
}

Measured memory_bytes: 65612
#include <iostream>

using namespace std;

int A, B, C;

void solve() {
	int cnt = 0;
	int A1, B1, C1;


	while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
		if (A == B && B == C) {
			cnt = -1;
			break;
		}
		else {

			A1 = A / 2;

			B1 = B / 2;

			C1 = C / 2;

			A = B1 + C1;
			B = A1 + C1;
			C = A1 + B1;

			cnt++;
		}
	}

	cout << cnt << endl;
}

int main() {

	cin >> A >> B >> C;
	solve();
	return 0;
}

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

using namespace std;

int main()
{
	int a, b, c; char op;

	vector<int> Ans;

	while(true)
	{
		cin >> a >> op >> b;

		if(op == '+') { c = a + b; }
		if(op == '-') { c = a - b; }
		if(op == '*') { c = a * b; }
		if(op == '/') { c = a / b; }
		if(op == '?') { break; }

		Ans.push_back(c);
	}

	for(vector<int>::size_type i = 0; i < Ans.size(); i++)
	{
		cout << Ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

vector<pair<long long, int>> factor(long long x) {
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= x; ++i) {
        if (x % i) continue;
        res.emplace_back(i, 0);
        while (x % i == 0) {
            x /= i;
            res.back().second++;
        }
    }
    if (x != 1) res.emplace_back(x, 1);
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n;
    cin >> n;
    auto f = factor(n);
    int cnt = 0;
    rep(i, sz(f)) {
        int x = f[i].se;
        for (int j = 1; ; ++j) {
            x -= j;
            if (x < 0) break;
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

	vector<int> P(N);
	for (int i = 0; i < N; i++) {
		cin >> P.at(i);
	}

	sort(P.begin(), P.end());

	int ans = 0;
	for (int i = 0; i < K; i++) {
		ans += P.at(i);
	}

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

Measured memory_bytes: 3628
#include <cstdlib>
#include <cstdio>
#include <cstdint>
#include <cstring>

const int N=5e5;
inline auto a(int64_t w) { return w*(w-1)/2; }
inline char* l(char* p, int s) { for(;*p==s;p++); return p; }

main(int argc, char* argv[])
{
  char s[N+1];
  int64_t sum=0, i=scanf("%s",s);
  char *p,*q,*r;
  for (p=s;*p;p=r) {
    q=l(p,'<'), r=l(q,'>');
    int m=q-p, n=r-q;
    sum += a(m) + a(n) + ((m>n)?m:n);
  }
  printf("%ld\n", sum);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   

   long int a,b;
   cin>>a>>b;

   cout<<(a*b)/__gcd(a,b);

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const long long MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse.

int main () {

    ll a,b,c;cin>>a>>b>>c;


    if (4*a*b<(c-(a+b))*(c-(a+b))&&a+b<c) {
        cout<<"Yes"<<endl;
    } else {
        cout<<"No"<<endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

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

const int mod = 1000000007;


struct mint {
    ll x;
    mint(ll x=0):x(x%mod){}

    mint& operator+=(const mint a) {
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator-=(const mint a) {
        if((x -= mod-a.x) >= mod) x -= mod;
        return *this;
    }

    mint& operator*=(const mint a) {
        x = (x * a.x) % mod;
        return *this;
    }

    mint& operator/=(const mint a) {
        *this *= a.inv();
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }

    mint pow(ll n) const {
      mint a(*this);
      mint res = 1;
      while (n > 0) {
          if (n & 1) res *= a;
          a *= a;
          n >>= 1;
      }
      return res;
    }

    mint inv() const {
      return pow(mod - 2);
    }
};

struct edge {
    int to;
    int cost;
};

const int MAX_V = 100005;
vector<edge> G[MAX_V];
int color[MAX_V];

void dfs(int i, int c) {
  if (color[i]) return;
  color[i] = c;
  for(auto j: G[i]) {
    dfs(j.to, (j.cost%2?-c:c));
  }
}

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

  int n;
  cin >> n;

  rep(i, n-1) {
    int v, u, w;
    cin >> v >> u >> w;
    v--;
    u--;
    G[v].push_back({u, w});
    G[u].push_back({v, w});
  }

  dfs(0, 1);

  rep(i, n)  {
    cout << (color[i] == 1?1:0) << endl; 
  }
}


Measured memory_bytes: 8320
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	private int[] a = new int[5];

	public static void main(String[] args) {
		new Main().run();
	}
	
	private void run() {
		Scanner scan = new Scanner(System.in);
		for (int i = 0; i < 5; i++) {
			a[i] = scan.nextInt();
		}
		Arrays.sort(a);
		for (int i = 4; i >= 0; i--) {
			System.out.print(a[i] + (i != 0 ? " " : "\n"));
		}
	}
	
	private void debug() {
		System.out.println();
	}

}

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

int main() {
	string s;
	cin >> s;
	for(int i = s.size()-1; i >= 0; i--) {
		if(i%2!=0) continue;
		if(s.substr(0,i/2)==s.substr(i/2,i/2)) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

ans =1
mod = 10**9+7
row = [0] *3
for i in range(N):
    
    ans *=row.count(A[i])
    ans %=mod
    for j in range(3):
        if row[j]==A[i]:
            row[j]+=1
            break
    

        
print(ans%mod)

Measured memory_bytes: 84036
H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]
ans = 0
for maskR in range(1 << H):
    for maskC in range(1 << W):
        black = 0
        for i in range(H):
            for j in range(W):
                if ((maskR >> i) & 1) == 0 and ((maskC >> j) & 1) == 0 and C[i][j] == '#':
                    black += 1
        if black == K:
            ans += 1
print(ans)

Measured memory_bytes: 9160
N = int(input())
A = list(map(int,input().split()))

con = 0
state = "FLAT"

for i in range(0,N - 1):
  if state == "FLAT":
    if A[i + 1] > A[i]:
      state = "INCREASE"
    elif A[i + 1] < A[i]:
      state = "DECREASE"
  elif state == "INCREASE":
    if A[i + 1] < A[i]:
      con += 1
      state = "FLAT"
  elif state == "DECREASE":
    if A[i + 1] > A[i]:
      con += 1
      state = "FLAT"
  
      
print(con + 1)

Measured memory_bytes: 14224
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 998244353LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll d[Maxn];
ll mk[Maxn];
set<pll> st;
vector<ll> G[Maxn];
void rev(pll x){
	if(st.count(x)){
		st.erase(x);
		st.insert({x.S, x.F});
		d[x.F] --;
		d[x.S] ++;
	} else {
		rev({x.S, x.F});
	}
}
void DFS(ll u){
	mk[u] = 1;
	for(auto adj : G[u]){
		if(mk[adj]) continue;
		DFS(adj);
		if(d[adj] & 1) rev({u, adj});
	}
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	if(m & 1) return cout << "-1", 0;
	ll u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		G[u].pb(v);
		G[v].pb(u);
		d[u] ++;
		st.insert({u, v});
	}
	DFS(1);
	
	for(auto x : st) cout << x.F << " " << x.S << '\n';
	return 0;
	
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 22400
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d,ans;

	cin >> a >> b >> c >> d;
	if(d<a || c>b){
		ans = 0;
	}else{
		ans = min(b,d) - max(a,c);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)

int count(int N)
{
        int ans = 0;
        while (N)
        {
                ans++;
                N /= 10;
        }
        return ans;
}

int main()
{
        ll X;
        cin >> X;
        ll n500 = X / 500;
        X -= n500 * 500;

        ll n5 = X / 5;
        ll ans = n500 * 1000 + n5 * 5;
        cout << ans << endl;
        return 0;
}


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

using ll = long long;
const int INF = 1<<29;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var)  std::cout<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n)   for(int i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(int i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define pb push_back
inline double isnatural(double a) { return a>=0 && ceil(a)==floor(a); }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

//sとtの最長共通部分列を求める
//戻り値:最長共通部分列の長さ
//dp配列を格納して返す
ll lcs(string s, string t, vector<vector<ll>> &dp){
	dp.assign(s.size()+1, vector<ll>(t.size()+1,0));
	for(ll i=0, slen=s.size(); i<slen; i++){
		for(ll j=0, tlen=t.size(); j<tlen; j++){
			if(s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j]+1);
			chmax(dp[i+1][j+1], dp[i][j+1]);
			chmax(dp[i+1][j+1], dp[i+1][j]);
		}
	}
	return dp[s.size()][t.size()];
}

//sとtの最長共通部分列を求める
//戻り値:最長共通部分列の文字列
string buildlcs(string s, string t, vector<vector<ll>> &dp){
	string lcsstr="";
	ll i=s.size();
	ll j=t.size();
	if(dp[i][j]==0) return "";
	while(i > 0 && j > 0){
		if (dp[i][j] == dp[i - 1][j]) {
			i--;
		} else if (dp[i][j] == dp[i][j - 1]) {
			j--;
		} else {
			i--; j--;
			lcsstr = s[i] + lcsstr;
		}
	}
	return lcsstr;
}

signed main() {
	//Longest Common Subsequence
	string s,t;
	cin >> s >> t;

	vector<vector<ll>> dp;
	ll lcsnum=lcs(s, t, dp);
	debug(lcsnum);

	string lcsstr=buildlcs(s, t, dp);
	p(lcsstr);

	return 0;
}



Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N), S(N+1);
    rep(i,N){
        cin >> A[i];
    }
    /*
    ll sum = 1;
    rep(i,K){
        sum *= A[i];
    }
    /*S[0] = 1;
    rep(i,N){
        S[i+1] = S[i]*A[i];
    }
    ll prev = S[K];*/
    for(ll i=K;i<N;i++){
        if(A[i] > A[i-K]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 6428
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void) {
    int W, H;
    while (1) {
        scanf("%d%d", &H, &W);
        if ((H == 0) && (W == 0))break;
        else {
            for (int i = 1; i <= H; i++) {
                for (int j = 1; j <= W; j++) {
                    if(i%2==0 && j%2==0 || i%2==1 && j%2==1)printf("#");
                    else printf(".");
                }
                printf("\n");
            }
        }
        printf("\n");
    }
    return 0;
}


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

#define MAX_N 200000

using namespace std;

typedef long long lint;

const lint MOD = (lint)(1e9) + 7;

lint fact[MAX_N + 1];

void euclid(lint a, lint b, lint &x, lint &y, lint &d)
{
    if(b == 0)
    {
        x = 1;
        y = 0;

        d = a;
        return;
    }
    lint xx, yy, qq = a / b;
    euclid(b, a % b, xx, yy, d);
    x = yy;
    y = xx - yy * qq;
}

lint put(lint a, lint b)
{
    lint cr = a;
    lint rez = 1;
    for(lint i = 0; (1 << i) <= b; i ++)
    {
        if(((1LL << i) & b) != 0)
        {
            rez = rez * cr % MOD;
        }

        cr = cr * cr % MOD;
    }

    return rez;
}

lint rez;

void poz(lint &x)
{
    if(x < 0)
    {
        x = MOD + x % MOD;
    }
}

lint comb(lint a, lint b)
{
    lint rez = 1;
    for(lint i = a - b + 1; i <= a; i ++)
        rez = rez * i % MOD;

    lint x, y, d;
    euclid(fact[b], MOD, x, y, d);
    poz(x);
    rez = rez * x % MOD;

    return rez;
}

lint n, a, b;

int main()
{
    cin >> n >> a >> b;

    fact[0] = 1;
    for(lint i = 1; i <= MAX_N; i ++)
        fact[i] = fact[i - 1] * i % MOD;

    rez = put(2, n) - 1;
    rez = rez - comb(n, a);
    rez = rez - comb(n, b);

    while(rez < 0)
        rez += MOD;

    rez %= MOD;

    cout << rez << "\n";

    return 0;
}


Measured memory_bytes: 1792
n=int(input())
A=list(map(int, input().split()))
B=[0 for i in range(n)]
for i in range(n):
    B[i]=[A[i],i]
B=sorted(B)
ans=[0 for i in range(n)]
for i in range(n):
    ans[i]=str(B[i][1]+1)
print(' '.join(ans))

Measured memory_bytes: 28452
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
   vector<int> data(N);
  for(int i=0;i<N;i++){
    int a;
    cin >> a;
  data.at(i) = a; 
  
  }
  sort(data.begin(), data.end());
  
  int count =1;
   for(int i=1;i<N;i++){ 
   if(data.at(i) > data.at(i-1)){
   count++;
   }
     
  }  
 
  cout << count << endl;
  
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	vector<int>stick(n);
	rep(i, n)cin >> stick[i];
	sort(all(stick));
	int c,ans=0;
	rep(i, n) {
		for (int j = i + 1; j < n; j++) {
			c = stick[i] + stick[j];
			for (int k = j + 1; k < n; k++) {
				if (stick[k] < c)ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3604
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define pb push_back
const ll mod = 1e9 + 7;
int n, h, a[100001], b[100001], ans, d;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>n>>h;
    for(int i=1; i<=n; i++) cin>>a[i]>>b[i];
    sort(a+1, a+n+1);
    sort(b+1, b+n+1);
    int k=n;
    while(d<h && k!=0 && a[n]<=b[k]){
        ans++, d+=b[k]; k--;
    }
    if(d>=h) cout<<ans; else{
        if((h-d)%a[n]==0) ans+=(h-d)/a[n]; else{ans+=(h-d)/a[n]; ans++;}
         cout<<ans;
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
ll a[3050];

int main(){
int n=read();
ll llx=0;
for (;n--;){
  llx+=read()-1;
  }write(llx),pl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long int
long long  INF=1e9+5;

int main()
{   ios_base::sync_with_stdio(0);
     cin.tie(0);
    ll n;
    cin>>n;
    vector<ll> h(n);
    for(ll& i: h)
    {    cin>>i;
    }
    vector<ll> dp(n,INF);
    dp[0]=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j:{i+1,i+2})
            {
                if(j<n)
                    dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a<c&&c<b) || (b<c&&c<a))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <string>
#include <cstring>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
#include <tuple>

using namespace std;
mt19937_64 rng(58);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k <= a)
        cout << k << "\n";
    else if (k <= a + b)
        cout << a << "\n";
    else
        cout << (a - (k - a - b)) << "\n";

}

Measured memory_bytes: 3192
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>

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

using namespace std;

typedef long long ll;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, int> pii;

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define Rep(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

int keta(ll m){
    int res = 0;
    while(m){
        m /= 10;
        res++;
    }
    return res;
}

int F(ll a, ll b){
    return keta(max(a, b));
}

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

    int ans = 100;
    //高々ルートn <= pow(10, 5)まで調べれば十分

    for(ll i = 1; i*i <= n; i++){
        //
        ll a = i;
        if(n%a == 0){
            ll b = n/a;
            //
            int tmp = F(a, b);
            ans = min(ans, tmp);
            //
        }
        //
    }

    cout << ans << endl;
}

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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define uset unordered_set
#define umap unordered_map

#define endl "\n"

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define all(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.first << ", " << p.second << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    int n;
    cin >> n;
    vi t(n + 1);
    ll tot = 0;
    for (int i = 1; i <= n; i++) {
        cin >> t[i];
        tot += t[i];
    }
    int m;
    cin >> m;
    int p;
    int x;
    for (int i = 0; i < m; i++) {
        cin >> p >> x;
        cout << tot - t[p] + x << endl;
    }
}


Measured memory_bytes: 3568
n, k = list(map(int, input().split()))
a_list = list(map(int, input().split()))


def count(num, k):
    if num == 0:
        return 0
    elif num % (k - 1) == 0:
        return num // (k - 1)
    else:
        return num // (k - 1) + 1


min_index = a_list.index(1)
res = []
for i in range(k):
    pre_end_index = max(min_index - (k-1) + i, 0)
    suf_start_index = min(min_index + i, n-1)
    pre = count(pre_end_index, k)
    suf = count(n-1-suf_start_index, k)
    res.append(pre+suf+1)

print(int(min(res)))

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

int main()
{
  int s, w;
  cin >> s >> w;
  if (s <= w)
  {
    cout << "unsafe" << endl;
  }
  else
  {
    cout << "safe" << endl;
  }
  return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	long long f[100];
	int n;
	cin>>n;
	f[0]=2;f[1]=1;
	for(int i=2;i<=n;i++)
	{
		f[i]=f[i-1]+f[i-2];
	}
	cout<<f[n]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
#include<array>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
constexpr ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acosl(-1.0);

ll mod_pow(ll x, ll n, ll m = mod) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * x % m;
		x = x * x % m; n >>= 1;
	}
	return res;
}
struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n % mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint& a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint& a, modint b) { a.n = ((ll)a.n * b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, ll n) {
	if (n == 0)return modint(1);
	modint res = (a * a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 21;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

void solve() {
	int n; cin >> n;
	ll ans = 0;
	for (int a = 1; a <= n; a++) {
		int d = n / a;
		ans += d;
		if (n % a == 0)ans--;
	}
	cout << ans << "\n";
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(15);
	//init_f();
	//init();
	//expr();
	//int t; cin >> t; rep(i, t)
	solve();
	return 0;
}




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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  map<string, int> count;
  string s;
  int max_count = 0;
  REP(i, N) {
    cin >> s;
    if (count.find(s) != count.end()) {
      ++count.at(s);
      max_count = max(max_count, count.at(s));
    } else {
      count.insert(make_pair(s, 0));
    }
  }

  vector<string> candidate;
  for (auto it : count) {
    if (it.second == max_count) {
      cout << it.first << endl;
    }
  }
  return 0;
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000001
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  int n;
  cin >> n;
  string s[n+1], t[n+1];
  REP(i, n){
    string k;
    cin >> k;
    s[i] = k;
    t[i] = k;
    REP(j, s[i].size()) if(s[i][j] == '?') s[i][j] = 'a';
    REP(j, s[i].size()) if(t[i][j] == '?') t[i][j] = 'z';
  }
  cin >> s[n];
  t[n] = s[n];
  string p = s[n];
  sort(s, s+n+1);
  sort(t, t+n+1);
  vector<int> v;
  REP(i, n+1){
    if(s[i] == p || t[i] == p) v.pb(i+1);
  }
  sort(ALL(v));
  FOR(i, v[0], v[v.size()-1]+1){
    cout << i;
    if(i == v[v.size()-1]) cout << endl;
    else cout << " ";
  }
  return 0;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String buf = br.readLine();
		String[] input = buf.split(" ");
		int[] array = new int[3];
		array[0] = Integer.parseInt(input[0]);
		array[1] = Integer.parseInt(input[1]);
		array[2] = Integer.parseInt(input[2]);
		
		Arrays.sort(array);
		
		System.out.println(array[0] + " " + array[1] + " " + array[2]);
	}
}

Measured memory_bytes: 24460
A,B,M = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
x = [list(map(int, input().split())) for _ in range(M)]
#print(A,B,M)
#print(a)
#print(b)
#print(x)

p = min(a) + min(b) #安いもの通しの組み合わせ
#print(p)
l=[]

for i in range(M):
    temp = a[x[i][0]-1] + b[x[i][1]-1] - x[i][2]
    l.append(temp)
#print(l)

print(min(p,min(l)))

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
     cout << fixed << setprecision(15);

    long double a, b, x; cin >> a >> b >> x;
    if((a*a*b)/2 < x) {
        ld ans =  atan(2*(b*a*a - x)/(a*a*a));
        cout << ans*180./(M_PI) << '\n';
    }
    else if((a*a*b) == 2*x) {
        ld ans = (atan(b/a));
        cout << ans*180./(M_PI) << '\n';
    }
    else {
        ld ans=  atan((a*b*b)/(2*x));
        cout << ans*180./(M_PI) << '\n';
    }

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

const int n = 75;
char m[n][n];
string memo[n][n];
string ans;

string big(string a, string b){
    if(a.size() > b.size()){
        return a;
    }else if(a.size() < b.size()){
        return b;
    }else{
        return a > b ? a : b;
    }
}

string dfs(int x, int y){
    string ret;
    if(memo[y][x] != "") return  memo[y][x];

    if(not isdigit(m[y][x])) return ret;
    else ret+=m[y][x];

    return memo[y][x] = ret + big(dfs(x + 1, y), dfs(x, y + 1));
}

int main(){
    int w, h;
    while(cin >> w >> h, w||h){
        ans = "";
        rep(i,n) rep(j,n) memo[i][j] = "";
        rep(i,n) rep(j,n) m[i][j] = '#';
        rep(i,h) rep(j,w) cin >> m[i + 1][j + 1];
        rep(i,h){
            rep(j,w){
                if(isdigit(m[i + 1][j + 1]) && m[i + 1][j + 1] != '0'){
                    ans = big(ans,dfs(j + 1, i + 1));
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3320
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty), *) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
#[allow(deprecated)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

fn main() {
    let (a, b, t) = read!(i32, i32, i32);
    println!("{}", t / a * b);
}


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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0296

int main() {
	int p[] = { 1, 5, 10, 50, 100, 500 };
	int sum = 0;
	for (int i = 0; i < 6; i++) {
		int a;
		cin >> a;
		sum += a * p[i];
	}
	cout << (sum >= 1000 ? 1 : 0) << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;


int main() {
    double N, K;
    cin >> N >> K;
    double NN = N;
    double ans = 0;
    double base = 1.0;
    while (NN >= 1.0) {
        dump(K);
        dump(NN);
        dump(base);
        if (K <= NN) {
            ans += (double)((LL)NN - ceil(K) + 1) / N / base;
            NN = (double)(ceil(K) - 1);
        }
        dump(ans);
        K /= 2;
        base *= 2;
    }   
    cout << setprecision(12) << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int graph[101][101];

int main(void){
    int n, d, i, a, j, n2;
    scanf("%d", &n);
    
    for (i = 1; i <= 100; i++) {
        for (j = 1; j <= 100; j++) {
            graph[i][j] = 0;
        }
    }
    
    for (i = 0; i < n; i++) {
        scanf("%d %d", &d, &n2);
        for (j = 0; j < n2; j++) {
            scanf("%d", &a);
            graph[d][a] = 1;
        }
    }
    
    for (i = 1; i <= n; i++) {
        for (j = 1; j < n; j++) {
            printf("%d ", graph[i][j]);
        }
        printf("%d\n", graph[i][j]);
    }
    
    return 0;
}


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

using namespace std;

bool checkRule(vector<string> words, string w, int i) {
    bool ans = true;
    // Check Word Start
    if (*w.begin() != *--words[i - 1].end()) ans = false;
    
    // Check Double
    int cnt = 0;
    for (string s : words) {
        if (w == s) cnt++;
    }
    if (cnt != 1) ans = false;

    return ans;
}

int main()
{
    int n; cin >> n;
    vector<string> words;
    bool ans = true;
    for (int i = 0; i < n; i++) {
        string s; cin >> s;
        words.push_back(s);
    }

    for (int i = 1; i < n; i++) {
        if (checkRule(words, words[i], i) != true) {
            ans = false;
            break;
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main() {
	char s[11], t[12];
	scanf("%s%s", s, t);
	if (strncmp(s, t, strlen(s)) == 0 && strlen(s) + 1 == strlen(t)) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1708
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main(){
  int N;
  cin >> N;
  char S[N];
  int W[N+1];

  for(int i=0;i<=N;i++) W[i] = 0;

  int sum = 0;
  for(int i=0;i<N;i++){
    cin >> S[i];
    if(S[i]=='W') sum++;
    W[i+1] = sum;
  }

  int ans = 1000000;
  for(int k=1;k<=N;k++){
     ans = min(ans, W[k-1]+N-k-W[N]+W[k]);
  }
  cout << ans <<endl;

  return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main()
{
   long long int A , B , N,i,max,h;
   cin >> A >> B >> N;
   if(B>N) cout << int(A*N/B) - A*int(N/B);
   else{
       max = int(A*(B-1)/B);
       /*for(i=B+1;i<=N;i++){
           if(i%B!= 0){
               h = int(A*i/B) - A*int(i/B);
               if(h>max) max = h;
           }
       }*/
       cout << max ;
   }
   
   return 0;
}

Measured memory_bytes: 3596
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
 
public class Main {
    public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String[] input = br.readLine().split(" ");
			System.out.println(Math.abs(Long.parseLong(input[0]) - Long.parseLong(input[1])) <= 1 ? "Brown" : "Alice");
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24404