akhauriyash/Code-Regression huggingface dataset:
N=int(input())
A=list(map(int, input().split()))

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

gcd_from_left = [0]*N # 自分のindexは含まないようなもの
gcd_from_right = [0]*N
 
for i in range(1,N):
  gcd_from_left[i] = gcd(A[i-1],gcd_from_left[i-1])
  gcd_from_right[N-1-i] = gcd(A[N-i],gcd_from_right[N-i])
  
ans = 0
 
for a,b in zip(gcd_from_left, gcd_from_right):
  x = gcd(a,b)
  if ans < x:
    ans = x
    
print(ans)

Measured memory_bytes: 86648
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5;
typedef long long ll;
const ll inf=10000000000000000LL;
ll a[maxn+5],s[maxn+5],odd[maxn+5],z[maxn+5];
ll pre[maxn+5],suf[maxn+5];
int n;
int main()
{

    cin>>n;
    for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
    for(int i=1;i<=n;++i)
    {
        s[i]=s[i-1]+a[i];
        odd[i]=odd[i-1]+(a[i]&1);
        z[i]=z[i-1]+(a[i]==0);
    }
    for(int i=1;i<=n;++i)
        if(a[i]==0) pre[i]=min(pre[i-1]+2,s[i]);
        else
            if(a[i]&1) pre[i]=pre[i-1]+1;
            else pre[i]=pre[i-1];
    for(int i=n;i>=1;--i)
        if(a[i]==0) suf[i]=min(suf[i+1]+2,s[n]-s[i]);
        else
            if(a[i]&1) suf[i]=suf[i+1]+1;
            else suf[i]=suf[i+1];
    ll ans=inf;
    ll mi=0;
    for(int i=1;i<=n;++i)
    {
        ans=min(ans,pre[i]+suf[i+1]);
        ans=min(ans,mi+i-odd[i]+suf[i+1]);
        mi=min(mi,odd[i]-i+pre[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 9600
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    そう甘くはないんだな〜w
*/

// from std...
use std::cmp::{
    max, min, Ordering,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::convert::TryInto;
use std::mem::swap;
use std::num::{NonZeroU32, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Div, DivAssign,
    Index, IndexMut, Mul, MulAssign, Neg, Rem, RemAssign, Shl, ShlAssign, Shr, ShrAssign, Sub,
    SubAssign,
};
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, multinomial, Integer};
use num_rational::Rational;
use num_traits::{clamp, one, pow, zero, Num, NumAssignOps, NumOps, One, Pow, Zero};
use permutohedron::Heap;
use proconio::{
    fastout, input, is_stdin_empty,
    marker::{Bytes, Chars, Isize1, Usize1},
};
use rand::random;

pub const MOD10E9_7: usize = 1000000007;
pub const MOD99_: usize = 998244353;
pub const MAX: usize = std::usize::MAX;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 65;

// code...
// #[fastout]
fn main() {
    input! {
        h: i64, n: usize,
        magic: [(i64, i64); n]
    }

    let mut dp = vec![MAX; 20005];
    dp[0] = 0;
    for damage in 1..dp.len() as i64 {
        for (a, b) in magic.iter() {
            if damage < *a || dp[damage as usize - *a as usize] == MAX {
                continue;
            } else {
                dp[damage as usize] = min(
                    dp[damage as usize],
                    dp[damage as usize - *a as usize] + *b as usize,
                );
            }
        }
    }

    let ans = *dp[h as usize..].iter().min().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 2232
#include<iostream>

using namespace std;

int main()
{
  int i;
  char s[6];
  
  for(i=0;i<6;i++){
    cin>>s[i];
  }
  
  if(s[2]==s[3]&&s[4]==s[5])
    cout<<"Yes";
  else
    cout<<"No";
}
    

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    cout << 180 * (n - 2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
#define _GLIBCXX_DEBUG
                    
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}


int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  int count = 0;
  bool check = false;
  rep(i, N) {
  int a, b; cin >> a >> b;
  if(a == b) count++;
  if(count == 3) {check = true; break;}
  if(a != b) count = 0;
  }
  
  if(check) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3616
#include <stdio.h>
#include <string.h>

int main(void){
    int N;
    scanf("%d", &N);

    int ans=0;

    if(N%2==0){
        ans = (N/2)-1;
    }
    else{
        ans = N/2;
    }
  
    printf("%d\n", ans);

    return 0;

}

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

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  vector<string> res(100);
  for (int i=0; i<100; ++i) {
    for (int j=0; j<100; ++j) {
      if (i < 50) res.at(i).push_back('#');
      else res.at(i).push_back('.');
    }
  }
  int h = 0, w = 0;
  for (int i=0; i<a-1; ++i) {
    res.at(h).at(w) = '.';
    w += 2;
    if (w == 100) {
      h += 2;
      w = 0;
    }
  }
  h = 51, w = 0;
  for (int i=0; i<b-1; ++i) {
    res.at(h).at(w) = '#';
    w += 2;
    if (w == 100) {
      h += 2;
      w =0;
    }
  }
  
  cout << 100 << ' ' << 100 << endl;
  for (int i=0; i<100; ++i) cout << res.at(i) << endl;
  return 0;
}


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

ll c[310][310],f[310][310],mod;
int n,m;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

inline ll pls(const ll &x,const ll &y) { return (x+y<mod)?x+y:x+y-mod; }
inline ll mns(const ll &x,const ll &y) { return (x-y<0)?x-y+mod:x-y; }
inline ll ksm(ll x,ll y) { ll res=1;for (;y;y>>=1,x=x*x%mod) if (y&1) res=res*x%mod;return res; }

inline void pre_gao()
{
	for (int i=0;i<=300;i++)
	{
		c[i][0]=1;
		for (int j=1;j<=i;j++) c[i][j]=pls(c[i-1][j-1],c[i-1][j]);
	}
}

int main()
{
	n=rd();m=rd();mod=rd();pre_gao();
	for (int i=0;i<=m;i++) f[1][i]=1;
	for (int i=2;i<=n+1;i++)
	{
		for (int j=1;j<i;j++)
		{
			ll now=0;
			for (int k=m;k;k--)
			{
				now=pls(now,f[i-j][k]);
				f[i][k-1]=pls(f[i][k-1],f[j][k-1]*c[i-2][i-j-1]%mod*now%mod);
			}
		}
	}
	printf("%lld\n",f[n+1][0]);
	return 0;
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    if( !((A*B*(A+B))%3) ) 
    {
        cout << "Possible\n";
    }
    else
    {
        cout << "Impossible\n";
    }

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
#define N 100010
#define NO !printf("-1\n")
typedef long long ll;
inline ll read(){
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,vis[N],t[N],x[N],y[N];
int d[N];
vector<pair<int,int> > G[N];
void dfs1(int u){
	vis[u]=1;
	for(auto qwq:G[u]){
		int v=qwq.first;
		if(vis[v])continue;
		t[qwq.second]=1;
		dfs1(v);
	}
}
void dfs2(int u,int fa){
	for(auto qwq:G[u]){
		int v=qwq.first;
		if(!t[qwq.second]||v==fa)continue;
		dfs2(v,u);
	}
	if(!fa)return;
	if(d[u]&1){
		++d[u];
		printf("%d %d\n",u,fa);
	}
	else{
		++d[fa];
		printf("%d %d\n",fa,u);
	}
}
int main(){
	n=read(),m=read();
	if(m&1)return NO;
	for(int i=1;i<=m;++i){
		int u=read(),v=read();
		G[u].emplace_back(v,i);
		G[v].emplace_back(u,i);
		x[i]=u,y[i]=v;
	}
	dfs1(1);
	for(int i=1;i<=m;++i){
		if(!t[i]){
			printf("%d %d\n",x[i],y[i]);
			++d[x[i]];
		}
	}
	dfs2(1,0);
	return 0;
}




Measured memory_bytes: 17444
import java.util.*;
public class Main {
    
  public static void main(String[] args) {
  	Scanner sc = new Scanner(System.in);
    // get a integer
    int N = sc.nextInt();
    int[] input = new int[N];
    for(int i=0; i<N ; i++){
      input[i] = sc.nextInt();
    }
    System.out.println(minCost(N, input));
  }
  
  public static int minCost(int N, int[] array) {
    int[] dp = new int[N];
    	dp[0] = 0;
    	dp[1] = Math.abs(array[0] - array[1]);
    	for (int i = 2; i < N; i++) {
      		dp[i] = Math.min(dp[i - 1] + Math.abs(array[i - 1] - array[i]),
          	dp[i - 2] + Math.abs(array[i - 2] - array[i]));
    	}
    return dp[N-1];
  }
}

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

int main(int argc, char *argv[]){
    constexpr int MAX_KEY = 1000, MAX_ALL = 4096;

    int N, M;
    std::cin >> N >> M;

    int a[MAX_KEY], d[MAX_KEY];
    int b, c;
    int i,j;
    for(i=0; i<M; ++i){
        std::cin >> a[i] >> b;
        d[i] = 0;
        for(j=0; j<b; ++j){
            std::cin >> c;
            d[i] |= 1<<(c-1);
        }
    }
    
    static int dp[MAX_KEY][MAX_ALL];
    int sup = std::numeric_limits<int>::max();
    for(i=0; i<MAX_KEY; ++i){
        for(j=0; j<MAX_ALL; ++j){
            dp[i][j] = sup;
        }
    }
    dp[0][0] = 0;
    dp[0][0|d[0]] = a[0];

    const int all = 1<<N;
    int tmp;
    for(i=1; i<M; ++i){
        for(j=0; j<all; ++j){
            dp[i][j] = dp[i-1][j];
        }
        for(j=0; j<all; ++j){
            dp[i][j|d[i]] = std::min(dp[i][j|d[i]], dp[i-1][j] < sup ? dp[i-1][j] + a[i] : sup);
        }
    }

    std::cout << (dp[M-1][all-1] < sup ? dp[M-1][all-1] : -1) << std::endl;

    return 0;
}


Measured memory_bytes: 16256
bingo = []
for i in range(3):
    bingo.append(list(map(int,input().split())))

N = int(input())
for i in range(N):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if bingo[j][k] == b:
                bingo[j][k] = 0
flag = False
for i in range(3):
    tmp = 0
    for j in range(3):
        tmp += bingo[i][j]
    if tmp == 0:
        flag = True
for j in range(3):
    tmp = 0
    for i in range(3):
        tmp += bingo[i][j]
    if tmp == 0:
        flag = True
if bingo[0][0] + bingo[1][1] + bingo[2][2] == 0:
    flag = True
if bingo[0][2] + bingo[1][1] + bingo[2][0] == 0:
    flag = True
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B) = explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));
$last = "";
$ary = array();
for($i=0;$i<$N;$i++) {
  $WA[]=trim(fgets(STDIN));
}
foreach($WA as $W) {
  if ($last != "") {
    if (substr($last,-1)!=substr($W,0,1)) {
      printf("No\n");
      exit;
    }
  }
  if (isset($ary[$W])) {
      printf("No\n");
      exit;
  }
  $ary[$W]=1;
  $last = $W;
}
printf("Yes\n");


Measured memory_bytes: 3828
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[s.size() - i - 1]) ans++;
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3652
// 0-1 knapsack
#include<iostream>
#include<cstring>
using namespace std;

const int INF = (1<<21);

int main(){
    int w[7] = {0, 2, 3, 5, 10, 12, 15};
    int c[7] = {0, 380, 550, 850, 1520, 1870, 2244};

    int dp[7][51] = {};
    for(int i = 0; i < 7; i++){
        for(int j = 1; j < 51; j++){
            dp[i][j] = INF;
        }
    }

    for(int i = 1; i < 7; i++){
        for(int j = 1; j <= 50; j++){
            if(w[i] > j)    dp[i][j] = dp[i-1][j];
            else            dp[i][j] = min(dp[i-1][j], dp[i][j-w[i]]+c[i]); 
        }
    }

    int kg;
    while(cin >> kg){
        if(kg == 0) break;
        cout << dp[6][kg/100] << endl;
    }

    return 0;
}


Measured memory_bytes: 3044
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;


signed main(){
    int n,k; cin >> n >> k;
    vector<Pll> v;
    rep(i,n){
        ll x,y; cin >> x >> y;
        v.pb({x,y});
    }
    sort(ALL(v));
    ll ans=-1;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ll x1=v[i].fi,x2=v[j].fi;
            vector<ll> vec;
            rep(l,n){
                if(v[i].fi<=v[l].fi && v[l].fi<=v[j].fi) vec.pb(v[l].se);
            }
            if(vec.size()<k) continue;
            sort(ALL(vec));
            ll dy=vec[k-1]-vec[0];
            for(int l=0;k-1+l<vec.size();l++){
                chmin(dy,vec[k-1+l]-vec[l]);
            }
            if(ans==-1) ans=(x2-x1)*dy;
            chmin(ans,(x2-x1)*dy);
        }
    }
    cout << ans << endl;
}



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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int n; cin >> n;
  int ans = 0, mi = 2e9;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    if (t < mi) ans++;
    mi = min(mi, t);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << endl
