akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define intarr(arr, n)  ll arr[n];  for (ll i = 0; i < n; i++)  cin >> arr[i]
#define inpvec(vec,n) for(ll i=0;i<n;i++){ll var;cin>>var;vec.push_back(var);}
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define vec vector<ll>
#define pi pair<ll,ll>
#define changeline cout<<endl
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define mod2 998244353
#define NO cout << "NO" <<endl
#define YES cout << "YES" <<endl
#define mem(arr,val) memset(arr,val,sizeof(arr));
const ll mod=1e9+7;
#define piii 3.14159265358979323846264338327950
#define print(a, n, m)     for (ll i = n; i < m; i++) {  cout << a[i] << " "; }  cout << endl
#define con continue

bool prime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
bool isPerfectSquare(ll x) {   
  long double sr = sqrt(x); 
  return ((sr - floor(sr)) == 0); 
} 
bool subsequence_checker(string str1, string str2, ll m, ll n) 
{ 
    if (m == 0) return true; 
    if (n == 0) return false; 
    if (str1[m-1] == str2[n-1]) 
        return subsequence_checker(str1, str2, m-1, n-1); 
    return subsequence_checker(str1, str2, m, n-1); 
}
bool cmp(const pair<int,int> &a,  const pair<int,int> &b) 
{ 
    if(a.ff == b.ff)
        return a.ss < b.ss;
    return (a.ff > b.ff); 
}
//////////////////////////////////////////////////// Lets Do It ////////////////////////////////////////////////////////
int gcd(int p, int q){
if(p % q == 0)return q;
return gcd(q, p % q);
}

void solve()
{

    ll n,m;
    cin>>n>>m;

    intarr(a,n);

    ll sum = 0;
    loop(i,0,n) sum+= a[i];

    ll ans = 0;
    ld req = (ld)sum/(4.0*m);
    loop(i,0,n)
    {
        if(a[i]>=req)
            ans++;
    }

    if(ans>=m)
    {
        cout<<"Yes";
    }
    else
        cout<<"No";

    return;
}
 
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        solve();
        cout<<endl;
    }

    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
} 

Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int n,m; cin >> n >> m;
  int p[m],y[m];
  Graph g(100005);
  REP(i,m) {
    cin >> p[i] >> y[i];
    p[i]--;
    g[p[i]].push_back(y[i]);
  }

  REP(i,n) sort(g[i].begin(), g[i].end());
  REP(i,m) {
    auto it = lower_bound(g[p[i]].begin(), g[p[i]].end(), y[i]);
    int order = it - g[p[i]].begin() + 1;
    printf("%06d%06d\n", p[i]+1, order);
  }
  return 0;
}

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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 100011, inf = 1000111222;
const ll inff = 1000111222333444;

int a[max_n], n;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n;
    int s = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (a[i] != i + 1) {
            ++s;
        }
    }
    if (s <= 2) cout << "YES\n"; else cout << "NO\n";
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


N = int(input())
A = list(map(int, input().split()))

# dp[i] := i日目の売却時の所持金の最大
# dp[i] = max(i-1のまま, j日目時点で買えるだけ買った株全て売却)

dp = [0] * (N+1)
dp[0] = 1000

for i in range(1, N+1):
    # print(f'i = {i}')
    max_j = 0
    for j in range(1, i):
        # print(f'j = {j}')
        q, r = divmod(dp[j-1], A[j-1])
        # print(f'q, r = {q}, {r}')
        max_j = max(max_j, A[i-1] * q + r)
    # print(f'dp[i-1] = {dp[i-1]}, max_j = {max_j}')
    dp[i] = max(dp[i-1], max_j)

# pprint(dp)
print(dp[N])


Measured memory_bytes: 74484
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const double PI=3.1415926535;

int main(){
    string S;
    cin>>S;
    cout<<((S[0]==S[1]||S[1]==S[2]||S[2]==S[3])?"Bad":"Good")<<endl;
}


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

#define pb push_back
#define mp make_pair

typedef long long ll;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

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

  ll a;
  if(n - m == 0){
    a = 2;
  }else if(abs(n - m) == 1){
    a = 1;
  }else{
    cout << 0 << endl;
    return 0;
  }

  ll b = 1;
  for(int i = 1; i <= n; i++){
    b = b * i % mod; 
  }

  ll c = 1;
  for(int i = 1; i <= m; i++){
    c = c * i % mod;
  }

  ll ans = a * b * c % mod;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void hoge(int x, int y)
{
    int counter = 0;
    string str(y, '#');
    while(counter < x) {
        cout << str << endl;
        counter += 1;
    }
    cout << endl;
    counter = 0;
}

int main()
{
    int H, W;
    while(cin >> H >> W, H+W != 0) {
    hoge(H,W);
    }
}




