akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> N;
    cin >> A >> B;

    for (int i = A; i <= B; i++)
    {
        if(i%N == 0) 
        {
            cout << "OK";
            return 0;
        }
    }

    cout << "NG";
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 4 * 100 * 1000 + 47;
const double EPS = 1e-8;

int A[MAX];

int main()
{
    int n;
    cin >> n;
    FOR(i, 0, 3 * n)cin >> A[i];
    sort(A, A + 3 *n);
    LL ans = 0;

    reverse(A, A+3*n);
    FOR(i, 0, n)
    {
        //cout << A[2 * i + 1] << endl;
        ans +=  A[2 * i + 1];
    }
    cout << ans << endl;
}








































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

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;
  int d=0;
  int bo;
  int A[N+1];
  for(int i=0;i<K;i++){
    cin >> d;
    //cout << d << " ";
    for(int j=0;j<d;j++){
      cin >> bo;
  	  A[bo] = 1;
    }
  }
  
  int count = 0;
  
  for(int i=1;i<=N;i++){
    //cout << A[i] << endl;
    if(A[i] != 1){
      count++;
    }
  }
  
  cout << count << endl;
}

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

using namespace std;

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

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

ll H, W;
ll ans = (ll)1e18;

ll calc(ll a, ll b, ll c) {
    ll s[3] = {a, b, c};
    sort(s, s + 3);
    return s[2] - s[0];
}