#define rep(i,n) for(int i=0; (i)<(n); ++(i))
#define rrep(i,n) for(int i=(n); (i)>0; --(i))
#define reps(i,s,n) for(int i=(s); (i)<(n); ++(i))
#define maxi(v) distance(v.begin(), max_element(v.begin(), v.end()))
#define mini(v) distance(v.begin(), min_element(v.begin(), v.end()))
#define lb(v,x) v[lower_bound(v.begin(), v.end(), x) - v.begin()]
#define ub(v,x) v[upper_bound(v.begin(), v.end(), x) - v.begin()]
template<class T> inline bool print(T& x){ cout << x << endl; return true; }
template<class T> inline bool print_(T& x){ cout << x << " "; return true; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
  }
const int INF = 1e9;
const ll llINF = 1LL<<60;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main(){
    int n, k; cin >> n >> k;
    vector<int> x(n); rep(i,n) cin >> x[i];
    int dist, ans=INF;
    rep(i,(n-k+1)){
      if(x[i+k-1]<=0) dist = abs(x[i]);
      else if(x[i]<0 && x[i+k-1]>0) dist = min(abs(x[i]), abs(x[i+k-1]))*2 + max(abs(x[i]), abs(x[i+k-1]));
      else if(x[i]>=0) dist = abs(x[i+k-1]);
      chmin(ans, dist);
    }
    cout << ans;
    
    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mems(a,x) memset(a,x,sizeof(a))
#define first fi
#define second se
using namespace std;
typedef long long ll;
const int mod=998244353,MS=105,N=3005;
ll inv(ll x){return x==1?x:(mod-mod/x)*inv(mod%x)%mod;}
ll inv(ll x,ll mod){return x==1?x:(mod-mod/x)*inv(mod%x,mod)%mod;}
ll qpow(ll a,ll n){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
ll qpow(ll a,ll n,ll mod){ll ans=1;while(n){if(n&1) ans=ans*a%mod;a=a*a%mod;n>>=1;}return ans;}
ll mul(ll a,ll b,ll mod){ll ans=0;while(b){if(b&1) ans=(ans+a)%mod;a=(a+a)%mod;b>>=1;};return ans;}
struct vec
{
    double x,y;
    vec(double x=0,double y=0):x(x),y(y){}
    vec operator+(const vec&o)const{ return vec(x+o.x,y+o.y);}
    vec operator-(const vec&o)const{ return vec(x-o.x,y-o.y);}
    double operator*(const vec&o)const{ return x*o.x+y*o.y;}
    double operator^(const vec&o)const{ return x*o.y-y*o.x;}
    vec operator/(const double&o)const{ return vec(x/o,y/o);}
    vec operator*(const double&o)const{ return vec(x*o,y*o);}
    void sc(){scanf("%lf%lf",&x,&y);}
    double len(){return sqrt(x*x+y*y);}
};
struct Mat
{
    ll a[MS][MS];
    int n,m;
    Mat(int n=0,int m=0):n(n),m(m) { mems(a,0);}
    Mat operator*(const Mat&B)const
    {
        Mat C(n,B.m);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=B.m;j++)
                for(int k=1;k<=m;k++)
                C.a[i][j]=(C.a[i][j]+a[i][k]*B.a[k][j])%mod;
        return C;
    }
};
int n,x,c[N][N];
ll dp[N][N<<1];
ll C(ll n,ll m)
{
    if(m==0||n==m) return 1;
    if(m==1) return n;
    if(c[n][m]) return c[n][m];
    return c[n][m]=(C(n-1,m-1)+C(n-1,m))%mod;
}
ll solve(int m)
{
    ll ans=0;
    for(int i=0;i<x;i++) (ans+=dp[m][i])%=mod;
    if((x&1)&&2*m>x) ans++;
    for(int i=x+1;i<2*m;i+=2)
    {
        int t=m-(i-(x-1)),s=i-(i-(x-1))*2;
        if(t>=0&&s>=0)
            (ans+=dp[t][s])%=mod;
    }
    return ans;
}
int main()
{
    scanf("%d%d",&n,&x);
    dp[0][0]=1;
    for(int i=0;i<n;i++)
        for(int j=i;j<=i*2;j++)
    {
        (dp[i+1][j+1]+=dp[i][j])%=mod;
        (dp[i+1][j+2]+=dp[i][j])%=mod;
    }
    ll ans=0;
    for(int i=0;i<=n;i++)
        ans=(ans+C(n,i)*solve(i))%mod;
    printf("%lld\n",ans);
}


Measured memory_bytes: 174848
#include <iostream>
using namespace std;
typedef long long ll;
ll f(ll x,ll y){
    ll i=0;
    while(1){
        if(x%2!=y%2)return i+1;
        i++;
        x/=2,y/=2;
    }
}
ll n;
int main(void){
    //cout<<f(4,8)<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            cout<<f(i,j)<<" ";
        }
        cout<<endl;
    }
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INFL = 1LL << 60;
const ll MOD = 1000000007;
const int INF = 1000000000;
const int MAX = 300000;
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 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;
    }
}

