akhauriyash/Code-Regression huggingface dataset:
def main():
    H, W, K = map(int, input().split())
    grid = [input() for _ in range(H)]

    n = H + W
    ans = 0
    for case in range(2**n):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (case >> i) & 1:
                    if (case >> j + H) & 1:
                        if grid[i][j] == "#":
                            cnt += 1
        if cnt == K:
            ans += 1
    print(ans)
   
main()

Measured memory_bytes: 9144
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct Edge
{
	int to;
	int nxt;
}e[400005];
int n,m,edgenum,head[200005],f[200005],dep[200005],max1[200005],max2[200005],pa[200005];
void add(int u,int v)
{
	e[++edgenum].to=v;
	e[edgenum].nxt=head[u];
	head[u]=edgenum;
}
void dfs(int node)
{
	dep[node]=dep[pa[node]]+1;
	max1[node]=max2[node]=dep[node];
	for(int hd=head[node];hd;hd=e[hd].nxt)
	{
		int to=e[hd].to;
		if(to==pa[node])continue;
		pa[to]=node;
		dfs(to);
		if(max1[to]>max1[node])max2[node]=max1[node],max1[node]=max1[to];
		else if(max1[to]>max2[node])max2[node]=max1[to];
	}
	m=max(m,max1[node]+max2[node]-2*dep[node]);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<n;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v);
		add(v,u);
	}
	dfs(1);
	n=m+1;
	f[1]=1,f[2]=0;
	for(int i=3;i<=n;i++)
	  f[i]=!(f[i-1]&f[i-2]);
	if(f[n])printf("First\n");
	else printf("Second\n");
	return 0;
}

Measured memory_bytes: 16896
n=int(input())
a=list(map(int,input().split()))
if n%2==1:
    x=[i for i in range(n)]
    for i in range(n):
        if i%2==1:
            x[i]+=1
else:
    x=[i for i in range(n)]
    for i in range(n):
        if i%2==0:
            x[i]+=1
