akhauriyash/Code-Regression huggingface dataset:
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll<<61;
typedef pair<int, int> P;
typedef pair<P, int> PP;
typedef pair<int, PP> PPP;
typedef vector<int> vec;
typedef vector<vec>mat;
struct edge { int to; int to2; int cost; };

int x[100006];
int dbl[20][100006];

void disp(int h, int w) {
	rep(i, h) {
		rep(j, w) {
			if (j)cout << ' '; cout << dbl[i][j];
		}
		cout << endl;
	}
}

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> x[i];
	int l; cin >> l;
	rep(i, n) {
		dbl[0][i] = upper_bound(x, x + n, x[i] + l) - x-1;
	}
	for (int i = 1; i <= 19; i++) {
		rep(j, n) {
			if (dbl[i - 1][j] == n)dbl[i][j] = n;
			else dbl[i][j] = dbl[i - 1][dbl[i - 1][j]];
		}
	}

	int q; cin >> q;
	rep(X, q) {
		int a, b; cin >> a >> b;
		a--; b--;
		if (a > b)swap(a, b);
		int lb = -1, ub = n;
		while (ub - lb > 1) {
			int mi = (ub + lb) / 2;
			int pos = a;
			for (int i = 19; i >= 0; i--) {
				if ((1 << i)&mi) {
					pos = dbl[i][pos];
				}
			}
			if (pos >= b)ub = mi;
			else lb = mi;
		}
		cout << ub << endl;
	}
}


Measured memory_bytes: 17280
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

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

    vector<long long> d(100001, 0);

    for(long long i = 0; i < n; i++){
        long long D;
        cin >> D;
        d[D]++;
    }

    vector<long long> sum(100002, 0);

    for(long long i = 0; i < 100002; i++) sum[i+1] = sum[i] + d[i];

    long long cnt = 0;

    for(long long i = 2; i <= 100002; i++){
        if(sum[i] == n/2) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

odd_cnt = 0
multi_4 = 0
for i in range(n):
    if a[i] % 4 == 0:
        multi_4 += 1
    elif a[i] % 2 == 1:
        odd_cnt += 1

if multi_4 + odd_cnt == n:
    print("Yes" if multi_4 >= odd_cnt - 1 else "No")
else:
    print("Yes" if multi_4 >= odd_cnt else "No")

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using   namespace  std;
typedef  long long  ll;
typedef pair<ll,ll>pll;
typedef    double   db;

#define fi  first
#define se second
#define endl "\n"
#define pb(x)       push_back(x)
#define mp(a,b)  make_pair(a,b);
#define sz(a)  ((int)(a).size())
#define all(x) x.begin(),x.end()

#define ff(i,a,b) for(ll i=a;i<=b;++i)

#define de(a) cout << #a << " = " << a << endl;
#define dd(a) cout << #a << " = " << a << "  ";

#define mem(a,b)   memset(a,b,sizeof(a))
#define file freopen("in.txt","r",stdin)
#define jkl ios::sync_with_stdio(false);cin.tie(0);
#define list list2

const ll INF     =    0x3f3f3f3f;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const ll MOD     =   1e9+7;
const double eps =    1e-8;
const double PI=acos(-1.0);
/*************************************************/
ll ans=0;
int main() {
	int n;cin >> n;
	while(n) {
		if(n>=0&&n<=9) ans++;
		else if(n>=100&&n<=999) ans++;
		else if(n>=10000&&n<=99999) ans++;
		n--;
	}
	cout << ans << endl;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n,k; cin>>n>>k;
  
  if(k==0){
    cout<<n*n<<endl;
    return 0;
  }
  
  ll ans=0;
  ireps(i,k+1,n){
    ll div=n/i;
    ans+=div*(i-k);
    ll mod=n%i;
    if(mod>=k){
      // cout<<i<<' '<<mod<<endl;
      ans+=mod-k+1;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_L = 1000;
const int MAX_N = 100;
const int MAX_M = 100;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int lim, n, m, x;
pii secs[MAX_N], stds[MAX_M];
int dp0[3][MAX_L + 1], dp1[MAX_M + 1][MAX_L + 1];

/* subroutines */

/* main */

int main() {
  for (;;) {
    cin >> lim >> n >> m >> x;
    if (lim == 0) break;

    string name;
    for (int i = 0; i < n; i++)
      cin >> name >> secs[i].first >> secs[i].second;
    for (int i = 0; i < m; i++)
      cin >> name >> stds[i].first >> stds[i].second;

    memset(dp0, -1, sizeof(dp0));
    dp0[0][0] = 0;

    for (int i = 0; i < n; i++) {
      int &ei = secs[i].first, &si = secs[i].second;
      int maxl = lim - ei;
      for (int j = 1; j >= 0; j--)
	for (int l = 0; l <= maxl; l++)
	  if (dp0[j][l] >= 0 && dp0[j + 1][l + ei] < dp0[j][l] + si)
	    dp0[j + 1][l + ei] = dp0[j][l] + si;
    }

    for (int i = 1; i <= 2; i++)
      for (int l = 1; l <= lim; l++)
	if (dp0[i][l] < dp0[i][l - 1]) dp0[i][l] = dp0[i][l - 1];
    
    memset(dp1, -1, sizeof(dp1));
    dp1[0][0] = 0;

    for (int i = 0; i < m; i++) {
      int &ei = stds[i].first, &si = stds[i].second;
      int maxl = lim - ei;
      for (int j = m - 1; j >= 0; j--)
	for (int l = 0; l <= maxl; l++)
	  if (dp1[j][l] >= 0 && dp1[j + 1][l + ei] < dp1[j][l] + si)
	    dp1[j + 1][l + ei] = dp1[j][l] + si;
    }
    
    for (int i = 1; i <= m; i++)
      for (int l = 1; l <= lim; l++)
	if (dp1[i][l] < dp1[i][l - 1]) dp1[i][l] = dp1[i][l - 1];

    int maxsum = 0;

    for (int i = 1; i <= 2; i++)
      for (int j = x; j <= m; j++)
	for (int l = 0; l <= lim; l++)
	  if (dp0[i][l] >= 0 && dp1[j][lim - l] >= 0) {
	    int sum = dp0[i][l] + dp1[j][lim - l];
	    if (maxsum < sum) maxsum = sum;
	  }

    cout << maxsum << endl;
  }

  return 0;
}

Measured memory_bytes: 1620
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	int n;
	cin>>n;
	n=n%10;
	if(n==2 || n==4 || n==5|| n==7|| n==9)
		cout<<"hon";
	else if(n==0 || n==1 || n==6|| n==8)
		cout<<"pon";
	else
		cout<<"bon";
	return 0;
}	

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


int main(){
  int N,X;
  cin >> N >> X;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin >> L.at(i);
  }
  int D = 0;
  int ans = 0;
  for(int i=1;i<N+1;i++){
    D += L.at(i-1);
    if(D>X){
      ans = i;
      break;
    }
  }
  if(D<=X) ans = N+1;
  cout << ans << endl;
}



Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,a[3111];
vector<int>con[3111];
int dp[3111];
bool vis[3111];
void dfs(int x)
{
	vis[x]=1;
	dp[x]=0;
	for(int i=0;i<con[x].size();i++)
	{
		int u=con[x][i];
		if(a[x]>a[u])
		{
			if(!vis[u])dfs(u);
			dp[x]|=!dp[u];
		}
	}
}
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)geti(a[i]);
	for(int i=1;i<n;i++)
	{
		int x,y;
		getii(x,y);
		con[x].PB(y);
		con[y].PB(x);
	}
	for(int i=1;i<=n;i++)if(!vis[i])dfs(i);
	for(int i=1;i<=n;i++)if(dp[i])puti(i);
	return 0;
}