ll 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;
}

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    COMinit();
    ll mx = 0, mi = 0;
    for (int i = 0; i < N; i++) {
        if (i + 1 >= K) {
            mx += (A[i] * COM(i, K - 1)) % MOD;
            mx %= MOD;
        }
        if (i + K - 1 < N) {
            mi += (A[i] * COM(N - i - 1, K - 1)) % MOD;
            mi %= MOD;
        }
    }
    cout << (mx - mi + MOD) % MOD << endl;
}


Measured memory_bytes: 7680
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

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


int main(){
  ll k; cin >> k;
  
  queue<ll> q;
  
  for(ll i=1; i < 10; i++){
    q.push(i);
  }
  
  while(q.size() <= k){
    ll x = q.front();
    q.pop(); 
    k--;
    
    ll c = x % 10;
    
    if(c != 0){
      q.push(10*x + (c-1));
    }
    
    q.push(10*x + c);
    
    if(c != 9){
      q.push(10*x + (c+1));
    }
  }
  
  while(k != 1){
    q.pop();
    k--;
  }
  
  cout << q.front() << endl;
  
  
}

Measured memory_bytes: 3896
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

template<class T>
inline istream& operator >>( istream& s, vector<T>& v ) {
	for( size_t i = 0; i < v.size(); ++i ) { s >> v[i]; }
	return s;
}

