akhauriyash/Code-Regression huggingface dataset:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = STR()
if len(s) < 26:
    for i in range(26):
        tmp = chr(i + ord('a'))
        if not tmp in s:
            print(s + tmp)
            exit()
if len(set(s)) == 26:
    for i in reversed(range(len(s))):
        for j in range(ord(s[i]) + 1, ord('z') + 1):
            if not chr(j) in s[:i]:
                print(s[:i] + chr(j))
                exit()
    print(-1)
    exit()
ans = [i for i in s]
for i in reversed(range(len(s))):
    tmp = chr(ans[i] + 1)
    if not tmp in ans:
        ans[i] = tmp
    print(''.join(ans))

Measured memory_bytes: 61676
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    cin >> S;

    vector<vector<int>> vis(H, vector<int>(W, INF));
    queue<pii> q;
    rep(i, 0, H) {
        rep(j, 0, W) {
            if (S[i][j] == '#') {
                q.push({i, j});
                vis[i][j] = 0;
            }
        }
    }
    
    while (sz(q)) {
        int y, x;
        tie(y, x) = q.front(); q.pop();
        rep(dir, 0, 4) {
            int yy = y + DY[dir];
            int xx = x + DX[dir];
            if (!inseg(0, yy, H) || !inseg(0, xx, W)) {
                continue;
            }
            if (chmin(vis[yy][xx], vis[y][x] + 1)) {
                q.push({yy, xx});
            }
        }
    }
    int ans = 0;
    rep(i, 0, H) {
        rep(j, 0, W) {
            chmax(ans, vis[i][j]);
        }
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 25524
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans=0;
  if(s.length()==1) {
    cout << 0 << endl;
    return 0;
  }
  for(int i=0; i<s.length()-1; i++) {
    if(s[i]==s[i+1]) {
      ans++;
      if(s[i]=='0') {
        s[i+1]='1';
      }
      else {
        s[i+1]='0';
      }
    }
    else {
      ans+=0;
    }
  }
  cout << ans << endl;
      
}



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

void main()
{
	immutable MAX = 50001;

	bool p[MAX];
	p[] = 1;
	p[0..2] = 0;
	foreach (i; 2..sqrt(MAX*1.0).ceil.to!int) {
		if (p[i]) {
			foreach (j; iota(i*2, MAX, i))
				p[j] = 0;
		}
	}

	int n;
	while (n = readln.chomp.to!int, n) {
		int cnt;
		foreach (i; 2..n/2+1) {
			if (p[i] && p[n-i]) {
				cnt++;
			}
		}
		cnt.writeln;
	}
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 100005;

int main() {
    int a, b, x; cin >> a >> b >> x;
    if (x < a || (a+b) < x) cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int cmp_char(const void* a, const void* b){
//    char *a_char = (char *)a;
//    char *b_char = (char *)b;
    return strcmp(a, b);
}

int main(){

    int N;
    scanf("%d", &N);

    char S[N+1][10+1];
    int i;

    for( i = 0; i < N; i++ ){
        scanf("%s", S[i]);
    }

    qsort( S, N, sizeof(S[0]), cmp_char );

    int ans = 1;
    for( i = 0; i < N-1; i++ ){
 //       printf("%s\n",S[i]);
        if( strcmp( S[i], S[i+1] ) != 0 ){
            ans += 1;
        }
    }

    printf("%d\n", ans);

    return 0;

}



Measured memory_bytes: 5744
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int arr[n];
set<int> s;
for(int i=0;i<n;i++)
{
    cin>>arr[i];
    s.insert(arr[i]);
}
if(s.size()==n)
{
    cout<<"YES"<<endl;
}
else
    cout<<"NO"<<endl;
    
    return 0;
}

Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 50;
ll a, b;

int main() {
    cin>>a>>b;
    int flag = -1;
    for(int i=1;i<=N;i++) {
        int x = (int)(i * 0.08);
        int y = (int)(i * 0.1);
        if(x == a && y == b){
                flag = i;
        break;
        }
    }
    cout<<flag<<endl;
    return 0;
}


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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Lib
//
uint64_t dp[101010][13]; // mod13

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int N, x; cin >> N >> x;
    vector<int> a(N);
    for(int i = 0; i < N; ++i){
        cin >> a[i];
    }

    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (x >= a[i]) {
            ++ans;
            x -= a[i];
        }
        else{
            break;
        }
    }
    if (ans == N && x != 0){
        --ans;
    }

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


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

