akhauriyash/Code-Regression huggingface dataset:
//Badwaper gg
#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-6
#define mp make_pair
#define pb push_back
#define re register ll
#define fr first
#define sd second
#define FOR(i,a,b) for(re i=a;i<=b;i++)
#define REP(i,a,b) for(re i=a;i>=b;i--)
#define lowbit(x) (x&(-x))
#define Z(x) (x>=mod?x-mod:x)
#define N 41
#define M 200010
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline ll read()
{
	char ch=getchar();
	ll s=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){s=s*10+ch-'0';ch=getchar();}
	return s*w;
}
const int mod=1e9+7;
int f[N][M],to[M][N];
int n,x,y,z;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),x=read(),y=read(),z=read();y+=x;z+=y;
	FOR(S,1,1<<z)FOR(i,1,10)
	{
		to[S][i]=1;
		FOR(k,0,z-i)if((S>>k)&1)if(!(k<x&&k+i>x)&&!(k<y&&k+i>y))to[S][i]|=(1<<(i+k));
		if((S==(1<<z))||(to[S][i]>=(1<<z)))to[S][i]=1<<z;
	}
	f[0][1]=1;
	FOR(i,0,n-1)FOR(S,1,(1<<z))FOR(j,1,10)f[i+1][to[S][j]]=Z(f[i+1][to[S][j]]+f[i][S]);
	printf("%d\n",f[n][1<<z]);
	return 0;
}


Measured memory_bytes: 45388
import java.util.*;

public class Main{
  