template<class T>
inline ostream& operator <<( ostream& s, vector<T>& v ) {
	for( size_t i = 0; i < v.size(); ++i ) {
		if( i ) { s << ' '; }
		s << v[i];
	}
	return s;
}

int main() {
	ios_base::sync_with_stdio( false );

	int n;
	cin >> n;

	vector<int> a( n );
	for( int i = 0; i < n; ++i ) { a[i] = i+1; }

	do {
		cout << a << '\n';
	} while( next_permutation( a.begin(), a.end() ) );

	return 0;
}



Measured memory_bytes: 3216
n,m = map(int,input().split())
a=[]
b=[]
c=[]
d=[]
for i in range(n):
    a1,b1=map(int,input().split())
    a.append(a1)
    b.append(b1)
for i in range(m):
    c1,d1=map(int,input().split())
    c.append(c1)
    d.append(d1)
for i in range(n):
    min_len = 1000000000
    cnt = None
    for j in range(m):
        len = abs(c[j]-a[i])+abs(d[j]-b[i])
        if len < min_len:
            min_len=len
            cnt = j+1
    print(cnt)


Measured memory_bytes: 3064
n = int(input())
p = list(map(int, input().split()))

cnt = 0
last = -2

for i in range(n):
    if p[i] == i+1:
        if last == i-1:
            cnt += 0
            last = -2
        else:
            cnt += 1
            last = i
    else:
        last = -2

