akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let r: i64 = sc.read();
    let c: i64 = sc.read();
    let n: usize = sc.read();

    let on_border = |x: i64, y: i64| x == 0 || x == r || y == 0 || y == c;
    let mut xy = vec![];
    for i in 0..n {
        let x1: i64 = sc.read();
        let y1: i64 = sc.read();
        let x2: i64 = sc.read();
        let y2: i64 = sc.read();
        if on_border(x1, y1) && on_border(x2, y2) {
            xy.push((i, x1, y1));
            xy.push((i, x2, y2));
        }
    }

    let mut points = vec![];
    for (i, x, y) in xy.into_iter() {
        let (p, x) = if y == 0 && x < r {
            (1, x)
        } else if x == r && y < c {
            (2, y)
        } else if y == c && c > 0 {
            (3, -x)
        } else {
            (4, -y)
        };
        points.push((p, x, i));
    }
    points.sort();

    let mut stack = vec![];
    for (_, _, i) in points.into_iter() {
        if let Some(&last) = stack.last() {
            if last == i {
                assert_eq!(stack.pop(), Some(i));
            } else {
                stack.push(i);
            }
        } else {
            stack.push(i);
        }
    }
    if stack.is_empty() {
        println!("YES");
    } else {
        println!("NO");
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;
    int a[n];
    rep(i, n) cin >> a[i];
    int cnt = 0;
    rep(i, n)
    {
        for (int j = 0; j < n - 1; j++)
        {
            if (a[j] > a[j + 1])
            {
                swap(a[j], a[j + 1]);
                cnt++;
            }
        }
    }

    rep(i, n) i != n - 1 ? cout << a[i] << " " : OP(a[i]);
    OP(cnt);
    return 0;
}


Measured memory_bytes: 3124
/*
    Problem 33
    https://atcoder.jp/contests/abc088/tasks/abc088_d
*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int WALL = -1;
const int ROOT = -2;
/* global variables */
vector< vector<int> > maze;
vector<int> dr{0, 0, -1, 1}, dc{1, -1, 0, 0};
int fourDirections = 4;
int R, C;
/* function */
int bfs() {
    queue<pii> Q;
    maze[0][0] = 1;
    Q.push(make_pair(0, 0));
    while(!Q.empty()) {
        pii p = Q.front();
        Q.pop();
        int r = p.first, c = p.second;
        for (int i = 0; i < fourDirections; i++) {
            int nr = r + dr[i], nc = c + dc[i];
            if (nr < 0 || R <= nr || nc < 0 || C <= nc) continue;
            if (maze[nr][nc] == ROOT) {
                maze[nr][nc] = maze[r][c] + 1;
                Q.push(make_pair(nr, nc));
            }
        }
    }
    return maze[R-1][C-1];
}
/* main */
int main(){
    cin >> R >> C;
    maze.assign(R, vector<int>(C));
    int ans = R * C;
    char ch;
    for (int i = 0; i < R; i++) {
        for (int j = 0; j < C; j++) {
            cin >> ch;
            if (ch == '.') maze[i][j] = ROOT;
            else {
                ans--;
                maze[i][j] = WALL;
            }
        }
    }
    int min_dist = bfs();
    if (min_dist == ROOT) {
        cout << -1 << '\n';
    }
    else {
        ans -= min_dist;
        cout << ans << '\n';
    }
}

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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int d=a/b;
		int r=a%b;
		double f=(double)a/(double)b;
		System.out.printf("%d %d %f",d,r,f);

	}

}



Measured memory_bytes: 26524
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define int long long
#define ld long double
using namespace std; 
 
const int N = 60, OO = 1e9 + 100, M = 1e18 + 7, P = 6151, SQ = 120, lg = 21;
typedef pair <int, int> pii;
vector <pii> v[N];
bitset <N> mark[(1 << lg)];

int pw(int x, int y) {
	if(y == 0) return 1;
	int cnt = pw(x, y / 2);
	cnt = (cnt * cnt);
	if(y % 2 == 1)
		cnt = (cnt * x);
	return cnt;
}

bool dfs(int x, int en, int y, int msk) {
	if(en == x)
		return true;
	for(auto u : v[x]) {
		if(u.ff == y)	
			continue;
		bool b = dfs(u.ff, en, x, msk);
		if(b) {
			mark[msk][u.ss] = 1;
			return true;
		}
	}
	return false;
}

