akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

int H, W, N;
vector<string> original_field;
vector<string> field;

int dh[] = {1, 0};
int dw[] = {0, 1};

inline bool in_field(int h, int w){
    return 0<=h&&h<H && 0<=w&&w<W;
}

bool vanish(){
    //?¶?????????????true?????????
    vector<vector<bool>> del_field(H, vector<bool>(W));
    
    bool updated = false;
    for(int h=0; h<H; h++){
        for(int w=0; w<W; w++){
            if(field[h][w] == '.') continue;
            
            char color = field[h][w];
            for(int d=0; d<2; d++){
                int l = 1;
                while(in_field(h+dh[d]*l, w+dw[d]*l) && field[h+dh[d]*l][w+dw[d]*l] == color){
                    l++;
                }
                if(l < N) continue;
                
                for(int i=0; i<l; i++){
                    del_field[h+dh[d]*i][w+dw[d]*i] = true;
                    updated = true;
                }
            }
        }
    }
    
    if(updated)
        for(int h=0; h<H; h++)
            for(int w=0; w<W; w++)
                if(del_field[h][w])
                    field[h][w] = '.';
    
    return updated;
}

void down(){
    for(int w=0; w<W; w++){
        int top = -1;
        for(int h=H-1; h>=0; h--){
            if(field[h][w] == '.') continue;
            if(top >= 0)
                top--;
            else{
                int hi = h+1;
                while(hi < H && field[hi][w] == '.') hi++;
                top = hi-1;
            }
            swap(field[top][w], field[h][w]);
        }
    }
}

bool check(){
    down();
    while(vanish())
        down();
    
    for(int h=0; h<H; h++)
        for(int w=0; w<W; w++)
            if(field[h][w] != '.')
                return false;
    
    return true;
}

string solve(){
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            int nh = i, nw = j+1;
            if(!in_field(nh, nw)) continue;
            
            field = original_field;
            swap(field[i][j], field[nh][nw]);
            if(check())
                return "YES";
            
        }
    }
    return "NO";
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    
    cin>>H>>W>>N;
    original_field = vector<string>(H);
    for(string &r: original_field) cin >> r;
    
    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 1224
/**** [ AkJn ] ****/
#include <bits/stdc++.h>
using namespace std;

#define fastIO ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ld long double
#define ll long long
#define fr(i,a,n) for(ll i=a; i<n; i++)
#define fre(i,a,n) for(ll i=a; i<=n; i++)
const ll mod = 1e9 + 7;

/* CHECK THESE POINTS BEFORE SUBMITTING
 * Read the question carefully.
 * Read the code once before final submission.
 * Check the extremities of the constraints.
 * 0 is better than -1.
*/