print(cnt)

Measured memory_bytes: 20580
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"gcc
  int H, M, H2, M2, K;
  cin >> H >> M >> H2 >> M2 >> K;
  int start = 60 * H + M;
  int end = 60 * H2 + M2;
  cout << end - start - K << endl;
}

Measured memory_bytes: 3668
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()-1
    ans=""
    while 1:
        if n<=25:
            ans += chr(97 + n)
            break
        r=n%26
        ans+=chr(97+r)
        n//=26
        n-=1
    print(ans[::-1])

main()

Measured memory_bytes: 9212
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Text;


public class Program{
    public static void Main(){
        TextReader reader;
        string filename="";
                if(filename.Length!=0){
            reader = new StreamReader(filename);
        }else{
            reader = Console.In;
        }
        var odd = reader.ReadLine();
        var even = reader.ReadLine();
        //var sb = new StringBuilder();
        string ans="";
        //長さが異なるときは必ず奇数のやつが多い
        for(int i=0; i<even.Length; i++){
            ans+=odd[i];
            ans+=even[i];
        }
        if(odd.Length==even.Length+1){
            ans+=odd.ToCharArray().Last();
        }
        Console.WriteLine(ans);
    }

    public static void Func(string a, string b ){

    }

}


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

const int max_V = 100010;
const ll INF = 1e+13;
vector<P> G[max_V];
ll dist[max_V];
bool seen[max_V];

void dijkstra(int r)
{
    priority_queue<P, vector<P>, greater<P>> que;
    dist[r] = 0;
    que.push(P(0, r));

    while (!que.empty())
    {
        int from, cost;
        tie(cost, from) = que.top();
        que.pop();
        seen[from] = true;

        for (P e : G[from])
        {
            int target, d;
            tie(target, d) = e;
            // すでに確定済みであれば無視
            if (seen[target])
                continue;
            // 更新する必要がなければ無視
            if (dist[target] < dist[from] + d)
                continue;

            dist[target] = dist[from] + d;
            que.push(P(dist[target], target));
        }
    }
}