void solve() {
    cin >> H >> W;
    for (ll i = 1; i <= H-1; i++) {
        ans = min(ans, calc(i*W, W*((H-i)/2), W*(H-i) - W*((H-i)/2)));
        ans = min(ans, calc(i*W, (H-i)*(W/2), (H-i)*W - (H-i)*(W/2)));
    }
    for (ll i = 1; i <= W-1; i++) {
        ans = min(ans, calc(i*H, H*((W-i)/2), H*(W-i) - H*((W-i)/2)));
        ans = min(ans, calc(i*H, (W-i)*(H/2), (W-i)*H - (W-i)*(H/2)));
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int main(){
  int N, M;
  while(cin>>N>>M && N){
    int dist1[200][200], dist2[200][200];
    REP(i, N)REP(j, N){
      dist1[i][j] = (i != j) ? INF : 0;
      dist2[i][j] = (i != j) ? INF : 0;
    }
    REP(i, M){
      int x, y, t;
      char sl;
      scanf("%d %d %d %c", &x, &y, &t, &sl);
      x--; y--;
      if(sl == 'L') {
        dist1[x][y] = dist1[y][x] = min(t, dist1[y][x]);
      } else{
        dist2[x][y] = dist2[y][x] = min(t, dist2[y][x]);
      }
    }
    REP(k, N)REP(i, N)REP(j, N){
      dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j]);
      dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
    }
    int R; cin>>R;
    vector<int> z(R);
    REP(i, R) {
      cin>>z[i];
      z[i]--;
    }
    int d[1001][200];
    REP(i, 1001)fill(d[i], d[i] + N, INF);
    d[0][z[0]] = 0;
    REP(i, R - 1)REP(fship, N)REP(toship,N){
      if(fship != toship) d[i+1][toship] = min(d[i][fship] + dist1[z[i]][fship] + dist2[fship][toship] + dist1[toship][z[i+1]], d[i+1][toship]);
      else d[i+1][toship] = min(d[i][fship] + dist1[z[i]][z[i+1]], d[i+1][toship]);
    }
    int ans = INF;
    REP(i, N) ans = min(ans, d[R-1][i]);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int a, b, t;
    cin>>a>>b>>t;
    cout<<(t / a) * b<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ul = unsigned long;
using ull = unsigned long long;
#define vec vector
#define rep(_i,_n) for(ull _i = 0; _i < _n; _i++)
#define rep2(_i,_s,_n) for(ull _i = _s; _i < _n; _i++)
#define elif else if
#define push(_a) push_back(_a)
#define fullSort(_a) sort(_a.begin(), _a.end())
#define inputVecI(_name, _n) vec<int> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecUL(_name, _n) vec<ul> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecULL(_name, _n) vec<ull> _name(_n);rep(_i, _n)cin >> _name[_i];
#define inputVecS(_name, _n) vec<string> _name(_n);rep(_i, _n)cin >> _name[_i];
#define printVec(_vec) cout << "{";rep(i, _vec.size()-1)cout << _vec[i] << ",";cout << _vec[_vec.size()-1];cout << "}\n";
#define append(_x) push_back(_x)
#define mapLoop(_i, _name) for(auto i = _name.begin(); i != _name.end(); i++)
 
int main()
{
    long N, M;
 
    cin >> N >> M;
    long l, r;
    long R = N + 1, L = 0;
 
    rep(i, M){
      cin >> l >> r;
      R = min(R, r);
      L = max(L, l);
    }
    if(R - L + 1 < 0)cout << 0 << endl;
    else cout << R - L + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{ 
  int n,flag=0;
  cin>>n;
  for(int i=0;i<3;i++){
    int rem;
   rem=n%10;
   if(rem==7){flag =1; break;} 
   n=n/10;
    
  }
  if(flag==1){cout<<"Yes";}
  else{cout<<"No";}
   

}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#define MOD 1000000007

typedef long long ll;
using namespace std;

int main(void) {
    ll a=0,b=0,c=0;
    ll i=0,j=0;
    ll n=0,k=0,tmp=0;
    double r=0;
    cin >> n >> k;
    tmp=1;
    while(tmp<k){
        i++;
        tmp*=2;
    }
    //cout<<tmp<<endl;
    for(j=1;j<=n;j++){
        if(tmp<2*k){
            r+=pow(0.5,i);
        }else{
            if(i>=1){
                tmp/=2;
                i--;
                
            }
            r+=pow(0.5,i);
        }
        tmp= tmp *(j+1)/(double)j;
    }
    r/=(double)n;
    printf("%.12f\n",r);
    return 0;
}

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

int main ()
{
    int a,b,c,num;
    a = 0;
    b = 0;
    c = 0;
    num = 0;

    cin >> a >> b >> c;

    if(a>b){
        num = a;
        a = b;
        b = num;
    }
    if(b>c){
        num = b;
        b = c;
        c = num;
    }
    if(a>b){
        num = a;
        a = b;
        b = num;
    }

    cout << a << " " << b << " " << c << '\n';

    return 0;
}


Measured memory_bytes: 3132
#include <iostream>
#include <climits>
using namespace std;
#define ll long long
#define N 100
#define W 100000
ll dp[N+1][W+1];
void solve()
{
	ll n,w;
	cin >> n >> w;
	ll wt[n],val[n];
	for(ll i=0;i<n;i++)
	{
		cin >> wt[i] >> val[i];
	}
	dp[0][0]=0;
	dp[0][wt[0]]=val[0];
	for(ll i=1;i<n;i++)
	{
		dp[i][0]=0;
		for(ll j=1;j<=W;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j>=wt[i])
			{
				dp[i][j]=max(dp[i][j],dp[i-1][j-wt[i]]+val[i]);
			}
		}
	}
	ll ans=LLONG_MIN;
	for(ll i=0;i<=w;i++)
	{
		ans=max(ans,dp[n-1][i]);
	}
	cout << ans << "\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll t=1;
	// cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<(max((a*b),(c*d)))<<endl;
    return 0;
}

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

int main() {
	int n, m, c; cin >> n >> m >> c;
	vector<int> b(m);
	vector<vector<int>> a(n, vector<int> (m));
	rep(i, m) cin >> b[i];
	rep(i, n) {
		rep(j, m) cin >> a[i][j];
	}

	ll count = 0;
	rep(i, n) {
		ll ans = c;
		rep(j, m) {
			ans += a[i][j] * b[j];
		}
		if(ans > 0) count++;
	}

	cout << count << endl;
}

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

ll ppow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
class UnionFind {
	vector<int>par, sz;
public:
	UnionFind() {}
	UnionFind(int n) {
		par = sz = vector<int>(n);
		for (int i = 0; i < n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (sz[x] > sz[y]) {
			par[y] = x;
			sz[x] += sz[y];
		}
		else {
			par[x] = y;
			sz[y] += sz[x];
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sz[find(x)];
	}
};
struct st{int a,b,c;bool used;};
vector<P>E[2000];
int pa[2000],co[2000],dep[2000];

void dfs(int v,int p,int d,int c){
	pa[v]=p;
	dep[v]=d;
	co[v]=c;
	for(auto u:E[v]){
		if(u.second==p)continue;
		dfs(u.second,v,d+1,u.first);
	}
}
int get(int u,int v){
	if(dep[u]>dep[v])swap(u,v);
	int ans=0;
	while(dep[u]!=dep[v]){
		ans=max(ans,co[v]);
		v=pa[v];
	}
	while(u!=v){
		ans=max(ans,co[u]);
		ans=max(ans,co[v]);
		u=pa[u];v=pa[v];
	}
	return ans;
}
int main(){
	int n,m;ll X;scanf("%d%d%lld",&n,&m,&X);
	vector<st>v;
	rep(i,m){
		int a,b,c;scanf("%d%d%d",&a,&b,&c);a--;b--;
		v.push_back({a,b,c,false});
	}
	sort(v.begin(),v.end(),[](st a,st b){return a.c<b.c;});
	UnionFind uf(n);
	ll c=0;
	for(auto&s:v){
		if(uf.same(s.a,s.b))continue;
		uf.unite(s.a,s.b);c+=s.c;
		s.used=true;
		E[s.a].push_back(P(s.c,s.b));
		E[s.b].push_back(P(s.c,s.a));
	}
	dfs(0,-1,0,0);
	ll ans=0;
	vector<ll>t;
	for(auto s:v){
		if(s.used==true)continue;
		ll res=s.c-get(s.a,s.b);
		t.push_back(res);
	}
	sort(t.begin(),t.end());
	rep(i,t.size()){
		if(c+t[i]==X){
			(ans+=ppow(2,m-(n+i)+1))%=MOD;
		}
	}
	if(c==X){
		(ans+=ppow(2,m)+MOD-ppow(2,m-n+2))%=MOD;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 508
tailrec fun countOfDivide(a: Int): Int {
    return if (a % 2 != 0) 0 else countOfDivide(a / 2) + 1
}

fun main(args: Array<String>) {
    val N = readLine()
    val As = readLine()!!.split(" ").map(String::toInt)
    
    println(As.fold(0) { r, a -> r + countOfDivide(a) })
}

Measured memory_bytes: 41324
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
 
#define rep(i,n) for(int i=0; i<n; ++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define repp(i,a,b) for(int i=a; i<=b; ++i)
#define repr(i,a,b) for (int i=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define fi first
#define INF 0x3f3f3f3f
#define se second
#define pb push_back
#define MAXN 1002
 
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)for(long blockTime=0;(blockTime==0?(blockTime=clock())!=0:false); debug("%s:%.4fs\n",d,(double)(clock()-blockTime)/CLOCKS_PER_SEC))
 
const ll mod = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	
	int a, b;
	cin >> a >> b;
	if(a > 9 or b > 9) cout << -1 << endl;
	else cout << a * b << endl;
	
	
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        String[] sArray = s.split("");
        String firstOther = null;
        for (int i = 0; i < k; i++) {
            if (!sArray[i].equals("1")) {
                firstOther = sArray[i];
                break;
            }
        }
        if (firstOther == null) {
            System.out.println(1);
            return;
        }
        System.out.println(firstOther);
    }
}

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


//This code is written by Sneh Thakkar on 16-12-2019

/*       AUTHOR NAME:

        _/_/_/_/   _/\        _/     _/_/_/_/_/    _/      _/
       _/         _/ _\      _/     _/            _/      _/
      _/_/_/_/   _/   _\    _/     _/_/_/_/_/    _/_/_/_/_/
           _/   _/     _\  _/     _/            _/      _/
    _/_/_/_/   _/       _\_/     _/_/_/_/_/    _/      _/
       
        
*/

using namespace std;

#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define F(i,a,b) for(ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<endl

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


int main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n,k;
    cin>>n;
    ll a[n];
    in(a,n);
    ll check=1,count=0;
    for(ll i=0;i<n;i++)
    {
        if(a[i]==check)
        check++;
        else
        count++;
    }
    if(count==n)
    cout<<"-1";
    else
    cout<<count;
    
}

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

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string a, b;
  cin >> a >> b;
  int x, y;
  cin >> x >> y;
  string p; cin >> p;
  if(p == a) x--;
  else y--;
  cout << x << ' ' << y << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
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<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int N; cin >> N;
    vector<int>v(N); for(auto & e : v) cin >> e;
    int maxi = *max_element(all(v));
    cout << ((accumulate(all(v),0LL) - maxi > maxi) ?  "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int N = Integer.parseInt(tok.nextToken());
		int M = Integer.parseInt(tok.nextToken());
		boolean arr[] = new boolean[N + 1];
		int arr2[] = new int[N + 1];
		arr[1] = true;
		Arrays.fill(arr2, 1);
		int cont = 0;
		for (int i = 0; i < M; i++) {
			tok = new StringTokenizer(in.readLine());
			int x = Integer.parseInt(tok.nextToken());
			int y = Integer.parseInt(tok.nextToken());
			if (arr[x]) {
				if (arr2[x] != 0) {
					// cont++;
					arr2[y]++;
					arr2[x]--;
					if (arr2[x] == 0) {
						arr[x] = false;
					}
					arr[y] = true;
				} else {
					arr2[y]++;
					arr2[x]--;
				}
			} else {
				arr2[y]++;
				arr2[x]--;
			}
		}

		for (int i = 0; i < arr.length; i++) {
			if (arr[i])
				cont++;
		}
		out.println(cont);
		out.close();
	}
}

Measured memory_bytes: 40476
import Data.Char

main::IO()
main = do
  dat<-getLine
  cn<-getLine
  let n = read cn::Int
  putStr (solve n dat)
  putStr "\n"

solve :: Int -> String -> String
solve k [c]  = [num_to_char (mod ((char_to_num c)+k) 26)]
solve k ('a':cs)='a':(solve k cs)
solve k (c:cs) = let to_a = (26 - (char_to_num c)) in
                    if ((k >= to_a) && (to_a > 0)) then  'a':(solve (k - to_a) cs) else c:(solve k cs)


char_to_num::Char -> Int
char_to_num c = (ord c)-97

num_to_char::Int -> Char
num_to_char n = chr (n + 97)

Measured memory_bytes: 5116
import sys
def main():
    N=int(sys.stdin.readline())
    h=tuple(map(int,sys.stdin.readline().split()))
    dp=[0 for _ in range(N)]
    for i in range(1,N):
        if i>1:dp[i]=min([dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2])])
        else:dp[i]=dp[i-1]+abs(h[i]-h[i-1])
    print(dp[N-1])