a.sort()
if x==a:
    print(pow(2,(n//2),10**9+7))
else:
    print(0)

Measured memory_bytes: 20460
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
long long n;
bool check(long long x)
{
	long long tmp=x;
	while(tmp*x<=n)
	{
		if((n-tmp)%(tmp*x)==0) return 1;
		tmp*=x;
	}
	tmp=x*x;
	while(tmp<=n)
	{
		if(tmp==n) return 1;
		tmp*=x;
	}
	return 0;
}
int ans=0;
long long calc(long long x)
{
	x--;
	int tot=1;
	for(long long i=2;i*i<=n;i++)
	if(x%i==0)
	{
		int cnt=1;
		while(x%i==0) cnt++,x/=i;
		tot*=cnt;
	}
	if(x>1) tot*=2;
	return tot;
}
signed main()
{
	cin>>n;
	if(n==2)
	{
		cout<<1<<endl;
		return 0;
	}
	for(long long i=2;i*i<=n;i++)
	if(check(i)) ans++;
	ans+=calc(n);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

macro_rules! input {
    ($($r:tt)*) => {
        let con = io::read_string();
        let mut sc = io::Scanner::new(&con);
        input_inner!{sc, $($r)*}
    };
}

macro_rules! input_inner {
    ($sc:expr) => {};
    ($sc:expr, ) => {};

    ($sc:expr, $var:ident : [ $t:tt ; $len:expr ], $($r:tt)*) => {
        let $var: Vec<_> = (0..$len).map(|_| read_value!($sc, $t)).collect();
        input_inner!{$sc, $($r)*}
    };

    ($sc:expr, $var:ident : $t:ty, $($r:tt)*) => {
        let $var: $t = read_value!($sc, $t);
        input_inner!{$sc, $($r)*}
    };
}

macro_rules! read_value {
    ($sc:expr, ( $($t:tt),* )) => {
        ( $(read_value!($sc, $t)),* )
    };

    ($sc:expr, $t:ty) => {
        $sc.next::<$t>()
    };
}

//-----

fn main() {
    input!{
        n: usize,
        m: usize,
        q: usize,
        ts: [(usize, usize); m],
        qs: [(usize, usize); q],
    }

    let mut tbl = vec![vec![0; n]; n];
    for (l, r) in ts {
        for r in tbl[l - 1][r - 1..n].iter_mut() {
            *r += 1;
        }
    }

    for (p, q) in qs {
        let ans: usize = tbl[p - 1..n].iter().map(|r| r[q - 1]).sum();
        println!("{}", ans);
    }
}


Measured memory_bytes: 16632
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}
class llm{
public:
llm(ll value){this->value = (ll)value;}
ll value;
llm operator + (llm obj){return llm((this->value + (ll)(obj.value))%MOD);}
llm operator + (ll obj){return llm((this->value + obj)%MOD);}
llm operator - (llm obj){return llm(((this->value + MOD - (ll)(obj.value)))%MOD);}
llm operator - (ll obj){return llm(((this->value + MOD - obj))%MOD);}
llm operator * (llm obj){return llm((this->value * (ll)(obj.value))%MOD);}
llm operator * (ll obj){return llm((this->value * obj)%MOD);}
llm operator / (llm obj){return llm(this->value / (ll)(obj.value));}
llm operator / (ll obj){return llm(this->value / obj);}
llm operator % (llm obj){return llm(this->value % (ll)(obj.value));}
llm operator % (ll obj){return llm(this->value % obj);}};
ostream& operator<<(ostream& os, llm l){os << l.value;return os;} 
llm operator+(ll a,llm l){return llm((a + l.value)%MOD);} 
llm operator*(ll a,llm l){return llm((a * l.value)%MOD);}


int g(int x,int c){
	if(x<=c*50&&x>=0){
		return 1;
	}else{
		return 0;
	}
}

int f(int x,int b,int c){
	int ret=0;
	for(int i=0;i<=b;i++){
		ret += g(x-100*i,c);
	}
	return ret;
}

 
int main(void){
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int ans=0;
	for(int i=0;i<=a;i++){
		ans+=f(x-500*i,b,c);
	}

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

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



public class Main{
	public static void main(String[] args){

		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int num;
		int sum;
		double div, m;
		String str;
		String[] array_str;

		try{

			while(true){
			num=Integer.parseInt(reader.readLine());
			if(num==0)break;
			sum=0;
			div=0;//??????????????§?????????
			str=reader.readLine();
			array_str=str.split(" ");

			for(int i=0;i<num;i++){
				sum+=Integer.parseInt(array_str[i]);
			}
			m=(double)sum/num;//??????


			for(int i=0;i<num;i++){
				div+=(Double.parseDouble(array_str[i])-m)*(Double.parseDouble(array_str[i])-m)/num;
			}System.out.printf("%.8f", Math.sqrt(div));
			System.out.println();

			}//while???????????°?????????

		}catch(IOException e){
			System.out.print(e);
		}
	}

}

Measured memory_bytes: 26384
from collections import defaultdict

N ,M = map(int,input().split())
PS = defaultdict(lambda:[0,0])
for _ in range(M):
    p, s = input().split()
    if s == 'AC':
        PS[p][0] = 1
    else:
        if PS[p][0] == 0:
            PS[p][1] += 1

AC = 0
WA = 0
for v in PS.values():
    AC += v[0]
    WA += v[0]*v[1]


print(AC,WA)

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

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

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

#define EACH(i, c) \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define SORT(c) sort((c).begin(), (c).end())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
const double PI = acos(-1.0);
#define CLR(a) memset((a), 0, sizeof(a))

char field[20][20];

int p, q;

void ta(int i, int j) {
  if (i < 0 || j < 0 || i >= q || j >= p) return;
  if (field[i][j] == '.' or field[i][j] == '@') {
    field[i][j] = 'x';
    ta(i + 1, j);
    ta(i, j + 1);
    ta(i - 1, j);
    ta(i, j - 1);
  }
}

void solve(int p, int q) {
  REP(i, q) {  // i:y
    REP(j, p) { cin >> field[i][j]; }
  }
  REP(i, q) {  // i:y
    REP(j, p) {
      if (field[i][j] == '@') ta(i, j);
    }
  }
  int ans = 0;
  REP(i, q) {  // i:y
    REP(j, p) {
      if (field[i][j] == 'x') ans++;
    }
  }
  cout << ans << "\n";
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // int p,q;
  while (cin >> p >> q && p && q) {
    solve(p, q);
  }
  return 0;
}

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

int w, h;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

void bfs(vector< vector<char> > &plane, int x, int y, int &ans){  
  plane[x][y] = '#';
  ans++;
  for(int i=0; i<4; i++){
    if(0 <= x+dx[i] && x+dx[i] < w && 0 <= y+dy[i] && y+dy[i] < h)
      if(plane[x + dx[i]][y + dy[i]] != '#')
        bfs(plane, x + dx[i], y + dy[i], ans);
  }
  
  return;
}

int main(){
  while(true){
    cin >> w >> h;
    if(w == 0)
      break;

    int sx, sy;
    vector< vector<char> > plane(w, vector<char>(h));
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        cin >> plane[j][i];
        if(plane[j][i] == '@'){
          sx = j;
          sy = i;
        }
      }
    }

    int ans = 0;
    bfs(plane, sx, sy, ans);
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3108
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) x*=i;
    return x;
}

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

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

ll modinv(ll a,ll m) {
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
    }
    u%=m;
    if (u<0) u+=m;
    return u;
}

ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,q;
    cin>>n>>q;
    
    vec<ll> a(n),x(q);
    rep(i,n) cin>>a[i];
    rep(i,q) cin>>x[i];
    
    rep(i,q){
        ll right=0,sum=0,res=0;
        rep(left,n){
            while(right<n && sum+a[right]<=x[i]){
                sum+=a[right];
                right++;
            }
            res += right-left;
            if(right==left) right++;
            else sum -= a[left];
        }
        cout<<res<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    int ans0 = 0;
    int ans1 = 0;
    for(int i = 0 ; i < S.size() ; i++){
        if(S[i] == 'A' ||S[i] == 'T' ||S[i] == 'G' ||S[i] == 'C'){
            ans1 ++;
        } else{
            ans0 = max(ans0 , ans1);
            ans1 = 0;
        }
    }
    ans0 = max(ans0 , ans1);
    cout << ans0 << endl;
    return 0;
}

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

using namespace std;

int main() {
    int h, w, n, a, cnt = 0;
    cin >> h >> w >> n;
    vector< vector<int> > d(h, vector<int>(w));
    for (int i = 1; i <= n; ++i) {
        cin >> a;
        for (int j = 0; j < a; ++j, ++cnt) d.at(cnt / w).at(cnt / w % 2 ? w - 1 - cnt % w : cnt % w) = i;
    }
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w - 1; ++j) cout << d.at(i).at(j) << " ";
        cout << d.at(i).back() << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b; cin>>a>>b;
    cout<<max({a+b, a-b, a*b})<<endl;


    return  0;
}