Measured memory_bytes: 3104
#include<cstdio>
#include<queue>
using namespace std;
const int MAXN = 200000;
const int MAXM = 2000000;
struct edge{
	int to;
	edge *nxt;
}edges[MAXM + 5], *adj[4*MAXN + 5], *ecnt = &edges[0];
char s[MAXN + 5];
void addedge(int u, int v) {
	edge *p = (++ecnt);
	p->to = v, p->nxt = adj[u], adj[u] = p;
}
int indeg[4*MAXN + 5];
int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	scanf("%s", s+1);
	for(int i=1;i<=M;i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		if( a == b ) {
			addedge(a+N, a+2*N);
			addedge(a+3*N, a);
		}
		else {
			if( s[a] == s[b] ) {
				addedge(a+N, b);
				addedge(b+N, a);
				addedge(a+3*N, b);
				addedge(b+N, a+2*N);
				addedge(b+3*N, a);
				addedge(a+N, b+2*N);
				addedge(a+3*N, b+2*N);
				addedge(b+3*N, a+2*N);
			}
			else {
				addedge(a, b+N);
				addedge(b, a+N);
				addedge(a+2*N, b+N);
				addedge(b, a+3*N);
				addedge(b+2*N, a+N);
				addedge(a+2*N, b+N);
				addedge(a+2*N, b+3*N);
				addedge(b+2*N, a+3*N);
			}
		}
	}
	for(int i=1;i<=4*N;i++) {
		for(edge *p=adj[i];p!=NULL;p=p->nxt)
			indeg[p->to]++;
	}
	queue<int>que;
	for(int i=1;i<=4*N;i++)
		if( !indeg[i] ) que.push(i);
	int cnt = 0;
	while( !que.empty() ) {
		cnt++;
		int f = que.front(); que.pop();
		for(edge *p=adj[f];p!=NULL;p=p->nxt) {
			indeg[p->to]--;
			if( !indeg[p->to] ) que.push(p->to);
		}
	}
	if( cnt == 4*N ) puts("No");
	else puts("Yes");
}