int main() {
    fastIO

	int n,l;
	cin>>n>>l;
	std::vector<string> v;
	for (int i = 0; i < n; ++i)
		{
			string temp;
			cin>>temp;
			v.push_back(temp);
		}	

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

	for (int i = 0; i < v.size(); ++i)
	{
		cout << v[i];
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, x, y;
    cin >> n >> x >> y;
    vector<vector<ll>> g(n+1);
    for(ll i = 1; i <= n; i++){
        if(i!=n) g[i].push_back(i+1);
        if(i!=1) g[i].push_back(i-1);
    }
    vector<ll> ans(n+1, 0);
    g[x].push_back(y);
    for(ll i = 1; i <= n-1; i++){
        queue<ll> que;
        que.push(i);
        vector<ll> dist(n+1, 1e+6);
        dist[i] = 0;
        while(!que.empty()){
            ll v = que.front();
            que.pop();
            for(ll nv : g[v]){
               if(dist[nv] < dist[v]+1) continue;
                dist[nv] = min(dist[nv], dist[v]+1);
                que.push(nv);
            }
        }
        ll count = 0;
        for(ll j = i+1; j <= n; j++){
            ll check = dist[j];
           // cout << i << " " << j << " " << dist[j] << endl;
            ans[check]++;
        }
    }
    for(ll i = 1; i <= n-1; i++)
        cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 384
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
inp = inp.shift().split(' ')
a = []
b = []
ao = {}
bo = {}
for (i=0; i<N; i++) {
    if (i % 2) {
        bo[inp[i]] = (bo[inp[i]] || 0) + 1
    } else {
        ao[inp[i]] = (ao[inp[i]] || 0) + 1
    }
}
as = 0
bs = 0
for (k in ao) {
    a.push({k: k, n: ao[k]})
    as += ao[k]
}
for (k in bo) {
    b.push({k: k, n: bo[k]})
    bs += bo[k]
}
a.sort((a, b) => b.n - a.n)
b.sort((a, b) => b.n - a.n)

max = 0
if (a[0].k == b[0].k) {
    if (b[1]) {
        max = Math.max(max, a[0].n + b[1].n)
    }
    if (a[1]) {
        max = Math.max(max, a[1].n + b[0].n)
    }
    if (!a[1] && !b[1]) {
        max = Math.max(max, a[0].n, b[0].n)
    }
    as -= max
} else {
    as -= a[0].n
    bs -= b[0].n
}

console.log(as + bs)

Measured memory_bytes: 36200
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long n; cin>>n;
  	int ans;
  	for(int i=1;i<=sqrt(n);i++){
  		if(n%i==0) ans=log10(n/i);
    }
  	cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


N = _i()
a_list = _li()
b_list = _li()
c_list = _li()

ans = sum(b_list)
for i in range(N-1):
    if a_list[i] + 1 == a_list[i+1]:
        ans += c_list[a_list[i] - 1]
print(ans)


Measured memory_bytes: 3064
l,r=map(int,input().split())
mod=2019
ans=float("inf")
if l==0:
    print(0)
    exit()
for i in range(l,min(l+2021,r)):
    for j in range(i+1,min(r+1,l+2022)):
        tmp=(i*j)%mod
        if tmp<ans:
            ans=tmp
print(ans)

Measured memory_bytes: 65044
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=100010;
int tt,s;
char w[N];
int head[N],to[N*2],nxt[N*2];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline bool dfs(int x,bool d) {
    w[x]=d,s+=d;
    for(int i=head[x];i;i=nxt[i]) {
	int y=to[i];
	if(w[y]==-1) {
	    if(!dfs(y,d^1)) return 0;
	}
	else if(w[x]==w[y]) return 0;
    }
    return 1;
}
int main() {
    int n,m;
    cin>>n>>m;
    memset(w,-1,sizeof(w));
    for(int i=1;i<=m;i++) {
	int x=gi(),y=gi();
	to[++tt]=y,nxt[tt]=head[x],head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],head[y]=tt;
    }
    if(dfs(1,0)) cout<<1LL*s*(n-s)-m;
    else cout<<1LL*n*(n-1)/2-m;
    return 0;
}

Measured memory_bytes: 2432
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;

int N,K;
map<int,bool> m;
int main(){
    cin>>N>>K;
    REP(i,0,K) {
        int a;
        cin>>a;
        m[a]=true;
    }
    REP(i,N,100000){
        int tmp=i;
        bool flag=true;
        while(tmp>0){
            if(m[tmp%10]) flag=false;
            tmp/=10;
        }
        if(flag){
            p(i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	string s, t;
	cin >> s >> t;
	int n = (int)s.length(), m = (int)t.length();
	int result = n;
	for (int i = 0; i + m <= n; i++)
	{
		int res = 0;
		for (int j = 0; j < m; j++)
			if (s[i + j] != t[j])
				res++;
		result = min(result, res);
	}
	cout << result << '\n';

	return 0;
}

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

int H, W, sum[4], tot[26];

int main(){
	scanf("%d%d", &H, &W);
	for(int i=1; i<=H; i++)
		for(int j=1; j<=W; j++){
			char ch=getchar();
			while(ch<'a' || ch>'z')	ch=getchar();
			tot[ch-'a']++;
		}
	for(int i=0; i<26; i++){
		if(tot[i]%4==3)	sum[1]++, sum[2]+=2;
		if(tot[i]%4==2)	sum[2]+=2;
		if(tot[i]%4==1)	sum[1]++;
	}
//	cout<<sum[1]<<" "<<sum[2];
	if(H%2==0 && W%2==0){
		if(sum[1] || sum[2])	printf("No");
		else					printf("Yes");
	}
	if(H%2==1 && W%2==1){
		if(sum[1]==1 && sum[2]<=W+H-2)	printf("Yes");
		else							printf("No");
	}
	if(H%2==1 && W%2==0){
		if(sum[2]<=W && sum[1]==0)	printf("Yes");
		else						printf("No");
	}
	if(W%2==1 && H%2==0){
		if(sum[2]<=H && sum[1]==0)	printf("Yes");
		else						printf("No");
	}
	return 0;
}

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

int main(){
  int n;
  cin >> n;
  int cnt = 0;
  int ans = 0;
  for(int i = 1;i <= n;i += 2){
    
    for(int j = 1;j <= i;j++){
      if(i % j == 0){
        cnt++;
      }
    }
    if(cnt == 8){
      ans++;
    }
    cnt = 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a)  (a).begin(),(a).end()
 
const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;
 
template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}
 
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main(){
    // ll N,S,K;
    ll a,b,c;
    cin >> a >>b >>c;
    if (a+b+c >= 22){
        cout << "bust" <<endl;
    }else{
        cout << "win" <<endl;
    }
    // cin >> N >> S >> K;
    // vector<ll> x(N);// 
    // vector<ll> y(N);//
    // vector<pair<ll,ll>> pos(N); // position
    // vector<ll> c(N);// power

    // for (ll i = 0; i < N; i++){
    //     cin >> x[i] >> y[i] >> c[i]; 
    //     pos[i] = make_pair(x[i],y[i]);
    // }

    // vector<vector<ll>> p(S,vector<ll>(K)); // p[i] 木Ti 木T i の頂点は p[i][j] : V[i][j] Tiに対応する出力



    
}


Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  int n, l;
  readf("%d %d\n", &n, &l);
  
  int sn;
  auto tmp = 100000;
  int res;
  foreach (i; 0..n) {
    auto t = l + i;

    if (abs(t).to!int < tmp) {
      tmp = abs(t).to!int;
      res = t;
    }

    sn += t;
  }

  writeln(sn - res);
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	long long n,d,a,b,x,ans=0;
	double y;
	cin>>n>>d;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b;
		x=a*a+b*b;
		y=sqrt(x);
		if(y<=d)
		    ans++;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


ll a[16][16];

int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    int i,j;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            scanf("%lld", &a[i][j]);
        }
    }

    int z[17];
    vector<ll> dp(1<<n);
    int k;
    for(k=0; k<(1<<n); k++) {
        int siz=0;
        for(i=0; i<n; i++) {
            if(k & (1<<i)) z[siz++]=i;
        }

        dp[k]=0;
        for(i=0; i<siz; i++) {
            for(j=i+1; j<siz; j++) {
                dp[k] += a[z[i]][z[j]];
            }
        }

        ll max=0;
        for(i=0; i<(1<<siz); i++) {
            int tmp0=0;
            for(j=0; j<siz; j++) {
                if(i & (1<<j)) tmp0 |= (1<<z[j]);
            }
            ll val = dp[tmp0]+dp[k^tmp0];
            max = MAX(max, val);
        }
        dp[k] = max;
    }
    printf("%lld\n", dp[(1<<n)-1]);

    return 0;
}


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string S,T,U;
  cin >> S;
  cin >> T;
  U = S + T[T.size()-1];

  if(U == T){
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  for (int i=0;i<k+1;i++) {
    if(a>=b){
      b*=2;
      continue;
    }
    if(b>=c){
      c*=2;
      continue;
    }
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
}  

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	int ans = 0;
	if (a < 2 * b)
	{
		ans = a * (x / 1000);

		x %= 1000;

		ans += min(a, b * ((500 + x - 1) / 500));
	}
	else
	{
		ans = b * (x / 500);

		x %= 500;
		ans += b * ((500 + x - 1) / 500);
	}

	cout << ans << endl;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double llf;
#define ft first
#define sd second
const int N=2000+5;
int a[N];
bitset<2000005> f;
int main(){
	int n;
	scanf("%d",&n);
	f[0]=1;
	int s=0;
	for(int i=1,a;i<=n;++i){
		scanf("%d",&a);
		s+=a;
		f|=f<<a;
	}
	if(n==1){
		printf("%d\n",s);
		return 0;
	}
	for(int i=s>>1;i;--i)
		if(f[i]){
			printf("%d\n",s-i);
			return 0;
		}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define ll long long
#define pp pair<ll,ll>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
ll max(ll x, ll y)
{
    return x>y ? x : y;
}
ll min(ll x, ll y)
{
    return x<y ? x : y;
}
void _(ll&a , ll b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    double n;cin >> n;
    double d=n*n*n/27;
    cout << setprecision(20) << d;
    }


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	ll ans = 0 ;
	for(int i=1;i<=n;i++){
		ll a ; cin >> a ;
		ans += ((a&1)&&(i&1)) ;
	}
	cout << ans << endl ;
}

Measured memory_bytes: 3620
#[allow(unused_imports)]
use {
    proconio::{fastout, input, marker::*},
    std::cmp::*,
    std::collections::*,
    std::ops::*,
};

trait Monoid {
    fn id() -> Self;
    fn f(a: Self, b: Self) -> Self;
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum MinInt {
    Val(i64),
    Maximal,
}
impl MinInt {
    fn unwrap(self) -> i64 {
        if let Self::Val(x) = self {
            x
        } else {
            panic!();
        }
    }
}
impl std::ops::MulAssign for MinInt {
    fn mul_assign(&mut self, other: Self) {
        if other < *self {
            *self = other
        };
    }
}
impl std::ops::Mul for MinInt {
    type Output = Self;
    fn mul(self, other: Self) -> Self {
        if self < other {
            self
        } else {
            other
        }
    }
}
impl Monoid for MinInt {
    fn id() -> Self {
        MinInt::Maximal
    }
    fn f(a: Self, b: Self) -> Self {
        a * b
    }
}
use MinInt::*;

#[fastout]
fn main() {
    input! {
        mut h: usize,
        mut w: usize,
        mut c: (usize, usize),
        mut t: (usize, usize),
        mut s: [Bytes; h]
    }

    for i in 0..h {
        s[i].insert(0, b'#');
        s[i].insert(0, b'#');
        s[i].push(b'#');
        s[i].push(b'#');
    }
    w += 4;
    s.insert(0, vec![b'#'; w]);
    s.insert(0, vec![b'#'; w]);
    s.push(vec![b'#'; w]);
    s.push(vec![b'#'; w]);
    h += 4;
    c = (c.0 + 1, c.1 + 1);
    t = (t.0 + 1, t.1 + 1);

    let mut q = VecDeque::new();
    let mut d = vec![vec![Maximal; w]; h];
    let mut visit = vec![vec![false; w]; h];
    q.push_back(c);
    d[c.0][c.1] = Val(0);
    while let Some((x, y)) = q.pop_front() {
        if visit[x][y] {
            continue;
        }
        visit[x][y] = true;
        for dx in 0..=4 {
            for dy in 0..=4 {
                let xn = x + dx - 2;
                let yn = y + dy - 2;
                if s[xn][yn] != b'#' && d[xn][yn] > d[x][y] {
                    if (dx as i64 - 2).abs() + (dy as i64 - 2).abs() <= 1 {
                        d[xn][yn] = d[xn][yn] * d[x][y];
                        q.push_front((xn, yn));
                    } else {
                        d[xn][yn] = d[xn][yn] * Val(d[x][y].unwrap() + 1);
                        q.push_back((xn, yn));
                    }
                }
            }
        }
    }

    if let Val(ans) = d[t.0][t.1] {
        println!("{}", ans);
    } else {
        println!("-1");
    }
}


Measured memory_bytes: 22688
/*
g++ -std=c++14 -o2 -Wall ABC121C.cpp -o .\out\ABC121C.out
.\out\ABC121C.out
*/

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

typedef long long ll;

ll a[100005];
ll b[100005];

ll inf = 1e18;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  ll ans = 0;
  vector<pair<int, int>> aa;
  for (int i = 0; i < n; ++i) {
    aa.push_back(make_pair(a[i], i));
  }
  sort(begin(aa), end(aa));
  int rest = m;
  for (int i = 0; i < aa.size(); ++i) {
    int aaa = aa[i].first;
    int idx = aa[i].second;
    int bbb = b[idx];
    int rmv = min(rest, bbb);
    ans += 1ll * aaa * rmv;
    rest -= rmv;
    if (rest <= 0) break;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 2936
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long d = sc.nextLong();
    int ans = 0;
    for(int i = 0; i < n; i++) {
      long x = sc.nextLong();
      long y = sc.nextLong();
      if((x * x + y * y) <= (d * d)) ans++;
    }
    System.out.println(ans);
  }
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  string s;
  cin >> s;

  sort(s.begin(), s.end());
  if (s == "abc") {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include<vector>
#include <unordered_map> 
#include<cmath>
#define ll long long int
using namespace std;


int main() {
     int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
     int k;
     cin>>k;
     cout<<a[k-1]<<endl;
}

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


def main():
    N, M, L = map(int, input().split())
    INF = 10**13
    dis = [[INF for _ in range(N)] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        dis[a-1][b-1] = c
        dis[b-1][a-1] = c
    Q = int(input())
    Query = [list(map(int, input().split())) for _ in range(Q)]

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dis[i][j] = min(dis[i][j], dis[i][k]+dis[k][j])
    
    movable = [[] for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if i != j and dis[i][j] <= L:
                movable[i].append(j)
    

    for s, t in Query:
        s, t = s-1, t-1
        q = movable[s]
        checked = [False]*N
        ok = False
        for p in q:
            if p == t:
                ok = True
                break
            checked[p] = True
        checked[s] = True
        
        if ok:
            print(0)
            continue
        c = 0
        while q:
            c += 1
            qq = []
            for p in q:
                for np in movable[p]:
                    if np == t:
                        ok = True
                        break
                    if not checked[np]:
                        qq.append(np)
                        checked[np] = True
            if ok: break
            q = qq
        if ok:
            print(c)
        else:
            print(-1)



            



if __name__ == "__main__":
    main()


Measured memory_bytes: 84060
// ADITYA JAIN

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

#define f first
#define s second
#define pb push_back
#define all(c) c.begin(),c.end()

#define gi(x) scanf("%d", &x)
#define pi(x) printf("%d", x)
#define gl(x) scanf("%lld", &x)
#define pl(x) printf("%lld", x)
#define nl printf("\n")
#define sp printf(" ")

typedef long long int lld;
typedef long double ldb;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


main(){
    lld n;
    cin >> n;
    set <char> ss;
    while(n--){
        char ch;
        cin >> ch;
        ss.insert(ch);
    }
    cout << ((int)ss.size()==4?"Four":"Three") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;

int main() {
	int N,D;
	scanf("%d %d", &N,&D);
	int res;
	if (N % (2 * D + 1)) {
		res = N / (2 * D + 1) + 1;
	}
	else {
		res = N / (2 * D + 1);
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 128
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    vector <ll> x ({a, b});
    vector <ll> y ({c, d});
    ll ans = -1 * inf;
    for (ll i = 0; i < 2; i++) {
        for (ll j = 0; j < 2; j++) {
            ans = max(ans, x[i] * y[j]);
        }
    }
    cout<<ans<<"\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include "string"

using namespace std;
int A,B;
 
int main(){

	cin >> A >>B;
	if(A%3==0||B%3==0||(A+B)%3==0){
		cout << "Possible";
	}else{
		cout<<"Impossible";
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			(3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
template<class T> void chmax(T &a, const T &b){if(a<b)a=b;}
template<class T> void chmin(T &a, const T &b){if(a>b)a=b;}
void YN(bool b){cout<<(b?"YES":"NO")<<endl;}
void Yn(bool b){cout<<(b?"Yes":"No")<<endl;}
void yn(bool b){cout<<(b?"yes":"no")<<endl;}


struct union_find {
	vector<int> rnk, par;
	union_find(int n) {
		rnk.resize(n);
		par.resize(n);
		rep(i, rnk.size()) {
			par[i] = i;
			rnk[i] = 0;
		}
	}
	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 (rnk[x] < rnk[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (rnk[x] == rnk[y])rnk[x]++;
		}
	}
	bool same(int x, int y) {
		return (find(x) == find(y));
	}
};

int main() {
	int n,k,l,p,q,r,s;
	cin>>n>>k>>l;
	union_find u1(n),u2(n);
	rep(i,k){
		cin>>p>>q;
		u1.unite(p-1,q-1);
	}
	rep(i,l){
		cin>>r>>s;
		u2.unite(r-1,s-1);
	}
	map<pii,ll>mp;
	rep(i,n)mp[pii(u1.find(i), u2.find(i))]++;
	rep(i,n)cout<<mp[pii(u1.find(i),u2.find(i))]<<(i!=n-1?" ":"\n");
}



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

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

	vector<int> v(n);
	for(int &e : v)
		cin >> e;
	
	int xD = INT_MAX;	
	int left = 0, right = accumulate(v.begin(), v.end(), 0);
	xD = right;
	for(int e : v){
		left += e;
		right -= e;		
		xD = min(xD,abs(left-right));
	}
	cout << xD;
}


Measured memory_bytes: 3628
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define sz(X) ((int)(X).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define all(X) (X).begin(),(X).end()
#define FOR(i, a, n) for(int i=(a), __ ## i=(n); i<__ ## i; i++)
#define REP(I,N) FOR(I,0,N)
#define PR(X) cout<<#X<<" = "<<(X)<<" "
#define PRL cout<<endl
#define PRV(X) {cout<<#X<<" = {";REP(__prv,sz(X)-1)cout<<(X)[__prv]<<",";if(sz(X))cout<<*(X).end();cout<<"}"<<endl;}

template<class T> ostream &operator<<(ostream &os, const vector<T> &vec)
{
    os << '{';
    REP(i, sz(vec))
    {
        os << vec[i];
        if (i + 1 != sz(vec) )
            os << ',';
    }
    os << '}';
    return os;
}

template<class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &par)
{
    os << '(' << par.X << ',' << par.Y << ')';
    return os;
}

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

int gcd(int x, int y)
{
    return y ? gcd(y, x % y) : abs(x);
}

template<class T> T sqr(T x)
{
    return x * x;
}

string a[550];

int main()
{
//    if (!freopen("1.in", "r", stdin))
//    {
//        cerr << "No input file" << endl;
//        return 1;
//    }
//    if (!freopen("1.out", "w", stdout))
//    {
//        cerr << "Error creating output file" << endl;
//        return 1;
//    }
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    REP(i, n) {
    	cin >> a[i];
    	REP(j, n)
    		a[i][j] = a[i][j] == '#';
    }
    bool hasans = false;
    REP(i, n)
    	REP(j, n)
    		if (a[i][j])
    			hasans = true;
    int ans = -1;
    if (hasans) {
    	ans = n;
        REP(i, n) {
        	int t = 0;
        	REP(j, n)
        		t += !a[i][j];
        	bool hasc = false;
        	REP(j, n)
        		if (a[j][i])
        			hasc = true;
        	t += !hasc;
        	ans = min(ans, t);
        }
        REP(i, n) {
        	bool isfilled = true;
        	REP(j, n)
        		if (!a[j][i])
        			isfilled = false;
        	ans += !isfilled;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
import heapq
x,y,a,b,c = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
res = P[:x] + Q[:y]
heapq.heapify(res)

for i in range(c):
    tmp_min = heapq.heappop(res)
    tmp_r = R[i]
    if tmp_r > tmp_min:
        heapq.heappush(res, tmp_r)
    else:
        heapq.heappush(res, tmp_min)
print(sum(res))

Measured memory_bytes: 23528
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N,M,X;
    cin>>N>>M>>X;
    vi v(M);
    rep(i,M) cin>>v[i];
    int left=0;
    int right=0;
    rep(i,M) {
        if(v[i]<X) left++;
        else right++;
    }
    cout<<min(left,right)<<endl;
}

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

using Lint=long long;

int main()
{
    Lint t[2],a[2],b[2];
    cin>>t[0]>>t[1]>>a[0]>>a[1]>>b[0]>>b[1];

    Lint X=(a[0]-b[0])*t[0];
    Lint Y=(a[1]-b[1])*t[1];

    if(X+Y==0){
        cout<<"infinity"<<endl;
        return 0;
    }
    if(X+Y<0) X=-X,Y=-Y;

    if(X>0){
        cout<<0<<endl;
        return 0;
    }
    if(X==0){
        cout<<1<<endl;
        return 0;
    }
    Lint ans=(-X)/(X+Y)*2+((-X)%(X+Y)!=0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>

int main(){
	int n;
	double score[1000];
	double a, sum, ave;
	scanf("%d", &n);
	while(n){
		sum = 0;
		for(int i = 0; i < n; i++){
			scanf("%lf", &score[i]);
			sum += score[i];
		}
		ave = sum / n;
		a = 0;
		for(int i = 0; i < n; i++){
			a += (score[i] - ave) * (score[i] - ave);
		}
		a /= n;
		printf("%lf\n", sqrt(a));
		scanf("%d", &n);
	}
	return 0;
}

Measured memory_bytes: 1092
#include<bits/stdc++.h>
#define pb push_back
#define debug(x) cerr << #x << " = " << x << "\n";
#define debug_v(x) cerr << #x << " ="; for(auto i : x){cerr << " [" << i << "]";} cerr << "\n";
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vii = vector<pii>;
const double PI = acos(-1);
const int mod = 998244353;
const int inf = 1e9 + 100;
const ll inf64 = 1e18 + 100;
const int maxn = 102;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(20);
	int n, answer = 0;
	cin >> n;
	vi a(n);
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for(int i = 1;i <= 1e5;i++){
		int it = lower_bound(a.begin(), a.end(), i) - a.begin();
		if(it - 1 == n - it - 1){
			answer++;
		}
	}
	cout << answer << "\n";
	return 0;
}
 


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

using namespace std;
typedef long long ll;

int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    ll ax = a;
    ll bx = b;
    if (ax < bx) {
        for (ll i = 0; i < t; i++) {
            ax += v;
            bx += w;
            if (ax >= bx) {
                cout << "YES" << endl;
                return 0;
            }
        }
    } else {
        for (ll i = 0; i < t; i++) {
            ax -= v;
            bx -= w;
            if (ax <= bx) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}


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

#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;

int main() {
	FASTIO
	ll k;
	cin >> k;
	ll y = 7 % k;
	ll z = 10 % k;
	int c = 1;
	vector<bool> m( k + 1);
	while(y){
		y = y * z + 7;
//		clog << y << endl;
		y %= k;
		c++;
		if(m[y]){
			return cout << -1 << endl,0;
		}
		m[y] = 1;
	}
	cout << c << endl;

}

Measured memory_bytes: 3756
#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;



int main(){
    ios::sync_with_stdio(false); 
    string s1,s2;
    cin>>s1>>s2;
    reverse(s1.begin(),s1.end()); 
    if(s1==s2) printf("YES\n");
    else printf("NO\n"); 
    return 0;
}

Measured memory_bytes: 256
import math
def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
    
x=int(input())
for i in range(x, 2*x):
    if is_prime(i):
        print(i)
        break

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
char ss[100015];
int ch[200];
int main()
{
    while(~scanf("%s",ss))
    {
        int flag=0,i;
        for(i=97; i<=122; i++)
            ch[i]=0;
        for(int i=0; i<strlen(ss); i++)
            ch[ss[i]]=1;
        for(i=97; i<=122; i++)
        {
            if(ch[i]!=1)
            {
                printf("%c\n",i);
                break;
            }
        }
        if(i>122)
            printf("None\n");
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int 
#define pb push_back
#define mp make_pair
using namespace std;
#define MAXN 100000
int main()
{
	ll n,mod,i,count=0,s;
	cin>>n>>mod;
	ll a[n+1],pre[n+1]={0};
	for(i=1;i<=n;i++){
		cin>>a[i];
	}
	map<ll,ll> mp1;
	for(i=1;i<=n;i++){
		pre[i]=pre[i-1]+a[i];
	}
	
	for(i=0;i<=n;i++){
		count+=mp1[pre[i]%mod];
		mp1[pre[i]%mod]++;
	}
	cout<<count;
}

Measured memory_bytes: 5760
using namespace std;
#define MAX_V 1000
#define MAX_E 2000
#define INF 1e9
#include<vector>
#include<iostream>
struct edge
{
	int from, to, cost;
};
edge es[MAX_E];
int V, E;
int d[MAX_V];

bool find_negative_loop(int s)
{
	for (int i = 0; i < MAX_V; i++)
	{
		d[i] = INF;
	}
	d[s] = 0;
	int count = 0;
	while (true)

	{
		bool update=false;
		count++;
		
		for (int i = 0; i < E; i++)
		{
			if (d[es[i].from ]!= INF&&d[es[i].to]>d[es[i].from]+es[i].cost)
			{
				if (count == V)
				{
					return true;
				}
				d[es[i].to] = d[es[i].from] + es[i].cost;//update
				update = true;
				
			}
			
		}
		if (!update)
		{
			break;
		}
	}
	return false;
}

int main()
{
	int r;
	cin >> V >> E >> r;
	for (int i = 0; i < E; i++)
	{
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	if (find_negative_loop(r))
	{
		cout << "NEGATIVE CYCLE" << endl;
	}
	else
	{
		for (int i = 0; i < V; i++)
		{
			if (d[i] == INF)
			{
				cout << "INF" << endl;
			}
			else
			{
				cout << d[i] << endl;
			}
		}
	}
	return 0;

}


Measured memory_bytes: 3112
//##MohK
//25/02/2020 .... 5,15.
#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
using ld = long double;
int main(){
    ll t;
    cin>>t;
    ll counter=0;
    map<string,ll>v;
    for(ll i=0;i<t;i++){
       string s;
       cin>>s;
       v[s]++;
       counter=max(counter,v[s]);
    }
    for(auto p : v){
        if(p.second==counter){
            cout<<p.first<<endl;
        }
        else continue;
    }
    return 0;
}


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

using namespace std;

int A, B, C;

int solve(int a, int b, int c, int cnt){
	if(a%2 || b%2 || c%2) return cnt;
	else if(a == b && b == c) return -1;
	int aa = (b+c)/2, bb = (a+c)/2, cc = (a+b)/2;
	return solve(aa, bb, cc, cnt+1);
}

int main(){
	cin >> A >> B >> C;
	cout << solve(A, B, C, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	double l;
	cin >> l;
	double s = l/3;
	s *= s*s;
	cout << fixed << setprecision(7) << s << endl;
	return 0;
}



Measured memory_bytes: 3684
#include<cstdio>
#include<vector>
#include<algorithm>
#define N 500000
using namespace std;

struct Point {
    int i, x, y;
} bucket[N];
struct Node {
    int lo, l, r;
} tree[N];

bool cmpx(Point a, Point b) { return a.x < b.x; };
bool cmpy(Point a, Point b) { return a.y < b.y; };
bool cmpi(int a, int b) { return a > b; };

int indx = 0;
int sx, tx, sy, ty;
vector <int> ans;

int make2Dtree(int l, int r, int depth) {
    if (l >= r) return -1;
    int t = indx++;
    int mid = (l + r) / 2;

    if (depth % 2 == 0) 
        sort(bucket + l, bucket + r, cmpx);
    else 
        sort(bucket + l, bucket + r, cmpy);

    tree[t].lo = mid;
    tree[t].l = make2Dtree(l, mid, depth + 1);
    tree[t].r = make2Dtree(mid + 1, r, depth + 1);

    return t;
}
void find(int v, int depth) {
    int x = bucket[tree[v].lo].x;
    int y = bucket[tree[v].lo].y;
    if (sx <= x && x <= tx && sy <= y && y <= ty)
        ans.push_back(bucket[tree[v].lo].i);
    
    if (depth % 2 == 0) {
        if (x >= sx && tree[v].l >= 0)
            find(tree[v].l, depth + 1);
        if (x <= tx && tree[v].r >= 0)
            find(tree[v].r, depth + 1);
    }
    else {
        if (y >= sy && tree[v].l >= 0)
            find(tree[v].l, depth + 1);
        if (y <= ty && tree[v].r >= 0)
            find(tree[v].r, depth + 1);
    }
}

int main() {
    int n, q;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        bucket[i].i = i;
        scanf("%d%d", &bucket[i].x, &bucket[i].y);
    }
    make2Dtree(0, n, 0);
    
    scanf("%d", &q);
    while (q--) {
        scanf("%d%d%d%d", &sx, &tx, &sy, &ty);
        find(0, 0);
        sort(ans.begin(), ans.end(), cmpi);
        while (!ans.empty())
            printf("%d\n", ans.back()),
            ans.pop_back();
        puts("");
    }
    return 0;
}


Measured memory_bytes: 14032
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;

int h,w,x;
char s[1000][1000];
bool visited [1000][1000];
pair<int,int> start,goal;
queue<pair<int,pair<int,int>>> q;
vector<pair<int,int>> ino;

int main(){
  int a,b,c;cin>>a>>b>>c;
  bool same = false;
  if(c>=a&&c<=b)same = true;
  cout << (same?"Yes":"No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
string s;
char t[10][100005];
int main(void){
    cin>>n>>s;
    t[0][0]='S';
    t[1][0]='S';
    t[2][0]='W';
    t[3][0]='W';
    if(s[0]=='o'){
        t[0][1]='S';
        t[0][n-1]='S';
        t[1][1]='W';
        t[1][n-1]='W';
        t[2][1]='S';
        t[2][n-1]='W';
        t[3][1]='W';
        t[3][n-1]='S';
    }else{
        t[0][1]='S';
        t[0][n-1]='W';
        t[1][1]='W';
        t[1][n-1]='S';
        t[2][1]='S';
        t[2][n-1]='S';
        t[3][1]='W';
        t[3][n-1]='W';
    }
    for(int i=2;i<n-1;i++){
        for(int j=0;j<4;j++){
            if(s[i-1]=='o'){
                if(t[j][i-1]=='S'){
                    t[j][i]=t[j][i-2];
                }else{
                    if(t[j][i-2]=='S'){
                        t[j][i]='W';
                    }else{
                        t[j][i]='S';
                    }
                }
            }else{
                if(t[j][i-1]=='S'){
                    if(t[j][i-2]=='S'){
                        t[j][i]='W';
                    }else{
                        t[j][i]='S';
                    }
                }else{
                    t[j][i]=t[j][i-2];
                }
            }
        }
    }
    for(int i=0;i<4;i++){
        bool k=false;
        bool l=false;
        if(s[n-2]=='o'){
            if(t[i][n-2]=='S'){
                if(t[i][n-1]==t[i][n-3]){
                    k=true;
                }
            }else{
                if(t[i][n-1]!=t[i][n-3]){
                    k=true;
                }
            }
        }else{
            if(t[i][n-2]=='S'){
                if(t[i][n-1]!=t[i][n-3]){
                    k=true;
                }
            }else{
                if(t[i][n-1]==t[i][n-3]){
                    k=true;
                }
            }
        }
        if(s[n-1]=='o'){
            if(t[i][n-1]=='S'){
                if(t[i][n-2]==t[i][0]){
                    l=true;
                }
            }else{
                if(t[i][n-2]!=t[i][0]){
                    l=true;
                }
            }
        }else{
            if(t[i][n-1]=='S'){
                if(t[i][n-2]!=t[i][0]){
                    l=true;
                }
            }else{
                if(t[i][n-2]==t[i][0]){
                    l=true;
                }
            }
        }
        if(k&&l){
            for(int j=0;j<n;j++){
                cout<<t[i][j];
            }
            cout<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;

}



Measured memory_bytes: 4088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;

int main(){
    int a,b;
    cin>>a>>b;
    if((a+b)%2==0) cout<<(a+b)/2<<endl;
    else cout<<"IMPOSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a,b;
	scanf("%d%d",&a,&b);
	int c=a*b;
	if (c&1) {
		printf("Odd\n");
	}
	else {
		printf("Even\n");
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int age = sc.nextInt();
		int sum = sc.nextInt();
		int total = 0;
		
		if (age <= 5) {
			;
		} else if (age >= 6 && age <= 12) {
			total = sum / 2;
		} else {
			total = sum;
		}
		
		System.out.println(total);
	}	
}

Measured memory_bytes: 20820
N, M = map(int, input().split())
AB = []
for _ in range(N):
    AB.append(list(map(int, input().split())))

from operator import itemgetter
AB.sort(key=itemgetter(0))
ans = 0
n = M
for a, b in AB:
    if n - b > 0:
        ans += a * b
        n -= b
    else:
        ans += a * n
        break

print(ans)

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

using namespace std;

int main() {
  int n;
  set<int> st;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    st.insert(x);
  }
  int dd = n - (int)st.size();
  if (dd & 1) dd ++;
  printf("%d\n", n - dd);
  return 0;
}


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

using namespace std;
long long pluspref[1000000];
long long minuspref[1000000];
int n, k;
long long niz[1000000];
int main()
{
    cin >>n >>k;
    pluspref[0] = 0;
    minuspref[0] = 0;
    for (int i = 1; i <= n; ++i){
        cin >>niz[i];
        if (niz[i] > 0){
            pluspref[i] = pluspref[i-1] + niz[i];
            minuspref[i] = minuspref[i-1];
        }else{
            minuspref[i] = minuspref[i-1] + niz[i];
            pluspref[i] = pluspref[i-1];
        }
    }

    long long sol = -1000000009;
    for (int i = 0; i <= n-k; ++i){
        long long score = 0;
        score += pluspref[i]-pluspref[0];
        score += pluspref[n]-pluspref[i+k];
        long long midsc = (pluspref[i + k]-pluspref[i])+(minuspref[i + k]-minuspref[i]);
        ///cout <<i <<" " <<i+k <<" " <<score <<" " <<pluspref[i-1]-pluspref[0] <<" " <<pluspref[n]-pluspref[i+k-1] <<midsc <<endl;
        if (midsc>0)score+=midsc;
        if (score>sol)sol = score;
    }
    cout <<sol;
return 0;
}
/*
10 5
  5 -4 -5 -8  -4   7   2   -4  0  7
0 5  5  5  5   5   12  14  14  14 21
0 0 -4 -9 -17 -21 -21 -21 -25 -25 -25
*/


Measured memory_bytes: 9216
n = int(input())
A = list(sorted(map(int, input().split())))
q = int(input())
M = list(map(int, input().split()))

R = [[None] * 2000 for i in range(n + 1)]

def solve(A, i, m, n):
    if R[i][m] != None:
        return R[i][m]
    if m == 0:
        R[i][m] = True
        return True
    elif i >= n:
        R[i][m] = False
        return False
    else:
        ans = solve(A, i + 1, m, n) or solve(A, i + 1, m - A[i], n)
        R[i][m] = ans
        return ans

for i in M:
    if sum(A) < i:
        print('no')
    elif solve(A, 0, i, n):
        print('yes')
    else:
        print('no')

Measured memory_bytes: 8120
#include <iostream>

using namespace std;

int main(void){
	
	int h,w;
	
	while(cin>>h>>w,w!=0&&h!=0){
		
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if((i+j)%2==0)
					cout<<"#";
				else
					cout<<".";
			}
			cout<<endl;
		}
		cout<<endl;
	}
	
	
}

Measured memory_bytes: 3012