int32_t main() {
    use_fast;
    int n;
    cin >> n;
    for(int i = 0; i < n - 1; i++) {
    	int x, y;
    	cin >> x >> y;
    	v[x].pb({y, i});
    	v[y].pb({x, i});
	}
	vector <pii> q;
	int m;
	cin >> m;
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		if(x == y)
			return cout << 0, 0;
		q.pb({x, y});
	}
	int ans = pw(2, n - 1);
	for(int i = 1; i < (1 << m); i++) {
		int cnt = 0;
		for(int j = 0; j < m; j++) {
			if((1 << j) & i) {
				cnt = j;
				break;
			}
		}
		mark[i] = mark[i - (1 << cnt)];
		dfs(q[cnt].ff, q[cnt].ss, 0, i);
		int t = __builtin_popcount(i);
		int h = n - 1 - mark[i].count();
		h = pw(2, h);
		if(t % 2 == 0) 
			ans = (ans + h);
		else
			ans = (ans - h);
	}
	cout << ans << endl;
	return 0; 
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

Measured memory_bytes: 10496
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;

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( b < a ) { a = b; return 1; } return 0;}

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))

lli getMax(lli a, lli b, lli c, lli d) {
	lli max = a;
	chmax<lli>(max, b);
	chmax<lli>(max, c);
	chmax<lli>(max, d);
	return max;
}

lli getMin(lli a, lli b, lli c, lli d) {
	lli min = a;
	chmin<lli>(min, b);
	chmin<lli>(min, c);
	chmin<lli>(min, d);
	return min;
}

int main() {
	int N, K;
	scanf("%d %d", &N, &K);
	lli	 x[50], y[50];
	for (int i = 0; i < N; i++) {
		scanf("%lld %lld", &x[i], &y[i]);
	}

	lli min = 2L*1000L*1000L*1000L*2L*1000L*1000L*1000L;
	for (int a = 0; a < N; a++) {
		for (int b = 0; b < N; b++) {
			for (int c = 0; c < N; c++) {
				for (int d = 0; d < N; d++) {
					lli top = getMax(y[a], y[b], y[c], y[d]);
					lli btm = getMin(y[a], y[b], y[c], y[d]);
					lli lft = getMin(x[a], x[b], x[c], x[d]);
					lli rgt = getMax(x[a], x[b], x[c], x[d]);
					int cnt = 0;
					for (int i = 0; i < N; i++) {
						if (top >= y[i] && y[i] >= btm && rgt >= x[i] && x[i] >= lft) cnt++;
					}
					if (cnt >= K) {
						chmin<lli>(min, abs(top-btm)*abs(rgt-lft));
					}
				}
			}
		}
	}

	printf("%lld\n", min);
}


Measured memory_bytes: 256
//Utkarsh.25dec
#include <bits/stdc++.h>
#define ll long long int 
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
using namespace std;
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vl v;
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    ll dp[n+2]={0};
    dp[0]=0;
    dp[1]=abs(v[0]-v[1]);
    for(int i=2;i<n;i++)
    {
        ll temp1=dp[i-2]+abs(v[i-2]-v[i]);
        ll temp2=dp[i-1]+abs(v[i-1]-v[i]);
        dp[i]=min(temp1,temp2);
    }
    cout<<dp[n-1]<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
}

Measured memory_bytes: 13684
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
//#define base 1000000000000000000
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-6;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=300000+10,maxn=10000000+10,inf=0x3f3f3f3f;