Measured memory_bytes: 892
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			string s = cin.Next();
			int[] ss = s.Select(x => (int)(x - '0')).ToArray();

			long ans = 0;
			for (int i = 0; i < 10; i++) {
				int index = -1;
				for (int j = 0; j < n; j++) {
					if (ss[j] == i) {
						index = j;
						break;
					}
				}

				if (index == -1) {
					continue;
				}

				HashSet<int> nums = new HashSet<int>();
				for (int j = 0; j < 10; j++) {
					int index2 = -1;
					for (int k = index + 1; k < n; k++) {
						if (ss[k] == j) {
							index2 = k;
							break;
						}
					}

					if (index2 == -1) {
						continue;
					}

					nums.Clear();
					for (int k = index2 + 1; k < n; k++) {
						nums.Add(ss[k]);
					}

					ans += nums.Count();
				}
			}

			Console.WriteLine(ans);
		}
	}


	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

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

const int N = 1e5 + 5;
ll a,b,c,d;

long long gcd(long long a, long long b){
    return b ? gcd(b, a % b) : a;
}

ll cnt_divide(ll x, ll y, ll z){
    ll yminus = y/z;
    ll xminus = (x-1)/z;
    
    return yminus - xminus;
}


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>a>>b>>c>>d;
    
    
    ll total =  b- a+1;
    
    ll divid_by_c = cnt_divide(a, b, c);
    ll divid_by_d = cnt_divide(a, b, d);
    
    ll divid_by_c_d = cnt_divide(a, b, c*d/gcd(c, d));
    
    cout<< total - (divid_by_c + divid_by_d - divid_by_c_d)<<endl;
    
    
    
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;


constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

namespace {
	template<typename T> void chmax(T& a, T b) { a = std::max(a, b); }
	template<typename T> void chmin(T& a, T b) { a = std::min(a, b); }
	template<typename T> void chadd(T& a, T b) { a = a + b; }

	void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
	template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
	template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }


	// 標準入出力
	struct inp {
		std::size_t sz;
		inp(std::size_t _sz = 1) : sz(_sz) {}
		template <typename T> operator T () const { T a; std::cin >> a; return a; }
		template <typename T> operator std::vector<T>() const { vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
		template <typename T, typename U> operator std::pair<T, U>() const { T f; U s; std::cin >> f >> s; return std::pair<T, U>(f, s); }
	};

	inp inp1; // input one
}

int main() {

	double l = inp1;

	double a, b, c;
	double ans = 0.0;

	ans = pow(l, 3) / 27.0;

	cout << fixed << setprecision(7) << ans << endl;

	return 0;
}


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

string f(ll n ){
    if(n==0) return" ";
    n--;
    return f(n/26) + string(1,'a'+n%26);
}
int main(){
    ll n;
    cin>>n;
    cout<<f(n)<<endl;
    return 0;
}

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