int main()
{
    int V, E, r;
    cin >> V >> E >> r;
    for (int i = 0; i < E; i++)
    {
        int from, to, d;
        cin >> from >> to >> d;
        G[from].push_back(P(to, d));
    }

    // dijkstra
    fill_n(dist, V, INF);
    fill_n(seen, V, false);
    dijkstra(r);

    for (int i = 0; i < V; i++)
    {
        if (dist[i] == INF)
        {
            cout << "INF" << endl;
        }
        else
        {

            cout << dist[i] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 13524
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll
#define F first
#define S second

const int N = 1e5 + 10;
vector<pair<int, int>> g[2 * N];
vector<int> comp;
bool used[2 * N];
int res[2 * N];
void dfs(int v) {
	comp.pb(v);
	used[v] = true;
	for (auto u : g[v]) {
		if (!used[u.F]) {
			res[u.F] = u.S - res[v];
			dfs(u.F);
		}
	}
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<pair<int, int>, int>> vl;
	for (int i = 0; i < k; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		g[a].pb({n + b, c});
		g[n + b].pb({a, c});
		vl.pb(make_pair(make_pair(a, b), c));
	}
	for (int i = 1; i <= n + m; i++) {
		if (!used[i]) {
			comp = {};
			dfs(i);
			int mn1 = 1e9, mn2 = 1e9;
			for (int v : comp) {
				if (v <= n) {
					mn1 = min(mn1, res[v]);
				}
				else {
					mn2 = min(mn2, res[v]);
				}
			}
			if (mn1 + mn2 < 0) {
				cout << "No\n";
				exit(0);
			}
		}
	}
	for (auto it : vl) {
		if (res[it.F.F] + res[it.F.S + n] != it.S) {
			cout << "No\n";
			exit(0);
		}
	}
	cout << "Yes\n";
}

Measured memory_bytes: 20784
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int msb(int x) { return 31 - __builtin_clz(x); }

int main() {
  int N; std::cin >> N;
  std::map<int,int> m;
  for(int i = 0; i < N; ++i) { int A; std::cin >> A; ++m[A]; }
  std::vector<std::pair<int,int>> v(m.begin(), m.end());
  int ans = 0;
  for(int j = v.size()-1; j >= 0; --j) {
    if(v[j].second < 1) continue;
    int val = v[j].first;
    int x = (1 << msb(val)+1) - val;
    if(val == x) { ans += v[j].second/2; continue; }
    int i = std::partition_point(v.begin(), v.end(),
              [&](auto const& p) { return p.first < x;}) - v.begin();
    if(i >= j) continue;
    if(v[i].first != x) continue;
    int n = std::min(v[j].second, v[i].second);
    ans += n;
    v[i].second -= n;
  }
  fin(ans);
  return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef pair<int,int> P;
int N,M,K;
vector<P> G[2000];
bool vis[2000];
int dp[2001][2][2],ndp[2001][2][2];		//k,prev,fst
int NO=-1e9;
void dfs(int v,int p,int c){
	if(p<0){
		rep(i,K+1) ndp[i][0][0]=dp[i][0][0];
		rep(i,K) ndp[i+1][1][1]=dp[i][0][0];
	}else if(vis[v]){
		rep(k,K+1){
			rep(prev,2) rep(fst,2){
				if(dp[k][prev][fst]==NO) continue;
				int ad=0;
				if(fst&&prev) ad=c;
				if(ad!=NO) chmax(ndp[k][0][0],dp[k][prev][fst]+ad);
			}
		}
	}else{
		rep(k,K+1) rep(prev,2) rep(fst,2){
			if(dp[k][prev][fst]==NO) continue;
			rep(pt,2){
				int ad=0;
				if(pt&&prev) ad=c;
				if(k+pt<=K&&ad!=NO) chmax(ndp[k+pt][pt][fst],dp[k][prev][fst]+ad);
			}
		}
	}
	rep(i,K+1) rep(j,2) rep(k,2) dp[i][j][k]=ndp[i][j][k],ndp[i][j][k]=NO;
	if(vis[v]) return;
	vis[v]=1;
	int u=-1,nc=0;
	for(P pi:G[v]) if(pi.fs!=p) u=pi.fs,nc=pi.sc;
	if(u<0){
		rep(k,K+1) rep(a,2) rep(b,2) chmax(dp[k][0][0],dp[k][a][b]);
		return;
	}
	dfs(u,v,nc);
}
int dfs1(int v,int p,int r){
	if(G[v].size()==1) return v;
	if(v==r&&p>=0) return v;
	int u;
	for(P pi:G[v]) if(pi.fs!=p) u=pi.fs;
	return dfs1(u,v,r);
}
int st(int v){
	if(G[v].size()<=1) return v;
	return dfs1(v,-1,G[v][0].fs);
}
int main(){
	cin>>N>>M>>K;
	rep(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		if(c==0) c=NO;
		G[a].pb(P(b,c));
		G[b].pb(P(a,c));
	}
	rep(i,K+1) rep(j,2) rep(k,2) dp[i][j][k]=ndp[i][j][k]=NO;
	dp[0][0][0]=0;
	rep(i,N) if(!vis[i]){
		int v=st(i);
		dfs(v,-1,0);
//		show(v);
//		rep(k,K+1) show(dp[k][0][0]);
	}
	int ans=dp[K][0][0];
	if(ans==NO) puts("Impossible");
	else cout<<ans<<endl;
}

Measured memory_bytes: 3284
using System;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var str1 = ReadLine();
        var str2 = ReadLine();
        var chara1 = new string[str1.Length];
        var chara2 = new string[str2.Length];
        for(var i = 0; i < str1.Length + str2.Length; i++)
        {
            if (i < str1.Length) chara1[i] = str1.Substring(i, 1);
            else chara2[i - str1.Length] = str2.Substring(i - str1.Length, 1);
        }
        str1 = "";
        str2 = "";
        Array.Sort(chara1);
        Array.Sort(chara2);
        for(var i = 0; i < chara1.Length + chara2.Length; i++)
        {
            if (i < chara1.Length) str1 += chara1[i]; 
            else str2 += chara2[chara2.Length - 1 - i + chara1.Length]; 
        }
        var s = new[] { str1, str2 };
        Array.Sort(s);
        var result = s[0] == str1 ? "Yes" : "No";
        if (str1 == str2) result = "No";
        WriteLine(result);
    }
}



Measured memory_bytes: 13280
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    int N, X;
    cin >> N >> X;
    int m;
    int mincost = 100000;
    for (int i = 0; i < N; i++)
    {
        cin >> m;
        X -= m;
        mincost = min(mincost, m);
    }
    cout << N + X / mincost << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  int a[101];
  for(int i=1; i<=n; i++)
    cin >> a[i];
  
  for(int k=1; k<=n-1; k++){
  	for(int j=n-1; j>=k; j--){
      int swap;
      if(a[j]>=a[j+1])
        continue;
      else{
        swap=a[j];
        a[j]=a[j+1];
        a[j+1]=swap;
      }
    }
  }
  
  int sum=0;
  for(int l=1; l<=n; l++){
    if(l%2 == 1)
      sum += a[l];
    else
      sum -= a[l];
  }
  cout << sum << endl;
}
    

Measured memory_bytes: 256
import itertools
X = int(input())
P = tuple(map(int, input().split(" ")))
Q = tuple(map(int, input().split(" ")))
comb = list(itertools.permutations(range(1, X+1),X))
a = comb.index(P)
b = comb.index(Q)
print(abs(a-b))

Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    long long int sum=0;
    for(long long int i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        {
            sum+=i;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<numeric>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

lli comb(lli m, lli r){
	lli ret = 1;
	for(lli i = 1; i<=r; i++) ret = ret * (m-r+i) / i;
	return ret;
}

int main(void){
	int n, a, b;
	cin >> n >> a >> b;
	vector<lli> v(n);
	rep(i, n) cin >> v[i];
	sort(v.begin(), v.end());
	
	lli sl=0; double sd=0;
	lli c=0;
	reg(i, a, b){
		lli tsl = 0; double tsd = 0;
		reg(j, n-i, n-1){
			tsl += v[j]/i;
			tsd += double(v[j]%i)/i;
		}
		tsl += int(tsd+1e-10); tsd -= int(tsd+1e-10);
		if(tsd < 1e-10) tsd = 0;
		if(sl < tsl || (sl==tsl && sd+1e-10<tsd)){
			c = 0;
			sl = tsl; sd = tsd;
		}
		if(sl < tsl || (sl==tsl && sd<=tsd)){
			lli m = count(v.begin(), v.end(), v[n-i]);
			lli r = count(v.begin()+n-i, v.end(), v[n-i]);
			c += comb(m, r);
		}
	}
	
	if(sl/10 == 0) printf("%0.6f\n%lld\n", (sl%10)+sd, c);
	else printf("%lld%0.6f\n%lld\n", sl/10, (sl%10)+sd, c);

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int N = int.Parse(Console.ReadLine());
    int[] cards = Console.ReadLine().Split(' ').Select(int.Parse).OrderByDescending(x => x).ToArray();
    int Alice = 0, Bob = 0;
    for (int i = 0; i < N; i++) {
      if (i % 2 == 0) { // Alice
        Alice += cards[i];
      } else { // Bob
        Bob += cards[i];
      }
    }
    Console.WriteLine(Alice-Bob);
  }
}


Measured memory_bytes: 13396
fn main() {
    let n = read::<usize>();
    let s = read::<String>().chars().collect::<Vec<_>>();
    let mut max = 0;
    let mut x = 0;
    for c in s {
        if c == 'I' {
            x += 1;
            max = std::cmp::max(x, max);
        } else if c == 'D' {
            x -= 1;
        }
    }
    println!("{}", max);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
a, b, k = map(int, input().split())
x = []
lx = b-a+1
if k <= lx//2:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
else:
    for i in range(a, b+1):
        print(i)


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    for (int i = 0; i < H; i++) {
        cin >> S[i];
    }

    int dh[4] = {-1, 1, 0, 0};
    int dw[4] = {0, 0, -1, 1};
    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (S[h][w] != '#')
                continue;

            bool ok = false;
            for (int i = 0; i < 4; i++) {
                int nh = h + dh[i];
                int nw = w + dw[i];
                if (0 <= nh && nh < H && 0 <= nw && nw < W && S[nh][nw] == '#') {
                    ok = true;
                }
            }
            if (!ok) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using vvll = vector<vll>;
const double EPS = 1e-9;
const long long MOD=1e9+7;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define SZ(x) ((int)(x).size())
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; }

using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
ll n; 
double dfs(vvvd &dp, ll n1, ll n2, ll n3){
  if(n1==0 && n2==0 && n3==0) return 0.0;
  if(dp[n1][n2][n3] >= 0.0){
    return dp[n1][n2][n3];
  }
  double expect = (double)n / (n1+n2+n3);
  if(n1 > 0){
    expect += dfs(dp, n1-1, n2, n3) * (double)n1/(n1+n2+n3);
  }
  if(n2 > 0){
    expect += dfs(dp, n1+1, n2-1, n3) * (double)n2/(n1+n2+n3);
  }
  if(n3 > 0){
    expect += dfs(dp, n1, n2+1, n3-1) * (double)n3/(n1+n2+n3);
  }
  return dp[n1][n2][n3] = expect;
}
int main(){
  cin>>n;
  vll a(n); rep(i,n) cin>>a[i];
  double p=1.0/n;
  ll n1,n2,n3; n1=n2=n3=0;
  rep(i,n){
    if(a[i]==1) n1++;
    else if(a[i]==2) n2++;
    else if(a[i]==3) n3++;
  }
  vvvd dp(n+1,vvd(n+1,vd(n+1,-1)));
  double ans = dfs(dp,n1,n2,n3);
  cout<< fixed << setprecision(10)<< ans<<endl;
}

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


using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define DOUBLE fixed << setprecision(10)
#define fi first
#define se second
const double pi = acos(-1.0);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef vector<P> vP;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };
template <typename T>
bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
};
template <typename T>
bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
};
void Pvll(vll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) cout << v[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}
void Pvvll(vvll v) {
	cout << "------------------------------------------------\n";
	rep(i, v.size()) {
		rep(j, v[i].size()) {
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Ps(string s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) cout << s[i] << " ";
	cout << endl;
	cout << "------------------------------------------------\n";
}

void Pvs(vs s) {
	cout << "------------------------------------------------\n";
	rep(i, s.size()) {
		rep(j, s[i].size()) {
			cout << s[i][j] << " ";
		}
		cout << endl;
	}
	cout << "------------------------------------------------\n";
}

void Yes(bool x) {
	if (x) cout << "Yes\n";
	else cout << "No\n";
}

void YES(bool x) {
	if (x) cout << "YES\n";
	else cout << "NO\n";
}

void yes(bool x) {
	if (x) cout << "yes\n";
	else cout << "no\n";
}

void Yay(bool x) {
	if (x) cout << "Yay!\n";
	else cout << ":(\n";
}

ll gcd(ll m, ll n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	// ユークリッドの方法
	while (m != n)
	{
		if (m > n) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

ll lcm(ll m, ll n)
{
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;

	return (((m*n) / gcd(m, n))); // lcm = m * n / gcd(m,n)
}//lcm

ll  n, m, r, l, k, h, ans = 0, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s,t;

void INIT() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << DOUBLE;
}

int main() {
	INIT();
	cin >> n;
	ll x3 = ((ll)1e9 - n % (ll)1e9) % (ll)1e9;
	ll y3 = (n + x3) / 1e9;
	cout << "0 0 " << (ll)1e9 << " 1 " << x3 << " " << y3 << endl;


	return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
if k > 2:
    if k % 2 == 0:
        a = n//(k//2)
        if a % 2 == 0:
            print(2*((a//2)**3))
        else:
            print(((a//2)**3)+(((a//2)+1)**3))
    else:
        print((n//k)**3)
elif k == 2:
    if n % 2 == 0:
        print(2*((n//2)**3))
    else:
        print(((n//2)**3)+(((n//2)+1)**3))
else:
    print(n**3)

Measured memory_bytes: 9156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            while(true){
                int n = Integer.parseInt(reader.readLine());
                if(n == 0){
                    break;
                }
                String line = reader.readLine();
                String[] s = line.split(" ");
                double sum1 = 0;
                for(int i = 0; i < n; i++){
                    sum1 += Double.parseDouble(s[i]);
                }
                double ave = sum1 / n;
                double sum2=0;
                for(int i = 0; i < n; i ++){
                    sum2 += (Double.parseDouble(s[i])-ave)*(Double.parseDouble(s[i])-ave);
                }
                double sigma = Math.sqrt(sum2/n);
                System.out.printf("%.8f\n",sigma);
            }
        }catch(IOException e){

        }
    }
}


Measured memory_bytes: 26512
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

const int N = 2e5 + 5;

typedef class dp_t {
	public:
		int v0, p1, p2, a;

		dp_t() {	}
		dp_t(int v0, int p1, int p2, int a) : v0(v0), p1(p1), p2(p2), a(a) {	}

		int eval(int x, int na) {
#define calc(xls, fold) ((fold) + (xls > x) + (a - xls < na - x))
			int rt = calc(0, v0);
			if (p1 <= a)
				rt = min(rt, calc(p1, v0 - 1));
			if (p2 <= a)
				rt = min(rt, calc(p2, v0 - 2));
			return rt;
		}
		dp_t trans(int na) {
			dp_t rt (0, 0, 0, na);
			rt.v0 = eval(0, na);
			int l = 0, r = na, mid;
			while (l <= r) {
				mid = (l + r) >> 1;
				if (eval(mid, na) == rt.v0) {
					l = mid + 1;
				} else {
					r = mid - 1;
				}
			}
			rt.p1 = l;
			r = na;
			while (l <= r) {
				mid = (l + r) >> 1;
				if (eval(mid, na) == rt.v0 - 1) {
					l = mid + 1;
				} else {
					r = mid - 1;
				}
			}
			rt.p2 = l;
			return rt;
		}
} dp_t;

int n;
int a[N];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	dp_t f (0, 1, 1, 0);
	for (int i = 1; i <= n; i++)
		f = f.trans(a[i]);
	f = f.trans(0);
	printf("%d\n", f.v0);
	return 0;
}


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

int main(){
  int N, M; // N:都市の数　M:道路の数
  cin >> N >> M;
  vector<int> num(N, 0);

  int a, b;
  for(int i = 0; i < M; i++){
    cin >> a >> b;
    // 道路の数を加算
    num.at(a - 1)++;
    num.at(b - 1)++;
  }

  // 各都市の道路の数を表示
  for(int i = 0; i < N; i++){
    cout << num.at(i) << endl;
  }
}


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

using namespace std;
int main(){
	char c;
	cin>>c;
	if(c=='A')cout<<'T';
	else if(c=='C')cout<<'G';
	else if(c=='T')cout<<'A';
	else if(c=='G')cout<<'C';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include<iomanip>
    using namespace std;
    void first()
    {
        cin.tie(0);
        cin.sync_with_stdio(0);
    }

    int main()
    {
        first();
        int k ;cin >> k;
        int a,b ;
        cin >> a >> b ;
        for(int i  = a ; i<=b ; i++){
            if(i%k==0){
                cout << "OK";
                return 0;
            }

        }
        cout << "NG";
    }






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

const int INF = 1000000007;
const int MOD = 1000000007;


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

const int PRC = 20;

double dp[100001][PRC + 1];
double e[100001];

int main(){
    for(int i = 0; i <= 100000; i++){
        fill(dp[i], dp[i] + PRC + 1, 0);
    }
    dp[0][0] = 1;
    for(int i = 0; i < 100000; i++){
        for(int j = 0; j < PRC; j++){
            dp[i + 1][j + 1] += dp[i][j] / pow(2, j);
            dp[i + 1][0] += dp[i][j] * (1 - 1 / pow(2, j));
        }
    }
    e[0] = 0;
    for(int i = 1; i <= 100000; i++){
        e[i] = e[i-1];
        for(int j = 0; j < PRC; j++){
            e[i] += dp[i-1][j] / pow(2, j);
        }
    }
    while(true){
        int n;
        scanf("%d", &n);
        if(n == 0) break;
        printf("%.12f\n", e[n]);
    }
    return 0;
}

Measured memory_bytes: 18448