Measured memory_bytes: 36224
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def main():
    hen, start=map(int,input().split())

    koyakusuu = gcd(hen, start)
    ans = koyakusuu * 3 * (hen // koyakusuu - 1)
    print(ans)

if __name__ == '__main__':
    main()

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i,m) cin >> p[i].first >> p[i].second;
    rep(x,1000) {
        int keta = 1;
        int nx = x/10;
        vector<int> d(1,x%10);
        while(nx) {
            keta++;
            d.push_back(nx%10);
            nx /= 10;
        }
        if (keta != n) continue;
        bool flag = true;
        reverse(d.begin(), d.end());
        rep(i,m) {
            if (d[p[i].first-1] != p[i].second) flag = false;
        }
        if (flag) {
            cout << x << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
static const int N = 10000;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int,int>> adj[N];

void dijkstra(int s){
	priority_queue<pair<int,int>> PQ;
	int color[N];
	int d[N];
	for(int i=0;i<n;i++){
		color[i] = WHITE;
		d[i] = INFTY;
	}
	d[s] = 0;
	PQ.push(make_pair(s,0));
	color[s] = GRAY;

	while(!PQ.empty()){
		pair<int,int> f = PQ.top();PQ.pop();
		int u = f.second;
		color[u] = BLACK;
		if(d[u] < f.first*-1)continue;

		for(int j=0;j<adj[u].size();j++){
			int v=adj[u][j].first;
			if(color[v] == BLACK)continue;
			if(d[v]>d[u]+adj[u][j].second){
				d[v] = d[u] + adj[u][j].second;
				PQ.push(make_pair(d[v]*-1,v));
				color[v] = GRAY;
			}
		}
	}
	for(int i=0;i<n;i++){
		cout << i << " " << (d[i]==INFTY?-1:d[i]) << endl;
	}
}

int main(){
	cin >> n;
	int u,k,v,c;
	for(int i=0;i<n;i++){
		cin >> u >> k;
		for(int j=0;j<k;j++){
			cin >> v >> c;
			adj[u].push_back(make_pair(v,c));
		}
	}
	dijkstra(0);
	return 0;
}




Measured memory_bytes: 8092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;


int main(){
  int i,j;
  ll n;
  cin>>n;
  if(n%2==1){
    cout<<0<<endl;
    return 0;
  }
  n=n/2;
  ll ans=0;
  while(n>1){
    ans+=n/5;
    n=n/5;
  }
  cout<<ans<<endl;
  

  return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

	string s,t; cin>>s>>t;

	vector<string> ans;

	int cnt =0;

	for(int i=0; i<s.length()-t.length()+1; i++){
		string ss = s;

			bool judge =true;
			for(int j =0; j<t.length(); j++){
				if(!(s[i+j] == t[j] || s[i+j] =='?') ){
					judge =false;
					break;
				}
			}
			if(judge){
				cnt++;
				for(int j=0; j<t.length(); j++){
					ss[i+j] =t[j];
				}
				for(int k =0; k<s.length(); k++){
					if(ss[k]=='?'){
						ss[k] ='a';
					}
				}
				ans.push_back(ss);
			}


	}
	sort(ans.begin(),ans.end());
	if(cnt){
	writeln(ans[0]);
	}else {
		writeln("UNRESTORABLE");
	}

}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define INF 1000000000 //1e9

int main(){
    int N;
    cin >> N;
    int num[N];
    for(int i = 0 ; i < N; i++){
        cin >> num[i] ;
    }
    int mini = num[0];
    int count = 0;
    for(int i = 0; i < N;i++){
        mini = min(mini,num[i]);
        if(mini >= num[i]) count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<map>
#define pb push_back
#define rep(i,k) for(int i=0;i<k;i++)
using namespace std;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
void _dfs(Graph &g, int cur, vector<int> &ord, int &num) {
  rep(i, g[cur].size()) {
    int nxt = g[cur][i];
    if(ord[nxt] != -1) continue;
    _dfs(g, nxt, ord, num);
  }
  ord[cur] = --num;
}
vector<int> topological_sort(Graph &g) {
  const int n = g.size();
  
  int num = n;
  vector<int> ord(n, -1);
  
  rep(i, n) if(ord[i] == -1) _dfs(g, i, ord, num);
  
  vector<int> _ord(n);
  rep(i, n) _ord[ord[i]] = i;
  return _ord;
}
int main(){
	int n,m;
	while(cin>>n>>m){
		vector<vector<P> > v(n);
		Graph g(n);
		for(int i=0;i<m;i++){
			int a,b,c;
			cin>>a>>b>>c;
			v[a].pb(P(b,c));
			g[a].pb(b);
		}
		vector<int> num=topological_sort(g);
		vector<int> p=num;
		/*for(int i=0;i<n;i++){
			p[num[i]]=i;
		}*/
		
		vector<int> d(n,0);
		d[0]=0;
		//for(int i=0;i<n;i++)
		//cout<<i<<" "<<p[i]<<endl;
		for(int i=0;i<p.size();i++){
			int ind=p[i];
			//cout<<" "<<ind<<endl;
			for(int j=0;j<v[ind].size();j++){
				int to=v[ind][j].first;
				int cost=v[ind][j].second;
				d[to]=max(d[to],d[ind]+cost);
			}
		}
		//cout<<endl;
		//for(int i=0;i<n;i++)
		//cout<<i<<" "<<d[i]<<endl;
		
		cout<<d[p[n-1]]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long int
#define M 1000000007
#define pie 3.141592653589793238
using namespace std;



signed main(){  
    int n; cin >> n;
    vector<int> v;
    while(n){
        int r = n%26;
        if(r == 0){
            v.push_back(25);
            n--;
        }
        else{
            v.push_back(r-1);
            
        }
        n /= 26;
    }
    reverse(v.begin(),v.end());
    for(auto x : v){
        cout << char(x+'a');
    }
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<P,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define print(v) cout<<v<<endl;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

ll gcd(ll a,ll b) {
    while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
    }
    return a;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    for(ll i=0;i<N;i++)cin>>A[i];
    ll ans=A[0];
    for(ll i=0;i<N;i++)ans=gcd(ans,A[i]);
    print(ans)


    return 0;
}

Measured memory_bytes: 1024
<?php
	$count = fgets(STDIN);
	$array = explode(' ', fgets(STDIN));
	$min = 100;
	for ($i = 0; $i < $count; $i ++) {
      for ($j = 0; $array[$i] % 2 == 0; $j ++) {
        $array[$i] /= 2;
      }
      $min = min($j, $min);
    }
	echo $min;
?>

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

int main() {
    int n, h;
    cin >> n >> h;
    int mx = 0;
    vector<int> b(n);
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a >> b[i];
        mx = max(mx, a);
    }
    sort(b.begin(), b.end());
    int res = 0;
    while (h > 0 && !b.empty()) {
        int t = b.back();
        if (t <= mx) break;
        res++;
        h -= t;
        b.pop_back();
    }
    if (h > 0) res += (h + mx - 1) / mx;
    cout << res << endl;
    return 0;
}

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

#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VB vector<bool>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

const std::string YES = "YES";
const std::string Yes = "Yes";
const std::string NO = "NO";
const std::string No = "No";

bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }

// 4近傍（右, 下, 左, 上）
const std::vector<int> dy = { 0, -1, 0, 1 };
const std::vector<int> dx = { 1, 0, -1, 0 };

using namespace std;


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

    while (true) {
        int n, s;
        cin >> n >> s;
        if (n == 0 and s == 0) { break; }

        // dp[i][j][k] = iまで見たときにj個を使ってkをつくる組み合わせの数
        vector<vector<vector<LL>>> dp(102, vector<vector<LL>>(n + 1, vector<LL>(s + 1, 0)));
        dp[0][0][0] = 1;


        FOR(i, 0, 101) {
            FOR(j, 0, dp[0].size()) {
                FOR(k, 0, dp[0][0].size()) {
                    if (dp[i][j][k] == 0) { continue; }

                    // not use
                    dp[i + 1][j][k] += dp[i][j][k];

                    // use
                    if (j + 1 < dp[0].size() and k + i < dp[0][0].size()) {
                        dp[i + 1][j + 1][k + i] += dp[i][j][k];
                    }
                }
            }
        }

        cout << dp[101][n][s] << endl;

    }
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T & a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k)cout << ":(" << endl;
	else cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll mod = 1000000007;
const int INF = 1<<29;

int main(){
  double L; cin >> L;

  printf("%.8f", (L / 3) * (L / 3) * (L / 3));
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline


def solve():
    N = int(input())
    par = {i:[] for i in range(1, N+1)}
    q = [1]
    l = []
    dp = [0] * (N+1)

    for i in range(2, N+1):
        a = int(input())
        par[a].append(i)

    while q:
        s = q.pop()
        l.append(s)
        for t in par[s]:
            q.append(t)

    for s in l[::-1]:
        depth = 1
        res = sorted([dp[t] for t in par[s]])[::-1]
        for i, j in enumerate(res):
            depth = max(depth, i+j+1)
        dp[s] = depth

    print(dp[1]-1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 35324
n = int(input())
a = []
flag = 0
d = 0
for i in range(n):
  a.append(int(input()))
a.sort()
for i in range(n - 1):
  if flag == 1:
    flag = 0
  elif a[i] == a[i + 1]:
    d = d + 2
    flag = 1
print(len(a) - d)

Measured memory_bytes: 7388
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;

/// 数列の読み込み
auto readNums() {
	return readln().chomp.split.map!(to!int).array;
}

/// 数の読み込み
auto readNum() {
	return readNums.front;
}

/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}

void main() {
	const nums = readNums();
	immutable size_t rows = nums[0];
	immutable size_t cols = nums[1];
	const grid = readRows(rows);
    foreach(y, row; grid) {
        foreach(x, c; row) {
            if(c != '#') {
                continue;
            }
            if(x > 0 && grid[y][x - 1] == '#') {
                continue;
            }
            if(x < (cols - 1) && grid[y][x + 1] == '#') {
                continue;
            }
            if(y > 0 && grid[y - 1][x] == '#') {
                continue;
            }
            if(y < (rows - 1) && grid[y + 1][x] == '#') {
                continue;
            }

            writefln("No");
            return;
        }
    }

    writefln("Yes");
}



Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <iomanip>
#include <queue>

#define PI 3.14159265358979
#define MOD 1000000007

//fixed << setprecision(15) <<

using namespace std;


int main(void) {
	long long int l, m, n, max, num, x, sum, y;
	int a[50], b[50], c[50], d[50];
	vector <long long int> e;
	int i, j, k;
	bool flag = true;
	cin >> n >> m >> l;
	num = 0;
	y = 1;
	for (i = 0; i < l; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	for (i = 0; i < n; i++) {
		e.push_back(1);
	}
	max = 0;
	for (; e[0] < m;) {
		sum = 0;
		for (j = 0; j < l; j++) {
			if (e[b[j] - 1] - e[a[j] - 1] == c[j])sum += d[j];
		}
		if (max < sum)max = sum;
		for (i = 0; i < n; i++) {
			if (e[e.size() - 1] == m)e.pop_back();
			else break;
		}
		e[e.size() - 1]++;
		for (i = 0; e.size() < n; i++) {
			e.push_back(e[e.size() - 1]);
		}
	}
	sum = 0;
	for (j = 0; j < l; j++) {
		if (e[b[j] - 1] - e[a[j] - 1] == c[j])sum += d[j];
	}
	if (max < sum)max = sum;
	cout << max << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n, cnt = 0;
	cin >> n;
	double dist = 0;
	vector<int> id(n);
	vector<double> x(n), y(n);
	rep (i, n) cin >> x[i] >> y[i], id[i] = i;
	do {
	  rep (i, n - 1) {
		double p = (x[id[i]] - x[id[i + 1]]) * (x[id[i]] - x[id[i + 1]]) + (y[id[i]] - y[id[i + 1]]) * (y[id[i]] - y[id[i + 1]]);
		dist += sqrt(p);
	  }
	  cnt++;
	} while (next_permutation(id.begin(), id.end()));
	cout << fixed << setprecision(10) << dist / cnt << endl;
    
    return 0;
}



Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ini(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define inf LLONG_MAX

ll power(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1)	ans*=x;
		y=y>>1;
		x*=x;
	}
	return ans;
}

ll mul(ll x,ll y)
{

	ll ans,i;
	ans=i=0;
	while(y>0)
	{
		ll temp=x*(y%10);
		// cout<<temp<<endl;
		ans+=temp*(power(10,i));
		y/=10;
		i++;
		// cout<<ans<<endl;
		if(ans>power(10,18) or ans<0)	return -1;
	}

	if(ans>power(10,18) or ans<0)	return -1;
	return ans;
	
}


void solve()
{
	ll n,i,res,ans;
	cin>>n;
	ll arr[n+1];
	for(i=0;i<n;i++)	{cin>>arr[i];if(arr[i]==0)	{cout<<0<<endl;return;}}

		ans=1;
	for(i=0;i<n;i++)	
	{
		res=mul(ans,arr[i]);
		if(res==-1)	{cout<<"-1";return;}
		ans=res;
	}
	
	cout<<ans<<endl;
}


int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		solve();
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 4568
//😄😄😄😄😄😄😄😄😄😄😄😄😄
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
#define endl "\n"
#define debug(x) cout<<"DEBUG------> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define mint map<int,int>

////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////


void solve() {

	int n; cin >> n;
	if (n <= 599)
		cout << 8;
	else if (n <= 799)
		cout << 7;
	else if (n <= 999)
		cout << 6;
	else if (n <= 1199)
		cout << 5;
	else if (n <= 1399)
		cout << 4;
	else if (n <= 1599)
		cout << 3;
	else if (n <= 1799)
		cout << 2;
	else
		cout << 1;
	cout << endl;
}




////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
//	freopen("in.txt", "r", stdin);
//	freopen ("out.txt", "w", stdout);
//	int t; cin >> t;
//	while (t--)
	solve();

	return 0;
}





///////////////////////////////////////////////////////////////////////////////////////////
//What are you doing ???



Measured memory_bytes: 3644
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;
#define MAXN 300010
#define LL long long
int n;
struct node{
	int a,b;
}bud[MAXN];
priority_queue<int> Q;
bool cmp(node p,node q)
{
	return p.b<q.b;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    	scanf("%d %d",&bud[i].a,&bud[i].b);
    sort(bud+1,bud+n+1,cmp);
    int T=0,ans=0;
    for(int i=1;i<=n;i++)
    {
    	if(T+bud[i].a>bud[i].b)
    	{
			if(!Q.empty())
    			if(bud[i].a<Q.top())
    			{
    				T-=Q.top();
    				Q.pop();
    				Q.push(bud[i].a);
    				T+=bud[i].a;
				}
		}
		else
		{
			Q.push(bud[i].a);
			ans++;
			T+=bud[i].a;
		}
	}
	if(ans==n)
		printf("Yes\n");
	else printf("No\n");
    return 0;
}

Measured memory_bytes: 2936
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int N;
    int[][] A;

    scan(N);
    A = new int[][](N, N);
    iota(N).each!(i => A[i] = readln.split.to!(int[]));

    long ans;

    foreach (i ; 0 .. N) {
        foreach (j ; i + 1 .. N) {
            bool flag = true;

            foreach (k ; 0 .. N) {
                if (k == i || k == j) continue;
                if (A[i][j] > A[i][k] + A[k][j]) {
                    writeln(-1);
                    return;
                }
                if (A[i][j] == A[i][k] + A[k][j]) {
                    flag = false;
                    break;
                }
            }

            if (flag) ans += A[i][j];
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
} 

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

int main(){
    long long n,w;
    cin>>n>>w;
    long long products[n][2];
    long long dp[100005];
    int sum = 0;
    for(long long i=0;i<n;i++){
        long long a,b;
        cin>>a>>b;
        products[i][1]=a;
        products[i][0]=b;
        sum+=b;
    }

    long long inf = 1000000000000000002;
    for(int i=0;i<=sum;i++) dp[i]=inf;
    dp[0]=0;
    for(int i=0;i<n;i++){
        long long temp[sum+1];
        for(int j=products[i][0];j<=sum;j++){
            if(products[i][1]+dp[j-products[i][0]]<dp[j]){
                temp[j]=products[i][1]+dp[j-products[i][0]];
            }
            else temp[j]=dp[j];
        }
        for(int j=products[i][0];j<=sum;j++){
            dp[j]=temp[j];
        }
    }
    for(int i=sum;i>=0;i--){
        if(dp[i]<=w){
            cout<<i<<endl;
            break;
        }
    }
}

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

int main(){
	int N;
	int A;
	int B;
	cin >> N >> A >> B;
	int sum;
	sum = N*A;
	
	if(sum<=B){
		cout << sum << endl;
	} else {
		cout << B << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || '9'<ch;ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=21,mo=1e9+7;
int _2[N],n,m,lim,c[N][N],f[2][N][524290],nxt[N][524290];
void upd(int &x,int y){x=(x+y)%mo;}
int main()
{
	_2[0]=1;fo(i,1,20) _2[i]=_2[i-1]<<1;
	int x,y,z;
	n=read(),m=read(),lim=read();--n;
	mset(c,-1);
	fo(i,1,lim) x=read(),y=read(),z=read(),c[x][y]=z;
	fo(s,0,_2[n]-1)
		fo(i,0,n-1) if(!(s&_2[i]))
			fo(j,i+1,n-1) if(s&_2[j]) {nxt[i][s]=j;break;}
	f[0][n][0]=1;
	z=1;
	for(int i=1;i<=m;i++,z^=1)
	{
		mset(f[z],0);
		fo(s,0,_2[n]-1) f[z][0][s]=f[z^1][n][s];
		fo(j,0,n-1)
			fo(s,0,_2[n]-1) if(f[z][j][s])
				if(s&_2[j])
				{
					if(c[i][j+1]==0) continue;
					upd(f[z][j+1][s],f[z][j][s]);
				}
				else
				{
					if(c[i][j+1]!=1)
					{
						upd(f[z][j+1][s],f[z][j][s]);
					}
					if(c[i][j+1]!=0)
					{
						int ps=nxt[j][s],ss=s|_2[j];
						if(ps) ss^=_2[ps];
						upd(f[z][j+1][ss],f[z][j][s]);
					}
				}
	}
	int ans=0;
	fo(s,0,_2[n]-1) upd(ans,f[z^1][n][s]);
	printf("%d",ans);
	return 0;
}


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

int main(){
    int N, hito, count;

    std::cin >> N;
    std::vector<int> syain(N);
    std::vector<int> numbers(N, 0);
    syain[0] = 0;

    for(int i = 1; i < N; i++){
        scanf("%d", &syain[i]);
    }

    for(int i = 1; i < N; i++){
        numbers[syain[i]-1]++;
    }
    
    for(int i = 0; i<N; i++){
        printf("%d\n", numbers[i]);
    }
    
}

Measured memory_bytes: 4836
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)

// https://ei1333.github.io/algorithm/cumulative-sum2d.html
template <class T> struct CumulativeSum2D {
    vector<vector<T>> data;
    int w, h;

    CumulativeSum2D(int W, int H) {
        data.assign(W + 1, vector<T>(H + 1));
        w = W, h = H;
    }

    void add(int x, int y, T z) {
        ++x, ++y;
        if (x >= w || y >= h)
            return;
        data[x][y] += z;
    }

    void build() {
        FOR(i, 1, w) FOR(j, 1, h) {
            data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
        }
    }

    T query(int sx, int sy, int gx, int gy) {
        return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
    }

    void print() {
        for (auto &x : data) {
            for (auto &y : x) {
                cout << y << " ";
            }
            cout << endl;
        }
    }
};

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    char c;
    int n, k, x, y;
    cin >> n >> k;
    CumulativeSum2D<int> s(k * 2, k * 2);
    REP(i, n) {
        cin >> x >> y >> c;
        if (c == 'W') {
            y += k;
        }
        y %= 2 * k;
        if (y >= k) {
            y -= k;
            x += k;
        }
        x %= 2 * k;
        // 上半分の黒色エリア
        s.add(x, y, 1);
        // 下半分の黒色エリア
        s.add((x + k) % (2 * k), y + k, 1);
    }
    // 二次元累積和
    s.build();
    // s.print();
    int maxv = 0;
    REP(x, k) REP(y, k) {
        int t = s.query(x, y, x + k, y + k);
        // 今までの最大値、今回の黒色の数、白色の数
        maxv = max({maxv, t, n - t});
    }
    cout << maxv << endl;
    return 0;
}


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

class LazySegmentTree {
public:
	const int n;
	const ll id = 0;
	vector<ll> data, data2;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	ll sub(int l, int r, int node, int lb, int ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) {
			return data[node] + data2[node] * (ub - lb);
		}
		ll res = data2[node] * (min(r, ub) - max(l, lb));
		return res + sub(l, r, node * 2, lb, (lb + ub) / 2) + sub(l, r, node * 2 + 1, (lb + ub) / 2, ub);
	}
	void suc(int l, int r, int node, int lb, int ub, ll val) {
		if (ub <= l || r <= lb) return;
		if (l <= lb && ub <= r) {
			data2[node] += val;
			return;
		}
		data[node] += val * (min(r, ub) - max(l, lb));
		suc(l, r, node * 2, lb, (lb + ub) / 2, val);
		suc(l, r, node * 2 + 1, (lb + ub) / 2, ub, val);
	}
	LazySegmentTree(int n_) :
		n(size(n_)), data(n * 2, id), data2(n * 2, id) {}
	void add(int l, int r, ll val) {
		suc(l, r + 1, 1, 0, n, val);
	}
	ll getSum(int l, int r) {
		return sub(l, r + 1, 1, 0, n);
	}
};

int main()
{
	int n, q, b, s, t, x;
	cin >> n >> q;
	LazySegmentTree lst(n);
	while (q--) {
		cin >> b;
		if (b) {
			cin >> s >> t;
			cout << lst.getSum(s - 1, t - 1) << endl;
		}
		else {
			cin >> s >> t >> x;
			lst.add(s - 1, t - 1, x);
		}
	}
	return 0;
}

Measured memory_bytes: 7064
from itertools import accumulate
N, C = map(int, input().split())
xs = [0]
ys = [0]
vs = [0]
us = [0]
ws = [0]
for i in range(N):
    x, v = map(int, input().split())
    us.append(us[-1]+v-x+xs[-1])
    vs.append(v)
    xs.append(x)
for i in range(N, 0, -1):
    y = C-xs[i]
    ws.append(ws[-1]+vs[i]-y+ys[-1])
    ys.append(y)
#vs = list(accumulate(vs))
#ws = list(accumulate(ws))
zs = [0] * (N+1)
c = 0
r = 0
for i, u in enumerate(us):
    if c <= u:
        c, ci = u, i
        r = max(r, c)
    zs[i] = (c, ci)
zs2 = [0] * (N+1)
c = 0
for i, u in enumerate(ws):
    if c <= u:
        c, ci = u, i
        r = max(r, c)
    zs2[i] = (c, ci)
for z, zi in zs:
    #print(z, zi, zs2[N-zi])
    c = z+zs2[N-zi][0]-xs[zi]
    r = max(r, c)
for z, zi in zs2:
    #print(z, zi, zs2[N-zi])
    c = z+zs[N-zi][0]-ys[zi]
    r = max(r, c)
#print(us, ws, zs, zs2, ys, sep="\n")
print(r)
#print(6500000000)


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

using namespace std;
typedef long long ll;

ll gcd(ll a, ll b){
    int r=1;
    while(1){
        r = a % b;
        if (r==0) return b;
        a = b;
        b = r;
    }
}

int main() {

    int N;
    cin>>N;

    ll arr[100002];
    ll left[N];
    ll right[N];

    for(int i =0; i < N; i++)
        cin>>arr[i];

    left[0] = arr[0];
    right[N-1] = arr[N-1];

    for(int i = 0; i< N-1; i++)
        left[i+1] = gcd(left[i], arr[i+1]);

    for (int i = N-1; i>0; i--)
        right[i-1] = gcd(right[i], arr[i-1]);

    ll max = -1;
    ll temp;

    for (int i = 0; i < N ; i++){
        if (i ==0)
            temp = right[1];
        else if (i==N-1)
            temp = left[N-2];
        else
            temp = gcd(left[i-1], right[i+1]);

        max = (temp > max) ? temp : max;
    }

    cout<< max;

    return 0;
}

Measured memory_bytes: 2560
S=chomp(readline())
N=length(S)
id=1
ans=0
while id<=N
	L=R=0
	while id<=N&&S[id]=='<'
		id+=1
		L+=1
	end
	while id<=N&&S[id]=='>'
		id+=1
		R+=1
	end
	ans+=div(L*(L+1),2)+div(R*(R+1),2)-min(L,R)
end
println(ans)


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


int main(){
	int n;cin>>n;
	vector<vector<int> > arr(n,vector<int>(3));
	//int k ; cin>>k;
	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	vector<int> dp(3,0);

	for(int i=0;i<n;i++){
		vector<int> new_dp(3,INT_MIN);
		
		for(int j=0;j<3;j++){
			for(int k = 0;k<3;k++){
				if(j!=k)
				new_dp[k] = max(new_dp[k], dp[j] + arr[i][k]);
			}
		}
		swap(dp,new_dp);
	}
	int ans = INT_MIN;
	for(int i=0;i<3;i++) ans = max(ans,dp[i]);
	cout<<ans;
	
	
	return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#include <bitset>
#define M 1000000007
#define M1 998244353

#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define fast                        \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

ll power(ll x, ll n)
{
    ll result = 1;
    while (n)
    {
        if (n % 2 == 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}

ll gcd(ll a, ll b)
{
    if (!b)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

inline ll mul(ll x, ll y, ll m)
{
    ll z = 1LL * x * y;
    if (z >= m)
    {
        z %= m;
    }
    return z;
}

ll powmod(ll x, ll y, ll m)
{
    ll r = 1;
    while (y)
    {
        if (y & 1)
        {
            r = mul(r, x, m);
        }
        y >>= 1;
        x = mul(x, x, m);
    }
    return r;
}



void start()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
/***********************************************************************************************************/

int main()
{
    start();
    int n;
    cin>>n;
    int a[n+1];
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int j=1;
    int c=0;
    for (int i=1;i<=n;i++)
    {
        if (a[i]!=j)
        {
            c++;
        }
        else
        {
            j++;
        }
    }
    if(c>=n)
    { 
        cout<<-1;
    }
    else
    {
        cout<<c;
    }
    
    return 0;
}

Measured memory_bytes: 4388
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

ans = ""

ans = "R" * dx + "U" * dy + "L" * dx
ans += "D" * (dy + 1) + "R" * (dx + 1) + "U" * (dy + 1) + "L" + "U"
ans += "L" * (dx + 1) + "D" * (dy + 1) + "R"

print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main{
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		String str = scn.nextLine();
		if(str.length() == 2) {
			System.out.println(str);
		}else {
			System.out.print(str.charAt(2));
			System.out.print(str.charAt(1));
			System.out.println(str.charAt(0));
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main () {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << c - d + b << " " << d - a + c << " " << a - d + b << " " << b - a + c<< endl; 
  return 0;
}

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

int solve(int i,int m,int* A,int n){
    bool res;
    if(m==0){
        return true;
    }
    if(i >= n){
        return false;
    }
    res = solve(i+1,m,A,n) || solve(i+1,m-A[i],A,n);
    return res;
}
int main(){
    int a,n,q,i,m,A[2000];
    cin>>n;
    for(a=0;a<n;a++){
        cin>>A[a];
    }
    cin>>q;
    for(a=0;a<q;a++){
        cin>>m;
        i=0;
        if(solve(i,m,A,n) == true){
            cout<<"yes"<<endl;
        }else{
            cout<<"no"<<endl;
        }
        
    }
    return 0;
}


Measured memory_bytes: 3116
let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m 
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let bits = Array.init (n + 1) (fun _ -> Array.make 31 0) in
  Array.iteri (fun i a ->
    for j = 0 to 30 do
      if a land (1 lsl j) > 0 then
        bits.(i + 1).(j) <- 1
    done) as_;
  for j = 0 to 30 do
    for i = 1 to n do
      bits.(i).(j) <- bits.(i).(j) + bits.(i - 1).(j)
    done
  done;
  (Array.init n (fun i ->
    upper_bound i n (fun j ->
      Array.init 31 (fun k -> bits.(j + 1).(k) - bits.(i).(k) <= 1)
      |> Array.fold_left ( && ) true) - i + 1))
  |> Array.fold_left ( + ) 0
  |> Printf.printf "%d\n"

let n = 4;;
let as_ = [| 2; 4; 5; 6 |];;



Measured memory_bytes: 61380
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define bisea binary_search
#define unsort(vec) sort(vec); rever(vec);
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  double t,x;
  cin>>t>>x;
  printf("%3.10Lf\n",t/x);
}


Measured memory_bytes: 256
/*string??¨set*/
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

void slove(void){
	set<string> S;
	string s;
	cin >> s;
	int size = s.size();
	reps(i, 1, size){//??????????????????????????§?????????
		string s1, s2, revs1, revs2;
		rep(j, i) s1 += s[j];//????????¨???
		reps(j, i, size) s2 += s[j];//????????¨???
		for (int j = i - 1; j >= 0 ; --j) revs1 += s[j];//?????????ver
		for (int j = size - 1; j >= i ; --j) revs2 += s[j];//?????????ver
		//cout << i << s1 << endl << s2 << endl << revs1 << endl << revs2 << endl;
		//?????????????????????????????????
		S.insert(s1 + s2);
		S.insert(s2 + s1);
		S.insert(s1 + revs2);
		S.insert(revs2 + s1);
		S.insert(revs1 + s2);
		S.insert(s2 + revs1);
		S.insert(revs1 + revs2);
		S.insert(revs2 + revs1);
	}
	cout << S.size() << endl;
	return;
}

int main(void){
	int n;
	cin >> n;
	rep(i, n) slove();

	return 0;
}

Measured memory_bytes: 3144
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    K=int(input())
    l=[0]*10**6
    for i in range(9):
        l[i]=i+1
    left=0
    right=9
    a=[[0,1],[0,1,2],[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7],[6,7,8],[7,8,9],[8,9]]
    while True:
        tmp=[]
        for x in l[left:right]:
            for y in a[x%10]:
                tmp.append(x*10+y)
        tmp.sort()
        l[right:right+len(tmp)]=tmp
        left=right
        right+=len(tmp)
        if right>K:
            print(l[K-1])
            break

if __name__ == '__main__':
    main()


Measured memory_bytes: 58352
// In God We Trust


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

# define INF 1 << 31 - 1
# define pb push_back
# define fi first
# define se second

signed main(){
  int m, d;
  cin >> m >> d;
  int l, r;
  cin >> l >> r;
  if (((m == 1 or m == 3 or m == 7 or m == 8 or m == 10 or m == 12) and (d == 31)) or ((m == 4 or m == 6 or m == 9 or m == 11) and d == 30)  or ((m == 2) and d == 28))
    cout << 1 << endl;
  else
    cout << 0 << endl;
  
    
    
}


Measured memory_bytes: 256
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

//abc140D
int main(void) {
  int n, i=0, k, c=0;
  char sx;
  scanf("%d %d", &n, &k);
  int s[n];
  for(i=0; i < n; i++){
    scanf(" %c", &sx);
    if(sx == 'L') s[i]=0;
    else s[i]=2;
  }
  for(i=0; i < n; i++){ //s: 0 LUnhappy,1 LHappy,2 RU,3 RH
    if(s[i] == 0 && i != 0 && s[i - 1] <= 1) c++;
    else if(s[i] == 2 && i != n - 1 && s[i + 1] >= 2) c++;
  }
  if(c + 2 * k < n) printf("%d", c + 2 * k);
  else printf("%d", n - 1);
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
main () {
	string str;
	int n[26] = {};
	while (getline(cin, str)) {
		for (int i=0; i<str.length(); i++) {
			if ('A' <= str[i] && str[i] <= 'Z') n[str[i]-'A']++;
			else if ('a' <= str[i] && str[i] <= 'z') n[str[i]-'a']++;
		}
	}
	for (int i=0; i<26; i++)
		cout << ((char)('a'+i)) << " : " << n[i] << endl;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=998244353;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2)%mod;
  ret*=ret;
  ret%=mod;
  if(y%2==1) ret*=x;
  return ret%mod;
}
ll ar[200005]={0};
int main(){
  ll n;
  cin>>n;
  bool f=true;
  ll ma=0;
  for(ll i=1;i<=n;i++){
    ll a;
    cin>>a;
    ar[a]++;
    ma=max(ma,a);
    if(i==1&&a!=0) f=false;
    if(i!=1&&a==0) f=false;
  }
  if(!f){
    cout<<0<<endl;
    return 0;
  }
  ll ans=1;
  for(ll i=1;i<=ma;i++) {
    ans*=pow(ar[i-1],ar[i])%mod;
    ans%=mod;
  }
  cout<<ans%mod<<endl;
}


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

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        scanner.nextLine();
        final Integer[] values = Arrays.stream(scanner.nextLine().split(" "))
                .map(Integer::parseInt).toArray(Integer[]::new);
        final Integer[] costs = Arrays.stream(scanner.nextLine().split(" "))
                .map(Integer::parseInt).toArray(Integer[]::new);

        int max = 0;
        for (int i = 0; i < values.length; i++) {
            if (values[i] > costs[i]) {
                max += values[i] - costs[i];
            }
        }

        System.out.println(max);
    }
}


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

using namespace std;

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

    vector<char> acgt = { 'A', 'C', 'G', 'T' };

    vector<int> max;
    int num = 0;
    for (int i = 0; i < s.size(); i++) {
        if (!(count(acgt.begin(), acgt.end(), s[i]))) {
            max.push_back(num);
            num = 0;
        }
        else {
            num++;
        }
    }

    max.push_back(num);

    sort(max.begin(), max.end(), greater<int>());

    cout << max[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
ll a , b , c;


int main(){
    cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0) return puts("0") , 0;
    cout << min(a * b , min(a * c , b * c)) << endl;
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	if (n < 1200)printf("ABC\n");
	if (n >= 1200 && n < 2800)printf("ARC\n");
	if (n >= 2800)printf("AGC\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <map>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())

//const int MOD = 1000000007;
const int INF = 1<<30;
using namespace std;

string disp(bool x){
    return x ? "Yes" : "No";
}

int main(){
    int n; cin >> n;
    int r[n];
    rep(i,n) cin >> r[i];
    
    int maxv = -1*INF;
    int minv = r[0];
    
    rep1(i,n-1){
        maxv = max(maxv,r[i]-minv);
        minv = min(minv,r[i]);
    }
    
    cout << maxv << endl;
}







Measured memory_bytes: 3832