bool cmt(pair<int, int> l, pair<int, int> r)
{
  return (l.first > r.first);
}

int main()
{
  int n, m;
  while (cin >> n >> m, n || m){
    vector<pair<int, int> > pii(m);
    int table[1010][1010];
    for (int i = 0; i < n; i++){
      for (int j = 0; j < m; j++){
        cin >> table[i][j];
      }
    }
    for (int i = 0; i < m; i++){
      int ct = 0;
      for (int j = 0; j < n; j++){
       if (table[j][i] == 1) ct++; 
      }
      pii[i] = make_pair(ct, i + 1);
    }
    stable_sort(pii.begin(), pii.end(), cmt);
    
    for (int i = 0; i < m; i++){
      if (i != 0) cout << ' ';
      cout << pii[i].second;
    }
    cout << "\n";
  }
}

Measured memory_bytes: 6992
using System;
using System.Linq;
using System.Collections.Generic;

/*
?????°??¶????????????????????¶??????
*/
public class Program{
    public static void Main(){
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var N = input[0];
        var W = input[1];
        var Product_Value = new int[N];
        var Product_Weight = new int[N];
        for(int i=0; i<N; i++){
            var info = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Product_Value[i] = info[0];
            Product_Weight[i] = info[1];
        }
        //??¶????????????????????§??????????????¨?????????
        var dp = new int[N+1, W+1];
        
        for(int i=1; i<N+1; i++){
            for(int j=0; j<W+1; j++){
                //?????¨??????????????\????????????????????¢???????¶??????????????????´????????????????????????????????????
                //j???????????¨????????????????¨??????§
                if(j<Product_Weight[i-1]){
                    dp[i, j] = dp[i-1, j];
                }else{
                    dp[i, j] = Math.Max(dp[i-1, j], dp[i, j-Product_Weight[i-1]]+Product_Value[i-1]);
                }
            }
        }
        
        //one dimensional array version
        /*
        var dp2 = new int[W+1];
        for(int i=1; i<N+1; i++){
            for(int j=Product_Weight[i-1]; j<W+1; j++){
                dp2[j] = Math.Max(dp2[j-1], dp2[j-Product_Weight[i-1]]+Product_Value[i-1]);
            }
        }
        */
        Console.WriteLine(dp[N, W]);
    }
}

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

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

x=int(input())
ok=[1]+[0]*100000
ok[100]=1
if x<100:
    print(0)
    sys.exit()
a=[100,101,102,103,104,105]
for i in range(100,x+1):
    for item in a:
        if i-item>=0 and ok[i-item]==1:
            ok[i]=1
print(ok[x])

Measured memory_bytes: 10368
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int d[888][888];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  fill(d[0],d[888],MOD);
  int n,m,t;
  cin>>n>>m>>t;
  vector<string> mp(n);
  rep(i,n) cin>>mp[i];
  queue<pii> q;
  rep(i,n)rep(j,m)if(mp[i][j]=='S'){
    d[i][j]=0;
    q.emplace(j,i);
  }
  int re=MOD;
  while(q.size()){
    int x,y;
    tie(x,y)=q.front(); q.pop();
    if(mp[y][x]=='#') continue;
    int mn=min({x,y,n-1-y,m-1-x});
    //out(x,y,mn,1);
    if(d[y][x]<=t) MN(re,(mn+t-1)/t+1);
    if(mn==0 || mp[y][x]=='#') continue;
    rep(i,4){
      int nx=x+dx[i];
      int ny=y+dy[i];
      if(MN(d[ny][nx],d[y][x]+1)) q.emplace(nx,ny);
    }
  }
  cout<<re<<endl;
  return 0;
}


Measured memory_bytes: 4096
#include <iostream>

using namespace std;

void putarray(int a[100],int n){
    for(int i=0;i<n;i++){
        cout << a[i] ;
        if (i!=n-1){
            cout << " ";
        }
    }
    cout << endl;
}
int main(){
    int n;
    cin >> n;
    int a[100];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=1;i<n;i++){
        putarray(a,n);
        int v=a[i];
        int j=i-1;
        while(j>=0 && a[j]>v){
            a[j+1]=a[j];
            j--;
            a[j+1]=v;
        }
    }
    putarray(a,n);
    return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int A, B;
    cin >> A >> B;
    int d[3];
    d[0] = A + B;
    d[1] = A * B;
    d[2] = A - B;
    sort(begin(d), end(d), greater<int>() );
    cout << d[0] << endl;
}


Measured memory_bytes: 256
from math import gcd