Measured memory_bytes: 512
<?php
//error_reporting(0);
$S = trim(fgets(STDIN));
$K = trim(fgets(STDIN));
//list($A,$B) = explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));
if ($K<strlen($S)) {
  $flg = 1;
  for($i=0;$i<$K;$i++) {
    //printf("i %d %s\n",$i,$S[$i]);
    if($S[$i]!="1") {
      $flg=0;break;
    }
  }
  if ($flg) {
    printf("1\n");
    exit;
  }
}
$s = str_replace("1","",$S);
if (strlen($s)==0) {
  printf("1\n");
  exit;
}
printf("%s\n",$s[0]);


Measured memory_bytes: 3828
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 101 B
 */
public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		int n = N;
		int S = 0;
		while (n > 0) {
			S += n % 10;
			n /= 10;
		}

		if (N % S == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21844
import itertools
import collections
from collections import Counter
n=int(input())
k=[]
t=0
for i in range(n):
    p=input()
    k.append(tuple(sorted(p)))
k=Counter(k)
v,c=zip(*k.most_common())
c=list(c)
for i in range(len(c)):
    n=c[i]
    t+=n*(n-1)/2
print(int(t))


Measured memory_bytes: 37480
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
using Graph = vector<vector<int>>;
using Graph_Wei = vector<vector<pair<int,int>>>;
using ll = long long;
const long long INF = 1LL<<60; // 仮想的な無限大の値
vector<bool> seen;

Graph G;


int a[4];
int main() {
    
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a2 - a1 == a3 - a2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
int w=0, h=0, x=0, y=0, r=0;
 
cin >>w >>h >>x >>y >>r;

if(0 <= x-r && x+r <= w &&
	0 <= y-r && y+r <= h)
{
	cout <<"Yes" <<endl;
}
else
{
	cout <<"No" <<endl;
}
 
return 0;
}

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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

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

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

string IntToString(int number) {
     stringstream ss;
     ss << number;
     return ss.str();
}


int main(){
    int n;
    cin >> n;
    int d = 0;
    for(int i=0; ; i++){
        string a = IntToString(n-i);
        string b = a;
        reverse(a.begin(), a.end());
        if(a == b){
            cout << a << endl;
            return 0;
        }
        a = IntToString(n+i);
        b = a;
        reverse(a.begin(), a.end());
        if(a == b){
            cout << a << endl;
            return 0;
        }
    }
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
        }
        int[] ans = new int[n + 1];
        for (int i = n; i >= 1; i--) {
            int sum = 0;
            for (int j = i; j <= n; j += i) {
                if (ans[j] == 1) {
                    sum++;
                }
            }
            if ((sum + a[i]) % 2 != 0) {
                ans[i] = 1;
            }
        }

        List<String> ball = new ArrayList<>();
        for (int i = 1; i < ans.length; i++) {
            if (ans[i] == 1) {
                ball.add(String.valueOf(i));
            }
        }
        System.out.println(ball.size());
        System.out.println(String.join(" ", ball));
    }

}


