akhauriyash/Code-Regression huggingface dataset:
/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n)

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vii adj;
ll ans = 1;
bool visited[110000];
int k;
void dfs(int a, int p) {
	visited[a] = true;
	ans = (ans * (k-p))%MOD;
	if(adj[a].size() > 2) {
		int j = 2;
		for(int child: adj[a]) {
			if(!visited[child]) {
				dfs(child,j++);
			}
		}
	}else {
		for(int child: adj[a]) {
			if(!visited[child]) {
				dfs(child,(int)adj[a].size());
			}
		}
	}
	
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n>>k;
	adj.resize(n+1);
	for(int i=0;i<n-1;i++) {
		int a,b;
		cin>>a>>b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int root = -1;
	for(int i=1;i<=n;i++) {
		if(adj[i].size() == 1) {
			root = i;
			break;
		}
	}
	dfs(root, 0);
	cout<<ans%MOD<<endl;
	
	return 0;
}






Measured memory_bytes: 8960
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ld pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
struct A {
	int x, y;
};
bool operator<(A a, A b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator==(A a, A b) { return a.x == b.x&&a.y == b.y; }
vector<A>a;
int b[10];
signed main() {
	int h, w, n, x, y;
	cin >> h >> w >> n;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		x--; y--;
		if (x > 1 && y > 1)
			a.push_back(A{ x - 2,y - 2 });
		if (x > 1 && y > 0 && y < w - 1)
			a.push_back(A{ x - 2,y - 1 });
		if (x > 1 && y + 2 < w)
			a.push_back(A{ x - 2,y });
		if (x > 0 && x + 1 < h&&y > 1)
			a.push_back(A{ x - 1,y - 2 });
		if (x > 0 && x + 1 < h&&y > 0 && y + 1 < w)
			a.push_back(A{ x - 1,y - 1 });
		if (x > 0 && x + 1 < h&&y + 2 < w)
			a.push_back(A{ x - 1,y });
		if (x + 2 < h&&y > 1)
			a.push_back(A{ x,y - 2 });
		if (x + 2 < h&&y > 0 && y + 1 < w)
			a.push_back(A{ x,y - 1 });
		if (x + 2 < h&&y + 2 < w)
			a.push_back(A{ x,y });
	}
	sort(a.begin(), a.end());
	int sum = 0;
	for (int i = 0; i < a.size();) {
		int j = i;
		while (j < a.size() && a[j] == a[i])
			j++;
		sum++;
		b[j - i]++;
		i = j;
	}
	b[0] = (h - 2)*(w - 2) - sum;
	for (int i = 0; i < 10; i++)
		cout << b[i] << endl;
	getchar(); getchar();
}

Measured memory_bytes: 18536
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        m: usize
    }
    if n * n <= m {
        let mut i = n;
        while i * i <= m {
            if m % i == 0 {
                println!("{}", m / i);
                return;
            }
            i += 1;
        }
        let mut i = n-1;
        while i > 0 {
            if m % i == 0 {
                println!("{}", i);
                return;
            }
            i -= 1;
        }
    } else {
        let mut i = m / n;
        while i > 0 {
            if m % i == 0 {
                println!("{}", i);
                return;
            }
            i -= 1;
        }
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define mod 1000000007
using namespace std;
inline int read()
{
	char c=getchar(); int num=0,f=1;
	while (c<'0'||c>'9') { if (c=='-') f=-1; c=getchar(); }
	while (c<='9'&&c>='0') { num=num*10+c-'0'; c=getchar(); }
	return num*f;
}
int n,m,dp[5005][5005],ans;
char s[5005];
int ksm(int a,int b)
{
	int ret=1;
	for (;b;b>>=1,a=1ll*a*a%mod)
	 if (b&1) ret=1ll*ret*a%mod;
	return ret;
}
int main()
{
	n=read(); scanf("%s",s+1); m=strlen(s+1);
	dp[0][0]=1;
	for (int i=0;i<n;i++)
	 for (int j=0;j<=i;j++) if (dp[i][j])
	 {
		 dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j]*2%mod)%mod;
		 dp[i+1][max(j-1,0)]=(dp[i+1][max(j-1,0)]+dp[i][j])%mod;
	 }
	ans=1ll*dp[n][m]*ksm(ksm(2,m),mod-2)%mod;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 96384
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}