k = int(input())

gcd_sum = [0] * 201
res = 0

for i in range(1, k + 1):
	for j in range(1, k + 1):
		gcd_sum[i] += gcd(i, j)

for a in range(1, k + 1):
	for b in range(1, k + 1):
		g = gcd(a, b)
		res += gcd_sum[g]

print(res)

Measured memory_bytes: 65160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);
static const ll mod = 1e9+7;

ll get_factorial(ll x) {
  ll y = 1LL;
  rep(i, x) {
    y *= (ll)(i+1);
    y %= mod;
  }

  return y;
}

int main() {
  ll N, M; cin >> N >> M;
  if (N > M) swap(N, M);

  ll ans = 0LL;
  if ( M == (N + 1LL) ) {
    ans = get_factorial(M);
    ans *= get_factorial(N);
  } else if ( M == N ) {
    ans = get_factorial(M);
    ans *= get_factorial(M);
    ans %= mod;
    ans *= 2LL;
  }

  ans %= mod;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per0(i, st, ed) for (int i = (st); i > ed; --i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
#define chmin(a, b) (a = a > b ? b : a)
#define chmax(a, b) (a = a < b ? b : a)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
const int maxn = 1e5 + 5;
vector<int> g[maxn];
int d[maxn];
queue<int> que;
int dis[maxn];
int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int n = read(), m = read();
    rep(i, 1, m) {
        int x = read(), y = read();
        g[x].push_back(y);
        d[y]++;
    }
    rep(i, 1, n) if (d[i] == 0) que.push(i);
    int ans = 0;
    while (!que.empty()) {
        int f = que.front();
        que.pop();
        int len = g[f].size();
        for (int i = 0; i < len; ++i) {
            int to = g[f][i];
            chmax(dis[to], dis[f] + 1);
            chmax(ans, dis[to]);
            --d[to];
            if (d[to] == 0) {
                que.push(to);
            }
        }
    }
    cout << ans << endl;
    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

void read (int&a) {
	a = 0; char k = getchar(); int f = 1;
	for(;!isdigit(k); k = getchar()) if (k == '-') f = -1;
	for(; isdigit(k); k = getchar()) a = a * 10 + k - '0';
	a *= f;
}

const int N = 200000 + 5, mod = 1000000007;
int fpow (int base, int v) {
	int tot = 1;
	for(; v; v >>= 1, base = 1LL * base * base % mod) if (v & 1) tot = 1LL * tot * base % mod;
	return tot;
}
void add (int&a, int b) { a = (a + b) % mod; }
vector<int> G[N], D[N];
int n, sz[N], dep[N], st[N][20];

void dfs (int u, int f) {
	dep[u] = dep[f] + 1;
	D[ dep[u] ].push_back (u);
	st[u][0] = f;
	for (int i = 1; i <= 19; ++i) st[u][i] = st[ st[u][i - 1] ][i - 1];
	for (int i = 0; i < (signed)G[u].size(); ++i) if (G[u][i] != f) {
		dfs (G[u][i], u);
	}
}

int LCA (int u, int v) {
	if (dep[u] < dep[v]) swap (u, v);
	for (int i = 19; i >= 0 && dep[u] != dep[v]; --i)
		if (dep[u] - (1 << i) >= dep[v])
			u = st[u][i];
	for (int i = 19; i >= 0 && u != v; --i)
		if (st[u][i] != st[v][i])
			u = st[u][i], v = st[v][i];
	return u == v ? u : st[u][0];
}

int stk[N], top, dp[N], sum0[N], pow2[N];

int dp0(int x) { return (pow2[sz[x]] - dp[x] + mod) % mod; }

void upd (int x, int y) {
	sz[y] += sz[x];
	dp[y] = 1LL * dp[y] * fpow (sum0[y], mod - 2) % mod;
	sum0[y] = 1LL * sum0[y] * dp0(x) % mod;
	add (dp[y], 1LL * dp[x] * fpow(dp0(x), mod - 2) % mod);
	dp[y] = 1LL * dp[y] * sum0[y] % mod;
}

int main ()
{
	read (n); n++;
	pow2[0] = 1; for(int i = 1; i <= n; ++i) pow2[i] = 1LL * pow2[i - 1] * 2 % mod;
	for (int i = 2; i <= n; ++i) {
		int x; read (x); ++x;
		G[x].push_back (i), G[i].push_back (x);
	}
	dfs (1, 0);
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		int nowdep = i;
		if (!D[i].size()) break;
		stk[ top = 1 ] = D[i][0], dp[D[i][0]] = 1, sum0[D[i][0]] = 1, sz[D[i][0]] = 1;
		for (int j = 1; j < (signed)D[i].size(); ++j) {
			int p = D[i][j], lca = LCA (p, stk[top]);

			dp[p] = 1, sum0[p] = 1, sz[p] = 1;

			while(dep[ stk[top] ] > dep[lca]) {
				if (top == 1 || dep[stk[top - 1]] < dep[lca]) { dp[lca] = 0, sum0[lca] = 1, sz[lca] = 0; upd (stk[top], lca); }
				else upd(stk[top], stk[top - 1]);
				top--;
			}
			if (top == 0 || stk[top] != lca) stk[++top] = lca;
			stk[++top] = p;
		}
		for (int i = top; i > 1; --i) upd (stk[i], stk[i - 1]);
		int tans;
		add (ans, tans = 1LL * pow2[n - (signed)D[nowdep].size()] * dp[stk[1]] % mod);
	}
	printf ("%d\n", ans);
	return 0;
}




















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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

int dp[1000010][2];

void solve() {
  rep(i, 1000010) rep(j, 2) dp[i][j] = 1e9;
  dp[0][0] = 0;
  string s;
  cin >> s;
  int n = sz(s);
  reverse(all(s));
  rep(i, n + 3) rep(j, 2) {
    int x = 0;
    if (i < n) {
      x = s[i] - '0';
    }
    if (j == 0) {
      amin(dp[i + 1][0], dp[i][j] + x);
      amin(dp[i + 1][1], dp[i][j] + (10 - x)); 
    } else {
      amin(dp[i + 1][0], dp[i][j] + x + 1);
      amin(dp[i + 1][1], dp[i][j] + (9 - x));
    }
  }
  cout << dp[n + 1][0] << endl;
}

Measured memory_bytes: 9756
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int A[] = new int[9];
		int ans[] = new int[9];
		for(int i = 0; i < 9; i++){
			A[i] = stdIn.nextInt();
			ans[i] = 1;
		}
		int N = stdIn.nextInt();
		int B[] = new int[N];

		for(int i = 0; i < N; i++){
			B[i] = stdIn.nextInt();
			for(int j = 0; j < 9; j++){
				if(B[i] == A[j]){
					ans[j] = 0;
				}
			}
		}
		if(ans[0] == 0 && ans[3] == 0 && ans[6] == 0){
			System.out.println("Yes");
		}
		else if(ans[1] == 0 && ans[4] == 0 && ans[7] == 0){
			System.out.println("Yes");
		}
		else if(ans[2] == 0 && ans[5] == 0 && ans[8] == 0){
			System.out.println("Yes");
		}
		else if(ans[0] == 0 && ans[1] == 0 && ans[2] == 0){
			System.out.println("Yes");
		}
		else if(ans[3] == 0 && ans[4] == 0 && ans[5] == 0){
			System.out.println("Yes");
		}
		else if(ans[6] == 0 && ans[7] == 0 && ans[8] == 0){
			System.out.println("Yes");
		}
		else if(ans[0] == 0 && ans[4] == 0 && ans[8] == 0){
			System.out.println("Yes");
		}
		else if(ans[2] == 0 && ans[4] == 0 && ans[6] == 0){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		stdIn.close();
	}
}