int a[N];
int main()
{
    int n,K;scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    ll ans=0;
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)if(i+j<=K&&i+j<=n)
    {
        vi v;
        for(int k=1;k<=i;k++)v.pb(a[k]);
        for(int k=n;k>=n-j+1;k--)v.pb(a[k]);
        sort(v.begin(),v.end());
        reverse(v.begin(),v.end());
        for(int k=1;k+i+j<=K;k++)
        {
            if(v.size()>0&&v.back()<0)v.pop_back();
            else break;
        }
        ll te=0;
        for(int x:v)te+=x;
        ans=max(ans,te);
    }
    printf("%lld\n",ans);
    return 0;
}
/********************

********************/


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  long long int a[5]={0};
  long long int ans=0;
  for(int i=0;i<n;i++){
    cin >>s;
    if(s[0]=='M'){
      a[0]++;
    }
    if(s[0]=='A'){
      a[1]++;
    }
    if(s[0]=='R'){
      a[2]++;
    }
    if(s[0]=='C'){
      a[3]++;
    }
    if(s[0]=='H'){
      a[4]++;
    }
  }
    ans+=(a[0]*a[1]*a[2]);
    ans+=(a[0]*a[1]*a[3]);
    ans+=(a[0]*a[1]*a[4]);
  ans+=(a[0]*a[2]*a[3]);
  ans+=(a[0]*a[2]*a[4]);
  ans+=(a[0]*a[3]*a[4]);
  ans+=(a[1]*a[2]*a[3]);
  ans+=(a[1]*a[2]*a[4]);
  ans+=(a[1]*a[3]*a[4]);
  ans+=(a[2]*a[3]*a[4]);
  cout << ans <<endl;
  }


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	int n, x[64], y[64];
	for (int T = 1; (scanf("%d", &n), n); ++T)
	{
		rep (i, n)
			scanf("%d%d", x + i, y + i);

		double res = 0;
		rep (i, n)
			res += x[i] * y[(i - 1 + n) % n] - y[i] * x[(i - 1 + n) % n];
		res /= 2;
		printf("%d %.1f\n", T, res);
	}
}

Measured memory_bytes: 0
h,w = map(int,input().split())

ans = 10**10

if h % 3 == 0 or w % 3 == 0:
    ans = 0