int main() {
	int h, a; cin >> h >> a;
	
	cout << (h % a == 0 ? h / a : h / a + 1) << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
int H,W,N;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
int d[1005][1005];
int X[1000000],Y[1000000];
int headX, headY;
int tailX, tailY;
int sx[10],sy[10];
void pushX(int x){
  X[tailX++]=x;
  tailX%=1000000;
}
int popX(){
  return X[headX++];
  headX%=1000000;
}
void pushY(int y){
  Y[tailY++]=y;
  tailY%=1000000;
}
int popY(){
  return Y[headY++];
  headY%=1000000;
}
void re(){
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      d[i][j]=INF;
    }
  }
}
int main(){
  int cnt=0;
  cin>>H>>W>>N;
  char mp[1005][1005];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>mp[i][j];
      if(mp[i][j]=='.' || mp[i][j]=='X') continue;
      else if(mp[i][j]=='S'){
	sx[0]=j;
	sy[0]=i;
      }
      else{
	sx[mp[i][j]-'0']=j;
	sy[mp[i][j]-'0']=i;
      }
    }
  }
  
  re();
  d[sy[cnt]][sx[cnt]]=0;
  int ke=0;
  while(1){
    if(cnt==N) break;
    pushX(sx[cnt]);
    pushY(sy[cnt]);
    d[sy[cnt]][sx[cnt]]=ke;
    cnt++;
    
    while(1){
      int x = popX();
      int y = popY();
      
      if(x==sx[cnt] && y==sy[cnt]) break;
      
      for(int i=0;i<4;i++){
	int nx = x + dx[i], ny = y + dy[i];
	if(nx < 0 || ny < 0 || nx >= W || ny >= H || mp[ny][nx]=='X') continue;
	
	if(d[ny][nx] > d[y][x]+1){
	  d[ny][nx] = d[y][x]+1;
	  pushX(nx);
	  pushY(ny);
	}
      }
    }
    headX=0;
    headY=0;
    tailX=0;
    tailY=0;
    /*
    for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(d[i][j]==INF) cout<<0;
      else cout<<d[i][j];
      cout<<" ";
    }
    cout<<endl;
  }
    */
    ke=d[sy[cnt]][sx[cnt]];
    //cout<<sy[cnt]<<" "<<sx[cnt]<<endl;
    //cout<<ke<<endl;
    re();
    
    
  }
  cout<<ke<<endl;
  return 0;
    
}