int n,q,pos=0,ans=0;
int tag[10000010],v1[10000010],v2[10000010];

map<int,int> mp;

struct node{
	int l,r;
}b[10000010];

struct node2{
	int rt;
	int num;
}cf[10000010];

struct segment_tree{
	int maxv,minv;
}tree[10000010];

inline void pushup(int rt){
	tree[rt].maxv=max(tree[2*rt].maxv,tree[2*rt+1].maxv);
	tree[rt].minv=min(tree[2*rt].minv,tree[2*rt+1].minv);
}

inline void change_max(int nl,int l,int r,int rt,int k){
	if(l==r&&l==nl){
		tree[rt].maxv=max(tree[rt].maxv,k);
		return;
	}
	
	int mid=(l+r)/2;
	if(nl<=mid)  
		change_max(nl,l,mid,2*rt,k);
	else 
		change_max(nl,mid+1,r,2*rt+1,k);
	
	pushup(rt);
}

inline void change_min(int nl,int l,int r,int rt,int k){
	if(l==r&&l==nl){
		tree[rt].minv=min(tree[rt].minv,k);
		return;
	}
	
	int mid=(l+r)/2;
	
	if(nl<=mid)  
		change_min(nl,l,mid,2*rt,k);
	else 
		change_min(nl,mid+1,r,2*rt+1,k);
	
	pushup(rt);
}

int query_max(int nl,int nr,int l,int r,int rt){
	int sumv=0,mid=(l+r)>>1;
	
	if(nl<=l&&r<=nr)  
		return tree[rt].maxv;
	if(nl<=mid)  
		sumv=max(sumv,query_max(nl,nr,l,mid,2*rt));
	if(nr>mid)  
		sumv=max(sumv,query_max(nl,nr,mid+1,r,2*rt+1));
		
	return sumv;
}

int query_min(int nl,int nr,int l,int r,int rt){
	int sumv=1e18+7,mid=(l+r)>>1;
	
	if(nl<=l&&r<=nr)  
		return tree[rt].minv;
	if(nl<=mid)  
		sumv=min(sumv,query_min(nl,nr,l,mid,2*rt));
	if(nr>mid)  
		sumv=min(sumv,query_min(nl,nr,mid+1,r,2*rt+1));
		
	return sumv;
}

bool cmp(node2 x,node2 y){
	return x.num<y.num;
}

bool cmp2(node x,node y){
	return x.l<y.l;
}

inline void clear(){
	for(int i=1;i<=8*n;i++)  
		tree[i].maxv=tag[i]=0,tree[i].minv=1e18+7;
}

signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>b[i].l>>b[i].r;
	}
	
	sort(b+1,b+n+1,cmp2);
	
	for(int i=1;i<=n;i++){
		v1[i]=b[i].l+b[i].r;
	  	v2[i]=b[i].r-b[i].l;
	}
	
	for (int i=1;i<=n;i++){
		cf[++pos].num=b[i].l,cf[pos].rt=pos;
		cf[++pos].num=b[i].r,cf[pos].rt=pos;
	}
	
	sort(cf+1,cf+2*n+1,cmp);
	
	int now=0;
	
	for(int i=1;i<=2*n;i++){
		if(cf[i].num!=cf[i-1].num)  
			now++,mp[cf[i].num]=now;
	}
	
	for(int i=1;i<=n;i++)  
		b[i].l=mp[b[i].l],b[i].r=mp[b[i].r];
	
	clear();
	
	for(int i=1;i<=n;i++){
		if(i!=1)  
			ans=max(ans,v1[i]-query_min(1,b[i].r,1,2*n,1));
		change_min(b[i].r,1,2*n,1,v1[i]);
	}
	
	clear();
	
	for(int i=1;i<=n;i++){
		if(i!=1)  
			ans=max(ans,query_max(b[i].r+1,2*n,1,2*n,1)-v2[i]);
		change_max(b[i].r,1,2*n,1,v2[i]);
	}
	
	cout<<ans<<"\n";
	return 0;
}

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