for i in range(1,h):
    a = w * i
    b = (h - i) * (w // 2)
    c = (h - i) * (w - w // 2)
    ans = min(ans, max(abs(a - b), abs(b - c), abs(c - a)))

for i in range(1,w):
    a = h * i
    b = (w - i) * (h // 2)
    c = (w - i) * (h - h // 2)
    ans = min(ans, max(abs(a - b), abs(b - c), abs(c - a)))

for i in range(1,h):
    a = w * i
    b = (h - i) // 2 * w
    c = h * w - a - b
    ans = min(ans, max(abs(a - b), abs(b - c), abs(c - a)))

for i in range(1,w):
    a = h * i
    b = (w - i) // 2 * h
    c = h * w - a - b
    ans = min(ans, max(abs(a - b), abs(b - c), abs(c - a)))

print(ans)


Measured memory_bytes: 73624
#!/usr/bin/env python
# -*- conding: utf-8 -*-

raw = raw_input()
A = int(raw.split()[0])
B = int(raw.split()[1])

if(A%3==0 or B%3==0 or (A+B)%3==0):
    print "Possible"
else:
    print "Impossible"


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;


int n;
int main(){
  cin >> n;
  pair<pair<string, int>,int> p[n];
  for(int i = 0; i < n; i++){
    string s; int score;
    cin >> s >> score;
    p[i] = make_pair(make_pair(s, -1*score), i);
  }
  sort(p,p+n);
  for(int i = 0; i < n; i++){
    cout << p[i].second+1 << endl;
  }
}

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

int main(void) {
	int N, K;
	scanf("%d %d", &N, &K);
	int d[100];
	int A[100][100];
	int sunuke[100] = {0};
	for (int i = 0; i < K; i++) {
		scanf("%d", &d[i]);
		for (int j = 0; j < d[i]; j++) {
			scanf("%d", &A[i][j]);
			sunuke[A[i][j] - 1]++;
		}
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (sunuke[i] == 0) ans++;
	}
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 3860
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=3000;
const int maxm=4000;
const int mod=1e9+7;
int n,m,tot;
int l[maxn+8],r[maxn+8],fac[maxn+8],fact[maxn+8],sum[maxm+8];
int f[maxn+8][maxn+8];
char S[maxn+8];
 
int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}
 
int power(int a,int k)
{
    int sum=1;
    for (;k;k>>=1,a=1ll*a*a%mod)
	if (k&1)
	    sum=1ll*sum*a%mod;
    return sum;
}
 
int C(int n,int m){if (n<m) return 0;return 1ll*fac[n]*fact[m]%mod*fact[n-m]%mod;}
 
int main()
{
    n=read(),m=read();
    scanf("%s",S+1);
    for (int i=1;i<=m;i++)
	{
	    int x=read(),y=read();
	    if (r[tot]>=y) continue;
	    if (l[tot]==x&&r[tot]<y) tot--;
	    l[++tot]=x,r[tot]=y;
	}
    l[++tot]=n,r[tot]=n;
    fac[0]=fact[0]=1;
    for (int i=1;i<=n;i++) sum[i]=sum[i-1]+(S[i]=='1');
    for (int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
    fact[n]=power(fac[n],mod-2);
    for (int i=n-1;i;i--) fact[i]=1ll*fact[i+1]*(i+1)%mod;
    f[0][0]=1;
    for (int i=1;i<tot;i++)
	{
	    //printf("Time:%d\n",i);
	    if (l[i+1]>r[i])
		{
		    for (int j=0;j<=n;j++)
			f[i][0]=(f[i][0]+1ll*f[i-1][j]*C(r[i]-l[i]+1,j+sum[r[i]]-sum[max(l[i]-1,r[i-1])])%mod)%mod;
		    continue;
		}
	    for (int j=0;j<=r[i]-l[i+1]+1;j++)
		    for (int k=0;k<=min(n,l[i+1]-l[i]+j-sum[r[i]]+sum[max(l[i]-1,r[i-1])]);k++)
			{
				if (!f[i-1][k]) continue;
			    //printf("update:%d %d\n",j,k);
			    f[i][j]=(f[i][j]+1ll*f[i-1][k]*C(l[i+1]-l[i],k-j+sum[r[i]]-sum[max(l[i]-1,r[i-1])])%mod)%mod;
			}
	}
    //for (int i=1;i<tot;i++,puts(""))
    // 	for (int j=0;j<=n;j++)
    //	    	    printf("%d ",f[i][j]);
    int ans=(f[tot-1][0]+f[tot-1][1])%mod;
       printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 15360
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a, b, c;
    char x;
    cin >> a >> b >> x >> c;
    b *= 100;
    b += c;
    cout << a * b / 100;
    return 0;

}


Measured memory_bytes: 3612
N=int(input())
A=list(map(int,input().split()))
S=[0 for i in range(0,N+1)]
X=[0 for i in range(0,N+1)]
for i in range(0,N):
    S[i+1]=S[i]+A[i]
    X[i+1]=X[i]^A[i]

s=0
t=0
count=0
while N>=s and N>=t:
    sum=S[t]-S[s]
    xor=X[t]^X[s]
    if sum==xor:
        t+=1
    else:
        count+=N-t+1
        s+=1
print(N*(N+1)//2-count)

Measured memory_bytes: 88052
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[10];
int main()
{
    int i,j,k,n;
    for(i=0;i<10;i++)
        a[i]=(i+1)*111;
    scanf("%d",&n);
    for(i=0;i<10;i++)
    if(n<=a[i])
        break;
    printf("%d\n",a[i]);
    return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a < b)
    {
        ans += b;
        b--;
    }
    else
    {
        ans += a;
        a--;
    }

    if(a < b)
    {
        ans += b;
        b--;
    }
    else
    {
        ans += a;
        a--;
    }
    cout << ans << endl;
}


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

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int i=0;
    while(i<s.length()){
        if(s.substr(i,5)=="maerd" || s.substr(i,5)=="esare"){
            i+=5;
            continue;
        }
        if(s.substr(i,6)=="resare"){
            i+=6;
            continue;
        }
        if(s.substr(i,7)=="remaerd"){
            i+=7;
            continue;
        }
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

int main(){
	int N, K;
	cin >> N >> K;
	int ans=0;
	while(N){
		N/=K;
		ans++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
N = int(input())
def main():
    head_prob_table = [[0.0] * (N+1) for i in range(N)]
    head_prob = list(map(float, input().split()))

    head_prob_table[0][1] = head_prob[0]
    head_prob_table[0][0] = 1-head_prob[0]

    for i in range(1, N):
        for j in range(i+2):
            head_prob_table[i][j] += head_prob_table[i-1][j] * (1 - head_prob[i])
            if j > 0:
                head_prob_table[i][j] += head_prob_table[i-1][j-1] * head_prob[i]

    print(sum(head_prob_table[N-1][(N+1)//2:]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 222600
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010

int main(){
	string s;cin>>s;
	lint n,cur=0,ans=0;n=s.size();
	rep(i,n){
		if(s[i]=='T')--cur;
		else ++cur;
		if(cur<0)++cur,++ans;
	}cout<<ans*2<<endl;
}

//sub-EOF


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int N;
struct holiday
{
	int a;
	int b;
	int c;
};

vector<holiday> Vac(100001);

int main(void)
{
	cin >> N;
	for (int n = 1; n <= N; n++)
	{
		cin >> Vac[n].a >> Vac[n].b >> Vac[n].c;
	}

	vector<holiday> dp(100001);
	dp[1].a = Vac[1].a;
	dp[1].b = Vac[1].b;
	dp[1].c = Vac[1].c;

	for (int n = 2; n <= N; n++)
	{
		dp[n].a = max(dp[n - 1].b + Vac[n].a, dp[n - 1].c + Vac[n].a);
		dp[n].b = max(dp[n - 1].a + Vac[n].b, dp[n - 1].c + Vac[n].b);
		dp[n].c = max(dp[n - 1].a + Vac[n].c, dp[n - 1].b + Vac[n].c);
	}

	cout << max(dp[N].a, max(dp[N].b, dp[N].c)) << endl;
}

Measured memory_bytes: 2560
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#define maxn 110005
#define ll long long int 
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
using namespace std;

int n;
int a[maxn];
int main(){
	//freopen("mohjong.in", "r", stdin);
	scanf("%d", &n);
	ll ans = 0;
	int last = 0;
	rep(i, 1, n) {
		scanf("%d", &a[i]);
		if (!a[i]) {
			last = 0;
			continue;
		}
		if (last){
			ans += (a[i] >> 1), a[i] &= 1;
			if (a[i]) ans++, last = 0; 
		}
		else {
			ans += (a[i] >> 1), a[i] &= 1;
			last = a[i];
		}
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

static int N=100;

int min(int x,int y){
  if(x>=y) return y;
  else return x;
}

int main(){
  int n,p[N+1],m[N+1][N+1];
  int i,j,l,k;

  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d%d",&p[i-1],&p[i]);
  }

  for(i=1; i<=n; i++)  m[i][i]=0;

  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j=i+l-1;
      m[i][j]=100000;
      for(k=i; k<=j-1; k++){
        m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }

  printf("%d\n",m[1][n]);

  return 0;
}




Measured memory_bytes: 2036
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    map<string,int> cnt;
    int N; cin>>N;
    REP(i,N){
        string s; cin>>s;
        cnt[s]++;
    }
    int M; cin>>M;
    REP(i,M){
        string t; cin>>t;
        cnt[t]--;
    }
    
    int ans=0;
    for(auto p:cnt){
        ans=max(ans,p.second);
    }
    cout<<ans<<endl;
 
}


Measured memory_bytes: 256
n = int(input())
cnt = {}
mx = 0
for i in range(n):
  s = input()
  if s not in cnt:
    cnt[s] = 0
  cnt[s] += 1
  mx = max(mx,cnt[s])
ans = []
for s in cnt:
  if cnt[s] == mx:
    ans.append(s)
ans.sort()
for i in ans:
  print(i)

Measured memory_bytes: 97368
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s; cin >> s;
    if (s.length() == 3)reverse(all(s));
    cout << s << "\n";
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		int X=nextInt();
		int Y=nextInt();
		if(Y%2==0&&X*2<=Y&&Y<=X*4)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


Measured memory_bytes: 32548
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  ll n;
  cin >> n;
  vector<tuple<string,ll,ll>> a(n);
  REP(i,n){
    string s;
    ll p;
    cin >> s >> p;
    a[i] = make_tuple(s,-p,i+1);
  }
  sort(ALL(a));
  REP(i,n){
    string s;
    ll p;
    ll idx;
    tuple<string,ll,ll> t = a[i];
    s = get<0>(t);
    p = get<1>(t);
    idx = get<2>(t);
    cout << idx << endl;
  }
  return 0;
}


Measured memory_bytes: 256
N=gets.to_i
min = 10**5
1.upto(N-1) do |a|
  b = N - a
  a_str = a.to_s
  b_str = b.to_s
  sum = 0
  a_str.each_char do |ac|
    sum += ac.to_i
  end
  b_str.each_char do |bc|
    sum += bc.to_i
  end
  if sum < min
    #binding.pry
    min = sum
  end
end
puts min


Measured memory_bytes: 1788
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int[] NK = Console.ReadLine().Split(' ').Select(o => int.Parse(o)).ToArray();
        long[] H = Console.ReadLine().Split(' ').Select(o => long.Parse(o)).ToArray();
        long O = H.OrderByDescending(o => o).Skip(NK[1]).Sum();
        Console.WriteLine(O);
    }
}

Measured memory_bytes: 39528
n, a, b = map(int, input().split())
mod = 10**9+7

def mypow(x, y, mod):
   ans = 1
   while y > 0:
      if bin(y & 1) == bin(1):
         ans *= x % mod
      x *= x % mod
      y = y >> 1
   return ans

def comb(n, r, mod):
   num, denom = 1, 1
   for i in range(1, r+1):
      num = (num*(n+1-i)) % mod
      denom = (denom*i) % mod
   return num * mypow(denom, mod-2, mod) % mod

print((mypow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];

  int ret = 0;
  REP(i, n) FOR(j, i+1, n) {
    chmax(ret, abs(a[i]-a[j]));
  }
  cout << ret << endl;

  return 0;
}


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

string Right(int a,int b,int c){
    string s;
    if(a*a+b*b==c*c || b*b+c*c==a*a || c*c+a*a==b*b)
        s = "YES";
    else s="NO";

    return s;
}

int main(){
    int n;
    int a,b,c;
    string s;
    while(cin >> n){
        for(int i=0;i<n;i++){
            cin >> a >> b >> c;
            s = Right(a,b,c);
            cout << s << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1192
n = int(input())
s = {}
m = 1
for _ in range(n):
    t = input()
    if t in s:
        s[t] += 1
        if s[t] > m:
            m = s[t]
    else:
        s.update({t : 1})
ans = [i for i, j in s.items() if j == m]
ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 32096
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        System.out.println(solve(N));
    }
    public static int solve(int N) {
        int answer = Integer.MAX_VALUE;
        for (int a = 1; a < N; a++) {
            int b = N - a;
            if (b < a) {
                break;
            }
            String a_s = Integer.valueOf(a).toString();
            String b_s = Integer.valueOf(b).toString();
            answer = Math.min(answer, sum(a_s, b_s));
        }
        return answer;
    }
    private static int sum(String a_s, String b_s) {
        char[] a_c = a_s.toCharArray();
        char[] b_c = b_s.toCharArray();
        int sum = 0;
        for(char c : a_c) {
            sum += (int) c - 48;
        }
        for(char c : b_c) {
            sum += (int) c - 48;
        }
        return sum;
    }
}


Measured memory_bytes: 34516
#include <bits/stdc++.h>
using namespace std;
# define ll long long
# define lld long double
int main() {
	// your code goes here
	cin.tie(NULL);
	cout.tie(NULL);
    int a,b,h,m;
    cin>>a>>b>>h>>m;
    lld hangle=(lld)(h)*(lld)(30) + (lld)(m)*(lld)(0.5);
    lld mangle=(lld)(m)*(lld)(6);
    lld angle=abs(hangle-mangle);
    angle=angle/(lld)180;
    angle=angle*(3.1415926535);
    lld f=(lld)(a*a)+(lld)(b*b) - (lld)(2*a*b)*(lld)(cos(angle));
    lld ans=(lld)(sqrt(f));
    cout<<fixed<<setprecision(10)<<ans;
}


Measured memory_bytes: 4164
#include <stdio.h>

int main()
{
	long long int Year = 0;
	long long int Bank = 100;
	long long int X;

	scanf("%lld", &X);

	while (Bank < X) {
		Bank = (long long int)(Bank * 1.01);
		Year++;
	}

	printf("%lld\n", Year);

	return 0;
}

Measured memory_bytes: 1688
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
 
int a, b, c;
int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> a >> b >> c;
	if (a+b < c) {
		cout << a+2*b+1;
		return 0;
	} else {
		cout << b+c;
		return 0;
	}
}

Measured memory_bytes: 3632
from copy import copy
def prime_table(n):
  n+=1
  table=[i if i%2 else 2 for i in range(n)]
  for i in range(3,n,2):
    if table[i]==i:
      for j in range(i*i,n,2*i):
        if table[j]==j:
          table[j]=i
  return table


def prime_fact(n,table):
  p=[]
  while n!=1:
    pp=table[n]
    p.append(pp)
    n//=pp
  r={}
  for i in p:
    if i in r:
      r[i]+=1
    else:
      r[i]=1
  return r



n=int(input())
t=prime_table(10**6)
a=list(map(lambda x:prime_fact(int(x),t),input().split()))

mx=copy(a[0])
for i in a[1:]:
  for j in i:
    if j in mx:
      mx[j]=max(mx[j],i[j])
    else:
      mx[j]=i[j]


sm=0
mod=10**9+7
for i in a:
  r=1
  for j in i:
    r=(r*pow(j,i[j],mod))%mod
  sm=(sm+pow(r,mod-2,mod))%mod

  
p=1
for i in mx:
  p=(p*pow(i,mx[i],mod))%mod

print((sm*p)%mod)

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

ll pow5(ll x) {
  return x * x * x * x * x;
}

int main() {
  ll x;
  cin >> x;

  ll a = 0;
  while (true) {
    ll left = -4000, right = 4000;

    while (right - left >= 1) {
      ll b = (left + right) / 2;

      if (pow5(a) - pow5(b) == x) {
        cout << a << " " << b << endl;
        return 0;
      }

      if (right - left == 1) break;

      if (pow5(a) - pow5(b) > x) left = b;
      else right = b;
    }

    a++;
  }

  return 0;
}

Measured memory_bytes: 3636
//S.G.N.//
#include <bits/stdc++.h>
using namespace std;
typedef vector< long long > vi;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define fr(n) for(ll i=0;i<n;i++)
#define tr(a) for(auto it=a.begin();it!=a.end();it++)
#define N 998244353445 
#define PI 3.1415926535897932384
#define F first
#define S second
#define mp make_pair
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007


void solve()
{
 ll n;
 cin>>n;
 ll a[n][n];
 fr(n){
 rep(j,0,n)
 {
  cin>>a[i][j];
 }
}
ll dp[2][1<<n];
fr(2)
{
  rep(j,0,1<<n)
  {
    dp[i][j]=0;
  }
}

dp[0][0]=1;
rep(i,1,n+1)
{
rep(j,0,1<<n)
{
  dp[i%2][j]=0;
  if(__builtin_popcount(j) != i)
    continue;
  rep(k,0,n)
  {
    if(j&1<<k&&a[i-1][k])
    {
      
      dp[i%2][j]+=dp[(i-1)%2][j^1<<k];
      dp[i%2][j]=dp[i%2][j]%mod;
    }
  }
  
}

}

cout<<dp[n%2][(1<<n)-1];
}
int main()
{
  
  #ifndef ONLINE_JUDGE
     * freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #endif
  FAST
  ll test;
test=1;
  //cin>>test;
  while(test--)
  {
    solve();
  }
  return 0;
}


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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  ll n, k, q;
  cin >> n >> k >> q;
  vector<ll> a(q);
  rep(i, q) { cin >> a[i]; --a[i]; }

  vector<ll> points(n, k - q);
  rep(i, q) { points[a[i]]++; }
  rep(i, n) {
    if (points[i] > 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;

int g[15][15];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i){
        for (int j = 0; j < n; ++j){
            g[i][j] = -1;
        }
    }

        for (int i = 0; i < n; ++i)
        {
            int m;
            cin >> m;
            for (int j = 0; j < m; ++j)
            {
                int a, x;
                cin >> a >> x;
                --a;
                g[i][a] = x;
            }
        }
        int ans = 0;
        for (int i = 0; i < (1 << n); ++i){
            vector<int> d(n);
            for (int j = 0; j < n; ++j){
                if( i>>j&1){
                    d[j] = 1;
                }
            }
            bool ok = true;
            for (int j = 0; j < n; ++j){
                if(d[j]){
                    for (int k = 0; k < n;++k){
                        if(g[j][k] == -1)
                            continue;
                        if(g[j][k] != d[k])
                            ok = false;
                    }
                }
            }
            if(ok)
                ans = max(ans, __builtin_popcount(i));
        }
        cout << ans << endl;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
using namespace std;
int main(){
	int c[3][3];
	for (int a = 0; a < 3; a++) {
		for (int b = 0; b < 3; b++) {
			cin >> c[a][b];
		}
	}
	int c1[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 2; j++) {
			c1[i][j] = c[i][j + 1] - c[i][j];
		}
	}
	for (int k = 0; k < 2; k++) {
		for (int l = 0; l < 2; l++) {
			if (c1[k][l] != c1[k+1][l]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		 float[] A = new float[5];
		 for(int i = 0 ; i < 5 ; i++){
			 A[i] = Float.parseFloat(br.readLine());
		 }
		 System.out.println((int)A[0] - (int) Math.max(Math.ceil(A[1] / A[3]),Math.ceil(A[2] / A[4])));
	}
}

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

int main(){
  string s,s2;
  long long k,n,i,j,p,p2;
  cin >> s >> k;
  n=s.size();
  p=0;
  p2=0;
  j=0;
  
  int a=1;
  for(i=0;i<n-1;i++){
    if(s.at(i)!=s.at(i+1)){
      a=0;
    }
  }
  
  if(a==1){
    cout << n*k/2 << endl;
  }else{
    s2=s+s;
    for(i=0;i<n;i++){
      if(i==n-1){
        p=p+(j+1)/2;
        j=0;
      }else if(s.at(i)!=s.at(i+1)){
        p=p+(j+1)/2;
        j=0;
      }else{
        j++;
      }
    }
    for(i=0;i<n*2;i++){
      if(i==n*2-1){
        p2=p2+(j+1)/2;
        j=0;
      }else if(s2.at(i)!=s2.at(i+1)){
        p2=p2+(j+1)/2;
        j=0;      
      }else{
        j++;
      }
    }
    cout << (k-1)*p2-(k-2)*p << endl;
  }
}

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

//#define DEBUG

using namespace std;

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}


void func_to_create(){
    uint32_t H1, M1, H2, M2, K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    uint32_t period = (H2 - H1) * 60 + M2 - M1;
    period -= K;
    cout << period << endl;
}
int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    func_to_create();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}


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

typedef long long int lli;

int main(){
    lli N;
    lli sum = 0;

    cin >> N;

    for(lli i=1; i<N+1; i++){
        if( i%3 != 0 && i%5 != 0){
            sum += i;
        }
    }

    cout << sum << endl;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//桁数
ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//約数全列挙
vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//累乗(xのn乗%mod)
ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//階乗
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}

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

void Main()
{
  vvll a(3, vll(3)); rep(i, 3) rep(j, 3) cin >> a[i][j];
  ll n; cin >> n;
  vll b(n); rep(i, n) cin >> b[i];
  vvb ans(3, vb(3, false));
  rep(i, n)
  {
    rep(j, 3)
    {
      rep(k, 3)
      {
        if(b[i] == a[j][k]) ans[j][k] = true;
      }
    }
  }
  
  rep(i, 3)
  {
    ll flag = 0, Flag = 0;
    rep(j, 3)
    {
      if(ans[i][j]) flag++;
      if(ans[j][i]) Flag++;
    }
    if(flag == 3) fin("Yes");
    if(Flag == 3) fin("Yes");
  }
  if(ans[0][0] && ans[1][1] && ans[2][2]||ans[2][0] && ans[1][1] && ans[0][2]) fin("Yes");
  fin("No");
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

    int N;
    cin >> N;
    ll ans = 1;
    ll cnt1 = 1;
    ll cnt2 = 1;
    for (int i = 0; i < N; ++i) {
        (ans *= 10) %= MOD;
        (cnt1 *= 9) %= MOD;
        (cnt2 *= 8) %= MOD;
    }

    ans = (ans - cnt1) * 2 + cnt2 - ans;
    ans %= MOD;
    if (ans < 0)
        ans += MOD;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
#define LOCAL

#undef _GLIBCXX_DEBUG

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

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define LLINF 1e18
#define INF (int)1e9+1

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

void debug_out() {
	cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;

const llong MOD = 998244353LL;

int main() {
	IOS;
	string s; cin >> s;
	for (int i = 0; i < s.length(); i++) cout << "x";
}

Measured memory_bytes: 3660