Measured memory_bytes: 10992
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(LLI i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(LLI i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	LLI n;
	cin >> n;
	vector<LLI> a(n + 1);

	REP(i, n + 1)
	{
		cin >> a[i];
	}

	vector<LLI> ok(n + 1);

	LLI r = 1;
	REP(i, n + 1)
	{
		if (r < a[i])
		{
			cout << -1;
			return 0;
		}

		ok[i] = r;
		r -= a[i];
		r *= 2;
		if (1e18L < r)r = 1e18L;
	}


	LLI cnt = 0;
	LLI node = 0;
	for (LLI i = n; 0 <= i; i--)
	{
		LLI rep = node / 2;
		node += a[i];

		node = node - _min(rep, _max(node - ok[i], 0));

		cnt += node;
	}


	cout << cnt;
	return 0;
}

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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 200016

constexpr ll d1 = 1000000000;
constexpr ll d2 = d1*d1;
constexpr int emx = 18;

int f[20][20];
ll a[N];

int main()
{
    canhazfast();

    int n;
    char tmp[16];
    map<ll, int> mp;
    ll ans = 0;

    cin >> n;
    for (int i = 0; i < n; ++i) {
        ll wh = 0, fr = 0, pw = 0;
        cin >> tmp;
        for (int j = 0; tmp[j]; ++j) {
            int c = tmp[j]-'0';
            if (tmp[j] == '.') {
                pw = 100000000;
            } else if (pw) {
                fr += c*pw;
                pw /= 10;
            } else {
                wh = 10*wh+c;
            }
        }
        a[i] = d1*wh+fr;
    }
    for (int i = 0; i < n; ++i) {
        ll x = gcd(d2, a[i]);
        int e2 = ctzll(x), e5 = 0;
        x >>= e2;
        while (x%5 == 0) {
            x /= 5;
            ++e5;
        }
        for (int j = emx-e2; j <= emx; ++j) {
            for (int k = emx-e5; k <= emx; ++k) ans += f[j][k];
        }
        ++f[e2][e5];
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 5216
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq

# decimal.getcontext().prec = 50
# sys.setrecursionlimit(10000)
# MOD = 10**9 + 7


def solve(f):
    n = f.read_int()
    a = [0] * (n+1)
    for i in xrange(n):
        a[f.read_int()] = i+1

    ma = 0
    cur = 0
    st = 1
    for i in xrange(1,n+1):
        if cur > a[i]:
            ma = max(ma, i-st)
            st = i
        cur = a[i]
    ma = max(ma, n+1-st)

    return n-ma


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case #%d\n"%f.case, solve(f)
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)


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

int main() {
	int N; cin >> N;
	int A; cin >> A;
	N %= 500;

	if (A >= N)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int count = 0;
    for(int i = 0;i< 3;i++){
      if(s.substring(i,i+1).equals(t.substring(i,i+1))){
        count++;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>

int main(){
	int N;
	int *p;
	int max = 0;
	int index = -1;

	scanf("%d", &N);
    p = (int*)malloc(sizeof(int)*N);
    for (int i = 0; i < N; i++){
    	scanf("%d", p+i);
    }

    for (int i = 0; i < N; i++){
    	if (p[i] > max){
    		max = p[i];
    		index = i;
    	}
    }

    int sum = 0;
    for (int i = 0; i < N; i++){
    	sum += p[i];
    }
    sum = (sum - p[index]) + p[index] / 2;
    printf("%d", sum);

}

Measured memory_bytes: 128
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()
if a <= 9 and b <= 9:
  print(a*b)
else:
  print(-1)


Measured memory_bytes: 5716
import java.util.*;
 
public class Main {
    Scanner sc = new Scanner(System.in);
 
    public static void main(String[] args) {
    	new Main(); 
    }
 
    public Main() {
    	new DPL5().doIt();
    }
    class DPL5{
    	int dpT(char ctra[],char ctrb[]){
    		int al = ctra.length;
    		int bl = ctrb.length;
    		int dp[][] = new int [al+1][bl+1];
    		int INF = 100000000;
    		for(int i = 0;i < al+1;i++){
    			for(int j = 0;j < bl+1;j++){
    				dp[i][j] = (i == 0 || j == 0 ? Math.max(i, j) : INF);
    			}
    		}
    		for(int i = 1;i < al+1;i++){
    			for(int j = 1;j < bl+1;j++){
    				dp[i][j] = Math.min(dp[i][j - 1] + 1, Math.min(dp[i - 1][j] + 1, dp[i - 1][j - 1] + (ctra[i - 1] == ctrb[j - 1] ? 0 : 1)));
    			}
    		}
    		return dp[al][bl];
    	}
    	void doIt(){
    		String stra = sc.next();
    		String strb = sc.next();
    		char ctra[] = stra.toCharArray();
    		char ctrb[] = strb.toCharArray();
    		System.out.println(dpT(ctra,ctrb));
    	}
    }
}

Measured memory_bytes: 30820
import java.util.Arrays;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int []m = new int[n];
		int sum1 = sc.nextInt();
		int ans = 0;
		
		for(int i = 0; i < n; i++) {
			m[i] = sc.nextInt();
			sum1 = sum1 - m[i];
			ans++;
		}
			Arrays.sort(m);
			ans += sum1 / m[0];
			
			System.out.println(ans);
	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <utility>
#include <stdint.h>
#include <set>
#include <string>

using namespace std;

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

  set<string> S;

  for (int n=0; n<N; ++n) {
    string s;
    cin >> s;
    S.insert(s);
  }

  cout << S.size() << endl;

  return 0;
}


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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
//    ll x;
//    x=1ll << 59;
//    ll y=(1ll << 59) - 1ll;
//    cout<<((double)(x)==(double)(x-1))<<endl;
    ll a,b,c,x,s2=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                ll s=500ll*i+100ll*j+50ll*k;
                if(s==x)s2++;
            }
        }
    }
    cout<<s2<<endl;
}


