akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<ctime>
using namespace std;
inline int read()
{
	int kkk=0,x=1;
	char c=getchar();
	while((c<'0' || c>'9') && c!='-')
		c=getchar();
	if(c=='-')
		c=getchar(),x=-1;
	while(c>='0' && c<='9')
		kkk=(kkk<<3)+(kkk<<1)+(c-'0'),c=getchar();
	return kkk*x;
}
int n,zone[1001][2],F,maxn,ans[41],d[41];
int main()
{
	n=read();
	for(register int i=1;i<=n;++i)
	{
		zone[i][0]=read();
		zone[i][1]=read();
		maxn=max(abs(zone[i][0])+abs(zone[i][1]),maxn);
	}
	for(register int i=2;i<=n;++i)
		if((abs(zone[i][0])+abs(zone[i][1]))%2!=(abs(zone[i-1][0])+abs(zone[i-1][1]))%2)
		{
			puts("-1");
			return 0;
		}
	if((zone[1][0]+zone[1][1])%2==0)
	{
		F=1;
		--maxn;
	}
	int LOG=ceil(log2(maxn+1))-1;
	printf("%d\n",LOG+1+F);
	d[0]=1;
	for(register int i=0;i<=LOG;++i,d[i]=d[i-1]*2)
		printf("%d ",d[i]);
	if(F)
		putchar('1');
	putchar('\n');
	for(register int i=1;i<=n;++i)
	{
		int x=zone[i][0],y=zone[i][1],mem=-1,bjx=0,bjy=0;
		if(F)
		{
			int type=(abs(x)>abs(y));
			if(type)
			{
				if(x<0)
				{
					x=-x;
					bjx^=1;
				}
				x-=1;
				mem=3;
				if(bjx)
					mem=2;
			}
			else
			{
				if(y<0)
				{
					y=-y;
					bjy^=1;
				}
				y-=1;
				mem=0;
				if(bjy)
					mem=1;
			}
		}
		//cout<<bjx<<" "<<bjy<<endl;
		for(register int j=LOG;j>=0;--j)
		{
			int type=(abs(x)>abs(y));
			if(type)
			{
				if(x<0)
				{
					x=-x;
					bjx^=1;
				}
				x-=d[j];
				ans[j]=3;
				if(bjx)
					ans[j]=2;
			}
			else
			{
				if(y<0)
				{
					y=-y;
					bjy^=1;
				}
				y-=d[j];
				ans[j]=0;
				if(bjy)
					ans[j]=1;
			}
		}
		for(register int j=0;j<=LOG;++j)
			switch(ans[j])
			{
				case 0:putchar('U');break;
				case 1:putchar('D');break;
				case 2:putchar('L');break;
				case 3:putchar('R');break;
			}
		if(F)
			switch(mem)
			{
				case 0:putchar('U');break;
				case 1:putchar('D');break;
				case 2:putchar('L');break;
				case 3:putchar('R');break;
			}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 640
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

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

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000

const double EPS = 1e-10;
const double PI  = acos(-1.0);
////////////////////////////////////////////////

int main()
{
	char s[6];
	scanf("%s",s);
	for(int i=0;i<6;i++)
	{
		if(s[i]=='A')
		{
			if(s[i+1]=='C')
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N,A,B = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    TF = 'Alice' if (B-A)%2==0 else 'Borys'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


Measured memory_bytes: 38384
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int a,b,c,ans,k;
int main(){
	cin>>a>>b>>c>>k;
	while(b<=a)
		b*=2,ans++;
	while(c<=b)
		c*=2,ans++;
	if(ans<=k)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3136
n = gets.chomp.to_i
s = gets.chomp.split(//)

def alp_index(s,n)
    i = n % 26
    alp = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split.map(&:to_s)
    total = (i + alp.find_index(s).to_i) % 26
    alp[total]
end

tmp = []
s.each do |s|
    tmp.push(alp_index(s,n).chomp)
end

puts tmp.join

Measured memory_bytes: 4348
uses math;
var
	N,A,ans,p,now,tmp:int64;
	j,k:Longint;
begin
	read(N,A);
	ans:=N;
	for k:=1 to 39 do begin
		p:=floor(power(N,1/(k+1)));
		now:=1;
		for j:=1 to k do now:=now*p;
		for j:=0 to k do begin
			tmp:=A*k+p*k+j+(N+now-1)div now;
			if ans>tmp then ans:=tmp;
			now:=now div p*(p+1);
			if now>N then break;
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

ll ans;

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

	ll A,B,C;
	cin >> A >> B >> C;
	
	ans = C - (A - B);

	if (ans < 0) ans = 0;

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

Measured memory_bytes: 256
"use strict"
let input=require('fs').readFileSync('/dev/stdin','utf8');
let arr=input.split(' ');
let r=parseFloat(arr[0]);
let pi=Math.PI;
let c=2*pi*r;
let a=pi*r*r;
console.log(a.toFixed(8)+' '+c.toFixed(8));



Measured memory_bytes: 15092
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int numA, numB, numC;
        int count = 0;

        numA = Integer.parseInt(scan.next());
        numB = Integer.parseInt(scan.next());
        numC = Integer.parseInt(scan.next());

        for (int i = numA; i < numB + 1 ; i++) {
            if (numC % i == 0) count++;
        }

        System.out.println(count);
    }
}



Measured memory_bytes: 26144
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{   
    int n, k;
    scanf("%d %d", &n, &k);

    int sum = 0;
    vector<int> a;
    for (int i = 0; i < n; ++i)
    {
        int x;
        scanf("%d", &x);
        sum += x;
        a.push_back(x);
    }
    
    
    vector<int> factor;
    for (int i = 1; i <= (int)sqrt(sum); ++i)
    {
        if (sum % i == 0)
        {
            factor.push_back(i);
            factor.push_back(sum / i);
        }
    }
    sort(factor.begin(), factor.end());
    factor.erase(unique(factor.begin(), factor.end()), factor.end());

    for (auto crit = factor.crbegin(); crit != factor.crend(); ++crit)
    {
        int x = *crit;

        vector<int> rem;
        transform(a.begin(), a.end(), 
                  back_inserter(rem), 
                  [x](int y) 
                  {
                      y %= x;
                      return y;  
                  });

        sort(rem.begin(), rem.end());
        int t = 0, s = 0;
        int l = 0, r = n - 1;
        while (l <= r) 
        {
            if (s <= 0) 
            {
                s += rem[l];
                t += rem[l];
                l++;
            }
            else 
            {
                s -= x - rem[r];
                t += x - rem[r];
                r--;
            }
        }
        if (t > 2 * k) continue;
        if (s == 0) 
        {
            printf("%d\n", x);
            break;
        }
    }

    
    return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
//#include<unordered_map>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl;
#define wa() cout<<"No"<<endl;
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=1e5+5;


signed main(){
    int a=re,b=re;
    for(int i=0;i<=10000;i++){
        if(i*8/100==a&&i*10/100==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
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;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }
  vector<ll> F(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> F.at(i);
  }
  sort(A.begin(), A.end());
  sort(F.begin(), F.end(), greater<ll>());

  ll ng = -1, ok = 1e12 + 10;
  ll ans;
  while (ok - ng != 1)
  {
    ans = (ng + ok) / 2;

    ll cnt = 0;
    for (ll i = 0; i < N; i++)
    {
      cnt += max(0LL, divceil(A.at(i) * F.at(i) - ans, F.at(i)));
    }

    if (cnt <= K)
      ok = ans;
    else
      ng = ans;

    //cerr << ok << " " << ng << " " << ans << endl;
  }
  cout << ok << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>
int main(void)
{
  int n,m,k,t,ans[35]={},cnt=0;
  scanf("%d%d",&n,&m);
  for(int i=0;i<n;i++){
    scanf("%d",&k);
    for(int j=1;j<=k;j++){
      scanf("%d",&t);
      ans[t]++;
    }
  }
  for(int i=1;i<=m;i++){
    //printf("ans[%d]=%d\n",i,ans[i]);
    if(ans[i]==n){
      cnt++;
    }
  }
  printf("%d",cnt);
  return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#define rep(i, n)for(int i=0; i<n; i++)
using ll = long long int;
using namespace std;

int main(){
    int d, t, s;
    cin >> d >> t >> s;

    if(d<=t*s)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3620
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// Datas :
type Datas []byte

func (p Datas) Len() int {
	return len(p)
}

func (p Datas) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Datas) Less(i, j int) bool {
	return p[i] < p[j]
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	m := make(map[string]int)

	for i := 0; i < N; i++ {
		s := Datas(getString())
		sort.Sort(s)
		m[string(s)]++
	}

	ans := 0
	for _, v := range m {
		ans += v * (v - 1) / 2
	}
	out(ans)
}


Measured memory_bytes: 10752
#include <iostream>

 

using namespace std;

 

int main()
{
    int i, x;
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if(x==0)
        break;
        
        cout << "Case " << i << ":"<<" "<< x << endl;
        

    }
}


Measured memory_bytes: 3080
import math
n = int(input())
li = list(map(int,input().split()))

if n == 0 and li[0] == 1:
    print(1)
    exit()

if li[0]!=0:
    print(-1)
    exit()

tmp = 1
for i,l in enumerate(li):
    if i == 0:
        continue
    tmp *= 2
    if l > tmp:
        print(-1)
        exit()
    else:
        tmp -= l

max_li = [1]
for i,l in enumerate(li):
    if i == 0:
        continue
    la = (max_li[-1]-li[i-1])*2
    max_li.append(la)


li.reverse()
ans = 0
codomo = li[0]
for i,l in enumerate(li):
    if i == 0:
        if l > 2**(n-i):
            print(-1)
            exit()
        else:
            ans += codomo
    else:
        tmp = codomo + l
        fin = min(min(2**(n-i),tmp),max_li[n-i])
        #print(min(2**(n-i),tmp),max_li[i],i,'i')
        ans += fin
        codomo = fin
    #print(ans,'ans')
print(ans)

Measured memory_bytes: 701952
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	max, nextMax := 0, 0
	maxIdx := 0

	for i := 0; i < n; i++ {
		if max < a[i] {
			nextMax = max
			max = a[i]
			maxIdx = i
		} else if nextMax < a[i] {
			nextMax = a[i]
		}
	}

	for i := range a {
		if i == maxIdx {
			fmt.Println(nextMax)
		} else {
			fmt.Println(max)
		}
	}
}


Measured memory_bytes: 6400
import java.util.*;

class Main {
    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);
        final String S = sc.next();
        sc.close();
        final String Y[] = {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};

        for (int i=0; i<7; i++) {
            if (S.equals(Y[i])) {
                System.out.println(i+1);
                return;
            }
        }

    }
}

Measured memory_bytes: 21844
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
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 mut $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")
    };
}

// solution 
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        H: usize,
        W: usize,
        s: [ chars; H]
    }

    let mut ss = vec![ vec![true; W+2]; H+2];
    for h in 0..H {
        for w in 0..W {
            if s[h][w] == '#' {
                ss[h+1][w+1] = false;
            }
        }
    }

    for h in 1..H+1 {
        for w in 1..W+1 {
            if !ss[h][w] {
                if ss[h-1][w] && ss[h][w-1] && ss[h+1][w] && ss[h][w+1] {
                    println!("No");
                    return
                }
            }
        }
    }

    println!("Yes");
}


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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    vector<int> A(N,0);
    for(int i = 0; i < N; i++) {
    cin >> A.at(i);
    }
    int ans = 0;
    sort(A.begin(),A.end());
    ans = A.at(N/2) - A.at(N/2 - 1);

    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

void solve(){
    ll a,b;cin>>a>>b;
    if(a>b) swap(a,b);
    if(a==b){
        cout<<2*(a-1)<<endl;
        return ;
    }

    ll r=floor(sqrt(a*b));
    ll hei=0;
    if(r*r==a*b) hei=1;

    ll ans=2*floor(sqrt(a*b))-2-hei;
    if((r+1)*r<a*b) ans++;
    cout<<ans<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int q;cin>>q;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

int main(){
	int cnt,a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		cnt=1;
		for(int i=10;;i*=10){
			if((a+b)/i==0){
				std::cout<<cnt<<'\n';
				break;
			}
			cnt++;
		}
	}
	return 0;
}

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

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

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll ans = 1;
    rep(i, n) {
        cin >> a[i];
    }

    rep(i, n) {
        if(a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    rep(i, n) {
        if(log10l(a[i]) + log10l(ans) > 18) {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
        if(ans > (ll)(1e18) || ans < 0) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

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


Measured memory_bytes: 4000
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define INF 1010001000
#define EPS 1e-10
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef pair<int, int> i_i;
typedef long long int llong;
typedef pair<llong, llong> ll_ll;
typedef struct edge {int f, t;}Edge;


int main()
{
    int n;
    while (cin >> n, n) {
        vector<int> line(24*60*60 + 1, 0);
        rep(i, n) {
            int h, m, n;
            scanf("%d:%d:%d", &h, &m, &n);
            m += h * 60;
            n += m * 60;
            line[n]++;
            scanf("%d:%d:%d", &h, &m, &n);
            m += h * 60;
            n += m * 60;
            line[n]--;
        }
        int ret = 0;
        rep(i, 24*60*60) {
            line[i+1] += line[i];
            ret = max(ret, line[i]);
        }
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 3436
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

void Init() {
	std::cin.tie(0); std::ios::sync_with_stdio(false);
	struct Init_caller { Init_caller() { Init(); } }caller;
}

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define INT_INF 1<<29
#define LL_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using ppi = pair<pi, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;
using vppi = vector<ppi>;

#pragma endregion

struct edge {
	int from, to, cost;
};

void y_n(bool p) {
	p ? _y() : _n();
}

void Y_N(bool p) {
	p ? _Y() : _N();
}

LL vmax(vi v, LL n) {
	int MAX = 0;
	f(i, 0, n) {
		MAX = max(MAX, v[i]);
	}
	return MAX;
}

LL vmin(vi v, LL n) {
	int MIN = LL_INF;
	f(i, 0, n) {
		MIN = min(MIN, v[i]);
	}
	return MIN;
}

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//エラトステネスの篩
void sieve(LL n) {
	vb s(n + 1, true);
	f(i, 2, n + 1) {
		for (int j = 2; i*j <= n; j++) {
			s[i*j] = false;
		}
	}
	cout << "2から" << n << "までの素数" << endl;
	f(i, 2, n + 1) {
		if (s[i]) {
			cout << i << " ";
		}
	}
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}


#pragma endregion 


/*****************************************************************************/
signed main(void) {
	int n;
	cin >> n;
	vi a(n);
	f_vI(a, n);
	int ans = 0;
	f(i, 0, n) {
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 384
Q,H,S,D = (int(i) for i in input().split())
N = int(input())

Qper025L = Q
Hper025L = H / 2
Sper025L = S / 4
Dper025L = D / 8

teainfo = [["Q",Qper025L,Q,0.25],["H",Hper025L,H,0.50],["S",Sper025L,S,1],["D",Dper025L,D,2]]

sortedtea = sorted(teainfo, key = lambda x:(x[1],x[2]), reverse = False)

price = 0

for i in range(4):
    if sortedtea[i][3] <= N:
        numbottles = int(N / sortedtea[i][3])
        N -= sortedtea[i][3] * numbottles
        price += sortedtea[i][2] * numbottles

print(int(price))

Measured memory_bytes: 3064
#python3

def main():
    n = int(input())
    h = [int(i) for i in input().split()]
    dp = [0]*n
    dp[0] = 0
    dp[1] = abs(h[1] - h[0])
    for i in range(2, n):
        x = dp[i-1] +  abs(h[i] - h[i-1])
        y = dp[i-2] + abs(h[i] - h[i-2])  
        dp[i] = min(x, y)

    print(dp[n-1])
main()


Measured memory_bytes: 13976
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#define FOR(i,a,b) for(int i=a;i<=b;i++) 
using namespace std;
const int N=100100;
int n,S,T,u,v,m,l,r,sz[N],fa[N],d[N],a[N],b[N],p[N],q[N];
vector<int>ve[N];
void add(int u,int v){ve[u].push_back(v);}
void dfs(int u,int&w){
	if(d[u]>d[w]) w=u;
	for(int v:ve[u])if(v!=fa[u]) fa[v]=u,d[v]=d[u]+1,dfs(v,w);
}
void work(int*p){
	l=u=0;
	FOR(i,1,m){
		p[l+sz[a[i]]+1]=++u;
		FOR(j,1,sz[a[i]]) p[++l]=++u;l++;
	}
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d",&n);
	FOR(i,2,n) scanf("%d%d",&u,&v),add(u,v),add(v,u);
	dfs(1,T);fa[T]=d[T]=0;dfs(T,S);
	for(u=S;u;u=fa[u]) a[++m]=u,b[u]=1;
	FOR(i,1,n)if(!b[i] && !b[fa[i]]) return puts("-1"),0;
	FOR(i,1,n)if(!b[i]) sz[fa[i]]++;
	work(p);reverse(a+1,a+m+1);work(q);
	FOR(i,1,n)if(p[i]!=q[i]){
		if(p[i]>q[i]) swap(p,q);
		break;
	}
	FOR(i,1,n) cout<<p[i]<<' ';cout<<'\n';
}

Measured memory_bytes: 13312
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
//const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int r;
    cin >> r;
    Sp(2 * r * pi);
    return 0;
    int n, m;
    cin >> n >> m;
    rep (i, m) {
        int x;
        cin >> x;
        n -= x;
    }
    if (n < 0) {
        cout << -1 << endl;
    }
    else {
        cout << n << endl;
    }
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  cout << (360 / gcd(360, n)) << '\n';

  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int x, cnt;
  cin >> x;
  
  cnt=(x/500)*1000;
  int y=x%500;
  cnt+=(y/5)*5;
  cout << cnt << endl;
}

  

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 101,M = 1e5 + 1;
ll n,W,V;
ll Items[N][2];
ll dp[M];
int main(){
	speed;
	cin >> n >> W;
	for(int i = 0 ; i < n ; i++)
		cin >> Items[i][0] >> Items[i][1],V += Items[i][1];
	for(int i = 0 ; i < M ; i++)
		dp[i] = INT_MAX;
	dp[0] = 0;
	for(int i = 0 ; i < n ; i++){
		ll v = Items[i][1] , w = Items[i][0];
		for(int x = V ; x > 0 ; x--){
			if(x >= v && dp[x - v] != INT_MAX)dp[x] = min(dp[x],dp[x - v] + w);
		}
	}
	for(int x = V ; x > 0 ; x--){
		if(W >= dp[x]){
			cout << x << "\n";
			return 0;
		}
	}
}
/*
Timus : 288471KD
CF : Zhabka
mail : dzhon.snoudin@mail.ru
*/



Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#define MAX(x,y)	((x)>(y)?(x):(y))
int main(){
    char s[1000+1]={0}, t[1000+1]={0};
    int sl, tl;
    scanf("%s%s", s, t);
    sl = strlen(s);
    tl = strlen(t);

    int cnt=0, max=0;
    for(int i=0; i<=sl-tl; i++){
        for(int j=0; j<tl; j++){
            if( s[i+j]==t[j] ){ cnt++; }
        }
        max = MAX( max, cnt );
        cnt=0;
    }
    printf("%d\n", tl-max);
    return 0;
}

Measured memory_bytes: 1708
import math

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

a=primes(10**5+1000)
n=int(input())

for i in a:
    if n<=i:
        print(i)
        exit()


Measured memory_bytes: 44784
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        int count = 0;
        for (int i = 0; i < n; i++) {
            if(sc.nextInt() >= k) {
                count++;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 47596
#include <bits/stdc++.h>
using namespace std;
int main (){
    int D;
    cin >> D;
    switch (D)
    {
        case 22:
            cout << "Christmas Eve Eve Eve" << endl;
            break;
         case 23:
            cout << "Christmas Eve Eve" << endl;
            break;
         case 24:
            cout << "Christmas Eve" << endl;
            break;
        case 25:
            cout << "Christmas" << endl;
            break;
    
        default:
            break;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        int x = Integer.parseInt(scan.next());
        int t = Integer.parseInt(scan.next());

        scan.close();

        System.out.println(((n + x - 1) / x) * t);
    }
}


Measured memory_bytes: 35568
#include<stdio.h>

int main(){

  int A[100],N,i,j,temp,tempcount=0,minj;

  scanf("%d",&N);
  
  for(i=0 ; i<100 ;i++){
    A[i] = 0;
  }
  
  for(i=0 ; i<N ; i++){
    scanf("%d",&A[i]);
  }  

  for(i=0 ; i<=N-1 ; i++){
    minj = i;
    for(j=i ; j<=N-1 ; j++){
      if (A[j] < A[minj]) minj = j;
    }
    if(i != minj) tempcount++ ;
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;

  }
    for(i=0 ; i<N ; i++){
    if(i > 0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",tempcount);
  return 0;
}



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

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

    set<string> bucket;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        bucket.insert(s);
    }

    if (bucket.size() == 3)
        cout << "Three" << endl;
    else
        cout << "Four" << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env ruby
DEBUG = false
def sum(array)
  array.inject(0){|sum, i| sum += i}
end
n = STDIN.readline().to_i
a = STDIN.readline().split(' ').map(&:to_i)
a.sort!{|a, b| b<=>a }
alice, bob = 0, 0
a.each_with_index do |n, i|
  if i.even?
    alice += n
  else
    bob += n
  end
end
puts alice - bob


Measured memory_bytes: 1788
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair

ll n,cnt,ans,a[ohara],b[ohara],c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<ll,ll> kazoe;
vector<ll> tans;

//-------------------------↓↓↓↓↓↓------------------------

struct UnionFind{
	std::vector<int> data;
	
	UnionFind(int n){
		data.assign(n, -1);
	}
	
	void unite(int x, int y){
		x = find(x); y = find(y);
		if(x == y) return;
		if(data[x] > data[y]) std::swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
	
	int find(int k){
		if(data[k] < 0) return k;
		return data[k] = find(data[k]);
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

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

    cin>>n>>m;
    rep(i,m)cin>>a[i]>>b[i];
    rrrep(i,n-1,1)ans+=i;
    UnionFind uf(n+100);
    rrrep(i,m-1,0){
        //Cout(ans);
        tans.push_back(ans);
        if(!uf.same(a[i],b[i])){
        ll hiku;
        hiku=max(kazoe[uf.find(a[i])],1LL)*max(kazoe[uf.find(b[i])],1LL);
        tmp=max(kazoe[uf.find(a[i])],1LL);
        tmpp=max(kazoe[uf.find(b[i])],1LL);
        ans-=hiku;
        if(ans<0)ans=0;
        kazoe[uf.find(a[i])]=0;
        kazoe[uf.find(b[i])]=0;
        uf.unite(a[i],b[i]);
        kazoe[uf.find(a[i])]=tmp+tmpp;
        }
    }
    rrrep(i,Size(tans)-1,0){
        Cout(tans[i]);
    }
    return 0;
}


Measured memory_bytes: 13684
import sys, math, collections, heapq, itertools
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0: a, b = b, a % b
    return b
  
def solve():
    N, A, B, C, D = map(int, input().split())
    S = input()
    Able = False
    if C < D:
        for i in range(A-1, C-1):
            if S[i] == S[i+1] == "#":
                break
        else:
            for i in range(B-1, D-1):
                if S[i] == S[i+1] == "#":
                    break
            else: Able = True
    else:
        for i in range(A-1, C-1):
            if S[i] == S[i+1] == "#":
                break
        else:
            for i in range(B-1, D):
                if S[i-1] == S[i] == S[i+1] ==".":
                    Able = True
                    break
    print("Yes" if Able else "No")



    INF = 10 ** 25
    mod = 7 + 10 ** 9
    return 0
  
if __name__ == "__main__":
    solve()

Measured memory_bytes: 3952
n = int(input())
a = list(map(int, input().split(' ')))

def binary_search(val):
    left, right = 0, n-1
    while right - left >= 0:
        mid = int((right+left)/2)
        if a[mid] == val: return 1
        if a[mid] < val:
            left = mid+1
        elif val < a[mid]:
            right = mid-1
    return 0

q = int(input())
for i in range(q):
    k = int(input())
    print(binary_search(k))



Measured memory_bytes: 17196
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))
#define PI 3.141592653589793


int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;
    if (s.size()<=k) {
        cout << s << endl;
    }
    else {
        s = s.substr(0, k);
        s = s + "...";
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
N = gets.chomp.to_i

a = 0
max_n = 0
max_i = 0
second = 0

for i in 1..N do
    a = gets.chomp.to_i
    if a > max_n
        second = max_n
        max_n = a
        max_i = i
    elsif a > second
        second = a
    end
end

for i in 1..N do
    if i == max_i
        puts second
    else
        puts max_n
    end
end

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

int main(){
    string s;
    int q;
    cin >> s >> q;
    int f = 0;
    vector<char> v[2];
    while(q--){
        int op;
        cin >> op;
        if(op == 1){
            f = 1-f;
        }else if(op == 2){
            int a;
            char b;
            cin >> a >> b;
            a--;
            v[f^a].push_back(b);
        }
    }
    for(char c : v[1])  s += c;
    reverse(s.begin(), s.end());
    for(char c : v[0])  s += c;
    if(!f)  reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}

/* main */

signed main(){
    ll N;
    cin >> N;
    ll A,B;
    cin >> A >> B;
    ll P[N];
    FOR(i,0,N)cin >> P[i];
    ll a = 0,b = 0,c = 0;
    FOR(i,0,N){
        if(P[i] <= A)a++;
        if(A+1 <= P[i] && P[i] <= B)b++;
        if(B+1 <= P[i])c++;
    }
    cout << min({a,b,c}) << endl;
}

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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int x, y;
    cin >> x >> y;

    if ( y & 1 ) {
        cout << "No\n";
        return 0;
    }

    for ( int i = 0; i <= x; i++ ) {
        for ( int j = 0; i + j <= x; j++ ) {
            if ( 2 * i + 4 * j == y and i + j == x ) {
                cout << "Yes\n";
                return 0;
            } else if ( 2 * i + 4 * j > y ) break;
        }
    }
    cout << "No\n";

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main(){
    int a[3],b[3];
    map<int,int> mp;
    for(int i = 0; i < 3; i++){
        cin >> a[i] >> b[i];
        mp[a[i]]++;
        mp[b[i]]++;
    }
    vector<int> v(0);
    for(int i = 1; i <=4; i++){
        v.push_back(mp[i]);
    }
    sort(v.begin(),v.end());
    if(v[0]==1&&v[1]==1&&v[2]==2&&v[3]==2) cout << "YES"<< endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
long long b[110000];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%lld",b+i);
	std::sort(b,b+a);
	long long ret=0;
	long long val=0;
	for(int i=5;i<a;i++){
		if(b[i-5]+b[i-4]>b[i-3])val=max(val,b[i-3]+b[i-4]+b[i-5]);
		if(b[i-2]+b[i-1]>b[i]&&val){
			//printf("%d: %lld %lld\n",i,val,b[i]+b[i-1]+b[i-2]);
			ret=max(ret,val+b[i-2]+b[i-1]+b[i]);
		}
	}
	for(int i=0;i<a-5;i++){
		for(int j=0;j<(1<<6);j++){
			if(__builtin_popcount(j)!=3)continue;
			long long A[3];int na=0;
			long long B[3];int nb=0;
			for(int k=0;k<6;k++){
				if(j&(1<<k)){
					A[na++]=b[i+k];
				}else{
					B[nb++]=b[i+k];
				}
			}
			if(A[0]+A[1]>A[2]&&B[0]+B[1]>B[2])ret=max(ret,A[0]+A[1]+A[2]+B[0]+B[1]+B[2]);
		}
	}
	printf("%lld\n",ret);
}

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

int hoge(int sum,int cnt){
	if(sum/10<=9) return cnt;
	else return hoge(sum/10,++cnt);
}

int main(){
	for(;;){
		int a,b;
		cin>>a>>b;
		if(cin.fail()) break;
		if(a+b<10) cout<<1<<endl;
		else cout<<hoge(a+b,2)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main() {
  int n,a[4][13],num;
  char marks,mark[4]={'S','H','C','D'};
  cin>>n;
  for (int i = 0; i < 13; i++) {
    for (int j = 0; j < 4 ; j++) {
    a[j][i]=0;
    }
  }
  for (int k = 0; k <n; k++) {
    cin>>marks>>num;
     for (int j = 0; j < 4; j++) {
           if(marks==mark[j]){
           a[j][num-1]=1;
           break;
           }
         }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13 ; j++) {
    if(a[i][j]==0)cout<<mark[i]<<" "<<j+1<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3104
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
    ll N, T;    cin >> N >> T;
    ll *t = new ll[N];
    for (int i = 0; i < N; i++)
        cin >> t[i];
    ll ans = T;
    ll lim = t[0];
    for (int i = 1; i < N; i++) {
        ans += min(t[i]-lim, T);
        lim = t[i];
    }

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

Measured memory_bytes: 1792
def a10000(y, k):
    for i in range(k + 1):
        if i * 10000 > y:
            break
        res = a5000(y - i * 10000, k - i)
        if res[0]:
            return i, res[1], res[2]
    return -1, -1, -1


def a5000(y, k):
    if k == 0:
        return y == 0, 0, 0
    for i in range(k + 1):
        if i * 5000 > y:
            break
        res = a1000(y - i * 5000, k - i)
        if res[0]:
            return True, i, res[1]
    return False, -1, -1

def a1000(y, k):
    return k * 1000 == y, k

N, Y = map(int, input().split())
ans = a10000(Y, N)
print(ans[0], ans[1], ans[2])


Measured memory_bytes: 3064
#include"stdio.h"
#include"stdlib.h"

int *N;

void BinaryNum(int r,int n)
{
  int i=r-1;
  while(0<=i)
    {
      N[i]=n%2;
      n/=2;
      i--;
    }
}
int Njou(int m,int n)
{
  int i;
  int num=1;
  for(i=0;i<n;i++)
    {
      num*=m;
    }
  return num;
}

int main()
{
  int n,q;
  int *A;
  int R;
  int m;
  int BN;
  int c;
  int buf;
  int i,j;
  int k;
  scanf("%d",&n);
  A=(int*)malloc(sizeof(int)*n);
  R=Njou(2,n);
  N=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&m);
      for(j=0;j<R;j++)
        {
          c=0;
          BinaryNum(n,j);
          for(k=0;k<n;k++)
            {
              c+=N[k]*A[k];
            }
          if(m==c)
            {
              printf("yes\n");
              break;
            }
        }
      if(j>=R)printf("no\n");
    }
  return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>

using namespace std;

typedef long long ll;

int main() {
    int A, B;
    string str;
    
    cin >> A >> B >> str;
    
    
    for (int i = 0; i < A + B + 1; ++i) {
        if (i != A) {
            if (str[i] < '0' || '9' < str[i]) {
                printf("No\n");
                return 0;
            }
        } else {
            if (str[i] != '-') {
                printf("No\n");
                return 0;
            }
        }
    }
    
    
    printf("Yes\n");
    return 0;
}


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

const int a[8] = {-1,0,1,0,-1,1,-1,1};
const int b[8] = {0,1,0,-1,1,1,-1,-1};
int mine[51][51];
int main(){

    int h,w;
    cin >> h >> w;
    char input;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> input;
            if(input=='#'){
                mine[i][j]=10;
                for(int k=0;k<8;k++)mine[i+a[k]][j+b[k]]++;
            }
        }
    }
    
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(mine[i][j]>=10)cout << '#';
            else cout << mine[i][j];
        }
        cout << endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

int main(){

	ll N,M,mokuhyou;
	scanf("%lld",&N);

	ll* problem = new ll[N];
	ll* ruisekiwa = new ll[N];
	for(int i = 0; i < N; i++){
		scanf("%lld",&problem[i]);
	}

	sort(problem,problem+N);
	for(int i = 0; i < N; i++)ruisekiwa[i] = problem[i];
	for(int i = 1; i < N; i++)ruisekiwa[i] += ruisekiwa[i-1];

	scanf("%lld",&M);

	ll* power = new ll[M];
	for(int i = 0; i < M; i++){
		scanf("%lld",&power[i]);
	}

	ll right,nibun_left,nibun_right,nibun_m;

	for(int i = 0; i < M; i++){
		scanf("%lld",&mokuhyou);

		nibun_left = 0,nibun_right = N-1;
		nibun_m = (nibun_left+nibun_right)/2;
		right = -1;
		while(nibun_left <= nibun_right){
			if(problem[nibun_m] > power[i]){
				nibun_right = nibun_m-1;
			}else{
				right = max(right,nibun_m);
				nibun_left = nibun_m+1;
			}
			nibun_m = (nibun_left+nibun_right)/2;
		}

		if(right == -1){
			if(mokuhyou == 0){
				printf("Yes\n");
			}else{
				printf("No\n");
			}
		}else{
			if(ruisekiwa[right] >= mokuhyou){
				printf("Yes\n");
			}else{
				printf("No\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 9464
// Vicfred
// https://atcoder.jp/contests/abc177/tasks/abc177_b
// implementation, string manipulation
import std.algorithm;
import std.stdio;
import std.string;

void main() {
    string s = readln.strip;
    string t = readln.strip;

    long minima = t.length;

    for(int i = 0; i + t.length <= s.length; ++i) {
        long mismatches = 0;

        for(int j = 0; j < t.length; ++j)
            if(t[j] != s[i + j])
                mismatches += 1;

        minima = min(minima, mismatches);
    }

    minima.writeln;
}



Measured memory_bytes: 2648