Measured memory_bytes: 93012
N=int(input())
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
ans=-1000000000
for i in range(1,1<<10):
    cnt=[0 for _ in range(N)]
    for j in range(10):
        if (i>>j)%2==1:
            for k in range(N):
                cnt[k]+=F[k][j]
    A=[P[j][cnt[j]] for j in range(N)]
    ans=max(ans,sum(A))
print(ans)


Measured memory_bytes: 9116
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define int long long
#define ll long long
#define ac() cout<<"Yes"<<endl;
#define wa() cout<<"No"<<endl;
#define dd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed (a)=0;(a)<(b);(a)++)
#define re read()
#define pr(a) print(a)
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1;while(b){if(b&1)ans=ans*a%mod;
a=a*a%mod;b>>=1;}return ans;}
int read(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void print(int x){if(x>=10){print(x/10);}//
putchar(x%10+'0');}
//
const int maxm=1e5+5;
const int mod=1e9+7;
int a[maxm],b[maxm];
map<string,int>mark;
vector<pair<int,string> >ans;
bool cmp(pair<int,string> a,pair<int,string> b){
    if(a.first!=b.first){
        return a.first<b.first;
    }else{
        return a.second>b.second;
    }
}
signed main(){
    int n=re;
    ff(i,n){
        string s;
        cin>>s;
        mark[s]++;
    }
    for(auto i:mark){
        ans.push_back({i.second,i.first});
    }
    sort(ans.begin(),ans.end(),cmp);
    n=ans.size();
    int ma=ans[n-1].first;
    for(int i=n-1;i>=0;i--){
        if(ans[i].first==ma){
            cout<<ans[i].second<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 28788
def main():
    N = int(input())
    result = []
    
    while N > 0:
        N -= 1
        mod = N % 26
        result.append(chr(mod + ord('a')))
        N //= 26

    result_str = ""
    for i in range(len(result)-1, -1, -1):
        result_str += result[i]

    print(result_str)

main()


Measured memory_bytes: 61788
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define RREP(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define ALL(vector) vector.begin(), vector.end()

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll cnt_ac=0;
    ll cnt_wa=0;
    ll cnt_re=0;
    ll cnt_tle=0;
    REP(_,n){
        string s;
        cin >> s;
        if (s == "AC"){
            cnt_ac += 1;
        }else if(s == "WA"){
            cnt_wa += 1;
        }else if(s == "TLE"){
            cnt_tle += 1;
        }else if(s == "RE"){
            cnt_re += 1;
        }
    }
    cout << "AC x " << cnt_ac <<endl; 
    cout << "WA x " << cnt_wa <<endl; 
    cout << "TLE x " << cnt_tle <<endl; 
    cout << "RE x " << cnt_re <<endl;
    return 0;
}

Measured memory_bytes: 3652
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let v: Vec<i32> = (0..4).map(|_| read::<i32>()).collect();
    let (n, k, x, y) = (v[0], v[1], v[2], v[3]);

    println!("{}", if n <= k { n * x } else { k * x + (n-k) * y });   
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void) {
  int A, B;
  char op;
  scanf("%d %c %d", &A, &op, &B);
  if(op == '+') {
    printf("%d\n", A+B);
  } else {
    printf("%d\n", A-B);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = getchar();c < '0' || c > '9';c = getchar()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = getchar()) res = res * 10 + (c - '0');
  return res * sig;
}
int a[300005],m,k;

int main(){
  m = getint(), k = getint();
  if(m == 0){
    if(k > 0) puts("-1");
    else{
      printf("0 0\n");
    }
  }else if(m == 1){
    if(k > 0) puts("-1");
    else{
      printf("0 0 1 1\n");
    }
  }else{
    if(k >= (1 << m)) puts("-1");
    else{
      for(int i = 0;i < k;i++) a[i] = i;
      for(int i = k;i < (1 << m) - 1;i++) a[i] = i + 1;
      a[(1 << m) - 1] = k;
      for(int i = (1 << m);i < (1 << (m + 1)) - 1;i++) a[i] = a[(1 << (m + 1)) - 2 - i];
      a[(1 << (m + 1)) - 1] = k;
      for(int i = 0;i < (1 << (m + 1));i++) printf("%d%c",a[i],i == (1 << (m + 1)) - 1 ? '\n' : ' ');
    }
  }
  return 0;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
    #include<sys/time.h>
    using namespace std;
     
    string ans="00100110010110111111110";
    const int timelim=2;
     
    int gettime(){
      timeval tv;
      gettimeofday(&tv, NULL);
      int x = tv.tv_sec % timelim * 1000 + tv.tv_usec / 1000;
      return x;
    }
     
    int T=40;
     
    int main(){
      //puts("Yes"); while (gettime()>10); return 0;
      int x=gettime()/T;
      if (x>=23){
        x=0;
      }
      puts(ans[x]=='1'? "Yes": "No");
      int aim=((x+1)*T-440+timelim*1000)%(timelim*1000);
      while (1){
        int t=gettime();
        if (t<=aim&&t>=aim-1) return 0;
      }
    }

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';
ll const mod = 998244353;

int main() {
    int n,s;
    cin >> n >> s;
    vector<int> a(n);
    vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
    for (int i = 0;i < n;++i) cin >> a[i];
    dp[0][0] = 1;
    for (int i = 0;i < n;++i) {
        for (int j = 0;j < s+1;++j) dp[i+1][j] = dp[i][j]*2%mod;
        for (int j = a[i];j < s+1;++j) (dp[i+1][j] += dp[i][j-a[i]]) %= mod;
    }
    cout << dp[n][s] << endl;
}

Measured memory_bytes: 73684
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	fmt.Println(minimum(s))
}

const favNum = 753

func minimum(s string) int {
	var minimum int
	for i := 0; i < len(s)-2; i++ {
		threeNums, _ := strconv.Atoi(s[i : i+3])
		diff := int(math.Abs(float64(favNum - threeNums)))
		if i == 0 {
			minimum = diff
		}
		if diff < minimum {
			minimum = diff
		}
	}
	return minimum
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());
//int rnd(int x) { return mrand()%x;}
typedef long long ll;
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
const ll md=1e9+7;
ll qp(ll a,ll b){
	ll ret=1;
	if(a==0) return ret;
	while(b){
		if(b&1) ret=ret*a%md;
		a=a*a%md;
		b>>=1;
	}
	return ret;
}
ll c1[200200],c2[200200];
void C(ll c[],ll x){
	ll ret=1;
	c[0]=c[x]=1;
	for(ll i=1;i<x;i++){
		ret=ret*(x-i+1)%md;
		ret=ret*qp(i,md-2)%md;
		c[i]=ret;
	}
	return;
}
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	ll ans=0;
	C(c1,n);
	C(c2,n-1);
	for(int i=0;i<n;i++){
		if(i>k ) continue;
		ans=(ans+c1[i]*c2[i]%md)%md;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3328
from collections import defaultdict
N = int(input())

def primeFactorization(n):
    res = defaultdict(int)
    m = int(n**0.5)
    for i in range(2,m+1):
        while n % i == 0:
            n = n//i
            res[i] += 1
    if n > 1:
        res[n] = 1
    return res

dic = primeFactorization(N)

ans = 0
for k,v in dic.items():
    n = 1
    while v >= n*(n+1)//2:
        ans += 1
        n += 1

print(ans)



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

void show(int a[],int n){
    for(int i=0;i<n;i++){
        if(i>0) cout<<' ';
        cout<<a[i];
    }
    cout<<endl;
}

void InsertSort(int a[],int n){
    int i,j,k;
    show(a,n);
    for(i=1;i<n;i++){
        k=a[i];
        for(j=i-1;j>=0&&a[j]>k;j--){
            a[j+1]=a[j];
        }
        a[j+1]=k;
        show(a,n);
    }
}

int main(){
    int n,i;
    int a[101];
    cin>>n;
    for(i=0;i<n;i++)
        cin>>a[i];
    InsertSort(a,n);
    return 0;
}



Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(a==i*j){
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
}


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

typedef long double ld;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long> vl;
typedef vector<double> vd;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

#define pi 3.14159265358979
#define eps 1e-9
#define inf 1<<30
#define MOD 1000000007 // 1e9+7

int main()
{
  int H, W, h, w;
  cin >> H >> W >> h >> w;

  cout << H*W - h*W - w*H + h*w << endl;

  return 0;
}



Measured memory_bytes: 256
import Foundation

func mainC() {
    let AB = readLine()!.split(separator: " ")
    let nsA = NSDecimalNumber(string: String(AB[0]))
    let nsB = NSDecimalNumber(string: String(AB[1]))

    let result = nsA.multiplying(by: nsB).stringValue

    if let index = result.firstIndex(of: ".") {
        print(result.prefix(upTo: index))
    } else {
        print(result)
    }
}
mainC()

Measured memory_bytes: 17324
import math

L = float(input())

# case of x==y==z
volume1 = (L/3.0)*(L/3.0)*(L/3.0)

# case of x==y!=z
# --> volume = x*x*(L-2x), which takes max at x=L/3
volume2 = (L/3.0)*(L/3.0)*(L-2.0*(L/3.0))

# case of x!=y==z
# --> same with ^ from the symmetry

# case of x!=y!=z
# --> x+y=L, y+z=L, which never happens...

print(max(volume1,volume2))


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

int main() {
    int n;cin>>n;
    int tmp=n;
    tmp=(tmp*100)/108;
    int ans = tmp;
//  cout<<ans<<endl;
    if(tmp*108/100 !=n){
      if((tmp+1)*108/100 ==n){
        cout<<ans+1<<endl;
      }
      else cout<<":("<<endl;
    }
    else cout<<ans<<endl;
	return 0;
}

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

int main(){
    ll a,b,x;
    cin>>a>>b>>x;
    ll sum;
    if(a==0){
        sum= b/x+1;
    }else{
        sum=b/x-(a-1)/x;
    }
    cout<<sum<<endl;

    return 0;
}    

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

struct point { int x, y; };
point ab[50];
point cd[50];
int d(point p1, point p2) { return abs(p2.x - p1.x) + abs(p2.y - p1.y); }

int main()
{
	int N, M, x, y, ans, distance;

	cin >> N >> M;
	rep(i, N) {
		cin >> x >> y;
		ab[i].x = x;
		ab[i].y = y;
	}
	rep(i, M) {
		cin >> x >> y;
		cd[i].x = x;
		cd[i].y = y;
	}

	rep(i, N) {
		ans = 0;
		distance = 1000000000;

		rep(j, M) {
			if (d(ab[i], cd[j]) < distance) {
				ans = j + 1;
				distance = d(ab[i], cd[j]);
			}
		}

		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int l[n+1],i,j,k,count=0;
  for(i=0;i<n;i++)
    scanf("%d",&l[i]);
  for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
      for(k=j+1;k<n;k++)
        if(l[i]+l[j]>l[k] && l[i]+l[k]>l[j] && l[i]<l[j]+l[k] && l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i])
          count++;
  printf("%d\n",count);
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i < 3; i++) {
    if (s.at(i) == 'R')
      count++;
  }
  if (s.at(1) == 'S' && count == 2)
    count = 1;
  
  cout << count << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
ll n,a,b;
int main(){
	cin>>n>>a>>b;
	if((b-a)%2ll==0ll){
		ll c=b-a;
		cout<<c/2ll;
	}else{
		ll ans;
		if(a-1ll<n-b){
			ans=a;
			ans+=(b-a)/2ll;
			cout<<ans;
		}else{
			ans=n-b;
			ans++;
			ans+=(b-a-1)/2;
			cout<<ans;
		}
	}
	re 0;
}

Measured memory_bytes: 256
A, B, M = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))
list1 = [list(map(int,input().split())) for i in range(M)]

sum = min(a) + min(b)

for i in range(0, M):
    x = list1[i][0]
    y = list1[i][1]
    c = list1[i][2]
    num = a[x-1]+b[y-1]-c
    #print(i)
    sum = min(sum, num)

print(sum)



Measured memory_bytes: 38564
let rec lower_bound l r p =
  if r <= 1 + l
  then r
  else let m = (l + r) / 2 in
       if p m
       then lower_bound l m p
       else lower_bound m r p

let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m 
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d\n" @@ fun n ->
  let xs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun x -> x in
  Scanf.scanf "%d\n" @@ fun l ->
  let up = Array.make_matrix 32 n 0 in
  let dn = Array.make_matrix 32 n 0 in
  for i = 0 to n - 1 do
    up.(0).(i) <- upper_bound 0 n (fun j -> xs.(j) - xs.(i) <= l);
    dn.(0).(i) <- lower_bound (-1) (n - 1) (fun j -> xs.(i) - xs.(j) <= l)
  done;
  for i = 1 to 31 do
    for j = 0 to n - 1 do
      up.(i).(j) <- up.(i - 1).(up.(i - 1).(j));
      dn.(i).(j) <- dn.(i - 1).(dn.(i - 1).(j))
    done
  done;
  Scanf.scanf "%d\n" @@ fun q ->
  for i = 0 to q - 1 do
    Scanf.scanf "%d %d\n" @@ fun a b ->
      Printf.printf "%d\n" @@ succ @@ snd @@
        ( if a < b then
            Array.fold_left (fun (a, acc) i ->
              if b - 1 <= up.(i).(a)
              then (a, acc)
              else (up.(i).(a), acc lor (1 lsl i))) (a - 1, 0)
          else 
            Array.fold_left (fun (a, acc) i ->
              if dn.(i).(a) <= b - 1
              then (a, acc)
              else (dn.(i).(a), acc lor (1 lsl i))) (a - 1, 0) ) @@
        Array.init 32 @@ fun i -> 31 - i
  done


Measured memory_bytes: 59000
#include<bits/stdc++.h>
using namespace std;
int main() {
	int m, k;
	cin>>m>>k;
	if((m==0||m==1)&&(k>0)) {
		cout<<-1;
		return 0;
	}
	if(k>(1<<m)-1) {
		cout<<-1;
		return 0;
	}
	if(m==1) {
		cout<<"0 1 1 0";
		return 0;
	}
	for(int i=0;i<=(1<<m)-1;i++) {
		if(i!=k) printf("%d ", i);
	}
	cout<<k<<" ";
	for(int i=(1<<m)-1;i>=0;i--) {
		if(i!=k) printf("%d ", i);
	}
	cout<<k<<" ";
}

Measured memory_bytes: 1920
N=int(input())
ls=list(input())
left=0
right=N-1
count=0
while True:
  while left<N and ls[left]=='R':
    left+=1
  while right>0 and ls[right]=='W':
    right-=1
  if left>=right:
    break
  left+=1
  right-=1
  count+=1
print(count)

Measured memory_bytes: 10428
mod = 10**9 + 7

n, m = map(int, input().split())
fib = [1] * (n+1)
for i in range(2, n+1):
  fib[i] = (fib[i-1] + fib[i-2]) % mod
count = 1
start = 0
for _ in range(m):
  a = int(input())
  stop = a-1
  if start > stop:
    count = 0
    break
  count = count * fib[stop - start] % mod
  start = a+1
stop = n
count = count * fib[stop - start] % mod
print(count)

Measured memory_bytes: 7028
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    string s[n];
    int a=0,b=0,ab=0;
    ll answer=0;
    REP(i,n){
        cin >> s[i];
        REP(j,s[i].length()-1){
            if(s[i][j] == 'A' && s[i][j+1] == 'B'){
                answer++;
            }
        }
        if(s[i][0] == 'B' && s[i][s[i].length()-1] == 'A'){
            ab++;
        }
        else if(s[i][0] == 'B')b++;
        else if(s[i][s[i].length()-1] == 'A')a++;
    }
    /*cout << a << endl << b << endl << ab << endl << answer << endl;
    int MIN = min(a,b);
    int MAX = max(a,b);
    if(MIN + ab <= MAX)answer += MAX;
    else answer += MAX + (MIN+ab-MAX)/2;*/
    /*answer += min(a,b);
    if(a!=b){
        answer += ab;
    }else{
        answer += max(ab-1,0);
    }*/
    if(ab > 0){
        answer += ab-1;
        if(a > 0){
            answer ++;
            a--;
        }
        if(b > 0){
            answer ++;
            b--;
        }
    }
    answer += min(a,b);
    
    cout << answer << endl;
    return 0;
}

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

int main()
{
    long long N;
    cin >> N;
    vector<long long> D(N);
    vector<long long> cnt(N, 0);
    for(int i = 0; i < N; i++)
    {
        int t;
        cin >> t;
        D[i] = t;
        cnt[t]++;
    }

    if(D[0] != 0)
    {
        cout << "0" << endl;
        return 0;
    }

    int a = 0;
    for(int i = 0; i < D.size(); i++)
    {
        if(D[i] == 0) a++;
        if(a >= 2)
        {
            cout << "0" << endl;
            return 0;
        }
    }

    bool flag = true;
    for(int i = 0; i < cnt.size(); i++)
    {
        if(flag == true && cnt[i] == 0) flag = false;
        else if(flag == false && cnt[i] > 0)
        {
            cout << "0" << endl;
            return 0;
        }
    }

    // calc
    long long ans = 1;
    const long long mod = 998244353;
    for(int i = 0; i < cnt.size()-1; i++)
    {
        if(cnt[i] != 0 && cnt[i+1] != 0)
        {
            //ans *= (long long)pow(cnt[i], cnt[i+1]);
            for(long long p = 0; p < cnt[i+1]; p++)
            {
                ans *= cnt[i];
                ans %= mod;
            }
        }
    }    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  long long D=0;
  long long S=101;
  cin>>N;
  vector<int>vec(N);
  for(int X=0;X<N;X++){
    cin>>vec[X];
    D+=vec[X];
    if(S>vec[X]&&vec[X]%10!=0){
      S=vec[X];
    }
  }
  if(D%10!=0){
    cout<<D<<endl;
  }
  else if(S==101){
    cout<<0<<endl;
  }
  else{
    cout<<D-S<<endl;
  }
}

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

const int def_l[] ={0,0,-1,1} ;
const int def_r[] ={-1,1,0,0} ;
const int INF = 1001001001 ;

int main() {
  int h , w ;
  cin >> h >> w ;
  vector<string> S(h) ;
  rep(i,h) cin >> S[i] ;
  //rep(i,h) cout << S[i] ;
  int ans = 0 ;
  rep(si,h) rep(sj,w){
	if(S[si][sj] == '#' ) continue ;
    vector<vector<int>> dist(h,vector<int>(w,INF)) ;
    queue<P> q ;
    auto update = [&] (int i , int j , int x){
      if(dist[i][j] != INF ) return ;
	  dist[i][j] = x ;
      q.push(P(i,j)) ;
    };
    update(si,sj,0) ;
    while(!q.empty()){
      int i = q.front().first ;
      int j = q.front().second ;
      q.pop() ;
      rep(ret,4){
        int in = i + def_l[ret] , jn = j + def_r[ret] ;
        if(in<0||in>=h||jn<0||jn>=w) continue ;
        if(S[in][jn] == '#' ) continue ;
        update(in,jn,dist[i][j]+1) ;
      }
    }
  	rep(i,h) rep(j,w){
      if( dist[i][j] == INF ) continue ;
      ans = max(ans,dist[i][j]);
    }
  }
  cout << ans << endl ; 
}

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

struct edge {int to, cost;};
//=============dijkstra============================
vector<long long> dijkstra(int s, int V, vector<vector<edge>> G)
{
  vector<long long> d(V, INF);
  typedef pair<long long, int> P;// first は最短距離　second は頂点の番号
  priority_queue<P, vector<P>, greater<P>> que;
  d.at(s) = 0;
  que.push(P(0, s));
  while (!que.empty())
  {
    P p = que.top();
    que.pop();
    int v = p.second;
    if (d.at(v) < p.first) continue;
    for (int i = 0; i < G.at(v).size(); ++i)
    {
      edge e = G.at(v).at(i);
      if (d.at(e.to) > d.at(v) + e.cost)
      {
        d.at(e.to) = d.at(v) + e.cost;
        que.push(P(d.at(e.to), e.to));
      }
    }
  }
  return d;
}
//=================================================


int main()
{
  int n;
  cin >> n;
  vector<vector<edge>> G(n, vector<edge>(0));
  for (int i = 0; i < n; ++i)
  {
    int u, k;
    cin >> u >> k;
    for (int j = 0; j < k; ++j)
    {
      int v;
      cin >> v;
      G.at(u - 1).push_back({v - 1, 1});
    }
  }
  vector<long long> ans = dijkstra(0, n, G);
  for (int i = 0; i < n; ++i)
  {
    if (ans.at(i) == INF)
    {
      cout << i + 1 << ' ' << -1 << endl;
    }
    else
    {
      cout << i + 1 << ' ' << ans.at(i) << endl;
    }
  }
}



Measured memory_bytes: 3176
#from heapq import heapify,heappush,heappop
N, K, L = map(int,input().split())

road = [i for i in range(N)]
rail = [i for i in range(N)]
rank = [0 for i in range(N)]

def find(a, U):
  if a == U[a]:
    return a
  else:
    par = find(U[a], U)
    U[a] = par
    return par
  
for i in range(K):
  p, q = map(int,input().split())
  p -= 1
  q -= 1  
  a = find(p, road)
  b = find(q, road)

  road[a] = b
  
for i in range(L):
  p, q = map(int,input().split())
  p -= 1
  q -= 1  
  a = find(p, rail)
  b = find(q, rail)

  rail[a] = b
  
for i in range(N):
  #print(road, rail)
  road[i] = find(road[i],road)
  rail[i] = find(rail[i],rail)
  
rr = [(road[i], rail[i]) for i in range(N)]
D = {}
for r in rr:
  if not r in D:
    D[r] = 1
  else:
    D[r] += 1
#print(road,rail)
#print(D)

for i in range(N):
  print(D[(road[i],rail[i])])
  
  

Measured memory_bytes: 54328
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		new Main();
	}

	public Main() {
		FasterScanner sc = new FasterScanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		for (int i = 0; i < m; i++) {
			n -= sc.nextInt();
		}
		if (n >= 0) System.out.println(n);
		else System.out.println(-1);
		
		sc.close();
	}
	
	class FasterScanner {
		private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner() {
			this(System.in);
		}

		public FasterScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public void close() {
			try {
				mIs.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}


Measured memory_bytes: 32592
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 

signed main(){
    FASTER;
    int n;cin>>n;
    vi v(n+1);
    int ans=0;
    for(int i=1;i<=n;i++){
        cin>>v[i];
        ans+= (i&1) && (v[i]&1);
    }
    cout<<ans;
}


Measured memory_bytes: 3612
#!/usr/bin/env python3
import sys
from collections import defaultdict
from functools import lru_cache
MOD = 1000000007  # type: int


@lru_cache(maxsize=None)
def div(a, b):
    return (a * pow(b, MOD-2, MOD)) % MOD


class Combination(object):

    def __init__(self, N, mod=MOD):
        fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1)
        fac[:2] = 1, 1
        finv[:2] = 1, 1
        inv[1] = 1
        for i in range(2, N+1):
            fac[i] = fac[i-1]*i % mod
            inv[i] = -inv[mod % i]*(mod//i) % mod
            finv[i] = finv[i-1]*inv[i] % mod
        self.N = N
        self.MOD = mod
        self.fac = fac
        self.finv = finv
        self.inv = inv

    def __call__(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        b = (self.finv[k]*self.finv[n-k] % self.MOD)
        return (self.fac[n] * b) % self.MOD


def solve(N: int, a: "List[int]", b: "List[int]"):
    # グラフの構築
    E = [[] for _ in range(N)]
    for aa, bb in zip(a, b):
        E[aa-1].append(bb-1)
        E[bb-1].append(aa-1)

    # 組み合わせの初期化
    cmb = Combination(N)

    # BFSの入り順を構成する
    curr = -1
    downward = [0]
    parent = [-1]*N
    while len(downward) < N:
        curr += 1
        v = downward[curr]
        for u in E[v]:
            if u == parent[v]:
                continue
            parent[u] = v
            downward.append(u)
    # print(downward)

    # 節点vを根とした部分木の塗り方dp[v]
    dp = [1]*N
    # 節点vを根とした部分木のサイズsize[v]+1
    size = [0]*N

    # 木DP
    # 葉から根へ向かう探索
    for v in reversed(downward):
        for u in E[v]:
            if u == parent[v]:
                continue
            size[v] += size[u]+1
            dp[v] *= cmb.finv[size[u]+1]
            dp[v] %= MOD
            dp[v] *= dp[u]
            dp[v] %= MOD
        dp[v] *= cmb.fac[size[v]]
        dp[v] %= MOD

    # 全方位木DP
    # 根から葉へ向かう探索
    for v in downward:
        for u in E[v]:
            if u == parent[v]:
                continue
            dp[u] = dp[v]
            dp[u] *= (size[u]+1)*cmb.inv[N-(size[u]+1)]
            dp[u] %= MOD

    for v in dp:
        print(v)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)


if __name__ == '__main__':
    main()


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

#define N 101
#define MAX 100000000

int G[N][N], v[N], k[N];
int n;

void DFS(int , int );

int main(){
  int i, j, u;
  int x, y, z;
  
  scanf("%d", &n);
  if(n<1 || n>100) exit(1);

  x=0;
  y=0;
  for(i=0; i<n; i++){
    v[i+1] = MAX;
    scanf("%d", &u);
    x++;
    y--;
    scanf("%d", &k[u]);
    z = x+y;
    
    for(j=0; j<k[u]; j++) scanf("%d", &G[u][j+1]);
  }
  
  DFS(1, 0);
  
  for(i=1; i<=n; i++){
    printf("%d", i);
    x--;
    if(v[i] == MAX) printf(" -1\n");
    else printf(" %d\n", v[i]);
  }
  
  return 0;
}

void DFS(int a, int b){
  int j;
  int x, y;
  
  v[a] = b;
  for(j=0; j<k[a]; j++)
    if(v[ G[a][j+1] ] > b+1) DFS(G[a][j+1], b+1);
  x++;
  y--;
  x+=y;

  return ;
}



Measured memory_bytes: 2056
#include <string>
#include <iostream>
using namespace std;
int H, W, A, sx, sy, gx, gy, dx[] = { 0, 1, 0, -1 }, dy[] = { 1, 0, -1, 0 }; bool vis[109][109][4][15][15]; string s[109];
void dfs(int x, int y, int dir, int mp, int mq) {
	vis[x][y][dir][mp][mq] = true;
	for (int i = 0; i < 4; i++) {
		if ((i ^ 2) == dir) continue;
		if (s[x][y] == 'S' && i != dir) continue;
		int tx = x + dx[i], ty = y + dy[i], nmp = mp + ((i ^ 1) == dir), nmq = mq + ((i ^ 3) == dir);
		if (0 <= tx && tx < H && 0 <= ty && ty < W && s[tx][ty] != '#' && (s[tx][ty] != 'S' || i != 3) && nmp <= A && nmq <= A && !vis[tx][ty][i][nmp][nmq]) {
			dfs(tx, ty, i, nmp, nmq);
		}
	}
}
int main() {
	cin >> H >> W >> A;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
		for (int j = 0; j < W; j++) {
			if (s[i][j] == 'S') sx = i, sy = j;
			if (s[i][j] == 'G') gx = i, gy = j;
		}
	}
	dfs(sx, sy, 1, 0, 0);
	int ret = 1 << 30;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j <= A; j++) {
			for (int k = 0; k <= A; k++) {
				if (vis[gx][gy][i][j][k] && ret > j + k) ret = j + k;
			}
		}
	}
	cout << (ret == 1 << 30 ? -1 : ret) << endl;
	return 0;
}