Measured memory_bytes: 3648
#include <stdlib.h> 
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <math.h>

using namespace std; 

int main()
{
  int n,k;
  int mayor;
  int cuenta = 0;
  
  cin>>n;
  cin>>k;

  int precios[n];

  for(int i = 0; i < n ; i ++ )
  {
      cin>>precios[i];
  }
   
  for(int i = 0 ; i < n-k ; i++) 
  {
  	for(int index = 0; index < n-k ; index++)
  	{
  		mayor = 0;
  		
  		for(int i = 0 ; i < n ; i++)
  		{
  			if(precios[i] > mayor && precios[i] != 0)
  			{
  				mayor = precios[i];
  			}
  		}
	  	for (int i = 0 ; i < n ; i++)
		{
  			if(mayor == precios[i])
  			{
  				precios[i] = 0;
  				break; 
  			}
  		}	
  	}
  	
  	break;
  }
  
	for(int i = 0; i < n ; i++)
		cuenta = cuenta + precios[i];
		
	cout<<cuenta;
	
}


Measured memory_bytes: 3564
#include <stdio.h>
int main() {
	int S, h, m, s;
	scanf("%d", &S);
	h = S / 3600;
	m = S / 60 - h * 60;
    s = S - h * 3600 - m * 60;
	printf("%d:%d:%d\n", h, m, s);
	return 0;
}


Measured memory_bytes: 2088
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N, X;
    cin >> N >> X;
    vector<int> m(N);
    for(int i=0; i<N; i++) {
        cin >> m[i];
    }
    cout << N + (X - accumulate(m.begin(), m.end(), 0)) / *min_element(m.begin(), m.end()) << endl;
    return 0;
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.split("\n")[0].split(" ");
    const A = arg[0];
    const B = arg[1];
    const C = arg[2];
    
    let flg = false;
    
    for(let i=0; i<B; i++) {
        if((A * i - C) % B === 0) {
            flg = true;
        }
    }
    
    console.log(flg ? "YES" : "NO");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 7372
//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>

using namespace std;

#define REP(i, max)	for(int i = 0, iMax = max; i < iMax; i ++)
#define MAX_TEXT_LEN	102400

char text[MAX_TEXT_LEN];