if __name__=='__main__':main()

Measured memory_bytes: 20308
#include<stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r) {
    int x, i, j, t;
    x = A[r];
    i = p - 1;
    for (j = p; j < r; j++) {
        if (A[j] <= x) {
            i++;
            t = A[i]; A[i] = A[j]; A[j] = t;
        }
    }
    t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
    return i + 1;
}

int main() {
    int i, q;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) scanf("%d", &A[i]);
    
    q = partition(0, n - 1);
    
    for (i = 0; i < n; i++) {
        if (i) printf(" ");
        if (i == q) printf("[");
        printf("%d", A[i]);
        if (i == q) printf("]");
    }
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 2136
def main():
  import sys
  numberOfStudent=int(input())
  orderOfArrive=tuple(map(int,sys.stdin.readline().split()))
  studentArrive=[None]*numberOfStudent
  count=1
  for arrive in orderOfArrive:
    studentArrive[arrive-1]=count
    count+=1
  print(" ".join(map(str,studentArrive)))
if __name__=="__main__":
  main()

Measured memory_bytes: 18312
<?php
$S = str();
$Q = int();
$rev = false;
$front = "";
$back = "";
while($Q--){
    $q = str();
    if($q == 1){
        $rev = !$rev;
    }else{
        $qs = explode(" ", $q);
        if(($rev + $qs[1]) % 2 == 1){
            $front.=$qs[2];
        }else{
            $back.=$qs[2];
        }
    }
}
$str = strrev($front). $S. $back;
if($rev == true){
    echo strrev($str);
}else{
    echo $str;
}

