akhauriyash/Code-Regression huggingface dataset:
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<cstring>
#include<cstdio>
using namespace std;
typedef long long int            ll;
typedef long double              ld;
#define Faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi                 acos(-1);
#define test        int t; cin>>t; while(t--)
//scanf("%[^\n]%*c", str);
//sort(s,s+n,greater<int>());
//cin.getline(array,size);
int main()
{
    int n,k,s=0;
    cin>>n>>k;
    int a[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<k;i++)
    {
        s+=a[i];
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		boolean canCalc = a < 10 && b < 10;
		int ans = canCalc ? a * b : -1;
		System.out.println(ans);
		sc.close();
	}

}


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

int main(){
  string S;
  cin >> S;
  int N = S.size();
  ll res = 0;

  for(int bit=0; bit<(1<<N-1); ++bit){
    ll tmp = 0;
    for(int i=0; i<N-1; ++i){
      tmp *= 10;
      tmp += S[i] -'0';
      if(bit & (1<<i)) res += tmp, tmp = 0;
    }
    tmp *= 10;
    tmp += S.back() - '0';
    res += tmp;
    }
  cout << res << endl;
}
          

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N, M;
set<long long int> star;
set<long long int> place;
long long int a, b, c, d;
long long int box;
bool flag;

int main(){
	cin >> M;
	while (M) {
		for (int i = 0; i < M; i++) {
			cin >> a >> b;
			a += 1000000;
			b += 1000000;
			//cout << a*MOD + b << endl;
			star.insert(a*MOD + b);
		}
		cin >> N;
		for (int i = 0; i < N; i++) {
			cin >> a >> b;
			a += 1000000;
			b += 1000000;
			place.insert(a*MOD + b);
		}
		for (auto i : place) {
			//cout << i << " ";
			a = i / MOD - 1000000;
			b = i%MOD - 1000000;
			c = *star.begin() / MOD - 1000000;
			d = *star.begin() % MOD - 1000000;
			box = i - *star.begin();
			flag = true;
			for (auto j : star) {
				//cout << j << endl;
				if (!place.count(j+box)) {
					flag = false;
					break;
				}
			}
			if (flag) {
				cout << a-c << " " << b-d << endl;
				star.clear();
				place.clear();
				break;
			}
		}
		cin >> M;
	}
	return 0;
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int g[15][15];
int main(){
  int n;
  cin >> n;
  rep(i,n)rep(j,n)g[i][j] = -1;
  rep(i,n){
    int m;
    cin >> m;
    rep(j,m){
      int a,x;
      cin >> a >> x;
      a--;
      g[i][a] = x;
    }
  }
  int ans = 0;
  rep(i,1 << n){
    vector<int> d(n);
    rep(j,n)if(i >> j & 1)d[j] = 1;
    bool ok = true;
    rep(j,n){
      if(d[j]){
        rep(k,n){
          if(g[j][k] == -1)continue;
          if(g[j][k] != d[k])ok = false;
        }
      }
    }
    if(ok)ans = max(ans,__builtin_popcount(i));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPLL(i, n) for(ll i = 0;i < (n);++i)

#define endl "\n"
#define pb push_back
#define MOD 1000000007LL
#define PI 3.1415926

typedef long long ll;

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template <typename T> inline T POW(T a,T b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}

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

	ll n, a[100000], sum[100001], ans = 0;
	cin >> n;
	sum[0] = 0;
	REP(i, n) cin >> a[i];
	ll motoa0 = a[0];

	ll MIN = 1e15, tmp = 0;
	if(motoa0 >= 0) {
		tmp = motoa0+1; a[0] = -1;
	}
	REP(i, n){
		sum[i+1] = sum[i] + a[i];
		if(i!=0 and sum[i]*sum[i+1]>=0){
			tmp += (sum[i]>0 ? sum[i+1]+1 : 1-sum[i+1]);
			sum[i+1] = (sum[i]>0 ? -1 : 1);
		}
	}
	if(tmp < MIN) MIN = tmp;
	tmp = 0; a[0] = motoa0;
	if(motoa0 <= 0) {
		tmp = 1-motoa0; a[0] = 1;
	}
	REP(i, n){
		sum[i+1] = sum[i] + a[i];
		if(i!=0 and sum[i]*sum[i+1]>=0){
			tmp += (sum[i]>0 ? sum[i+1]+1 : 1-sum[i+1]);
			sum[i+1] = (sum[i]>0 ? -1 : 1);
		}
	}
	if(tmp < MIN) MIN = tmp;

	cout << MIN << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,d,ans=0;
int main(){
	cin >> n >> d;
	for (ll i=1,x,y;i<=n;i++){
		cin >> x >> y;
		if (x*x+y*y<=d*d) ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)

int main(){

	

    FAST
//	PRECISE

char c;
cin>>c;
ll t;
t=c;
if(t>=97)
cout<<'a';
else
cout<<'A';



return 0;
 }

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<ll>
#define pi pair<ll,ll>
#define vp vector<pi>
#define mp map<ll,ll>
#define pb push_back
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
ll inf=1e+9;

ll dist[2003]; 

typedef pair<ll, ll> iPair; 
  
void shortestPath(ll src,vp adj[]) 
{ 
   
    priority_queue< iPair, vector <iPair> , greater<iPair> > pq; 
  
    
    pq.push(make_pair(0, src)); 
    dist[src] = 0; 
  
  
    while (!pq.empty()) 
    { 
        
        ll u = pq.top().second; 
        pq.pop(); 
  
        for (auto i : adj[u]) 
        { 
        
            ll v = i.first; 
            ll weight = i.second; 
  
            //  If there is shorted path to v through u. 
            if (dist[v] > dist[u] + weight) 
            { 
                // Updating distance of v 
                dist[v] = dist[u] + weight; 
                pq.push(make_pair(dist[v], v)); 
            } 
        } 
    } 
 
} 



int32_t main(){
    
    fast;

    ll n,x,y;
    cin>>n>>x>>y;
    vp adj[n+1];
    for(ll i=1;i<n;i++)
    {
        adj[i].pb({i+1,1});
        adj[i+1].pb({i,1});
    }
    adj[x].pb({y,1});
    adj[y].pb({x,1});
    ll c=0;
    mp m;
    for(ll i=1;i<=n;i++)
    {
    for(ll i=0;i<=n;i++)dist[i]=inf;
    shortestPath(i,adj);
    for(ll j=i+1;j<=n;j++)
    {
    	//if(dist[j]==i)c++;
    	//cout<<dist[j]<<" "
    	m[dist[j]]++;
    } 
    //cout<<endl;
    }
    //ll c=1;
    for(ll i=1;i<=n-1;i++)cout<<m[i]<<endl;
    //cout<<c;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n,m;
	cin >> n>> m;
	vector<int> l(n);
	rep(i,m)
	{
		int a,b;
		cin >> a >> b;
		l[a-1]++;
		l[b-1]++;
	}
	rep(i,n)
	cout<<l[i]<<endl;
	return 0;
}

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

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
int a[112345];
int b[112345];
LL c[112345];
LL d[112345];
typedef vector<int> V;
typedef vector<V> VV;
void dfs(VV &g,int v,int p,LL di){
    d[v]=di;
    for(auto e:g[v]){
        int u=v^a[e]^b[e];
        if(u==p)continue;
        dfs(g,u,v,di+c[e]);
    }
}
int main(){
    int N;
    cin>>N;
    VV g(N);
    REP(i,N-1){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;b[i]--;
        g[a[i]].pb(i);
        g[b[i]].pb(i);
    }
    int Q,K;
    cin>>Q>>K;
    K--;
    dfs(g,K,K,0);
    REP(i,Q){
        int s,t;
        cin>>s>>t;
        cout<<d[s-1]+d[t-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
struct coordinates{
	int x, y, id;
}a[MAXN];
struct edge{
	int u, v, l;
}e[MAXN*2];
int n, np, ans;
int Fa[MAXN];
bool cmp(edge x, edge y){
	return x.l < y.l;
}
bool cmpx(coordinates x, coordinates y){
	return x.x < y.x;
}
bool cmpy(coordinates x, coordinates y){
	return x.y < y.y;
}
int Find(int x){
	return x == Fa[x] ? x : Fa[x] = Find(Fa[x]);
}
inline int read(void){
	int num = 0, f = 1;
	char ch;
	while(!isdigit(ch=getchar())) if(ch == '-') f = -1;
	while(isdigit(ch)) num = num*10 + ch-'0', ch = getchar();
	return num * f;
}
int main()
{
	n = read();
	for(int i = 1; i <= n; i++)
		a[i].x = read(), a[i].y = read(), a[i].id = i;
	sort(a+1, a+n+1, cmpx);
	for(int i = 2; i <= n; i++)
		e[++np] = (edge){a[i-1].id, a[i].id, a[i].x - a[i-1].x};
	sort(a+1, a+n+1, cmpy);
	for(int i = 2; i <= n; i++)
		e[++np] = (edge){a[i-1].id, a[i].id, a[i].y - a[i-1].y};
	sort(e+1, e+np+1, cmp);
	for(int i = 1; i <= n; i++) Fa[i] = i;
	for(int i = 1; i <= np; i++){
		int f1 = Find(e[i].u), f2 = Find(e[i].v);
		if(f1 != f2){
			ans += e[i].l;
			Fa[f1] = f2;
		}
	}
	printf("%d\n", ans);
	return 0;
}


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


int main(){
    int h,m;
    cin >> h >> m;
    rep(i,m){
        int a;
        cin >> a;
        h -= a;
    }
    if(h <= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++ )
 
int main()
{
  double n, k;
  cin >> n >> k;
  vector<pair<double, double> > v;
  REP(i, n) {
    double a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  sort(v.begin(), v.end());
  int cnt = 0;
  while(k > 0) {
    k -= v[cnt].second;
    cnt++;
  }
  cout << v[cnt - 1].first << endl;
}

Measured memory_bytes: 2420
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    d: usize
    }
    let ans = n / (2 * d + 1) + if n % (2 * d + 1) > 0 { 1 } else { 0 };
    println!("{}", ans);
}


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

int main(){
	int N, i, ans = 0;
	scanf("%d", &N);
	vector<int> H(N);
	for(i = 0; i < N; i++){
		scanf("%d", &H[i]);
		int f = 1, j;
		for(j = 0; j < i; j++){
			if(H[j] > H[i]){
				f = 0;
			}
		}
		ans += f;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>

using namespace std;

int main(){
    string ainp,binp,cinp;
    cin >> ainp >> binp >> cinp;
    queue<char> a,b,c;
    for(int i=0;i<ainp.size();i++) a.push(ainp[i]);
    for(int i=0;i<binp.size();i++) b.push(binp[i]);
    for(int i=0;i<cinp.size();i++) c.push(cinp[i]);

    char before = a.front();a.pop();

    while(true){
        if(before == 'a') {if(a.size() == 0){cout << "A";break;};before = a.front();a.pop();continue;}
        if(before == 'b') {if(b.size() == 0){cout << "B";break;}before = b.front();b.pop();continue;}
        if(before == 'c') {if(c.size() == 0){cout << "C";break;}before = c.front();c.pop();continue;}
    }
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def min(a,b)
    return a>b ? b : a
end
INF=Float::INFINITY
N=gets.to_i
A=get_i
rsum=A.inject(:+)
lsum=0
ans=INF
N.times do|i|
  lsum+=A[i]
  rsum-=A[i] 
  ans=min(ans,(lsum-rsum).abs)
end
puts ans

Measured memory_bytes: 18316
import sys

N = int(input())
t = [0]
x = [0]
y = [0]

for i in range(N):
  t1, x1, y1 = map(int, input().split())
  t.append(t1)
  x.append(x1)
  y.append(y1)

for i in range(len(t)-1):
  T = t[i+1] - t[i]
  d = abs(x[i] - x[i+1]) + abs(y[i] - y[i+1])
  if not (d <= T and T%2 == d%2):
    print('No')
    sys.exit(0)
print('Yes')

Measured memory_bytes: 11816
#include<stdio.h>
#define min(x,y)(x < y? x:y)
#define max(x,y)(x > y? x:y)

int main(){
    int h,n;
    scanf(" %d %d",&h,&n);
    int dp[h+1];
    for(int i = 0; i < h+1;++i) dp[i] = 1000000000;
    dp[h] = 0;
    for(int i = 0; i < n;++i){
        int a,b;
        scanf("%d %d",&a,&b);
        for(int j = h; j > 0;--j)
            dp[max(0,j-a)] = min(dp[max(0,j-a)],dp[j]+b);
    }
    printf("%d\n",dp[0]);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define EPS 1e-9
#define first fst
#define second scd

#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long


signed main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  if(a+b<c*2){
    cout<<(a*x)+(b*y)<<endl;
  }
  else{
    int ans=0;
    ans+=(min(x,y)*c*2);
    if(x>y) ans+=(x-y)*min(a,c*2);
    else ans+=(y-x)*min(b,c*2);
    cout<<ans<<endl;
  }
  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
    int A,B;
    cin >> A >> B;
    if(A % 2 != 0 && B % 2 !=0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int p1[9],p2[9];
#define rep(i,n) for(int i=0;i<(int)n;i++)
double ans = 0;
long long dp[9][(1 << 9)][200]={0};

void solve(){
  rep(i,9)rep(j,(1<<9))rep(k,200)dp[i][j][k]=0;
  rep(j,9){
    int state = ( 1 << j);
    if ( p1[0]>p2[j]){
      dp[0][state][p1[0]+p2[j]]+=1;
    }else {
      dp[0][state][0]+=1;
    }      
  }
  
  for(int i=0;i<8;i++){
    rep(j,(1<<9)){
      rep(k,200){
	if ( dp[i][j][k] == 0)continue;
	rep(l,9){
	  if ( ( (1 << l)&j) != 0)continue;
	  if (p1[i+1]>p2[l]){
	    dp[i+1][(1<<l)|j][k+p1[i+1]+p2[l]]+=dp[i][j][k];
	  }else {
	    dp[i+1][(1<<l)|j][k]+=dp[i][j][k];
	  }
	}
      }
    }
  }
  

  double div=0;
  rep(i,200)div+=dp[8][(1 << 9)-1][i];
  for(int i=86;i<200;i++){
    ans+=dp[8][(1<<9)-1][i];
  }
  //cout << ans << " " << div << endl;

  ans/=div;
  
}


main(){
  int te;
  cin>>te;
  while(te--){
    ans =0;
    rep(i,9)cin>>p1[i];
    rep(i,9)cin>>p2[i];
    solve();
    
    printf("%.5lf %.5lf\n",ans,1-ans);
  }
}

Measured memory_bytes: 8104
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n = int(input())
b = list(map(int, input().split()))

t = b[0]
for i in range(1, n - 1):
    t += min(b[i - 1], b[i])

t += b[n - 2]

print(t)


Measured memory_bytes: 2940
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;

int main(){
    char a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a == b || b == c || c == d){
        cout << "Bad" << endl;
    }
    else cout << "Good" << endl;
}


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

int main() {
	// your code goes here
	int n,k;
	cin>>n;
	cin>>k;
	if(n%2==0)
	{
	    if(k<=n/2)
	    {
	        cout<<"YES";
	    }
	    else
	    {
	        cout<<"NO";
	    }
	}
	else
	{
	    if(k<=(n+1)/2)
	    {
	        cout<<"YES";
	    }
	    else
	    {
	        cout<<"NO";
	    }
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  long long int a, b, c;  scanf("%lld%lld%lld", &a, &b, &c);
  if(c - a - b > 0  &&  4 * a * b < (c - a - b)*(c - a - b))
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 128
import sys
# from collections import Counter


def main():
    N = int(sys.stdin.readline().rstrip())
    X = [[] for _ in range(200005)]
    Y = [[] for _ in range(200005)]
    A = [[] for _ in range(200005 * 2 + 1)]
    B = [[] for _ in range(200005 * 2 + 1)]

    for i in range(N):
        x, y, u = sys.stdin.readline().rstrip().split()
        x = int(x)
        y = int(y)
        X[x].append((y, u))  # 同一X に含まれるもの
        Y[y].append((x, u))
        A[x + y].append((x, u))
        B[x - y + 200005].append((x, u))

    # 正面衝突
    length = 10000000
    for xs in X:
        if len(xs) >= 2:
            xs.sort()

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "D":
                    length = min(abs(y - tmp_y) * 5, length)
                    is_count = False
                if u == "U":
                    tmp_y = y
                    is_count = True

    # 正面衝突
    for xs in Y:
        if len(xs) >= 2:
            xs.sort()

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "L":
                    length = min(abs(y - tmp_y) * 5, length)
                    is_count = False
                if u == "R":
                    tmp_y = y
                    is_count = True

    # 正面衝突
    for xs in A:
        if len(xs) >= 2:
            xs.sort()

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "U":
                    length = min(abs(y - tmp_y) * 10, length)
                    is_count = False
                if u == "R":
                    tmp_y = y
                    is_count = True

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "L":
                    length = min(abs(y - tmp_y) * 10, length)
                    is_count = False
                if u == "D":
                    tmp_y = y
                    is_count = True

    # 正面衝突
    for xs in B:
        if len(xs) >= 2:
            xs.sort()

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "L":
                    length = min(abs(y - tmp_y) * 10, length)
                    is_count = False
                if u == "U":
                    tmp_y = y
                    is_count = True

            is_count = False
            tmp_y = 0
            for y, u in xs:
                if is_count and u == "D":
                    length = min(abs(y - tmp_y) * 10, length)
                    is_count = False
                if u == "R":
                    tmp_y = y
                    is_count = True

    if length == 10000000:
        print("SAFE")
    else:
        print(length)


main()


Measured memory_bytes: 177884
#include <stdio.h>

int main(void)          
{
	int n = 1 , x = 1;
	int counter = 0;
	int i, j, k;

	while (n != 0 || x != 0)
	{
		scanf("%d %d", &n, &x);
		if (n == 0 && x == 0) break;
		for (i = 1; i <= n; i++)
		{
			if (n * 3 < x) break;
			if (i > x) break;
			for (j = i+1; j <= n; j++)
			{
				if (i + j > x) break;
				for (k = j+1; k <= n; k++)
				{
					if (i + j + k > x) break;
					if (i + j + k == x) counter++;
				}
			}
		}
		printf("%d\n", counter);
		counter = 0;
	}
	return 0;
}

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

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

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e14;
typedef long long int ll;

#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 llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

bool vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

int main(){
    ll D,G;
    cin >> D >> G;
    ll P[D+2], C[D+2];
    llrep(i,D){
        cin >> P[i] >> C[i];
    }

    ll minimum = 1000;

    // cout << "---------------------" << endl;
    int n=D;
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1<<n); ++bit)
    {
        // cout << "bit = " << bit << endl;
        ll sum=0;
        ll cnt=0;
        // bit の表す集合を求める
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                S.push_back(i);
                sum += (100 * (i+1) * P[i] + C[i]);
                cnt += P[i];
            }
        }
        // cout << "sum = " << sum << endl;
        // cout << "cnt = " << cnt << endl;


        if (sum < G){
            ll rest = G - sum;
            for(int i=D; i>0; i--){
                // cout << "bbb" << endl;
                if (rest > 0){
                    if (!vector_finder(S, i-1)){
                        if (rest - (P[i-1]-1)*(100*i) < 0){//残りがP[i-1]-1個以下ですむ
                            if (rest%(100*i)==0){
                                cnt += (rest/(100*i));
                                rest -= 100*i*(rest/(100*i));
                            }else{
                                cnt += (rest/(100*i)) + 1;
                                rest -= 100*i*(rest/(100*i)+1);
                            }
                        }else{
                            cnt += (P[i-1]-1);
                            rest -= (P[i-1]-1)*(100*i);
                        }
                    }
                }
            }
            if (rest > 0) cnt=1000;
        }
        if (cnt < minimum) minimum = cnt;
        // cout << "cnt = " << cnt << endl;
        // cout << "minimum = " << minimum << endl;
        // cout << "---------------------" << endl;
    }

    cout << minimum << endl;

    return 0;
}


Measured memory_bytes: 256
/* ex6_2
   kohei_suzuki */
/*i18n*/
#include <stdio.h>
#include <string.h>

#define SIZE 256

int main(void){
    int lenth; //i,単語の長さ
    char word[SIZE]; //単語の文字型配列

    scanf("%s",word); //入力受取
    lenth = strlen(word); //配列の長さを代入

    putchar(word[0]); //1文字目出力
    printf("%d",lenth-2); //間の長さを出力
    putchar(word[lenth-1]); //最後の文字出力

    putchar('\n'); //改行
    return 0;
}

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

int main()
{
  char n[4];
  cin >> n;

  for(int i = 0; i < 3; i++){
    if(n[i] == '1') n[i] = '9';
    else if(n[i] == '9') n[i] = '1';
  }

  cout << n << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n;cin>>n,n;){
		vs names(n);
		vvi table(n,vi(n));
		rep(i,n){
			cin>>names[i];
			rep(j,n){
				if(i==j)
					continue;
				cin>>table[i][j];
			}
		}
		vi scores(n);
		rep(i,n) rep(j,n){
			if(i==j)
				continue;
			if(table[i][j]==0)
				scores[i]+=100;
			else if(table[i][j]==1)
				scores[i]-=1;
		}
		rep(i,n)
			for(int j=i;j>0;j--)
			if(scores[j-1]<scores[j]){
				swap(names[j-1],names[j]);
				swap(scores[j-1],scores[j]);
			}
		rep(i,n)
			cout<<names[i]<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	var aa [300][300]int
	for i := 0; i < n; i++ {
		for ii := 0; ii < n; ii++ {
			aa[i][ii] = getNextInt(scanner)
		}
	}
	ans := solve(n, aa)

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(n int, aa [300][300]int) int64 {
	var ans int64
	var min [300][300]int
	for r := 0; r < n; r++ {
		for l := 0; l < r; l++ {
			min[l][r] = int(1e9 + 1)
		}
	}
	for m := 0; m < n; m++ {
		for r := 0; r < n; r++ {
			for l := 0; l < r; l++ {
				if m == l || m == r {
					continue
				}
				if aa[l][r] > aa[l][m]+aa[m][r] {
					return -1
				}
				if min[l][r] > aa[l][m]+aa[m][r] {
					min[l][r] = aa[l][m] + aa[m][r]
				}
			}
		}
	}

	for r := 0; r < n; r++ {
		for l := 0; l < r; l++ {
			if min[l][r] > aa[l][r] {
				ans += int64(aa[l][r])
			}
		}
	}

	return ans
}


Measured memory_bytes: 7040
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n, k, q, a;
	cin >> n >> k >> q;


	vector<int> points(n, 0);

	for (int i = 0; i < q; i++) {
		cin >> a;
		points[a - 1]++;
	}


	for (auto x: points) {
		int score = k - q + x;
		cout << (score > 0 ? "Yes" : "No") << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
    
using namespace std;
bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
} 

  
int main(){
    IOS;
 
   ll n;cin>>n;
   string s;cin>>s;
   n=n%26;
   for(ll i=0;i<s.size();i++){
       ll f=s[i]-'A';
       if(f+n>25){ f=(n+f)%26;cout<<(char)('A'+f);}else {f=n;cout<<(char)(s[i]+f);}
      // cout<<(char)(s[i]+f);
   }
    return 0;}

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

using namespace std;

int dp[50][500][500];

int main()
{
    int n, ma, mb;
    cin >> n >> ma >> mb;

    int a[n], b[n], c[n];
    for (int i = 0; i < n; i++) cin >> a[i] >> b[i] >> c[i];

    for (int i = 0; i < 50; i++)
        for (int j = 0; j < 500; j++)
            for (int k = 0; k < 500; k++)
                dp[i][j][k] = 1 << 30;

    dp[0][0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= n * 10; j++) {
            for (int k = 0; k <= n * 10; k++) {
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);
                dp[i + 1][j + a[i]][k + b[i]] = min(dp[i + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]);
            }
        }
    }

    int ans = 1 << 30;
    for (int i = 1; i < 500; i++) {
        for (int j = 1; j < 500; j++) {
            if (j * ma == i * mb) ans = min(ans, dp[n][i][j]);
        }
    }
    cout << (ans == 1 << 30 ? -1 : ans) << endl;

    return 0;
}


Measured memory_bytes: 49024
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
string s;

int main() {
    cin >> n;
    vector<int> dp(n, 1e9);
    REP(i, n) {
        int a; cin >> a;
        *lower_bound(ALL(dp), a) = a;
    }

    cout << lower_bound(ALL(dp), 1e9) - dp.begin() << endl;

    return 0;
}



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

int main() {
  int N, K;
  cin >> N >> K;
  
  int result = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    
    if (x < K - x) {
      result += 2 * x;
    }
    else {
      result += 2 * (K - x);
    }
  }
  
  cout << result << endl;
  
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#define	MOD = 1000000007;
using namespace std;

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

	string A[50];
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	string B[50];
	for (int i = 0; i < M; i++)
	{
		cin >> B[i];
	}

	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < A[i].size(); j++)
		{
			bool same = true;
			for (int k = 0; k < N; k++)
			{
				for (int l = 0; l < B[k].size(); l++)
				{
					if (i + k < N && j + l < A[i].size())
					{
						if (A[i + k][j + l] != B[k][l])
						{
							same = false;
							break;
						}
					}
					else {
						same = false;
						break;
					}
				}
				if (!same) {
					break;
				}
			}

			if (same)
			{
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: usize = read().unwrap();
    let k: u64 = read().unwrap();

    let mut ans = 1;
    for _ in 0..n {
        if ans * 2 > k + ans {
            ans += k;
        } else {
            ans *= 2;
        }
        //        println!("{}", ans);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
def factorization(n): #素因数分解のプログラム([素因数,指数]のリストのリストで出力→24→[[2, 3], [3, 1]])
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr 

import math
import sys
n = int(input())
ls = factorization(n)
q = 0
if n == 1:
    print(0)
    sys.exit()
for i in range(len(ls)):
    j = 1
    k = 2
    p = 0
    while True:
        if ls[i][1] >= j:
            j += k
            p += 1
            k += 1
        else:
            break
    q += p
print(q)

Measured memory_bytes: 9492
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a), end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef pair<lli, lli> ii;
typedef long double ld;
typedef vector<lli> vi;

int main()
{   _
    lli n, acum = 0, mn = 1e18, num; cin >> n;
    vi v(n); fore(i, 0, n) cin >> v[i];
    sort(v.rbegin(), v.rend());
    int cnt = n - 2;
    acum = v[0];
    fore(i, 1, n) {
        if(cnt == 0) break;
        if(cnt == 1) {
            --cnt;
            acum += v[i];
        }
        else {
            cnt -= 2;
            acum += v[i] * 2;
        }
    }
    cout << acum << ENDL;
    return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s;
    cin >> s;
    int sum=700;
    if(s[0]=='o') sum+=100;
    if(s[1]=='o') sum+=100;
    if(s[2]=='o') sum+=100;
    cout << sum << endl;
}


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

int H[20005];

int main()
{
	string str;
	cin >> str;
	
	H[0] = (str[0] == '\\' ? -1 : (str[0] == '/' ? 1 : 0));
	int len = str.length();
	for(int i = 1; i < len; ++i)
	{
		H[i] = H[i - 1] + (str[i] == '\\' ? -1 : (str[i] == '/' ? 1 : 0));
	}
	
	int total = 0, count = 0, pool[10000];
	for(int i = 0; i < len; ++i)
	{
		if(str[i] == '\\')
		{
			int idx = -1, mh = -100000;
			for(int j = i + 1; j < len; ++j)
			{
				if(str[j] == '/' && H[j] > mh)
				{
					idx = j;
					mh = H[j];
					
					if(H[j] == H[i] + 1)
					{
						break;
					}
				}
			}
			
			if(idx >= 0)
			{
				int sum = 0;
				for(int j = i; j <= idx; ++j)
				{
					if((str[j] == '/' && H[j] <= mh) || H[j] < mh)
					{
						sum += (str[j] == '\\' ? (mh - H[j]) * 2 - 1 : (str[j] == '/' ? (mh - H[j]) * 2 + 1 : (mh - H[j]) * 2));
					}
				}
				
				pool[count] = sum / 2;
				total += pool[count++];
				i = idx - 1;
			}
			else
			{
				break;
			}
		}
	}

	cout << total << endl;
	cout << count;
	for(int i = 0 ; i < count; ++i)
	{
		cout << " " << pool[i];
	}
	cout << endl;

    return 0;
}



Measured memory_bytes: 3340
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
		}
		sc.close();

		int n2 = n * n;
		long ans = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > n2) {
				long x = a[i] - n2;
				x = x - x % (n + 1);
				ans += x;
				a[i] -= x;
			}
		}

		long max = 0;
		int idx = 0;
		for (int i = 0; i < n; i++) {
			if (max < a[i]) {
				max = a[i];
				idx = i;
			}
		}
		while (max >= n) {
			ans++;
			max = 0;
			int nidx = 0;
			for (int i = 0; i < n; i++) {
				if (i == idx) {
					a[i] -= n;
				} else {
					a[i] ++;
				}
				if (max < a[i]) {
					max = a[i];
					nidx = i;
				}
			}
			idx = nidx;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23764
n = int(input())

def factorization(n):
    arr = []
    if n == 1:
        return arr
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

f_list = factorization(n)
ans = 0
#print(f_list)
for i in range(len(f_list)):
    _tmp = f_list[i][1]
    #print("tmp",_tmp)
    j = 1
    #素因数分解したときのx^y y=1,2のとき1 y=3,4,5のとき2 y=6,7,8,9のとき3
    while _tmp >= 0:
        _tmp -= j
        j += 1
    ans += j-2

print(ans)


Measured memory_bytes: 63304
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ios;
	ll n;cin>>n;
	ll a[n][n];
	for(ll i=0;i<n;i++){
		for(ll j=0;j<n;j++)cin>>a[i][j];
	}
	ll N=(1<<n);
	ll dp[N];
	memset(dp,0,sizeof(dp));
	dp[0]=1;
	for(ll i=0;i<N;i++){
		int x=__builtin_popcount(i);
		for(int j=0;j<n;j++){
			//cout<<(i&(1<<j))<<" "<<a[x][j]<<" 2"<<endl;
			if((i&(1<<j))==0&&a[x][j]==1){
				//cout<<"x"<<endl;
				//cout<<i<<" "<<dp[i]<<endl;
				dp[(i|(1<<j))]=(dp[(i|(1<<j))]+dp[i])%hell;
			}
		}
	}
	//for(int i=0;i<N;i++)cout<<dp[i]<<" ";cout<<endl;
	cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
int main(){
  string o;
  string e;
  int s=0,t=0;
  cin >>o;
  cin >>e;
  
  for(int i=1;i<=100;i++){
    if(o[s]=='\0'&&e[t]=='\0') break;
    if(i%2==1){
      cout << o[s];
      s++;
	}
    else{
      cout << e[t];
      t++;
    }
  }
  cout << endl;
  return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

vector<int> adj[200000];
int N, x[200000], A[200000], ans[200000];
bool vis[200000];

void dfs(int c)
{
	vis[c]=true;
	ans[c]=lower_bound(x,x+N,0x7f7f7f7f)-x;
	for(auto n: adj[c]) if(!vis[n]) {
		int r=lower_bound(x,x+N,A[n])-x, v=A[n];
		swap(x[r],v);
		dfs(n);
		swap(x[r],v);
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	cin>>N; memset(x,0x7f,sizeof(x));
	for(int i=0;i<N;i++) cin>>A[i];
	for(int i=1;i<N;i++) {
		int a, b;
		cin>>a>>b;
		adj[--a].push_back(--b);
		adj[b].push_back(a);
	}
	x[0]=A[0];
	dfs(0);
	for(int i=0;i<N;i++) cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 31468
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		String ans = "Yes";
		List<String> list = new ArrayList<>();
		sc.nextLine();
		String word = sc.nextLine();

		list.add(word);
		String strfin = word.substring(word.length()-1);

		for(int i = 0; i < N-1; i++) {
			word = sc.nextLine();

			if(ans.equals("No")) {
				continue;
			}
			if(!(word.substring(0,1).equals(strfin))){
				ans = "No";
				//System.out.println(word + " " + word.substring(0,1) +"　"+ strfin);
			}

			for(int j = 0; j <= i; j++) {
				if(word.equals(list.get(j))) {
					ans = "No";
					//System.out.println(word + " "+ list.get(j));
				}
			}
			list.add(word);
			strfin = word.substring(word.length()-1);
		}


		System.out.println(ans);
		sc.close();
	}

}

Measured memory_bytes: 23764
# include<iostream>
#include <vector>
#include <stdio.h>
#include <numeric>
#include <cmath>

int main(){

    using namespace std;
    long long N, K;
    long long i;

    cin >> N >> K;

    vector<long long> vec{};

    for(i=0;i<=N;i++){
        vec.push_back(i);
    }

    long long ans = 0;
    for(i=K;i<=(N+1);i++){
        long long tmp_max, tmp_min;
        // 上からi個で最大値
        tmp_max = i*((N-i+1)+N)/2;
        // 下からi個で最小値
        tmp_min = i*(0+i-1)/2;
        // 最大値-最小値の値がiごとの答え
        ans += tmp_max-tmp_min+1;
    }

    // デカい場合に備えてansを割った余りが答え
    cout << ans%(1000000000+7) << endl;

    return 0;
}

Measured memory_bytes: 5340
import collections
n = int(input())
s = [0]*n
L = [0]*n
ans = 0
for i in range(n):
	s[i] = input()
	L[i] = ''.join(sorted(list(s[i])))
D = collections.Counter(L)
for i in D.values():
	ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 26972
import java.util.*;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        double A = sc.nextInt();
        double B = sc.nextInt();
        double X = sc.nextInt();
        double s = X / A;
        double ans;
        if (s * 2 < A * B) {
            double h = s * 2 / B;
            ans = Math.PI / 2 - Math.atan2(h, B);
        } else {
            double h = (A * B - s) * 2 / A;
            ans = Math.atan2(h, A);
        }
        System.out.printf("%.9f\n", ans * 180 / Math.PI);
    }
}


Measured memory_bytes: 23252
def chmin(a,b):
  if a < b:
    return a
  else:
    return b

N = int(input())
S = list(input() + "#")
dp = [[0,0] for i in range(N+2)]
dp[0][1] = 1

for i in range(N):
  if( S[i] == "#" ):
    if( S[i+1] == "#" ):
      dp[i+1][0] = chmin(dp[i][0],dp[i][1])
      dp[i+1][1] = dp[i][1]+1
    else:
      dp[i+1][0] = dp[i][1]
      dp[i+1][1] = chmin(dp[i][0],dp[i][1]) + 1
  else:
    if( S[i+1] == "#" ):
      dp[i+1][0] = chmin(dp[i][0],dp[i][1])
      dp[i+1][1] = dp[i][0]+1
    else:
      dp[i+1][0] = dp[i][0]
      dp[i+1][1] = chmin(dp[i][0],dp[i][1]) + 1
print( chmin(dp[N-1][0],dp[N-1][1]) )


Measured memory_bytes: 31432
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

int main()
{
	long long k,cur=0;
	long long sn[10000],sn_s[10000];
	cin>>k;

	for (long long i=1; i<1000000; i++) {
		int i_s=0;
		for(long long j=i; j; j=j/10) {
			i_s+=j%10;
		}
		while(cur>0 && sn[cur-1]*i_s>i*sn_s[cur-1]) {
			cur--;
		}
		sn[cur]=i;
		sn_s[cur]=i_s;
		cur++;
	}
	int mm=10;
	for (int loop=7;loop<=15;loop++,mm=mm*10)
	for (long long i=100000; i<1000000; i++) {
		int i_s=0;
		long long x=(i+1)*mm-1;
		for(long long j=x; j; j=j/10) {
			i_s+=j%10;
		}
		while(cur>0 && sn[cur-1]*i_s>x*sn_s[cur-1]) {
			cur--;
		}
		sn[cur]=x;
		sn_s[cur]=i_s;
		cur++;
	}
	for (int i=0; i<k; i++) cout<<sn[i]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int s[730];
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int a,b,c,d;
		scanf("%d%d%d%d",&a,&b,&c,&d);
		a=(a-1)*30+(b-1);
		//[a,a+c)
		for(int i=0;i<360;i++){
			int x=(a+i)%360;
			if(i<c)s[x]=max(s[x],d);
			else s[x]=max(s[x],max(d-(360-i),d-(i-(c-1))));
		}
	}
	int ans=1000;
	for(int i=0;i<360;i++)ans=min(ans,s[i]);
	printf("%d\n",ans);
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
#include <set>
#define rep(i,n) for (int i =0; i < (n); ++i)
using namespace std;
// 152a

int main() {
  int x,y;
  cin >> x >> y;
  int m = y / 2;
  cout << x + m << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

int main()
{
   int n;
  std::cin>>n;
  std::vector<mp::cpp_int> a(n);
  mp::cpp_int x = 1;
  for(int i=0;i<n;i++){
    std::cin>>a[i];
    if(a[i]==0){
      x=0;
    }
  }
  if(x==0){
    std::cout<<0<<std::endl;
  }else{
  for(int i=0;i<n;i++){
    x*=a[i];
    if(x>1000000000000000000){
      x=-1;
      break;
    }
  }
    std::cout<<x<<std::endl;
}
}

Measured memory_bytes: 6504
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in); 
    String x=sc.nextLine();
    String y=sc.nextLine();
    int n=x.length();
    int m=y.length();
    int dp[][]=new int[n+1][m+1];
    for(int i=0;i<=n;i++)
    dp[i][0]=0;
    for(int i=0;i<=m;i++)
    dp[0][i]=0;
    for(int i=1;i<=n;i++){
      for(int j=1;j<=m;j++){
        if(x.charAt(i-1)==y.charAt(j-1)){
          dp[i][j]=dp[i-1][j-1]+1;
        }
        else{
          dp[i][j]=Math.max(dp[i-1][j],
            dp[i][j-1]);
        }
      }
    }
    String rev="";
    int i=n,j=m;
    while(i!=0 && j!=0){
      if(x.charAt(i-1)==y.charAt(j-1)){
      rev+=x.charAt(i-1);
      i--;
      j--;
      }
      else{
        if(dp[i-1][j]>dp[i][j-1]){
          i--;
        }
        else{
          j--;
        }
      }
    }
    String ans="";
    for(i=rev.length()-1;i>=0;i--)
    ans+=rev.charAt(i);
    System.out.print(ans);
  }
}

Measured memory_bytes: 88716
mod = 10 ** 9 + 7  # mod素数
def nCr(n, r, mod):
  ret = [1]*(r+1)
  for i in range(1, r+1):
    ret[i] = (ret[i-1] * (n-i+1) * pow(i,mod-2,mod)) % mod
  return ret
    
X,Y=map(int,input().split())
x,y = 2*X-Y, 2*Y-X
if x<0 or y<0 or x%3!=0 or y%3!=0:
  ret=0
else:
  x,y=x//3,y//3
  nCrl = nCr(x+y, min(x,y), mod)
  ret=nCrl[min(x,y)]
print(ret)

Measured memory_bytes: 16256