int main(int args, char **ppArgs)
{
	int numTables;
	
	while(::scanf("%d", &numTables), numTables)
	{
		// Input conversion tables
		map<char, char>	conversionMap;	// DO NOT FORGET TO RESET!!
		char	from, to;
		REP(i, numTables)	cin >> from >> to,	conversionMap[from]	= to;
		
		// Input text
		int textLen;
		::scanf("%d", &textLen);
//		string	text(textLen, 0);
		REP(i, textLen)
		{
			char ch;
			cin >> ch;
			text[i]	= conversionMap.count(ch) ? conversionMap[ch] : ch;
		}
		//::puts(text.c_str());
		text[textLen]	= 0;
		::puts(text);
	}
}

Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1010;
const ll inf=1e15;
bool vis[maxn];
ll val[maxn];
ll k;
struct edge
{
    int from,to,c,next;
}e[maxn*2];
int tol,head[maxn];
void init()
{
    tol=0;
    memset(head,-1,sizeof(head));
}
void addedge(int u,int v,int c)
{
    e[tol].from=u;
    e[tol].to=v;
    e[tol].c=c;
    e[tol].next=head[u];
    head[u]=tol++;
}
int main()
{
    int n,m;
    memset(vis,0,sizeof(vis));
    for(int i=0;i<maxn;i++)
        val[i]=-inf;
    init();
    scanf("%d%d",&n,&m);
    //cout<<inf<<endl;
    for(int i=0;i<m;i++)
    {
        int u,v,c;
        scanf("%d%d%d",&u,&v,&c);
        addedge(u,v,c);
    }

    val[1]=0;
    for(int i=1;i<=2*n;i++)
    {
        for(int j=0;j<m;j++)
        {
            edge temp=e[j];
            if(val[temp.from]==-inf)    continue;
            if(val[temp.to]<val[temp.from]+temp.c)
            {
                val[temp.to]=val[temp.from]+temp.c;
                if(i==2*n)
                {
                    vis[temp.to]=1;
                }
            }
        }
    }

    if(vis[n]==0)
        printf("%lld\n",val[n]);
    else
        printf("inf\n");
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    bool flag = false;
    if (a%2 == 0 || b%2 == 0) flag = true;
    if (flag) cout << "Even\n";
    else  cout << "Odd\n";
}


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

stack = [H]
count = 0
while stack:
    lst = stack.pop()
    m = min(lst)
    count += m
    lst = [l-m for l in lst]
    prev = 0
    left = 0
    for i, h in enumerate(lst):
        if h == 0 and prev != 0: # H = {..., 0, *(left), *, ..., *, 0(right), ...} (*: 正数)
            stack.append(lst[left:i])
        elif h != 0 and prev == 0:
            left = i
            if i == len(lst)-1: # H = {..., 0, *(left)} (*: 正数)
                stack.append(lst[left:i+1])
        elif h != 0 and i == len(lst)-1: #(prev != 0) H = {..., 0, *(left), ..., *, *} (*: 正数)
            stack.append(lst[left:i+1])
        prev = h
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
double dp[3000][3000];
int n;
double p[3000];
double ans;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>p[i];
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			dp[i][j]+=dp[i-1][j]*(1.0-p[i]);
			if(j>0) dp[i][j]+=dp[i-1][j-1]*p[i];
		}
	}
	for(int i=0;i<=n;i++){
		if(i>n-i) ans+=dp[n][i];
	}
	printf("%.10lf\n",ans);
	
	return 0;
}

Measured memory_bytes: 68992
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

typedef long long ll;
//typedef pair<ll, ll> P;
#define rep(i, n) for(ll i=0;i<n;i++)

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;
//#define PI 3.14159265359