function str(){
  return trim(fgets(STDIN));
}
function ints(){
  return array_map("intval", explode(" ", trim(fgets(STDIN))));
}
function int(){
  return intval(trim(fgets(STDIN)));
}
function chmax(&$a,$b){if($a<$b){$a=$b;return 1;}return 0;}
function chmin(&$a,$b){if($a>$b){$a=$b;return 1;}return 0;}

function o(...$val){
    if(count($val)==1)$val = array_shift($val);
    $trace = debug_backtrace();
    echo $trace[0]['line'].")";
    if(is_array($val)){
        if(count($val) == 0){
            echo "empty array";
        }elseif(!is_array(current($val))){
            echo "array: ";
            echo implode(" ", addIndex($val))."\n";
        }else{
            echo "array:array\n";
            if(isCleanArray($val)){
                foreach($val as $row)echo implode(" ", addIndex($row))."\n";
            }else{
                foreach($val as $i => $row)echo "[".$i."] ".implode(" ", addIndex($row))."\n";
            }
        }
    }else{
        echo $val."\n";
    }
}
function addIndex($val){
    if(!isCleanArray($val)){
        $val = array_map(function($k, $v){return $k.":".$v;}, array_keys($val), $val);
    }
    return $val;
}
function isCleanArray($array){
    $clean = true;
    $i = 0;
    foreach($array as $k => $v){
        if($k != $i++)$clean = false;
    }
    return $clean;
}
/**
 * 座圧対象の配列を渡すと以下の値を返す
 * ・圧縮された配列
 * ・復元用のMap
 * ・圧縮用のMap
 **/