ll f(ll a) {
    ll res[] = {a, 1, a+1, 0};
    return res[(a+4) % 4];
}

int main(){
	ll n,m;
	cin >> n >> m;
	cout << (f(n-1)^f(m)) << endl;
	cin >> n;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

#define ynmes(a) (a) ? mes("Yes") : mes("No")
#define YNmes(a) (a) ? mes("YES") : mes("NO")
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{    
    ll n;
    cin >> n;
    
    ll r = 0;
    map <ll, ll> mp;
    
    ll a = 0;
    rep(i, n) {
        cin >> a;
        mp[a]++;
    }
    
    for(auto i: mp) {
        if (i.second < i.first) r += i.second;
        if (i.second > i.first) r += i.second-i.first;
    }
    
    mes(r);
    


    
	
    
    
    
    
    
    
    
}



Measured memory_bytes: 9460
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int T = s.nextInt();
		for(int i = 0; i < T; i++){
			int a = s.nextInt();
			int b = s.nextInt();
			int c = s.nextInt();

            if(a*a==b*b+c*c||b*b==a*a+c*c||c*c==b*b+a*a){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
		}
	}
}

Measured memory_bytes: 33960
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] t = new int[n + 1], x = new int[n + 1], y = new int[n + 1];
			t[0] = x[0] = y[0] = 0;
			IntStream.rangeClosed(1, n).forEach(i -> {
				t[i] = scanner.nextInt();
				x[i] = scanner.nextInt();
				y[i] = scanner.nextInt();
			});
			boolean ok = true;
			for (int i = 1; i <= n; i++) {
				int diff = (t[i] - t[i - 1]) - Math.abs(x[i] - x[i - 1]) - Math.abs(y[i] - y[i - 1]);
				if (diff < 0 || ((diff & 1) == 1)) {
					ok = false;
					break;
				}
			}
			System.out.println(ok ? "Yes" : "No");
		}
	}
}


Measured memory_bytes: 94228
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
int a[110];
int cnt;
int cur=1;
int sw1,sw2;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",a+i);
		if(a[i]&1)
		{
			cnt++;
			if(!sw1)sw1=i;
			else sw2=i;
		}
	}
	if(cnt>2)
	{
		printf("Impossible");
		return 0;
	}
	if(sw1)swap(a[1],a[sw1]);
	if(sw2)swap(a[m],a[sw2]);
	for(int i=1;i<=m;i++)printf("%d ",a[i]);
	puts("");
	m=max(m,2);
	a[1]--;a[m]++;
	int st=1;
	if(!a[1])st=2;
	printf("%d\n",m+1-st);
	for(int i=st;i<=m;i++)printf("%d ",a[i]);
	return 0;
} 

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{BufWriter, Write};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($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:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        x: i32,
        y: i32
    }
    puts!("{}\n", x + y / 2);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 2200
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 998244353;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll Co[3050][3050];
int main() {
	int i, j, k;
	for (i = 0; i <= 3020; i++) {
		Co[i][0] = Co[i][i] = 1;
		for (j = 1; j < i; j++) Co[i][j] = (Co[i - 1][j - 1] + Co[i - 1][j]) % MOD;
	}

	ll ans = 0;
	int N, X;
	scanf("%d %d", &N, &X);
	for (i = 0; i <= N; i++) {
		for (j = 0; j <= N-i; j++) {
			ll s = i + 2 * j;

			ll cnt = 0;
			if (s < X) cnt = Co[i + j][i];
			else if (s < 2 * X) {
				ll K = s - X;
				if (K % 2 && K != X-1) {
					int c2 = K + 1;
					if (j >= c2) cnt = Co[i + j - c2][i];
				}
			}
			else {
				if (i == 0 && X % 2 == 1) cnt = 1;
			}

			ans = (ans + cnt * Co[N][i + j]) % MOD;
		}
	}
	return !printf("%lld\n", ans);
}