int main() {
    // input
    ll X;
    cin >> X;

    // process
    ll ans = 0;
    ll a = 100;

    while (1) {
        ans++;
        a *= 1.01;
        if (a >= X) {
            cout << ans;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1e9
 
inline void moveState(vector<int> &v,int p){
    const int dx[4] = {-1,0,1,0};
    const int dy[4] = {0,-1,0,1};
    bool tmp[16][4],use[16][4] = {{0}};
    fill(use[p],use[p]+4,1);
    bool update = 1;
    while(update){
	vector<int> next = v;
	update = 0;
	memset(tmp,0,sizeof(tmp));
	for(int i = 0 ; i < 16 ; i++){
	    for(int j = 0 ; j < 4 ; j++){
		if(!use[i][j]) continue;
		int nx = i%4 + dx[j], ny = i/4 + dy[j];
		int np = nx + 4*ny;
		if(nx < 0 || nx >= 4 || ny < 0 || ny >= 4){
		    continue;
		}
		update = 1;
		if(v[np] > 0) next[np]++;
		else tmp[np][j] = 1;
	    }
	}
	for(int i = 0 ; i < 16 ; i++){
	    if(next[i] >= 5){
		next[i] = 0;
		fill(tmp[i],tmp[i]+4,1);
	    }
	}
	v = next;
	memcpy(use,tmp,64);
    }
}
 
int solve(vector<int> &v,int step){
    if(count(v.begin(),v.end(),0) == 16){
	return step;
    }
    if(step == 5) return INF;
    int res = INF;
    for(int i = 0 ; i < 16 ; i++){
	vector<int> next = v; next[i]++;
	if(next[i] == 5){
	    next[i] = 0;
	    moveState(next,i);
	}
	res = min(res,solve(next,step+1));
    }
    return res;
}
 
int main(){
    vector<int> v(16);
    for(int i = 0 ; i < 16 ; i++){
	cin >> v[i];
    }
    int res = solve(v,0);
    cout << (res < INF ? res : -1) << endl;
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N;
    cin >> N;
    ll Ai;
    multiset<ll> A;
    cin >> Ai;
    A.insert(Ai);
    for(int i=1;i<N;i++){
        cin >> Ai;
        if(Ai <= *A.begin()){
            A.insert(Ai);
        }else{
            auto it = A.lower_bound(Ai);
            A.erase(--it);
            A.insert(Ai);
        }
    }
    cout<<A.size()<<endl;

    return 0;
}

Measured memory_bytes: 4992
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<int,pint> tint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
int a[114514];
int main()
{
	int n,c,k,out=0,it=0;
	cin>>n>>c>>k;
	rep(i,n) cin>>a[i];
	sort(a,a+n);
	while(it<n){
		int ne=it;
		while(ne<n && a[ne]<=a[it]+k && ne<it+c) ne++;
		out++;it=ne;
	}
	cout<<out<<endl;
}


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


void solve(long long n, long long m){
    cout << (n-1)*(m-1) <<  endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long n;
    scanf("%lld",&n);
    long long m;
    scanf("%lld",&m);
    solve(n, m);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

    if (a >= k) {
        a -= k;
    } else if (a + b >= k) {
        k -= a;
        a = 0;
        b -= k;
    } else {
        a = 0;
        b = 0;
    }

    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MOD 1000000007

int dp[100001][13];


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

	string s;
	cin >> s;

	dp[0][0] = 1;
	rep(i,s.size()) rep(j, 13)if(dp[i][j]){
		if (s[i] == '?') {
			rep(d,10) {
				int m = (j * 10 + d) % 13;
				(dp[i + 1][m] += dp[i][j]) %= MOD;
			}
		}
		else {
			int m = (j * 10 + s[i] - '0') % 13;
			(dp[i + 1][m] += dp[i][j]) %= MOD;
		}
	}

	cout << dp[s.size()][5] << endl;



	return 0;
}

Measured memory_bytes: 5584
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
int main()
{
    fio;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin>>s;
    ll ans = 0;
    for(ll i=0;i<s.length();i++)
    {
        ans += (s[i] - '0');
    }
    cout<<(ans%9 ? "No" : "Yes");
    return 0;
}

Measured memory_bytes: 3768
#include<iostream>
#include<sstream>
#include<set>
#include<string>
using namespace std;
set<unsigned int> s;
int n,m;
int cards[100];
bool used[100];
void solve(int cnt,string a){
  string tmp=a;
  if(cnt==m){
    s.insert(atoi(a.c_str()));
    return;
  }
  for(int i=0;i<n;i++){
    if(used[i]==true)continue;
    used[i]=true;
    stringstream ss;
    ss << cards[i];
    a+=ss.str();
    solve(cnt+1,a);
    a=tmp;
    used[i]=false;
  }
}

int main(){
  while(cin>>n,n){
    s.clear();
    cin>>m;
    for(int i=0;i<n;i++){
      used[i]=false;
      cin>>cards[i];
    }
    solve(0,"");
    // for(auto i:s)
    // cout << i << endl;

    cout << s.size() << endl;
  }
  return 0;
}

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

int main() {
	int N;
	cin >> N;
	int ans = 1000000000;
	int x;
	for (int i=0; i<N; i++) {
		int cnt=0;
		cin >> x;
		while (x%2==0) {
			x/=2;
			cnt++;
		}
		if (cnt < ans) ans = cnt;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N; cin >> N;
    vector<ll> a(N);
    int keta = 0;
    rep(i, N){
        cin >> a[i];
        if(a[i] == 0){
            cout << 0 << endl;
            return 0;
        }
        keta += log10(a[i]);
        // cout << log10(a[i]) << endl;
    }
    if(keta >= 19){
        cout << -1 << endl;
        return 0;
    }
    ll ans = 1;
    rep(i, N){
        if(a[i] <= 1000000000000000000 / ans){
            ans *= a[i];
        }else{
            cout << -1 << endl;
            return 0;
        }
    }

    cout << ans << endl;

}

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

int main()
{
    int N, K;
    cin >> N >> K;
    std::vector<int> v(N);

    for(int i=0; i<K; i++){
        int d; cin >> d;
        for(int j=0; j<d; j++){
            int A; cin >> A;
            v[A-1] = A;
        }
    }
    int ans = 0;
    for(int i=0; i<N; i++){
        if(v[i] == 0){
            ans += 1;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3556
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<stdbool.h>
#include<vector>
#include<algorithm>
#include<string>
typedef long long ll;
using namespace std;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]

l = [0] * (N+1)
r = [0] * (N+1)

for i in range(N):
    l[i+1] = l[i] + a[i]

for i in range(N-1,-1,-1):
    r[i] = r[i+1] + a[i]

res = []

for i in range(1,len(l)-1):
    res.append(abs(l[i]-r[i]))

print(min(res))


Measured memory_bytes: 37852
import queue

n, m = map(int, input().split())

road = [[] for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

# cost to isMin
result = [[999999999999999, None, False] for i in range(n)]

# from tom
q = queue.Queue()

result[0] = [0, None, True]
for i in road[0]:
    q.put([0,i])

while not q.empty():
    n = q.get()
    if(not result[n[1]][2]):
        result[n[1]]=[result[n[0]][0]+1, n[0], True]
        for i in road[n[1]]:
            q.put([n[1], i])

flag = True
for i in result:
    if(not i[2]):
        flag = False
        break

if(flag):
    print("Yes")
    for i in range(1,len(result)):
        print(result[i][1]+1)
else:
    print("No")


    



Measured memory_bytes: 151668
#include <iostream>

using namespace std;

int main(){
    int A,B,C,D,E,F;
    cin>>A>>B>>C>>D>>E>>F;
    double min=100;
    int sugarwater;
    int sugar;
    for(int a=0;a<=30;a++){
        for(int b=0;b<=30;b++){
            for(int c=0;c<=100;c++){
                for(double d=0;d<=100;d++){
                    if(C*c+D*d+100*A*a+100*B*b<=F){
                        if(E*(A*a+B*b)-(C*c+D*d)>=0 and E*(A*a+B*b)-(C*c+D*d)<min*(A*a+B*b)){
                            min = E-(C*c+D*d)/(A*a+B*b);
                            sugarwater = 100*A*a+100*B*b+C*c+D*d;
                            sugar = C*c+D*d;
                        }
                    }
                }
            }
        }
    }
    cout<<sugarwater<<endl;
    cout<<sugar<<endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    for (int i=0; i < n; i++) cin >> vec.at(i);


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

    int cnt = 0;
    for (int i=vec.size()-1; i >= 0; i--) {
        for (int j=i-1; j >= 0; j--) {
            for (int k=j-1; k >= 0; k--) {
                if (vec[i] == vec[j] || vec[j]==vec[k] || vec[k] == vec[i]) continue;
                if ((vec[i] < vec[j]+vec[k]) && (vec[j] < vec[k]+vec[i]) && (vec[k] < vec[i]+vec[j])) cnt++;
            }
        }
    }
    
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>
#include <cassert>
using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    vector<pair<double,pair<double,double> > >p;
    rep(i,n){
        double x,y;
        cin >> x >> y;
        double r = atan2(y,x);
        p.push_back(MP(r,MP(x,y)));
    }
    sort(p.begin(),p.end());
    double mx = 0;
    for(int i=0;i<n;i++){
        
        for(int j=0;j<n;j++){
            ll sx = 0;
            ll sy = 0;
            for(int k=j;k<=j+i;k++){
                int s = k;
                if(s>=n)s-=n;
                sx += p[s].second.first;
                sy += p[s].second.second;
            }
            //cerr << sx << " " << sy << endl;
            mx = max(mx,sqrt(sx*sx+sy*sy));
        }
    }
    cout.precision(30);
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

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

int main() {
    ll n; cin >> n;
    Vl a(n);
    rep(i, 0, n) cin >> a[i];

    bool f = true;
    rep(i, 0, n){
        if(a[i]%2 != 0) f = false;
    }
    if(f) co("second");
    else co("first");

    return 0;
}
 
 


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

long long int getDigit(long long int n) {
    long long int ret = 0;
    while(n) {
        n /= 10;
        ret++;
    }
    return ret;
}

int main() { 
    long long int n, ans = 100000000000;
    cin >> n;
    for(long long int i=1 ; i*i<=n ; ++i) {
        if(n%i == 0) ans = min(ans, max(getDigit(i), getDigit(n/i)));
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int digit_sum(int n) {
  int sum=n%10;
  while(n!=0) {
    n/=10;
    sum+=n%10;
  }
  return sum;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}




int main() {
  int h,w;
  cin >> h >> w;
  char s[h][w];
  REP(i,h) {
    REP(j,w) {
      cin >> s[i][j];
    }
  }
  REP(i,w+2) {
    cout << "#";
  }
  cout << endl;
  REP(i,h) {
    cout << "#";
    REP(j,w) {
      cout << s[i][j];
    }
    cout << "#" << endl;
  }
  REP(i,w+2) {
    cout << "#";
  }
  cout << endl;
  return 0;
}


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

int main(void) {
  int a, b;
  while(true){
  cin >> a;
  cin >> b;
  if( a == 0 && b == 0){
      break;
  }
  for (int i = 0; i < a; i++){
      for (int j = 0; j < b; j++){
          cout << "#";
      }
      cout << endl;
 }
 cout << endl;
 }
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e14;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const ll MN = 200 + 10;
const ll mod = 1e9 + 7;

ll dp[N][N];
string grid[MAXN];

int main()
{
	faster();
	int n , m;
	cin >> n >> m;
	dp[1][1] = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> grid[i];
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if(grid[i][j] == '.')
				(dp[i + 1][j + 1] += dp[i][j + 1] + dp[i + 1][j]) %= mod;
			else
				dp[i + 1][j + 1] = 0;
		}
	}
	cout << dp[n][m] << endl;
}

Measured memory_bytes: 42240
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n string
	fmt.Scan(&n)
	s := strings.Split(n, "")
	for i:=0; i< len(s); i++ {
		if s[i] == "9" {
			fmt.Print("1")
		} else {
			fmt.Print("9")
		}
	}
	fmt.Println()
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    ll n;string s;cin>>n>>s;
    ll r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R')r++;
        else if(s[i]=='G')g++;
        else b++;
    }
    ll ans=r*g*b;
    rep(i,n){
        REP(j,i+1,n){
            if(s[i]==s[j])continue;
            ll k=2*j-i;
            if(k<n){
                if(s[i]!=s[k]&&s[j]!=s[k])ans--;
            }
        }
    }
    out(ans);
}

Measured memory_bytes: 3644