function atsu($array){
    $a = array_flip($array);
    $fuku = array_flip($a);
    sort($fuku);
    $atsu = array_flip($fuku);
    foreach($array as $i => $val)$array[$i] = $atsu[$val];
    return [$array, $fuku, $atsu];
}
//配列の最大公約数
function gcdAll($array){
    $gcd = $array[0];
    for($i = 1; $i < count($array); $i++){
        $gcd = gcd($gcd, $array[$i]);
    }
    return $gcd;
}

//最大公約数
function gcd($m, $n){
    if(!$n)return $m;
    return gcd($n, $m % $n);
}

//配列の最小公倍数
function lcmAll($array){
    $lcm = $array[0];
    for($i = 1; $i < count($array); $i++){
        $lcm = lcm($lcm, $array[$i]);
    }
    return $lcm;
}

//最小公倍数
function lcm($a, $b) {
    return $a / gcd($a, $b) * $b;
}
//ビットカウント-1の数を数える
function popcount($x){
    $con = 0;
    while ($x) {
        $x &= $x-1;
        ++$con;
    }
    return $con;
}

Measured memory_bytes: 4856
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = int(input())
aa = inpl()
for i in range(N):
	aa[i] -= i+1

aa.sort()

if N%2 == 1:
	mid = aa[N//2]
else:
	mid = (aa[N//2]+aa[N//2-1])//2

ans = 0
for a in aa:
	ans += abs(mid-a)

print(ans)


Measured memory_bytes: 27500
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;
    
#define EPS (1e-7)
#define INF (1<<30)
#define LLINF (1LL<<60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    if(llabs(a-b) % 2){
        cout<<"IMPOSSIBLE"<<endl;
    }else{
        cout << min(a,b)+(llabs(a-b)/2)<<endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
class UnionFind:
    def __init__(self,size):
        self.parent=range(size)#???????????????????????????
        self.tree_num=size#??¨????????¨?????°
        self.tree_w=[1]*size#????????????????????????????±???????????????¨??????????????°
        self.rank=[0]*size#??¨?????????

    def findset(self,x):#????????¢????????????x??????????????§?????£???????????????????????????????????????
        if self.parent[x]==x:
            return x
        else:
            self.parent[x]=self.findset(self.parent[x])
            return self.parent[x]

    def unite(self,x,y):#x,y?????????
        x=self.findset(x)
        y=self.findset(y)
        if x==y:
            return
        if self.rank[x]<self.rank[y]:
            self.parent[x]=y
            self.tree_num-=1
            self.tree_w[y]+=self.tree_w[x]
        else:
            self.parent[y]=x
            self.tree_num-=1
            self.tree_w[x]+=self.tree_w[y]
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

    def same(self,x,y):#x,y???????????¨????±????????????????????????????
        if self.findset(x)==self.findset(y):
            return True
        else:
            return False

    def tree_number(self):#??¨????????¨?????°
        return self.tree_num

    def tree_weight(self,x):#x????±?????????¨??????????????°
        return self.tree_w[self.findset(x)]

n,q=map(int,raw_input().split())
uf=UnionFind(n)
for i in xrange(q):
    com,x,y=map(int,raw_input().split())
    if com==0:
        uf.unite(x,y)
    else:
        if uf.same(x,y):
            print(1)
        else:
            print(0)

Measured memory_bytes: 6864
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 

struct DisjointSet {
    vector<int64_t> par; //根.連結成分の根にはその成分の要素数を符号反転して保存する．

    DisjointSet(int64_t n) : par(n, -1) {} //.0-indexed 
    void init(int64_t n) {par.assign(n, -1);}// 初期化

    int root(int64_t x) {
        if (par[x] < 0) return x; //根が負なら自身が根．
        else return par[x] = root(par[x]); //径路圧縮
    }

    // 連結判定
    bool issame(int64_t x, int64_t y) { return root(x) == root(y); }

    bool unite(int64_t x, int64_t y) { // 結合が行われればtrue.行われなければfalse.
        x = root(x); y = root(y); // 径路圧縮
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); 
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int64_t size(int64_t x){ return -par[root(x)]; }
};

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

int N, M, K; cin >> N >> M >> K;
VI cnt(N+1, 0);
DisjointSet DS(N+1);
rep(i, 0, M){
    int a, b; cin >> a >> b;
    ++cnt[a];
    ++cnt[b];
    if (!DS.issame(a, b)) DS.unite(a, b);
}
rep(i, 0, K){
    int a, b; cin >> a >> b;
    if (DS.issame(a, b)){
        ++cnt[a];
        ++cnt[b];
    }
}

rep(i, 1, N+1){
    cout << DS.size(i) - cnt[i] - 1 << ' ';
}

cout  << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    vector<ll> P(N);
    rep(i, N) {
        ll p;
        cin >> p;
        P[i] = p;
    }
    sort(P.begin(), P.end());
    rep(i, K) {
        ans += P[i];
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


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

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

  int ans = 0;
  while (true) {
    if (7 * a >= c) {
      ans += ceil((double)c / a);
      break;
    } else if (7 * a + b >= c) {
      ans += 7;
      break;
    } else {
      ans += 7;
      c -= 7 * a + b;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 3100
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
long long COM(ull n, ull k){
    return n*(n-1)/2;
}

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ull n;cin>>n;
    vector<ull>a(n);
    map<ull,ull>m;
    for(ull i=0;i<n;i++){
        cin>>a[i];
        m[a[i]]++;
    }
    ull total=0;
    for(ull i=1;i<=n;i++){
        if(m[i]>=2)
        total+=COM(m[i],2);
    }

    for(ull k=1;k<=n;k++){
        ull tmp=total;
        if(m[a[k-1]]>=2)
        tmp-=COM(m[a[k-1]],2);
        if(m[a[k-1]]>=3)
        tmp+=COM(m[a[k-1]]-1,2);
        cout<<tmp<<endl;
    }

    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------


































Measured memory_bytes: 16640
//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

long gcd(long a, long b) {
	long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

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

int main() {
	long N, M;
	cin >> N >> M;
	string s, t;
	cin >> s >> t;
	long g = gcd(N,M);
	long L = lcm(N,M);
	long n = N / g;
	long m = M / g;
	for (int i = 0; i < g; i++) {
		if (s.substr(i * n, 1) != t.substr(i * m, 1)) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << L << endl;
}



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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using mp = map<ll, ll>;
using pq = priority_queue<ll>;

#define cout cout << setprecision(12)

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

ll gcd(ll a, ll b) {
    if (a == b || a == 0)
        return b;
    else if (a < b)
        return gcd(b%a, a);
    else
        return gcd(b, a);
}

mp prime_factor(ll n) {
    mp ret;
    for (ll i = 2; i*i <= n; ++i) {
        while (n % i == 0) {
            ++(ret[i]);
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
    cin >> n >> k;
	m = gcd(n, k);
	mp aaa = prime_factor(m);
	aaa[1] = 1;
    cout << aaa.size() << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=4004;
struct node{int to,next;}num[N];
int cnt=1,n,m,u,v,ans,Cnt[N],st[N],ed[N],head[N],vis[N],sure[N];
vector<int> vec[N],pass[N]; 
void add(int x,int y)
{num[++cnt].to=y;num[cnt].next=head[x];head[x]=cnt;}
int dfs(int x,int fa,int aim,int id)
{
	if (x==aim) return 1;
	for (int i=head[x];i;i=num[i].next)
	  if (num[i].to!=fa)
	  {
	  	  Cnt[i/2]++;pass[i/2].push_back(id);
	  	  vec[id].push_back(i);
	  	  if (dfs(num[i].to,x,aim,id)==1) return 1;	
		  Cnt[i/2]--;pass[i/2].pop_back();vec[id].pop_back();
	  }
	return 0;
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<n;i++) scanf("%d%d",&u,&v),add(u,v),add(v,u);
	for (int i=1;i<=m;i++)
	{
		scanf("%d%d",&st[i],&ed[i]);
		dfs(st[i],-1,ed[i],i);
	}
	for (int i=1;i<n;i++) ans+=min(Cnt[i],2);
	printf("%d\n",ans);
	while (1==1)
	{
		int p=0,q;//choose edge 
		for (int i=1;i<n;i++)//如果有一条边的一个方向已被确定，那么剩下的那一条路径有唯一的方向
		  if (Cnt[i]==1&&vis[i*2]!=vis[i*2+1]) {p=i;break;} 
		if (!p)//否则在经过次数>=2的边中随便取一条 
		  for (int i=1;i<n;i++)
		    if (Cnt[i]>=2) {p=i;break;}
	    if (!p) break;
		for (int i=0;i<pass[p].size();i++)//choose path
		  if (!sure[pass[p][i]]) {q=pass[p][i];break;}
		int x=st[q],y=ed[q];sure[q]=1;
		for (int i=0;i<vec[q].size();i++)
		{
			int t=vec[q][i];
			if (t/2==p)
			{
				if (vis[t])
				{
				   for (int j=0;j<vec[q].size();j++)
				     vec[q][j]^=1;
				   swap(st[q],ed[q]);
				}
				for (int j=0;j<vec[q].size();j++)
				  Cnt[vec[q][j]/2]--,vis[vec[q][j]]=1;
				break;
			}
		}
	}
	for (int i=1;i<=m;i++) printf("%d %d\n",st[i],ed[i]);
	return 0;
}
 

Measured memory_bytes: 15744
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

int main()
{
  ll N, A, B;
  ll bef;
  ll sum = 0;

  cin >> N >> A >> B;
  cin >> bef;

  for(int i=1; i<N; i++) {
    ll now;
    cin >> now;
    sum += min((now - bef) * A, B);
    bef = now;
  }

  cout << sum << endl;
} 


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		for (int i=0; i<N; i++){
			String s = sc.next();
			if (s.equals("Y")){
				System.out.println("Four");
				return;
			}
		}
		System.out.println("Three");
		return;
	}
}


Measured memory_bytes: 22868
N = int(input())
rst = []
for i in range(N):
	S,P = input().split()
	P = int(P)
	rst.append([S,P,i+1])
rst.sort(key=lambda x:x[1],reverse=True)
rst.sort(key=lambda x:x[0])
for j in range(N):
	print(rst[j][2])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    #define pb push_back
    #define printV(v) for(int i=0;i<v.size();i++){cout << v[i] << " ";} cout << endl
    #define printRev(v) for(int i=v.size()-1;i >= 0;i--){cout << v[i] << " ";} cout << endl
    #define sortV(v) sort(v.begin(),v.end())
    #define revV(v) reverse(v.begin(),v.end())
    ll a,b,c,d,e,f,g,n,m,k,t,p,x;
 
    ll mod = 998244353;
 
   
    bool isPal(string &str){
        for(int i=0;i<str.size();i++){
            if(str[i] != str[str.size()-1-i]) return false;
        }
        return true;
    }

    void solve(){
       double l; cin >> l;
       double answer = l/3 * l/3 * l/3;
       std::cout << std::setprecision(10) << answer << '\n';
    }
 
 
 
    int main(){
        ios_base::sync_with_stdio(false);
     
        int cases = 1; 
        //cin >> cases;

        while(cases--){
            solve();
        }
        return 0;
 
    }

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		PrintWriter out = new PrintWriter(System.out);
		String result = "No";
		for(int i=0;i<15;i++){
			for(int j=0;j<=25;j++){
				if(7*i+4*j==N){
					result = "Yes";
					break;
				}
			}
		}
		out.println(result);
		out.flush();
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

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

long long M = 1000000007ll;

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

  long long l = 0, r = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    for(int j = 0; j < n; ++j) {
      if (i < j && a.at(i) > a.at(j)) {
        ++r;
        ans += k;
        ans %= M;
        ans += k * (k - 1) / 2;
        ans %= M;
      }
      if (i > j && a.at(i) > a.at(j)) {
        ++l;
        ans += k * (k - 1) / 2;
        ans %= M;
      }
    }
  }
  //long long ans = ((r * (k % M) % M) + ((((r + l) % M) * (((k % M) * ((k - 1ll) % M) % M) % M) 2ll) % M) % M) % M;
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 256
def main():
    s = input()
    for i in range(len(s)):
        if (i+1) % 2 == 1:
            if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
                pass
            else:
                print('No')
                break
        else:
            if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
                pass
            else:
                print('No')
                break
    else:
        print('Yes')

    return 0;

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
const int MOD = 1e9+7; 
int main() {
  string s;
  int n;
  cin >> n >> s;
  map<char, int> d;
  rep(i,n) {
    d[s[i]]++;
  }
  ll ans = 1;
  rep(i,26) {
    char c = 'a' + i;
    if (d[c] == 0) continue;
    ans *= (d[c]+1);
    ans %= MOD;
  }
  ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3692
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader cd = new BufferedReader(new InputStreamReader(System.in));
		String[] vd = cd.readLine().split(" ");
		int a = Integer.parseInt(vd[0]);
		int b = Integer.parseInt(vd[1]);

		System.out.println(Math.max((a+b), Math.max((a-b), a*b)));
	}

}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    vector<int> a(N);
    double mean = 0;
    rep (i, 0, N) {
        cin >> a[i];
        mean += a[i];
    }
    mean = round(mean / a.size());

    long long cost = 0;
    rep (i, 0, N) {
        if (mean != a[i])
            cost += pow(a[i]-mean, 2);
    }

    cout << cost << endl;
}

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

char alphabet[30];
ll N;

int main(){
  rep(i, 26) alphabet[i ] = 'a' + i;
  cin >> N;

  vector<int> X;
  while (N > 0){
    // あまりが0のときはa，25のときはzになるように調整
    // Nを0から始めるということ
    N -= 1;
    X.push_back(N % 26);
    N /= 26;
  }

  string ans;
  rep(i, X.size()) ans += alphabet[X[i]];
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void)
{
    int k;
    cin >> k;
    int a, b;
    cin >> a >> b;
    
    for (int i = a; i<= b; i++) {
        if (i % k == 0) {
            cout << "OK";
            return 0;
        }
    }
    
    
    cout << "NG";
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int n,h[100010],c[100010],mmax=-1;
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&h[i]);
	c[n]=0;
	for(int i=n-1;i>=1;i--)
		if(h[i]>=h[i+1]) c[i]=c[i+1]+1;
		else c[i]=0;
	for(int i=1;i<=n;i++)
		mmax=max(mmax,c[i]);
	cout<<mmax<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef pair<int, int> P;
int pr[200001];
long long dp[200001];

int main() {
    int N;
    cin >> N;
    vector<P> I;

    for(int i=0; i<200001; ++i) pr[i] = -1;
    for(int i=1; i<=N; ++i) {
        int C;
        cin >> C;
        if(!(pr[C] == -1 || pr[C] == i - 1)) I.push_back(P(i, pr[C]));
        pr[C] = i;
    }
    sort(I.begin(), I.end());

    dp[0] = 1;
    dp[1] = 2;
    for(int i=1; i < I.size(); ++i) {
        dp[i + 1] = dp[i];
        auto itr = upper_bound(I.begin(), I.end(), P(I[i].second, MOD));
        dp[i + 1] += dp[distance(I.begin(), itr)];
        dp[i + 1] %= MOD;
    }
    
    cout << dp[I.size()] << endl;
}

Measured memory_bytes: 4208