Measured memory_bytes: 70528
#include <math.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;

using ll = long long;
typedef pair<ll, ll> P_ll;
typedef pair<int, int> P;

const ll INF_ll = 1e17;
const int INF = 1e8;

int main() {
  int N;
  cin >> N;
  vector<ll> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int a = L[i];
    for (int j = i + 1; j < N; j++) {
      int b = L[j];
      if (a == b) {
        continue;
      }
      for (int k = j + 1; k < N; k++) {
        int c = L[k];
        if (a == c || b == c) {
          continue;
        }
        // cout << a << " " << b << " " << c << endl;
        if (a + b > c && b + c > a && c + a > b) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
# -*- coding: utf-8 -*-

N, H, W = map(int, input().split())

A = [0] * N
B = [0] * N

for i in range(N):
    A[i], B[i] = map(int, input().split())

output = 0
for i in range(N):
    if A[i] >= H and B[i] >= W:
        output += 1

print(output)

Measured memory_bytes: 3064
import java.util.Scanner;
     
    public class Main {
    	public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
    			String p=sc.next();
    		if(p.equals("ABC"))
    						System.out.println("ARC");
              else
                		System.out.println("ABC");
    				
    	}
     
    }

Measured memory_bytes: 35212
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,M,C;
    cin >>N>>M>>C;
    vector<ll> B(M);
    vector<vector<ll>> A(N,vector<ll>(M));

    rep(i,M) cin>>B[i];

    rep(i,N){
        rep(j,M){
            cin>>A[i][j];
        }
    }

    ll ans = 0;
    rep(i,N){
        ll sum = C;
        rep(j,M){
            sum+= A[i][j]*B[j];
        }
        if(sum>0){
            ans++;
        }
    }


    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 3628
int main()
{
  int a, b, c, d;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  
  int i, cnt1 = 0, cnt2 = 0;
  for (i = 0; i * b < c; i++)
    cnt1++;
  for (i = 0; i * d < a; i++)
    cnt2++;
  if (cnt1 <= cnt2)
    printf("Yes");
  else
    printf("No");
}

Measured memory_bytes: 1708
#include <iostream>
#include <float.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <stack>
#include <queue>

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)


using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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


int main() {
	int n;
	cin >> n;
	map<char, int> mp;
	rep(i, n) {
		string str;
		cin >> str;
		if (i == 0) {
			rep(i, str.length()) {
				mp[str[i]]++;
			}
			continue;
		}
		map<char, int> tmp;
		rep(i, str.length()) {
			tmp[str[i]]++;
		}

		ALL(it, mp) {
			mp[it->first] = min(mp[it->first], tmp[it->first]);
		}
	}
	ALL(it, mp) {
		rep(i, it->second)
			cout << it->first;
	}
	cout << endl;
}

Measured memory_bytes: 256
using System;
namespace q1
{
  class q2
  {
    static void Main()
    {
      string[] nyuuryoku=Console.ReadLine().Split();
      int a=int.Parse(nyuuryoku[0]);
      int b=int.Parse(nyuuryoku[1]);
      Console.WriteLine(a*(a-1)/2+b*(b-1)/2);
    }
  }
}

Measured memory_bytes: 27540
let p1 n = (n mod 3 = 0);;

let rec p2 n i =
  let num = string_of_int n in
  if i = (String.length num) then false
  else num.[i] = '3' || p2 n (i+1) ;;

let rec numbers n res =
  if n = 0 then res
  else if (p1 n) || (p2 n 0) then numbers (n-1) (n :: res)
  else numbers (n-1) res ;;
                         
let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let n_lst = numbers n [] in
  List.iter (Printf.printf " %d") n_lst ; print_newline();;


Measured memory_bytes: 2984
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define vll vector< ll >
//#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<int,int>
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//#define int unsigned long long
//#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long  
#define int long long
using namespace std;
//using ll = unsigned long long;
ll md=MD;
//ll M=1073741824;
ll M=1e9+7;
//ll exp(ll a,ll b){ll r=1;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(int a,int b){if(a<b)return a; return b;}
ll Max(int a,int b){if(a>b)return a; return b;}
ll powM(ll a,ll b){if(a==1) return 1;ll ans=1;while(b>0){if(b&1)ans=(ans*a)%M;a=(a*a)%M;b=b>>1;}return ans;}
ll power(ll a,ll b){if(a==1) return 1;ll ans=1;while(b>0){if(b&1)ans=(ans*a);a=(a*a);b=b>>1;}return ans;}
const int INF=1000000000000000000;

//always try to hack ur soln before submitting (penalty-50 wrong submission 50 min sochle isse aacha)
// Abe n*m ke grid main y ke coordinates m se akm hone chahiye na ke n se 

int32_t main()
{
	IOS;
	int t;
//	cin>>t;
	t=1;
	while(t--)
	{
		int n;
		cin>>n;
		vector<int> a(n);
		for(int i=0;i<n;++i)cin>>a[i];
		sort(a.rbegin(),a.rend());
		queue<int> q;
		q.push(a[0]);
		int ans=0;
		for(int i=1;i<n;++i)
		{
			ans+=q.front();
			q.pop();
			q.push(a[i]);
			q.push(a[i]);
		}
		cout<<ans<<"\n";
		
	}
}


Measured memory_bytes: 6348
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;


const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll MAXN = 2e5 + 10;
const ll INF = 1e18;
ll n, H, W, H1, W1;

int main(){
	IOS;
	cin >> n >> H >> W;
	ll Cnt = 0;
	for (int i = 0; i < n; i++){
		cin >> H1 >> W1;
		if (H1 >= H && W1 >= W)  Cnt ++;
	}
	cout << Cnt;
	
	
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

using namespace std;

typedef long long lli;
typedef pair<lli, lli> P;

const lli N = 2005;
const lli M = 100005;
const lli INF = 1e12;

lli n, m, l, K[N], S[M+1], dp[N][N], cum[M+1];
P vec[N];

lli calc(lli a, lli b){
	//if(vec[a].first > vec[b].first) swap(a, b);
	//return (cum[vec[b].second] - cum[vec[a].second-1]) / l;
	return (cum[K[a]] - cum[K[b]-1]) / l;
}

int main(){
	cin >> n >> m >> l;
	for(lli i=0;i<n;i++) cin >> K[i];
	for(lli i=1;i<=m;i++) cin >> S[i];
	cum[0] = 0;
	for(lli i=1;i<=m;i++) cum[i] = cum[i-1] + S[i];
	for(lli i=0;i<n;i++) vec[i] = make_pair(S[K[i]], K[i]);
	//sort(vec, vec+n);
	//reverse(vec, vec+n);
	sort(K, K+n);
	reverse(K, K+n);
	fill(dp[0], dp[N], INF);
	dp[0][0] = 0;
	for(lli i=0;i<n;i++){
		for(lli j=0;j<=i;j++){
			if(dp[i][j] >= INF) continue;
			int h = max(i, j) + 1;
			//dp[i+1][j] = min(dp[j][i+1], dp[i][j] + calc(i, i+1));
			//dp[i+1][i] = min(dp[i+1][i], dp[i][j] + calc(j, i+1));
			dp[h][j] = min(dp[j][h], dp[i][j] + (cum[K[i]] - cum[K[h]-1]) / l);
			dp[h][i] = min(dp[h][i], dp[i][j] + (cum[K[j]] - cum[K[h]-1]) / l);
		}
	}
	lli ans = INF;
	for(lli i=0;i<n;i++){
		//ans = min(ans, dp[n-1][i] + calc(n-1, i));
		ans = min(ans, dp[n-1][i] + (cum[K[i]] - cum[K[n-1]-1]) / l);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 34192
import java.util.*

fun main(args: Array<String>) {
    abc141d()
}

fun abc141d() {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toLong() }
    val queue = PriorityQueue<Long>()
    var total = 0L
    for (l in a) {
        total += l
        queue.add(-l)
    }
    repeat(m) {
        val expensive = -queue.poll()
        val discount = Math.floor(expensive / 2.0).toLong()
        total += discount - expensive
        queue.add(-discount)
    }
    println(total)
}


Measured memory_bytes: 72124
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int n, a[103], ans;
int tmp = 1;


int main() {

	cin >> n;
	a[0] = 0;
	REP(i, 1, n + 1)cin >> a[i];
	a[n + 1] = 0;

	rep(i, n + 2) {
		if (a[i] == 0) {
			ans = max(ans, tmp);
			tmp = 1;
		}
		else {
			tmp++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
int main(){
    string s;
    cin >> s;
    int a[3];
    rep(i,3) a[i] = s[i] - 'a';
    sort(a,a+3);
    if (a[0] == 0 && a[1] == 1 && a[2] == 2) PRINT("Yes");
    else PRINT("No");
}


Measured memory_bytes: 256
a, b = map(int, input().split())

ans = 0
for i in range(a, b+1):
    i = list(str(i))
    t_size = len(i)
    if t_size%2 == 0:
        if i[:t_size//2] == list(reversed(i[t_size//2:])):
            ans+=1
    else:
        if i[:t_size//2] == list(reversed(i[t_size//2+1:])):
            ans+=1
print(ans)

Measured memory_bytes: 9148
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL H,W;
 
LL ans = INF;
 
void solve(){
    //横の、iマス目の直後で縦に切断
    //残った右側の箇所をさらに横に切断
    auto slasher1 = [](LL h,LL w){
        for(LL i=0;i<=w-2;i++){
            LL left = (i+1)*h;
            LL upper = (w-i-1)*(h/2 + (h%2==1));
            LL bottom = (w-i-1)*(h/2);
            ans = min(ans,max(left,upper) - min(left,bottom));
        }
    };
    //横に,iマス目の直後で縦に切断
    //さらに残った箇所を縦に2分割
    auto slasher2 = [](LL h,LL w){
        for(LL i=0;i<=w-3;i++){
            LL left = (i+1)*h;
            LL center = (w-i)/2*h;
            LL right = (w-i-1)/2*h;
            ans = min(ans,max(left,center) - min(left,right));
        }
    };
    slasher1(H,W);
    slasher1(W,H);
    slasher2(W,H);
    slasher2(H,W);
}
 
int main(){
    cin >> H >> W;
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(v) (v).begin(),(v).end()
#define endl "\n"
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define vi vector<int>
#define pii pair<int,int>
#define mii map<int,int>
#define SET(A,VAL) memset(A, VAL, sizeof(A))
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int MAX = 1e6+8;
const int sz = 1e5+5;
void f_io(){
    IOS;
}
int dist[105][105];
int32_t main(){
    f_io();
    int t = 1;
    //cin>>t;
    while(t--){
        int n,m; cin>>n>>m;
        std::vector<pii> edges(m);
        vi weight(m);
        rep(i,0,m){
            int a,b; cin>>a>>b>>weight[i];
            edges[i] = {--a,--b};          
        }
        //for(auto k : edges) trace2(k.ff,k.ss);
        rep(a,0,n)rep(b,0,n){
            if(a == b) dist[a][b] = 0;
            else dist[a][b] = INT_MAX;
        }
        rep(i,0,m){
            dist[edges[i].ff][edges[i].ss] = min(dist[edges[i].ff][edges[i].ss],weight[i]);
            dist[edges[i].ss][edges[i].ff] = min(dist[edges[i].ff][edges[i].ss],weight[i]);
        }
        rep(k,0,n)rep(i,0,n)rep(j,0,n){
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        }
        int ans = m;
        rep(i,0,m){
            bool flag = false;
            rep(j,0,n) if(dist[j][edges[i].ff] + weight[i] == dist[j][edges[i].ss]) flag = 1;
            if(flag) ans--;
        }
        cout<<ans<<endl;

    }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
    using namespace std;
     
    typedef long long ll;
     
    const int N = 3e3 + 10;
    int n, K, q, a[N], bak[N];
    vector<int> c;
     
    int main() {
        cin >> n >> K >> q;
        for (int i = 1; i <= n; ++i)
            cin >> a[i];
        int ans = 1e9 + 7;
        for (int i = 1; i <= n; ++i) {
            copy(a + 1, a + n + 1, bak + 1);
            c.clear();
            int lbound = a[i];
            int l = 1, r = 1;
            while (l <= n) {
                r = l;
                while (r <= n && a[r] >= lbound) ++r;
                if (r > l) {
                    sort(bak + l, bak + r);
                    for (int j = 0; j < r - l - K + 1; ++j)
                        c.push_back(bak[l + j]);
                }
                l = max(r, l + 1);
            }
            sort(c.begin(), c.end());
            if ((int) c.size() >= q)
                ans = min(ans, c[q - 1] - lbound);
        }
        cout << ans << endl;
    }

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n, x, t;
	cin >> n >> x >> t;
	int k = n/x + bool(n%x);
	cout << k * t;
}

Measured memory_bytes: 3612
#include <stdio.h>

int main(void){
    int h, w;
    int i, j;
    while(1){
        scanf("%d %d ", &h, &w);
        if(h==0&&w==0)break;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                if(i==0||i==h-1||j==0||j==w-1){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            puts("");
        }
        puts("");
    }

    return 0;
}

Measured memory_bytes: 592
import numpy as np

h, w = map(int, (input().split()))
raw = np.array([list(input()) for i in range(h)])

v_removed = raw[:, np.any(raw == '#', axis=0)]
vh_removed = v_removed[np.any(v_removed == '#', axis=1), :]

for s in vh_removed.tolist():
    print(''.join(s))


Measured memory_bytes: 13348
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
 const ll MOD = 1000000007;
 
 long long fac[MAX], finv[MAX], inv[MAX];
 
 // テーブルを作る前処理
 void COMinit() {
     fac[0] = fac[1] = 1;
     finv[0] = finv[1] = 1;
     inv[1] = 1;
     for (int i = 2; i < MAX; i++){
         fac[i] = fac[i - 1] * i % MOD;
         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
         finv[i] = finv[i - 1] * inv[i] % MOD;
     }
 }
 
 // 二項係数計算
 long long COM(int n, int k){
     if (n < k) return 0;
     if (n < 0 || k < 0) return 0;
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
 }
 

 long long modpow(long long a, long long n) {
      long long res = 1;
      while (n > 0) {
          if (n & 1) res = res * a % MOD;
          a = a * a % MOD;
          n >>= 1;
      }
      return res;
  }
  ll inv_mul(ll x, ll y){
     return (x % MOD* modpow(y,MOD-2))%MOD;
 }
  
int main() {
    COMinit();
    ll n,k;
    std::cin >> n>>k;
    
    if(k>=n-1){
        std::cout << fac[2*n-1]*finv[n]%MOD*finv[n-1]%MOD << std::endl;
        return 0;
    }
    ll sum = 0;
    for (int i = 0; i <= k; i++) {
        sum += COM(n,i)*fac[n-1]%MOD*finv[n-i-1]%MOD*finv[i];
        sum %= MOD;
    }
    std::cout << sum << std::endl;
}


Measured memory_bytes: 12160
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
using namespace std;

int main()
{
    int n;
    cin >> n;
    if(n%2 == 0){
        cout << 0.5 << endl;
    }else{
        double m = (double)n;
        cout << (m+1)/2/m << endl;
    }
    return 0;
}

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

int main(){
  int n; cin>>n;
  vector<int> w(n);
  for(int i=0; i<n; ++i)cin>>w[i];

  int l=0, r=accumulate(w.begin(), w.end(), 0);
  int ans=100000;
  for(int i=0; i<n-1; ++i){
    l+=w[i]; r-=w[i];
    int sub=abs(l-r);
    ans=min(ans, sub);
  }

  cout<<ans<<endl;
}


Measured memory_bytes: 256
# input
n, m = map(int, input().split())
submits = []
for i in range(m):
  ta, tb = map(str, input().split())
  submits.append([int(ta), tb])

ac = [0 for i in range(n+1)]
ac_cnt = 0
wa = [0 for i in range(n+1)]
wa_cnt = 0

# main
for s in submits:
  if s[1] == "WA" and ac[s[0]] == 0:
    wa[s[0]] += 1
  if s[1] == "AC" and ac[s[0]] == 0:
    ac[s[0]] += 1

# output
for i in range(n+1):
  if ac[i] == 1:
    ac_cnt += ac[i]
    wa_cnt += wa[i]

print(ac_cnt, wa_cnt)


Measured memory_bytes: 23608
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  double N; cin >> N;
  double l = 4.0 / N;
  for (double h = 1; h <= 3500; h++) {
    for (double n = 1; n <= 3500; n++) {
      // 4/N = 1/h + 1/n + 1/w
      // 4hnw = Nnw + Nhw + Nhn
      // w(4hn - Nn - Nh) = Nhn
      // w = Nhn / (4hn - Nn - Nh)
      double w = N*h*n / (4*h*n - N*n - N*h);
      if (0 < w && w <= 3500 && w == floor(w)) {
        cout << h << " " << n << " " << w << endl;
        return 0;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define int long long
#define double long double
#define low lower_bound
#define upp upper_bound
#define mod (int)1e9+7
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < n; i++)
#define Rep(i,n) for (int i = n; i >= 0; i--)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define cend cout<<endl;
#define P pair<int, int>
#define prique priority_queue<P, vector<P>, greater<P>>
using namespace std;
string s;
int n;
signed main() {
	cin>>s;
	n=s.size();
	rep(i,7) {
		if(s.substr(0,i)+s.substr(n-(7-i),n-1)=="keyence") {
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;


int main()
{
	int a, b; cin >> a >> b;
	string bstr = to_string(b);
	int num = a * pow(10, bstr.length()) + b;

	int i;
	for (i = 1; i <= 100100; i++)
	{
		if (i * i == num) break;
	}

	if (i > 100100) cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int main(){
  int N; cin >> N;
  int h,w; cin >> h >> w;
  int r = (N-h+1) * (N-w+1);
  cout << r << "\n";
  
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Knight solver = new Knight();
        solver.solve(1, in, out);
        out.close();
    }

    static class Knight {
        public static int MOD = 1000000007;
        static long[] fac;
        static long[] finv;
        static long[] inv;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int x = in.nextInt();
            int y = in.nextInt();

            if ((x + y) % 3 != 0) {
                out.println(0);
                return;
            }

            int n = (2 * y - x) / 3;
            int m = (2 * x - y) / 3;

            comInit(n + m);
            out.println(com(n + m, n));

        }

        static void comInit(int max) {
            fac = new long[max + 1];
            finv = new long[max + 1];
            inv = new long[max + 1];

            // 階乗
            fac[0] = fac[1] = 1;
            // 逆元の階乗
            finv[0] = finv[1] = 1;
            // 逆元
            inv[1] = 1;

            for (int i = 2; i <= max; i++) {
                fac[i] = fac[i - 1] * i % MOD;
                inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
                finv[i] = finv[i - 1] * inv[i] % MOD;
            }
        }

        static long com(int n, int k) {
            if (n < k || n < 0 || k < 0) {
                return 0;
            }
            return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
        }

    }
}



Measured memory_bytes: 58064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String a = in.nextString();
            String b = in.nextString();
            String c = in.nextString();

            boolean ok1 = a.charAt(a.length() - 1) == b.charAt(0);
            boolean ok2 = b.charAt(b.length() - 1) == c.charAt(0);

            out.println(ok1 && ok2 ? "YES" : "NO");
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23380