  public static void main (String []args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    if (N == 1) { 
      System.out.println(1); return; 
    }
    
    int max = Integer.MIN_VALUE;
    for (int i = 2; i <= N; i++) {
      for (int j = 2; j <= N; j++ ){
        double pow = Math.pow((double)i, (double)j);
        if (pow > N) {
          break;
        }
        max = Math.max((int)pow, max);
      }
    }
    System.out.println(max);
  }
}
      

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  ll x;cin>>x;

  for(ll a=-300;a<=300;a++){
    for(ll b = -300; b<=300;b++){
      if(x==pow(a,5)-pow(b,5)){
        cout<<a<<' '<<b<<endl;
        return 0;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 3884
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
int main(){
	int n,x;cin>>n>>x;
	int d=0;int cnt=1;
	rep(i,n){
		int l=0;
		cin>>l;
		d+=l;
		if(d<=x)cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
S = input()
K = int(input())

# 2の5000兆乗はlog10をとると5000兆*log_10(2)となり明らかに10**18より大きいと分かる
# よってSを左から見て1以外の数値がK番目以内にあればそれが答え。そうでなければ1が答え

for i in range(K):
    if int(S[i]) != 1:
        print(int(S[i]))
        exit()
print(1)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define int long long

struct IoSetup {
    IoSetup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout <<fixed<<setprecision(12);
        cerr <<fixed<<setprecision(12);
    }
}IoSetup;

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int n, k;
vector<int> a;


signed main() {

    cin >> n >> k;
    a.resize(n);

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    sort(ALL(a), greater<int>());

    ll ans = 0;

    COMinit();

    for(int i = 0; i < n; i++) {
        ans += (COM(n-i-1, k-1) * a[i]) % SMOD;
        ans -= (COM(i, k-1) * a[i]) % SMOD;
        ans %= SMOD;
    }

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



Measured memory_bytes: 13056
def main():
    N = int(input())
    a = input().split()
    for i in range(N):
        a[i] = int(a[i])
    j = 1
    for i in range(N):
        if(j == a[i]):
            j += 1
    if j > 1:
        print(N-j+1)
    else:
        print(-1)
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 18332
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

const int N = 1e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
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> pii;
typedef pair <ll, ll> pll;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string s;
main() {
    file("stars");
    ios;
    cin >> s;
    if (s == "SUN") return !(cout << 7);
    if (s == "MON") return !(cout << 6);
    int ans;
    if (s == "TUE") ans=5;
    if (s == "WED") ans = 4;
    if (s == "THU") ans = 3;
    if (s == "FRI") ans = 2;
    if (s == "SAT") ans = 1;
    cout << ans;
    cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC;
    return 0;
}
/**

*/


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
use std::cmp::max;
use std::cmp;

fn main() {
    input!{
    	n: i32,
    	m: i32
    }
    let ans = cmp::max(n - 2*m,0);
    print!("{}",&ans);
}


Measured memory_bytes: 4352
def solve():
    ans = []
    def square(n, rest, limit):
        if rest == 0:
            print(*ans)
        else:
            for i in range(rest, 0, -1):
                if i > limit:
                    continue
                ans.append(i)
                square(n, rest - i, i)
                ans.pop()
    
    import sys
    for n in map(int, sys.stdin.readlines()):
        if n == 0:
            break
        square(n, n, n)

solve()


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

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E>> F;
  int water = F, salt = 0;
  for (int i = 0; i <= F; i += 100*A) {
    for (int j = 0; i+j <= F; j += 100*B) {
      if (i+j == 0) continue;
      for (int k = 0; i+j+k <= F; k += C) {
        for (int l = 0; i+j+k+l <= F; l += D) {
          if (E*(i+j)/100 < k+l) continue;
          if (salt*(i+j+k+l) <= (k+l)*(water+salt)) {
            water = i+j;
            salt = k+l;
          }
        }
      }
    }
  }
  cout << water + salt << " " << salt << endl;
}


Measured memory_bytes: 3640
from fractions import gcd


N=int(input())
A=list(map(int,input().split()))

total=0
left=[0]*(N+1)
right=[0]*(N+1)

for i in range(N):
    left[i+1]=gcd(left[i],A[i])
    right[N -i - 1] = gcd(right[N-i], A[N-1-i])

for i in range(N):
    total=max(total,gcd(left[i],right[i+1]))

print(total)

Measured memory_bytes: 16116
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

// (10進法での)桁数
int dignum10(ll n) {
  int res = 0;
  while(n>0) {
    res++;
    n /= 10;
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  int K = dignum10(N), c = N/pow(10, K-1), ans = 0;
  bool flag = false;
  for (int i=0; i<=16; i++) {
    if ((ll)(c+1)*pow(10, i)-1==N) {
      flag = true;
      break;
    }
  }
  if (flag) ans = c+9*(K-1);
  else ans = c+9*(K-1)-1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int Maxn = 500001;
#define For( i, j, k ) for( int i = j; i <= k; ++i ) 
using std::cin;
using std::cout;
char c[ Maxn ];
int n, nxt1[ Maxn ], nxt2[ Maxn ];
void KMP( int *nxt )
{
	nxt[ 0 ] = -1;
	For( i, 1, n )
	{
		int j = nxt[ i - 1 ];
		while( j > -1 && c[ i ] != c[ j + 1 ] )
			j = nxt[ j ];
		nxt[ i ] = j + 1;
	}
	return;
}

bool chkPre( int p ) { return nxt1[ p ] && p % ( p - nxt1[ p ] ) == 0; }
bool chkSuf( int p ) { return nxt2[ p ] && p % ( p - nxt2[ p ] ) == 0; }
bool chk( int p ) { return !chkPre( p ) && !chkSuf( n - p ); }
int main( )
{
	std::ios::sync_with_stdio( false );
	cin >> c + 1;
	n = strlen( c + 1 );
	KMP( nxt1 );
	std::reverse( c + 1, c + n + 1 );
	KMP( nxt2 );
	if( nxt1[ n ] && !( n % ( n - nxt1[ n ] ) ) )
	{
		if( nxt1[ n ] == n - 1 )
			cout << n << '\n' << 1;
		else
		{
			cout << 2 << '\n';
			int ans = 0;
			For( i, 1, n )
				ans += chk( i );
			cout << ans;
		}
	}
	else
		cout << 1 << '\n' << 1;
	return 0;
}

Measured memory_bytes: 8008
#include <iostream>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include<vector>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <climits>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
typedef long double ld;
using namespace std;

vector<int> sieve(ll n)
{
	vector<int> a(n+1,0);
	for(ll i=3;i<=n;i+=2)
	a[i]=1;
	for(ll i=3;i<=n;i+=2)
	{
       if(a[i]==1)
	   {
		   for(ll j=i*2;j<=n;j+=i)
		   a[j]=0;
	   }
	}
	a[2]=1;
	a[1]=a[0]=0;
	return a;
}
ll reverse(ll n)
{
	ll s=0;
	while(n>0)
	{
       ll t=n%10;
	   s=s*10+t;
	   n/=10;
	}
	return s;
}
int count_setbits(int N)

{ int cnt=0;

while(N>0)

{

cnt+=(N&1);

N=N>>1;

}

return cnt;

}
ll power(ll x, ll y)  
{  
    int res = 1;     // Initialize result  
  
    x = x % mod; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % mod;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % mod;  
    }  
    return res;  
}  

void BellmanFord(vector< vector<ll> > &graph, int V, int E, int src) 
{ 
    // Initialize distance of all vertices as infinite. 
    int dis[V]; 
    for (int i = 0; i < V; i++) 
        dis[i] = INT_MAX; 
  
    // initialize distance of source as 0 
    dis[src] = 0; 
  
    // Relax all edges |V| - 1 times. A simple 
    // shortest path from src to any other 
    // vertex can have at-most |V| - 1 edges 
    for (int i = 0; i < V - 1; i++) { 
  
        for (int j = 0; j < E; j++) { 
            if (dis[graph[j][0]] + graph[j][2] < 
                               dis[graph[j][1]]) 
                dis[graph[j][1]] =  
                  dis[graph[j][0]] + graph[j][2]; 
        } 
    } 
  
    // check for negative-weight cycles. 
    // The above step guarantees shortest 
    // distances if graph doesn't contain 
    // negative weight cycle.  If we get a 
    // shorter path, then there is a cycle. 
    for (int i = 0; i < E; i++) { 
        int x = graph[i][0]; 
        int y = graph[i][1]; 
        int weight = graph[i][2]; 
        if (dis[x] != INT_MAX && 
                   dis[x] + weight < dis[y]) 
            cout << "Graph contains negative"
                    " weight cycle"
                 << endl; 
    } 
  
    
} 

ll find_binary_rotated(vector<ll> &a,ll key)
{
 ll start=0;ll end=a.size()-1;
 while(start<=end)
 {
	 ll mid=(start+end)/2;
	 if(key==a[mid])
	 return mid;
	 else if(a[start]<=a[mid])
	 {
		 if(key>=a[start] && key<=a[mid])
		 end=mid-1;
		 else
		 {
			 start=mid+1;
		 }
		 
	 }
	 else
	 {
		 if(key>=a[mid] && key<=a[end])
		 start=mid+1;
		 else
		 {
			 end=mid-1;
		 }
		 
	 }
	 
 }
 return -1;
}



int main()
{
	
	ld a,b;cin>>a>>b;ll res=floor(a*b);
	cout<<res<<"\n";
return 0;

		

		

	


		

		
		
		

		
		
	
	
	


	
	
}

Measured memory_bytes: 3736
N=gets.to_i
aNs=gets.chomp.split.map(&:to_i)
bNs=gets.chomp.split.map(&:to_i)
sum = 0
N.times do |index|
  tempA = aNs[index]+aNs[index+1]
  diffTemp = tempA - bNs[index]
  if diffTemp == 0
    sum += bNs[index]
    aNs[index+1] = 0
  elsif diffTemp > 0
    sum += bNs[index] 
    aNs[index+1] = [diffTemp,aNs[index+1]].min 
  elsif diffTemp < 0
    sum += tempA
    aNs[index+1] = 0
  end
end
puts sum

Measured memory_bytes: 21780
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD=1000000007;
 
int main() {
  
  int a; cin>>a;
  int ans = a%1000;
  if (ans==0) cout << ans << endl;
  else
  cout<<1000-ans;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main(){
	ll stuff = 100000;
	ll x,y; cin>>x>>y;
	ll need = (x == 1 && y == 1) ? 400000 : 0;
	ll ans1 = ((4-x)*stuff);
	ll ans2 = (4-y)*stuff;
	if(ans1 <= 0 && ans2 <= 0) { cout<<0; return 0;}
	if(ans1 <=  0) {cout<<ans2<<"\n"; return 0;}
	if(ans2 <= 0) { cout<<ans1<<"\n";  return 0;}
	cout<<ans1+ans2+need<<"\n";
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a, b, c;
	char s1[105],s2[105],s3[105];
	char s,ss;
	s = 0;
	ss = 0;
	for (int i = 0; i < 105; i++){
		s1[i] = 0;
		s2[i] = 0;
		s3[i] = 0;
	}
	scanf("%s",s1);
	scanf("%s",s2);
	scanf("%s",s3);
	s = s1[0];
	a++;
	for (;;){
		if (s == 'a') {
			ss = s;
			s = s1[a];
			a++;
		}
		if (s == 'b') {
			ss = s;
			s = s2[b];
			b++;
		}
		if (s == 'c') {
			ss = s;
			s = s3[c];
			c++;
		}
		if (s == 0){
			printf("%c", ss-32);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include<algorithm>
#include <string>
#include<iomanip>
#include <string.h>
#include<stdlib.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 0;
    cin >> t;
    if(t == 1){
        cout << 0;
    }else{
        cout << 1;
    }

return 0;
}


Measured memory_bytes: 3636
#include<iostream>

using namespace std;

int main(){

  while(1){

    int data[15][15];
    char in;
    for(int i = 0; i < 15; i++){
      for(int j = 0; j < 15; j++){
	data[i][j] = 0;
      }
    }
    for(int i = 3; i < 11; i++){
      for(int j = 3; j < 11; j++){
	if(cin >> in){
	  if(in == '1'){
	    data[i][j] = 1;
	  }
	}else{
	  return 0;
	}
      }
    }
    int x,y,status = 0;
    
    for(int i = 3; i < 11; i++){
      for(int j = 3; j < 11; j++){
	if(data[i][j] == 1){
	  x = i;
	  y = j;
	  status = 1;
	  break;
	}
      }
      if(status == 1) break;
    }
    
    if(data[x+1][y] == 1 && data[x][y+1] && data[x+1][y+1]) cout << "A" <<endl;
    else if(data[x+1][y] == 1 && data[x+2][y] == 1 && data[x+3][y] == 1) cout << "B" <<endl;
    else if(data[x][y+1] ==1 && data[x][y+2] ==1 &&data[x][y+3] ==1) cout << "C" << endl;
    else if(data[x+1][y] ==1 && data[x+1][y-1] ==1 && data[x+2][y-1] ==1) cout << "D" << endl;
    else if(data[x][y+1] ==1 && data[x+1][y+1] ==1 && data[x+1][y+2] ==1) cout << "E" << endl;
    else if(data[x+1][y] ==1 && data[x+1][y+1] ==1 && data[x+2][y+1] ==1) cout << "F" << endl;
    else if(data[x][y+1] ==1 && data[x+1][y] ==1 && data[x+1][y-1] ==1) cout << "G" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
use std::io::{stdin, Read};

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut buf_iter = buf.split_whitespace();
    let bingo_seat = (0..9).map(|_| buf_iter.next().unwrap().parse::<i32>().unwrap()).collect::<Vec<i32>>();
    let n = buf_iter.next().unwrap().parse::<usize>().unwrap();
    let numbers = (0..n).map(|_| buf_iter.next().unwrap().parse::<i32>().unwrap()).collect::<Vec<i32>>();

    println!("{}", solve(bingo_seat, numbers));
}

fn solve(bingo_seat: Vec<i32>, numbers: Vec<i32>) -> String{
    let mut result = "No";
    let bool_array = bingo_seat.iter().map(|iter| numbers.contains(iter)).collect::<Vec<bool>>();
    // 縦横のビンゴ確認
    for counter in 0..3{
        if bool_array[counter * 3] && bool_array[counter * 3 + 1] && bool_array[counter * 3 + 2] {
            result = "Yes"
        } else if bool_array[counter] && bool_array[counter + 3] && bool_array[counter + 6]{
            result = "Yes"
        }
    }
    // 斜めのビンゴ確認
    if bool_array[0] && bool_array[4] && bool_array[8] {
        result = "Yes"
    } else if bool_array[2] && bool_array[4] && bool_array[6] {
        result = "Yes"
    }
    result.to_string()
}

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

int main()
{
    int n;
    int h[110];
    int largest_sofar=-999;
    int sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>h[i];
    for(int i=0;i<n;i++)
    {
        if(largest_sofar<=h[i])
        {
            sum++;
            largest_sofar=h[i];
        }
    }
    cout<<sum<<"\n";
    return 0;
}


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

//幅優先探索

int main(){
    int n, m; cin >> n >> m;
    vector<bool> b(n);
    for(int i = 0; i < n; i++){
        int in; cin >> in;
        b[i] = (bool)in;
    }
    vector<int> p(m);
    for(int i = 0; i < m; i++) cin >> p[i];
    vector<bool> g1;
    vector<bool> g2;
    for(int i = 0; i < m; i++){
        if(i % 2 == 0){
            for(int j = 0; j < p[i]; j++){
                g1.push_back(false);
                g2.push_back(true);
            }
        }else{
            for(int j = 0; j < p[i]; j++){
                g1.push_back(true);
                g2.push_back(false);
            }
        }
    }

    set<vector<bool> > used;
    queue<pair<vector<bool>, int> > q;
    q.push({b, 0});
    used.insert(b);
    
    while(!q.empty()){

        vector<bool> vec = q.front().first;
        int cost = q.front().second;
        q.pop();
        
        if(vec == g1 || vec == g2){
            cout << cost << endl;
            break;
        }

        for(int i = 0; i < n - 1; i++){
            vector<bool> nxt = vec;
            swap(nxt[i], nxt[i + 1]);
            if(used.find(nxt) == used.end()){
                used.insert(nxt);
                q.push({nxt, cost + 1});
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define SORTPairSecond(v, n) sort(v, v+n, pairCompareSecond);
// #define int long long    // %d=>%lld
#define pb push_back
#define INF 1000000007
#define llINF 1e17
#define EPS 1e-9
#define pi acos(-1)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
bool pairCompareSecond(const pii& firstEl, const pii& secondEl) {
    return firstEl.second > secondEl.second;
}

const int MAX_V = 50;
vector<int> G[MAX_V];
int V,E;
int s,t;

signed main(){

    scanf("%d%d",&V,&E);
    for(int i = 0;i < E;i++){
        scanf("%d%d",&s,&t);
        G[s-1].pb(t-1);
        G[t-1].pb(s-1);
    }

    for(int i = 0;i < V;i++){
        cout<< G[i].size()<< endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  long double a, b, x;
  cin >> a >> b >> x;
  // cout << b << " " << x << " " << a << endl;
  if (x < a * a * b / 2.0) {
    long double y = (2 * x) / (a * b);
    long double theta = atan(y / b) * 180.0 / M_PI;
    cout << fixed << setprecision(10) << 90.0 - theta << endl;
  } else {
    long double y = 2 * b - (2 * x) / (a * a);
    long double theta = atan(y / a) * 180 / M_PI;
    cout << fixed << setprecision(10) << theta << endl;
  }
  return 0;
}

Measured memory_bytes: 3828
inf = 10**10
import sys
input = sys.stdin.readline
from functools import reduce
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def gcd_list(numbers):
    return reduce(gcd,numbers)
def lcm(a,b):
  return a*b //gcd(a,b)
n,k = map(int,input().split())
a = list(map(int,input().split()))
d = gcd_list(a)
if k > max(a):
    print("IMPOSSIBLE")
else:
    if (max(a)-k)%d == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


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

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<pair<int, int>> group_S;
    int prev_num = S.at(0) == '0' ? 0 : 1;
    int cur_count = 1;
    for (int i = 1; i < S.size(); i++) {
        int cur_num = S.at(i) == '0' ? 0 : 1;
        if (cur_num == prev_num) cur_count += 1;
        else {
            group_S.emplace_back(prev_num, cur_count);
            prev_num = cur_num;
            cur_count = 1;
        }
    }
    group_S.emplace_back(prev_num, cur_count);

    int left = 0, right = 0;
    int num_group_zeros = 0;
    int cur_num_items = 0;
    int max_consecutive_ones = 0;
    for (int i = 0; i < group_S.size(); i++) {
        while (right < group_S.size() && (
            group_S.at(right).first == 1 || (num_group_zeros < K))) {
            pair<int, int> cur_group = group_S.at(right);
            if (cur_group.first == 0) num_group_zeros += 1;
            cur_num_items += cur_group.second;
            right += 1;
        }
        max_consecutive_ones = max(max_consecutive_ones, cur_num_items);
        pair<int, int> poped_group = group_S.at(i);
        if (poped_group.first == 0) num_group_zeros -= 1;
        cur_num_items -= poped_group.second;
    }
    cout << max_consecutive_ones << "\n";
}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n; cin >> n;
	ll s = 0;
	for(ll i = sqrt(n);i >= 1;i--){
		ll j = n / i;
		if(i * j == n){
			s = i + j - 2;
			break;
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
/*
ID: alec3
LANG: C++14
PROG: ttwo
*/

#include <bits/stdc++.h>

#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define FOR(i, a, b) for (int i = a; i < b; i++)

typedef long long ll;
typedef unsigned long long ull;

int pct(int x) { return __builtin_popcount(x); }

using namespace std;

ifstream fin("ttwo.in");
ofstream fout("ttwo.out");
int a[100000][3], dp[100000][3];

int main()
{
    io;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        for (int j = 0; j < 3; j++)
            cin >> a[i][j];
    }
    for (int j = 0; j < 3; j++)
        dp[0][j] = a[0][j];

    for (int i = 1; i < n; i++){
        for (int j = 0; j < 3; j++){
            int mx = 0;

            for (int k = 0; k < 3; k++){
                if (k != j)
                    mx = max(dp[i-1][k], mx);
                dp[i][j] = mx + a[i][j];
            }
        }
    }
    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});

    return 0;
}


Measured memory_bytes: 6000
using System;
    using System.Linq;
    using System.Collections.Generic;
     
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int rem; int num; int dividable;
            int max_dividable = 0;
            int output = 1;

            for(int i=1; i<=N; i++){
                num = i; dividable = 0;
                rem = num % 2;
                while(rem==0){
                    rem = num % 2;
                    num /= 2;
                    dividable += 1;
                }
                if(dividable>max_dividable){
                    max_dividable = dividable;
                    output = i;
                }
            }

            Console.WriteLine(output);
        }
    }

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

int main(){
    vector<queue<char>> s(3);
    for(int ix=0;ix<3;ix++){
        string tmp;
        cin >> tmp;
        for(int ixx=0;ixx<tmp.size();ixx++) s.at(ix).push(tmp.at(ixx));
    }
    char card;
    int turnplayer = 0;
    while(!s.at(turnplayer).empty()){
        card = s.at(turnplayer).front();
        s.at(turnplayer).pop();
        turnplayer = card - 'a';
    }
    if(turnplayer == 0) cout << "A" << endl;
    if(turnplayer == 1) cout << "B" << endl;
    if(turnplayer == 2) cout << "C" << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
double dp[3001][3001];
double solve(vector<double>&arr,int i,int x){
	if(x==0){
		return 1;
	}
	if(i==0){
		return 0;
	}
	if(dp[i][x] > -0.9){
		return dp[i][x];
	}
	return dp[i][x] = (arr[i] * solve(arr,i-1,x-1)) + ((1 - arr[i]) * solve(arr,i-1,x));
}
int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	vector<double>arr(n+1);
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	cout<<fixed<<setprecision(10)<<solve(arr,n,(n+1)/2)<<endl;
	return 0;
}

Measured memory_bytes: 74380
/* ***********************************************
Author        :dasinlsb
Created Time  :2018/6/2 0:56:02
File Name     :C:\dasin\mine.cpp
************************************************ */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
const int N=100005;
int n,ed,fir[N],f[N][3],deg[N],q[N],col[N],del[N];
char strc[N];
struct E{int v,nxt;}e[N*2];
void addedge(int x,int y){
  e[++ed].v=y;e[ed].nxt=fir[x];fir[x]=ed;
}
int delLeaf(){
  int i,h=0,t=-1,c=0;
  for(i=1;i<=n;++i)if(col[i]==1&&deg[i]<=1)q[++t]=i;
  for(;h<=t;){
    int x=q[h++];
    del[x]=1;++c;
    for(i=fir[x];i;i=e[i].nxt){
      --deg[e[i].v];
      if(deg[e[i].v]==1&&col[e[i].v]==1)q[++t]=e[i].v;
    }
  }
  return c;
}
void dp(int x,int y){
  for(int i=fir[x];i;i=e[i].nxt){
    int v=e[i].v;
    if(del[v]||v==y)continue;
    dp(v,x);
    if(f[v][1]>f[x][1])f[x][2]=f[x][1],f[x][1]=f[v][1];
    else if(f[v][1]>f[x][2])f[x][2]=f[v][1];
  }
  f[x][1]+=1-col[x];
  f[x][0]=f[x][1]+f[x][2];
}
int main(){
 // freopen("C:/dasin/aa.in","r",stdin);
  //freopen("C:/dasin/mine.out","w",stdout);
  int i,j;
  scanf("%d",&n); 
  for(i=1;i<n;++i){
    int x,y;scanf("%d%d",&x,&y);
    addedge(x,y);addedge(y,x);
    ++deg[x];++deg[y];
  }
  scanf("%s",strc+1);
  for(i=1;i<=n;++i)col[i]=strc[i]=='B';
  int rest=n-delLeaf();
  if(rest<=1)return printf("%d\n",rest),0;
  int ans=2*(rest-1);
  for(i=1;i<=n;++i)if(!del[i]){
    col[i]^=(deg[i]&1);
    ans+=1-col[i];
  }
  for(i=1;i<=n;++i)if(!del[i]){dp(i,0);break;}
  int res=0;
  for(i=1;i<=n;++i)if(!del[i])res=max(res,f[i][0]);
  ans-=res*2;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 10240
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
T = LS2()
s = len(S)
t = len(T)

ans = 10**5
for i in range(s-t+1):
    count = 0
    for j in range(t):
        if T[j] != S[i+j]:
            count += 1
    ans = min(ans,count)

print(ans)


Measured memory_bytes: 65288
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
#include <fstream>
#include <climits>
 
  using namespace std;
   
 
//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ

  typedef long long ll;
  typedef long double lld;
  typedef unsigned long long ull;
  // int INF = INT_MAX;
  ll mod = 1000000007;
  // lld PI = 3.141592653;



  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
     ll s;
     cin>>s;
     ll dp[s+1];
     if (s<=2){
      cout<<"0\n";
      return 0;
     }
     dp[3] = 1;
     for (int i = 4;i<=s;i++){
      dp[i] = 1;
      for (int j = 3; j<i-2;j++){
        dp[i] = (dp[i]+dp[j])%mod;
        // cout<<i<<" "<<j<<endl;
      }

     }
     cout<<dp[s]<<"\n";


}

Measured memory_bytes: 3148
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
int main()
{
    string s,t;
    cin >> s >> t;
    int n = t.size();
    bool ans = true;
    rep(i,n-1){
        if(s[i] != t[i]) ans = false;
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(){
    int n, z, w, c;
    cin >> n >> z >> w;
    vector<int> a;
    for(int i=0; i<n; i++){
        cin >> c;
        a.push_back(c);
    }
    if(n == 1){
        cout << int(abs(w-a[n-1])) << endl;
    }
    else{
        cout << int(max(abs(a[n-2]-a[n-1]), abs(w-a[n-1]))) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
inline int f(int n, vi s, int q, vi t) {
	int cnt = 0;
	rep(j, 0, q) {
		if (find(all(s), t[j]) != s.end()) ++cnt;
	}
	return cnt;
}
int main() {
	int n; cin >> n;
	unordered_set<int> ss; {ll t; rep(i, 0, n) {cin >> t; ss.emplace(t);}}
	vi s(all(ss));
	int q; cin >> q;
	vi t(q); rep(i, 0, q) cin >> t[i];
	P(f(len(s), s, q, t));
	return 0;
}

Measured memory_bytes: 5256
C=[list(map(int,input().split())) for _ in range(3)]
x=[0]*3
y=[0]*3
x[0]=0
y[0]=0

for i in range(3):
    y[i]=C[0][i]-x[0]
for i in range(3):
    x[i]=C[i][0]-y[0]
    
ans=True
for i in range(3):
    for j in range(3):
        if C[i][j]!=x[i]+y[j]: ans=False
print('Yes' if ans else 'No')

Measured memory_bytes: 9188
n=int(input())
a=[int(input())for i in range(n)]
total=sum(a)
ans=[]
for i in a:
    if i%10!=0:
        ans.append(i)
ans.sort()
if total%10!=0:
    print(total)
elif len(ans)!=0:
    print(total-ans[0])
else:
    print(0)

Measured memory_bytes: 3060
<?php
  list($w, $h, $n) = explode(" ", trim(fgets(STDIN)));

  $list = [0, 0, $w, 0, $h];
  for ($i=0; $i<$n; $i++) {
    list($x, $y, $a) = explode(" ", trim(fgets(STDIN)));
    if($a == 1) $list[$a] = max($x, $list[$a]);
    if($a == 2) $list[$a] = min($x, $list[$a]);
    if($a == 3) $list[$a] = max($y, $list[$a]);
    if($a == 4) $list[$a] = min($y, $list[$a]);
  }
  $x = $list[2] - $list[1];
  $y = $list[4] - $list[3];
  if($x <= 0 || $y <= 0) {
    echo "0";
  }else{
    echo $x * $y;
  }

Measured memory_bytes: 16176
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    char s[1000];
    int n, a=0, b=0, i;
    
    scanf("%s",s);
    n=strlen(s);
    
    for(i=2;i<n-1;i++){
        if(s[i]=='C') a++;
    }
    for(i=0;i<n;i++){
        if((s[i]<'a')||(s[i]>'z')) b++;
    }
    if((s[0]=='A')&&(a==1)&&(b==2)) printf("AC\n");
    else printf("WA\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>


int main()
{
	int n;
	std::cin >> n;
	for (int i = 1;i <= n;i++) {
		int x=i;
		if (i % 3 == 0) {
			std::cout << " " << i;
			continue;
		}
		else while (x) {
			if (x % 10 == 3) {
				std::cout << " " << i;
				break;
			}
			x /= 10;
		}
	}
	std::cout << std::endl;
	return 0;
}

Measured memory_bytes: 3084
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val lrd    = inputs(0).split(" ").map(_.toInt)
  val l = lrd(0)
  val r = lrd(1)
  val d = lrd(2)

  println(solve(l, r, d))

  def solve(l: Int, r: Int, d: Int): Int = {
    var ans = 0
    (l to r).foreach { i =>
      if (i % d == 0) {
        ans = ans  + 1
      }
    }
    ans
  }
}

Measured memory_bytes: 54772
#include<iostream>

using namespace std;

int main(){
	int N; cin >> N;
	int A[100];
	int count = 0;
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	int j = 0;
	bool flag = false;
	while (!flag){
		flag = true;
		for ( int i = N-1; i > j; i--){ 
			if (A[i] < A [i-1]){
				int tmp = A[i];
				A[i] = A[i-1];
				A[i-1] = tmp;
				count++;
				flag = false;
			}
		}
		j++;

	}
	for ( int i = 0; i < N; i++){
		cout << A[i] ;
		if(i != N-1){
			cout << " ";
		}
	}
	cout << endl;
	cout << count << endl;

	return 0;
}

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

constexpr int MOD = 1e9 + 7;
using fint64 = int_fast64_t;
template<fint64 MOD>
struct ModInt {
	fint64 x;
	ModInt():x(0){}
	ModInt(fint64 x):
		x(x>=0?x%MOD:(MOD-(-x)%MOD)%MOD)
		{}
	// 負号
	ModInt operator -() const{
		return ModInt(-x);
	}
	// 加算
	ModInt &operator +=(const ModInt &rhs){
		x+=rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator +(const ModInt &rhs) const{
		return ModInt(*this)+=rhs;
	}
	// 減算
	ModInt &operator -=(const ModInt &rhs){
		x+=MOD-rhs.x;
		if(x>=MOD) x-=MOD;
		return (*this);
	}
	ModInt operator -(const ModInt &rhs) const{
		return ModInt(*this)-=rhs;
	}
	// 乗算
	ModInt &operator *=(const ModInt &rhs){
		x*=rhs.x;
		if(x>=MOD) x%=MOD;
		return (*this);
	}
	ModInt operator *(const ModInt &rhs) const{
		return ModInt(*this)*=rhs;
	}
	// 除算
	ModInt &operator /=(const ModInt &rhs){
		(*this)*=rhs.inverse();
		return (*this);
	}
	ModInt operator /(const ModInt &rhs) const{
		return ModInt(*this)/=rhs;
	}
	// 等号
	bool operator ==(const ModInt &rhs){
		return x==rhs.x;
	}
	bool operator !=(const ModInt &rhs){
		return x!=rhs.x;
	}
	// 累乗
	ModInt pow(fint64 n) const{
		fint64 tmp=x;
		fint64 ret=1;
		while(n>0){
			if(n&1) ret=ret*tmp%MOD;
			tmp=tmp*tmp%MOD;
			n>>=1ll;
		}
		return ModInt(ret);
	}
	// 逆元
	ModInt inverse() const{
		fint64 a=x,b=MOD,s=1,t=0;
		while(b>0){
			fint64 u=a/b;
			a-=u*b;
			s-=u*t;
			swap(a,b);
			swap(s,t);
		}
		return ModInt(s);
	}
	// 入出力
	friend istream &operator >>(istream &lhs,ModInt<MOD> &rhs){
		fint64 x; lhs>>x;
		rhs=ModInt<MOD>(x);
		return lhs;
	}
	friend ostream &operator <<(ostream &lhs,const ModInt<MOD> &rhs){
		return lhs<<rhs.x;
	}
};
using mint = ModInt<MOD>;

mint dp[5010][5010];
int main() {
	int n; cin >> n;
	string s; cin >> s;
	dp[0][0] = 1;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j <= i; ++j) {
			if(j == 0) {
				dp[i + 1][j] += dp[i][j];
			} else {
				dp[i + 1][j - 1] += dp[i][j];
			}
			dp[i + 1][j + 1] += dp[i][j] * 2;
		}
	}
	mint d = 2;
	d = d.pow(s.size());
	cout << dp[n][s.size()] / d << '\n';
	return 0;
}

Measured memory_bytes: 196480
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var l float64
	fmt.Fscan(r, &l)

	tmp := l / 3
	ans := tmp * tmp * tmp

	fmt.Printf("%.9f\n", ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}


Measured memory_bytes: 640
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    sf(n);
    x = 1000*(n/500);
    n = n%500;
    x+= (n/5)*5;
    cout<<x<<endl;
    return 0;
}



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

namespace TYC
{
	typedef long long ll;
	const int N = 8005, M = 205, MAXN = 1 << 15 | 5, mod = 998244353, INV2 = (mod + 1) >> 1;

	int F[M][N], Fac[N], Inv[N], A[MAXN], B[MAXN], w[MAXN], rev[MAXN];

	inline int qpow(int x, int tim)
	{
		int ans = 1;
		for (; tim; tim >>= 1, x = (ll)x * x % mod)
			if (tim & 1)
				ans = (ll)ans * x % mod;
		return ans;
	}

	void init(const int n)
	{
		for (int i = 0; i < n; i++)
			rev[i] = (rev[i >> 1] >> 1) | ((i & 1) * (n >> 1));
		w[0] = 1, w[1] = qpow(3, (mod - 1) / n);
		for (int i = 2; i < n; i++)
			w[i] = (ll)w[i - 1] * w[1] % mod;
	}

	void NTT(int *a, const int n, const int type)
	{
		for (int i = 0; i < n; i++)
			if (i < rev[i])
				swap(a[i], a[rev[i]]);
		if (type)
			reverse(w + 1, w + n);
		for (int len = 1; len < n; len <<= 1)
			for (int i = 0; i < n; i += len << 1)
				for (int k = 0; k < len; k++)
				{
					int x = a[i + k], y = (ll)w[n / (len << 1) * k] * a[i + len + k] % mod;
					a[i + k] = (x + y) % mod;
					a[i + len + k] = (x - y + mod) % mod;
				}
		if (type)
		{
			reverse(w + 1, w + n);
			for (int i = 0, t = qpow(n, mod - 2); i < n; i++)
				a[i] = (ll)a[i] * t % mod;
		}
	}

	inline int C(const int x, const int y)
	{ return x < y ? 0 : (ll)Fac[x] * Inv[x - y] % mod * Inv[y] % mod; }

	void work()
	{
		int n, m;
		scanf("%d%d", &n, &m);
		int t = max(n++, m) + 2;
		Fac[0] = 1;
		for (int i = 1; i <= t; i++)
			Fac[i] = (ll)Fac[i - 1] * i % mod;
		Inv[t] = qpow(Fac[t], mod - 2);
		for (int i = t; i; i--)
			Inv[i - 1] = (ll)Inv[i] * i % mod;

		int len;
		for (len = 1; len < (n << 1); len <<= 1);
		init(len);
		F[0][0] = 1;
		for (int j = 1; j <= m; j++)
		{
			for (int i = 0; i < n; i++)
			{
				A[i] = (ll)F[j - 1][i] * Inv[i] % mod;	
				B[i] = Inv[i + 2];
			}
			B[0] = 0;
			memset(A + n, 0, sizeof(int[len - n]));
			memset(B + n, 0, sizeof(int[len - n]));
			NTT(A, len, 0);
			NTT(B, len, 0);
			for (int i = 0; i < len; i++)
				A[i] = (ll)A[i] * B[i] % mod;
			NTT(A, len, 1);
			for (int i = 0; i < n; i++)
				F[j][i] = (((ll)i * (i + 1) / 2 + 1) % mod * F[j - 1][i] % mod + (ll)A[i] * Fac[i + 2] % mod) % mod;
		}
		int ans = 0;
		for (int i = 0; i < n; i++)
			ans = (ans + (ll)F[m][i] * C(n - 1, i)) % mod;
		printf("%d\n", ans);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 10256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
ll N;
ll v[312345];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (int i = 0; i < 3 * N; ++i) cin >> v[i];

  priority_queue<ll, vector<ll>, greater<ll>> pq1;
  priority_queue<ll> pq2;

  ll sum1 = 0;
  ll sum2 = 0;
  for (int i = 0; i < N; ++i) {
    sum1 += v[i];
    pq1.push(v[i]);
  }

  for (int i = 2 * N; i < 3 * N; ++i) {
    sum2 += v[i];
    pq2.push(v[i]);
  }

  ll ret = sum1 - sum2;
  ll ss1[N + 1];
  ll ss2[N + 1];

  ss1[0] = sum1;
  for (int i = 0; i < N; ++i) {
    pq1.push(v[N + i]);
    ll psum = ss1[i];

    psum += v[N + i];
    psum -= pq1.top();
    pq1.pop();
    ss1[i + 1] = psum;
  }


  ss2[N] = sum2;
  for (int i = N - 1; i >= 0; --i) {
    pq2.push(v[N + i]);
    ll psum = ss2[i + 1];

    psum += v[N + i];
    psum -= pq2.top();
    
    pq2.pop();
    ss2[i] = psum;
  }

  for (int i = 0; i <= N; ++i) {
    ret = max(ret, ss1[i] - ss2[i]);
  }
  cout << ret << endl;
}


Measured memory_bytes: 5876
#include<iostream>
using namespace std;
int main()
{
	int k, a, b,judge = 0;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++)
		if (i % k == 0) {
			judge = 1;
			break;
		}
	if (judge) cout << "OK" << endl;
	else cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> parts_a(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_a[n];
  }
  sort(parts_a.begin(), parts_a.end());
  
  vector<int64_t> parts_b(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_b[n];
  }
  
  vector<int64_t> parts_c(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_c[n];
  }
  sort(parts_c.begin(), parts_c.end());
  
  int64_t result = 0;
  for (int64_t n = 0; n < N; ++n) {
    auto it = lower_bound(parts_a.begin(), parts_a.end(), parts_b[n]);
    int64_t num = (it - parts_a.begin());
    if (num == 0) continue;
    auto it2 = upper_bound(parts_c.begin(), parts_c.end(), parts_b[n]);
    result += num * (parts_c.end() - it2);
  }
  cout << result << endl;
  
  return 0;
}


Measured memory_bytes: 5616
N=int(input())
List=list(map(int,input().split()))
Flag=0
Counter=-1
Element=0
while Flag<1:
  while Element<N:
      if List[Element]%2==1:
        Flag=1
      List[Element]=List[Element]/2
      Element+=1
  Element=0
  Counter+=1
print(Counter)

Measured memory_bytes: 3064