Measured memory_bytes: 35632
//
// Created by tac on 2016/10/12.
//

#include <cstdlib>
#include <iostream>

int main() {
    int n;
    int i = 0;
    while (true) {
        std::cin >> n;
        if (n <= 0) {
            break;
        }
        ++i;
        std::cout << "Case " << i << ": " << n << std::endl;
    }
    return EXIT_SUCCESS;
}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a != c)
		cout << "Yes";
	else if (a == c && a != b)
		cout << "Yes";
	else if (b == c && b != a)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 256
let fn1: string -> int =
  Seq.distinct >> Seq.length

let fn2: string -> int =
  fun s ->
    [0..(s.Length - 1)]
    |> Seq.fold (fun m i ->
      match Map.tryFind s.[i] m with
      | Some _ -> m
      | _ -> m.Add (s.[i], s.[(i + 1)..] |> fn1)
    ) Map.empty
    |> Seq.sumBy (fun x -> x.Value)

let fn3: string -> int =
  fun s ->
    [0..(s.Length - 1)]
    |> Seq.fold (fun m i ->
      match Map.tryFind s.[i] m with
      | Some _ -> m
      | _ -> m.Add (s.[i], s.[(i + 1)..] |> fn2)
    ) Map.empty
    |> Seq.sumBy (fun x -> x.Value)

stdin.ReadLine()
|> ignore
|> fun () -> stdin.ReadLine()
|> fn3
|> printfn "%d"


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