Measured memory_bytes: 9452
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    printf("%d %d %d %d\n", x2-(y2-y1), y2+(x2-x1), x1-(y2-y1), y1+(x2-x1));
    return 0;
}


Measured memory_bytes: 1696
#pragma GCC optimize("Ofast","inline")
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Fod(i,b,a) for (int i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define _SEED_ ('C'+'L'+'Y'+'A'+'K'+'I'+'O'+'I')
#define outval(x) printf(#x" = %d\n",x)
#define outvec(x) printf("vec "#x" = ");for (auto _v : x)printf("%d ",_v);puts("")
#define outtag(x) puts("----------"#x"----------")
#define outarr(a,L,R) printf(#a"[%d...%d] = ",L,R);\
						For(_v2,L,R)printf("%d ",a[_v2]);puts("");
using namespace std;
typedef long long LL;
typedef vector <int> vi;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=100005;
int n,k;
vi p,q,ip,iq,a[10];
vi Inv(vi A){
	vi B(n);
	For(i,0,n-1)
		B[A[i]]=i;
	return B;
}
vi Mul(vi A,vi B){
	vi C(n);
	For(i,0,n-1)
		C[i]=A[B[i]];
	return C;
}
vi Pow(vi x,int y){
	vi ans;
	For(i,0,n-1)
		ans.pb(i);
	for (;y;y>>=1,x=Mul(x,x))
		if (y&1)
			ans=Mul(ans,x);
	return ans;
}
int main(){
	n=read(),k=read();
	For(i,1,n)
		p.pb(read()-1);
	For(i,1,n)
		q.pb(read()-1);
	ip=Inv(p),iq=Inv(q);
	a[1]=p,a[2]=q;
	For(i,3,6)
		a[i]=Mul(a[i-1],Inv(a[i-2]));
	int len=(k-1)/6;
	vi cir=Pow(Mul(q,Mul(ip,Mul(iq,p))),len);
	vi rem=a[k-len*6];
	vi res=Mul(cir,Mul(rem,Inv(cir)));
	For(i,0,n-1)
		printf("%d ",res[i]+1);
	return 0;
}

Measured memory_bytes: 9056
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    
    int ans=0;
    int A=a,B=b,C=c;
    while(a%2==0&&b%2==0&&c%2==0){
        int p=(b+c)/2;
        int q=(c+a)/2;
        int r=(a+b)/2;
        a=p;
        b=q;
        c=r;
        ans++;
        if(a==A&&b==B&&c==C){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256