int main() {

	int N, K;
	string S;

	cin >> N >> S >> K;

	for (int i = 0; i < N; i++) {
		if (S[i] == S[K - 1]) {
			cout << S[i];
		}else{
			cout << "*";
		}
	}
	cout << endl;

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    //cout << N << endl;
    int a[N];
    int res = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        res += a[i] - 1;
//        cout << a[i] << endl;
    }
    cout << res;
    return 0;
}

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

int main(){
int n;
long long a,now = 0,sum = 0;
cin >> n;

for(int i =0;i < n; i++){
cin >> a;


if(now < a){
  sum += 0;
  now = a;
}else{
  sum += now - a;
}

}
cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<long long int,long long int>,null_type,less<pair<long long int,long long int> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

void go()
{
    int x,n;
    cin>>x>>n;
    vector<int> a(n);
    map<int,int> h;
    for(int i=0;i<n;i++)
        cin>>a[i],h[a[i]]++;
    int m=INT_MAX,ans=INT_MAX;
    for(int i=0;i<=101;i++)
    {
        if(h.find(i)==h.end())
        {
            if(abs(i-x) < m)
            {
                m=abs(i-x);
                ans=i;
            }
            else if(abs(i-x) == m)
                ans=min(ans,i);
        }
    }
    cout<<ans;
}
int main()
{
    FIO;
    //int t;
    //cin>>t;
    //while(t--)
    go();
    return 0;
}



Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)x.size()
#define int ll

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (auto &it : a) {
		cin >> it;
	}
	sort(a.rbegin(), a.rend());
	pair<int, int> cur = {1, 0};
	while (cur.S + 1 < n && a[cur.S + 1] >= cur.F + 1) {
		cur.F++;
		cur.S++;
	}
	int cnt = 0;
	for (int i = cur.S; i < n; i++) {
		if (a[i] >= cur.F) {
			cnt++;
		}
	}
	if (cnt % 2 == 0 || (a[cur.S] - cur.F + 1) % 2 == 0) {
		cout << "First\n";
	}
	else {
		cout << "Second\n";
	}
}	

Measured memory_bytes: 1024
n, y = map(int, input().split())
for i in range(n+1):
  for j in range(n-i+1):
    if i*10000 + j*5000 + (n-i-j) * 1000 == y:
      print(i, j, n-i-j)
      exit()
print("-1 -1 -1")

Measured memory_bytes: 40684
#include <iostream>
using namespace std;
int main(void){
 int x,y,n;
 cin>>x>>y>>n;
 for(int i = 0;i < n;i++){
     int s,f;
     cin>>s>>f;
    if(y>s&&x<f){
        cout<<"1"<<endl;
          return 0;
    }
 }
 cout<<"0"<<endl;
}


Measured memory_bytes: 3116
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200200;
const ll oo=1000000000000000000ll;
int i,j,k,n,m,ch,a,b;
ll sum,ans;
int x[N];
struct tree { ll v0,v1;} T[N<<2];
void R(int &x) {
	x=0;ch=getchar();
	while (ch<'0' || '9'<ch) ch=getchar();
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
}
void W(ll x) {
	if (x<0) putchar('-'),x=-x;
	if (x>=10) W(x/10);
	putchar(x%10+'0');
}
void up(int k) {
	T[k].v0=min(T[k<<1].v0,T[k<<1|1].v0);
	T[k].v1=min(T[k<<1].v1,T[k<<1|1].v1);
}
void T_build(int L,int R,int k) {
	if (L==R) {
		T[k].v0=T[k].v1=oo;
		return;
	}
	int mid=(L+R)>>1;
	T_build(L,mid,k<<1);
	T_build(mid+1,R,k<<1|1);
	up(k);
}
void T_add(int L,int R,int x,ll y,int k) {
	if (L==R) {
		T[k].v0=min(T[k].v0,y-L);
		T[k].v1=min(T[k].v1,y+L);
		return;
	}
	int mid=(L+R)>>1;
	if (x<=mid) T_add(L,mid,x,y,k<<1);
	else T_add(mid+1,R,x,y,k<<1|1);
	up(k);
}
ll T_min0(int L,int R,int l,int r,int k) {
	if (L==l && R==r) return T[k].v0;
	int mid=(L+R)>>1;
	if (r<=mid) return T_min0(L,mid,l,r,k<<1);
	if (l>mid) return T_min0(mid+1,R,l,r,k<<1|1);
	return min(T_min0(L,mid,l,mid,k<<1),T_min0(mid+1,R,mid+1,r,k<<1|1));
}
ll T_min1(int L,int R,int l,int r,int k) {
	if (L==l && R==r) return T[k].v1;
	int mid=(L+R)>>1;
	if (r<=mid) return T_min1(L,mid,l,r,k<<1);
	if (l>mid) return T_min1(mid+1,R,l,r,k<<1|1);
	return min(T_min1(L,mid,l,mid,k<<1),T_min1(mid+1,R,mid+1,r,k<<1|1));
}
void T_bl(int L,int R,int k) {
	if (L==R) {
		ans=min(ans,T[k].v0+L+sum);
		return;
	}
	int mid=(L+R)>>1;
	T_bl(L,mid,k<<1);
	T_bl(mid+1,R,k<<1|1);
}
int main() {
	R(n);R(m);R(a);R(b);
	T_build(1,n,1);
	for (i=1;i<=m;i++) R(x[i]);
	T_add(1,n,a,(ll) abs(x[1]-b)-sum,1);
	T_add(1,n,b,(ll) abs(x[1]-a)-sum,1);
	for (i=2;i<=m;i++) {
		ll t0=T_min0(1,n,1,x[i],1)+sum+x[i];
		ll t1=T_min1(1,n,x[i],n,1)+sum-x[i];
		ll t=min(t0,t1);
		sum+=abs(x[i]-x[i-1]);
		T_add(1,n,x[i-1],t-sum,1);
	}
	ans=oo;
	T_bl(1,n,1);
	W(ans);puts("");
}

Measured memory_bytes: 11136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n,m;
		int[][] A = new int[100][100];
		int[] B = new int[100];
		int[] C = new int[100];

	    n = sc.nextInt();
	    m = sc.nextInt();

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++){
				A[i][j] = sc.nextInt();
			}
		}
		for (int j = 0; j < m; j++){
			 B[j] = sc.nextInt();
		}
		for (int i = 0; i < n; i++) {
			C[i] = 0;
			for (int j = 0; j < m; j++){
				C[i] += A[i][j] * B[j];
			}
		}
		for (int i = 0; i < n; i++) {
			System.out.println(C[i]);
		}

	}

}

Measured memory_bytes: 40616
def eratosthenes(mx):
    array = [1 for _ in range(mx)]
    array[0] = array[1] = 0
    for i in range(4, mx, 2):
        array[i] = 0
    for i in range(3, mx, 2):
        if not array[i]:
            continue
        for j in range(i+i, mx, i):
            array[j] = 0
    return array

n = int(input())
prime = [i for i, flag in enumerate(eratosthenes(55555 + 1)) if flag and i % 10 == 3]
ans = prime[1:n+1]
print(*ans)


Measured memory_bytes: 3608
fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.read();
    let mut a: Vec<i64> = (0..n).map(|_| sc.read()).collect();

    let mut ans = 0;
    loop {
        let mut s = 0;
        for i in 0..n {
            let n = n as i64;
            if a[i] > n - 1 {
                let t = (a[i] - (n - 1) + n - 1) / n;
                s += t;
            }
        }
        for i in 0..n {
            let n = n as i64;
            let t = (a[i] - (n - 1) + n - 1) / n;
            a[i] = a[i] + s - t - t * n;
        }

        ans += s;

        let mut ok = true;
        for i in 0..n {
            let n = n as i64;
            if a[i] > n - 1 {
                ok = false;
                break;
            }
        }

        if ok {
            println!("{}", ans);
            return;
        }
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

double dis(double x1, double y1, double x2, double y2){
  return sqrt(pow(x1-x2, 2.0)+pow(y1-y2, 2.0));
}

int main(){
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    double xa, ya, ra, xb, yb, rb, d;
    cin >> xa >> ya >> ra >> xb >> yb >> rb;
    d = dis(xa, ya, xb, yb);
    if(d > ra+rb) cout << "0" << endl;
    else if(d+rb < ra) cout << "2" << endl;
    else if(d+ra < rb) cout << "-2" << endl;
    else cout << "1" << endl;
  }
  return 0;
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;
using PP = pair<int, pair<int, int> >;

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

const int INF = 1e9;
const int INFLL = 1e18;
const int MOD = 1e9 + 7;

int dp[50001];

signed main(){
    int N, M; cin >> N >> M;
    vector<int> c( M );
    REP( i, M ) cin >> c[i];

    REP( i, N + 1 ) dp[i] = i;

    REPONE( i, N ){
        REP( j, M ){
            if( c[j] <= i ){
                chmin( dp[i], dp[i - c[j]] + 1 );
            }
        }
    }
    cout << dp[N] << endl;

}



Measured memory_bytes: 3484