akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

int main() {
    int n, y;
    cin >> n >> y;
    y /= 1000;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n - i; j++) {
            if (9 * i + 4 * j == y - n) {
                cout << i << ' ' << j << ' ' << n - i - j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  ll ans=0;
  int xa=0,bx=0,axb=0,bxa=0;
  rep(i,n){
    int siz=sz(s[i])-1;
    for(int j=0; j<siz-1; j++){
      if(s[i][j]=='A' && s[i][j+1]=='B') ans++;
    }
    if(s[i][0]!='B' && s[i][siz]=='A') xa++;
    if(s[i][0]=='B' && s[i][siz]!='A') bx++;
    if(s[i][0]=='B' && s[i][siz]=='A') bxa++;
    //if(s[i][0]=='A' && s[i][siz]=='B') axb++;
  }
  /*cout << xa << endl;
  cout << bx << endl;
  cout << axb << endl;
  cout << bxa << endl;
  cout << ans << endl;*/

  if(bxa==0)ans+=min(xa,bx);
  else{
    if(xa+bx>0) ans+=bxa+min(xa,bx);
    else ans+=bxa-1;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 768
A,B,H,M = map(int,input().split())
import math
pt = (H+M/60)

a_th = (pt * 1/12 - int(pt * 1/12)) * 360
b_th = (pt  - int(pt)) * 360

theta = 1000

if a_th > b_th:
    theta = a_th-b_th
    if theta > 180:
        theta = 360 -theta

if a_th <= b_th:
    theta = -a_th+b_th
    if theta > 180:
        theta = 360 -theta

# print(A,B,theta)
# theta = 0.5

theta = math.radians(theta)


C = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(theta))

print(C)

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

using namespace std;
typedef long long ll;


int main(){
    
    ios_base::sync_with_stdio(0);
    int n,m,l;
    cin>>n>>m>>l;
    int a[n][m];
    int b[m][l];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++)
            cin>>b[i][j];
    }

    ll c[n][l];
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            c[i][j] = 0;
           // cout<<c[i][j]<<" ";
        }
        //cout<<"\n";
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            //cout<<"----"<<c[i][j]<<endl;
            for(int k=0;k<m;k++){
                c[i][j] += ((ll)a[i][k]*b[k][j]);
                //cout<<a[i][k]<<" "<<b[k][j]<<" "<<c[i][j]<<endl;
            }
           // cout<<i<<" "<<j<<" "<<c[i][j]<<endl;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            if(j!=l-1)
                cout<<c[i][j]<<" ";
            else
                cout<<c[i][j];
        }
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3336
#include<stdio.h>
int main (){
	int ha;
	int wa;
	int na;
	int hasil;
	
	scanf("%d", &ha);
	scanf("%d", &wa);
	scanf("%d", &na);
	
	if(ha>=wa){
        if(na%ha == 0) {
            hasil = na/ha;
        } else {
            hasil = na/ha+1;
        }
    } else {
        if(na%wa == 0) {
            hasil = na/wa;
        } else {
            hasil = na/wa+1;
        }
    }
    printf("%d", hasil);
	return 0;
}


Measured memory_bytes: 1700
/*input
10 0 15 0 30

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int x = 0;
  int h = h1, m = m1;
  while (1) {
    if (h == h2 && m == m2) break;
    x++;
    m++;
    if (m == 60) {
      m = 0;
      h = (h + 1) % 24;
    }
  }
  int ans = x - k;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3616
N, K = map(int, input().split())

x = N
pre_x = x

if x // K > 0:
    x = abs(x - K * (x // K))
    pre_x = x

while True:
    pre_x = x
    x = abs(x - K)

    if pre_x < x:
        print(pre_x)
        exit()


Measured memory_bytes: 9124
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

bool dp[110][10510];

int main () {
  int n;
  cin >> n;
  vi s(n);
  rep(i,n) cin >> s[i];
  
  dp[0][0] = true;
  rep(i,n+1) {// n+1をnにしないように注意！
    rep(j,10210) {
      if (i-1 >= 0 && dp[i-1][j]) {
        dp[i][j] = dp[i-1][j];
      }
      if (i-1 >= 0 && j-s[i-1] >= 0 && dp[i-1][j-s[i-1]]) {
        dp[i][j] = dp[i-1][j-s[i-1]];
      }      
    }
  }

  int ans = 0;
  rep(i,10001) {
    if (dp[n][i] && i%10 != 0) {
      chmax(ans,i);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
import std;

auto input()
{
    return readln().chomp();
}

alias sread = () => readln.chomp();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    long x;
    scan(x);
    long k = 1;
    while ((x * k) % 360 != 0)
    {
        k++;

    }
    writeln(k);

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


Measured memory_bytes: 3656
n, m = map(int, input().split())
a = dict()

for i in range(m):
    ta,tb = map(int, input().split())
    if not ta in a:
        a[ta] = [tb]
    else:
        a[ta].append(tb)

ans=False
for i in a[1]:
    if not i in a: continue
    if n in a[i]:
        ans = True
        
print(("IMPOSSIBLE","POSSIBLE")[ans])


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

typedef long long int lli;
#define pb push_back
#define gcd __gcd
#define MOD 1000000007
#define mod2 998244353
#define forz(i,n) for(long long int i=0;i<n;i++)
char A[51][51];
set<pair<lli,lli>> s1,s2;
set<pair<lli,lli>>::iterator i1,i2;

lli mod(lli a){
    if(a<0) return -1*a;
    return a;
}

bool comp(pair<lli,lli> a,pair<lli,lli> b){
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1,u,j;
    //cin>>t;
    for(u=1;u<=t;u++){
        lli n,m,i,j,p=0,c,q=0,k,a,b,x,y,ne=0,p1=0,q1=0;
        cin>>n;
        cout<<n+(lli)pow(n,2)+(lli)pow(n,3)<<endl;
   }
}

Measured memory_bytes: 4044
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
int main()
{
    int tp,q,val;
    string key;
    map<string,int> mp;
    cin>>q;
    while(q--){
        cin>>tp;
        if(tp)
        {
            cin>>key;
            cout<<mp[key]<<"\n";
        }
        else{
            cin>>key>>val;
            mp[key]=val;
        }
    }

}





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

int main() {
  int L,R,d;
  cin >> L >> R >> d;
  
  int ans=0;
  
  while(L <= R){
    if(L % d == 0){
      ans++;
    }
    L++;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N;
  cin >> N;
  ll ans = 0;
  auto occur = vector<int>(100);
  REPS(i, 1, N + 1) {
    int bottom = i % 10;
    if(bottom == 0) {
      continue;
    }
    int top = bottom;
    int digit = 1;
    int cur = i;
    while(cur >= 10) {
      cur /= 10;
      top = cur % 10;
      digit++;
    }

    int key = top * 10 + bottom;
    int rev = bottom * 10 + top;
    if(top == bottom) {
      ans++;
    }
    ans += occur[rev] * 2;
    occur[key]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

//#include<bits/stdc++.h>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 3e5 + 123;                                          
const int PRI = 555557;
const int pri = 997;
const int Magic = 2101;

//const int dx[] = {2, 2, 1, 1, -1, -1, -2, -2};
//const int dy[] = {1, -1, 2, -2, 2, -2, 1, -1};

int n, m, k;
int l[N], r[N];

ll solve (int par) {
 	set < pair < int, int > > L, R;
  	for (int i = 1; i <= n; i ++)
    	L.insert (mp (l[i], i)), R.insert (mp (r[i], i));
  
  	ll ans = 0;
  	int cur = 0;
  	for (int k = 1; k <= n; k ++) {
    	int i;
    	if ((k & 1) == par)    
      		i = L.rbegin() -> S;
    	else
      		i = R.begin() -> S; 
    
    	L.erase (mp (l[i], i));
    	R.erase (mp (r[i], i));
    	
    	if (cur < l[i])
    	  ans += abs (cur - l[i]), cur = l[i];
    	else  if (cur > r[i]) 
    	  ans += abs (cur - r[i]), cur = r[i];
  	}
  	ans += abs (cur);
   
  	return ans;
}

inline void Solve () {
	cin >> n;

	int cur = 0;
	ll ans = 0;

	for (int i = 1; i <= n; i ++) {
		cin >> l[i] >> r[i];
	}

	cout << max(solve(0), solve(1)) << '\n';
}

int main () {
	int tests = 1;
	SpeedForce;
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);	
	//cin >> tests;
	while(tests --) {
		Solve ();
		// TooSimple ? True : False
	}
	// Accepted ? True : True
	return Accepted; 
}


// Coded by Al... Bat...

Measured memory_bytes: 12536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
bool bfs(const vector<vector<pair<int,int>>> &G, int start, vector<ll> &dist){
    queue<int> pos; pos.push(start);
    dist[start] = 0;
    while(!pos.empty()){
        int from = pos.front(); pos.pop();
        for (auto to : G[from])
        {
            if(dist[to.first]!=INF){
                if(dist[to.first]!=dist[from]+to.second) return false;
                else continue;
            }
            dist[to.first] = dist[from]+to.second;
            pos.push(to.first);
        }
    }
    return true;
}

int main() {
    int N, M; cin >> N >> M;
    vector<vector<pair<int,int>>> G(N);
    for (int i = 0; i < M; i++)
    {
        int l, r, d; cin >> l >> r >> d;
        l--; r--;
        G[l].push_back(make_pair(r,d));
        G[r].push_back(make_pair(l,-d));
    }

    vector<ll> dist(N, INF);    
    for (int i = 0; i < N; i++)
    {
        if(dist[i]==INF) {
            if(!bfs(G, i, dist)){
                cout << "No" << endl;
                return 0;
            }
        }
    } 
    cout << "Yes" << endl;
}

Measured memory_bytes: 9728
#include <iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
typedef unsigned long long ull;

int main()
{
    int n,k,s;
    cin>>n>>k>>s;
    for(int i=0;i<k;i++)
        cout<<s<<" ";
    n=n-k;
    if(s!=(1e9))
    {
        for(int i=0;i<n;i++)
            if(i!=n-1)
            cout<<s+1<<" ";
        else
            cout<<s+1<<endl;
    }
    else
    {
        for(int i=0;i<n;i++)
            if(i!=n-1)
            cout<<1<<" ";
        else
            cout<<1<<endl;
    }
    return 0;
}








Measured memory_bytes: 1280
#include <iostream>
using namespace std;
int main(void){
    int m;  //受験者の人数
    int min, max;  //合格者数の最小値と最大値
    int score[200];  //受験者の成績
    int s;  //合格者数

    while(true){
        cin >> m;
        cin >> min >> max;
        if(m == 0 && min == 0 && max == 0) break;

        for(int i = 0; i < m; i++){
            cin >> score[i];
        }
        
        int gapmax = 0;  //合格者の最低点と不合格者の最高点の差の最大値の初期値を０とする
        for(int j = min; j <= max; j++){
            int gap = score[j - 1] - score[j];
            if(gap >= gapmax){
                gapmax = gap;
                s = j;
            }
        }
        cout << s << endl;
    }
}


Measured memory_bytes: 3016
visited=[False]*(10**6+1)

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

if N>=2 and A[1]==1:
  print(0)
  exit()
if A[0]==1 or N == 1:
  print(1)
  exit()
  
ans=0
for i in range(N):
  if visited[A[i]]:
    continue
  if i < N-1 and A[i]==A[i+1]:
    index = 1
    while A[i]*index<=10**6:
      visited[A[i]*index]=True
      index+=1
    continue
  ans+=1
  index=1
  while A[i]*index<=10**6:
    visited[A[i]*index]=True
    index+=1
    
print(ans)

Measured memory_bytes: 40228
//#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma G++ optimize(2)
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
using namespace std;

#define ios ios::sync_with_stdio(false)
#define ll long long
#define pa pair<int,int>
#define mk make_pair
#define sc(n) scanf("%d",&n)
#define ss(s) scanf("%s",s)
#define fo(i, a, b) for(int i = a; i <= b; i++)
#define of(i, a, b) for(int i = a; i >= b; i--)
#define mem(a, b) memset(a, b, sizeof a)
#define copy(a,b) memcpy(a, b, sizeof b)
#define pi acos(-1)
#define in freopen("input.in", "r", stdin);
#define out freopen("output.out", "w", stdout);

const ll inf = 0x3f3f3f3f;
const ll mod = 998244353;
const ll N = 2e5 + 10;
const ll M = 1e4 + 10;
const double eps = 1e-10;

int n, m, t;
double f[20][20];
int x[20], y[20];
int a[20];

int main()
{
	cin >> n;
	string s;
	cin >> s;
	if (n & 1)
		puts("No");
	else
	{
		int flag = 1;
		int i = 0, j = n / 2;
		for (; i < n / 2; i++, j++)
		{
			if (s[i] != s[j])
			{
				flag = 0;
				break;
			}
		}
		if (flag)
			puts("Yes");
		else
			puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
 
int main() {
  int N, h, m;
  set<int> S;
  REP(z, 2){
    cin >>N;
    while(N--){ cin >>h >>m; S.insert(h * 60 + m); }
  }
  bool f = false;
  for(int n : S){
    printf("%s%d:%02d", (f ? " " : ""), n / 60, n % 60);
    f = 1;
  }
  cout <<endl;
  return 0;
}

Measured memory_bytes: 3240
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()
int num(vector<string> a,int mask,int h,int w){
  for(int i = 0;i<h;i++){
    if((mask>>i)&1){
      for(int j = 0;j<w;j++){
        a[i][j] = '!';
      }
    }
  }

  for(int i = h;i<h+w;i++){
    if((mask>>i)&1){
      for(int j = 0;j<h;j++){
        a[j][i-h] = '!';
      }
    }
  }

  int cnt = 0;
  for(int i = 0;i<h;i++){
    cnt += count(all(a[i]),'#');
  }
  return cnt;

}
int32_t main()
{ 
   IOS
  
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> a(h);

  for(int i = 0;i<h;i++){
    cin>>a[i];
  }
  int ans = 0;
  for(int mask = 0;mask<(1ll<<(h+w));mask++){
    if(num(a,mask,h,w) == k){
      ans++;
    }
  }

  cout << ans << endl;


  
}

Measured memory_bytes: 3656
n=int(input())
adj=[list(map(int,input().split())) for _ in range(n)]

lst=[[0 for i in range(n)] for j in range(n)]
for x in adj:
    u,v=x[0],x[2:]
    for y in v:
        lst[u-1][y-1]=1

for x in lst:
    print(" ".join(map(str,x)))




Measured memory_bytes: 5676
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;
template<class T> inline void fix(T &x) {if(x >= mod | x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    string in;
    cin >> in;
    int a = -1, b = -1;
    for(char c = 'a'; c <= 'z'; c ++ ){
        ll pref = 0, mn = mod, mnind = 0, prv = 0;
        for(int i = 0; i < in.size(); i ++) {
            if(in[i] == c) {
                pref ++;
            } else {
                pref --;
            }
            if(pref - mn >= 1) {
                a = mnind + 1;
                b = i + 1;
            }
            if(chkmin(mn, prv)) {
                mnind = i;
            }
            prv = pref;
        }
    }
    cout << a << " " << b << endl;

    return 0;
}



Measured memory_bytes: 512
import java.util.*;
import java.io.*;
public class Main {
    public static ArrayList<ArrayList<Integer>> tree = new ArrayList<>();
    public static long dp[][];
    public static int mod = 1000000007;

    public static long solve(int node , int constraints , int pr){
        long ans = 0L;

        ArrayList<Integer> temp = tree.get(node);

        long w1 = 1L;

        if(dp[node][constraints] != -1){
            return dp[node][constraints];
        }

        for(int i = 0 ; i < temp.size() ; i++){
            if(temp.get(i) != pr){
                w1 = (w1 * solve(temp.get(i) , 0 , node))%mod;
            }
        }

        ans += w1;
        if(constraints == 0){
            long w2 = 1L;
            for(int i = 0 ; i < temp.size() ; i++){
                if(temp.get(i) != pr){
                    w2 = (w2 * solve(temp.get(i) , 1 , node))%mod;
                }
            }
            ans += w2;
        }
        return dp[node][constraints] = ans%mod;
    }
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();

        for(int i = 0 ; i < n ; i++){
            tree.add(new ArrayList<Integer>());
        }

        dp = new long[n+1][3];
        for(int i = 0 ; i < n+1 ; i++){
            for(int j = 0 ; j < 3 ; j++){
                dp[i][j] = -1;
            }
        }

        for(int i = 0 ; i < n-1 ; i++){
            int x = s.nextInt()-1;
            int y = s.nextInt()-1;
            tree.get(x).add(y);
            tree.get(y).add(x);
        }

        System.out.println(solve(0 , 0 , -1));
    }
}

Measured memory_bytes: 88528
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    double pai = 3.14159265358979323846264338;
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double tmp1 = 30 * H + 0.5 * M;
    double tmp2 = 6 * M;
    double tmp3;
    if (tmp1 == 0 || tmp2 == 0) {
        tmp3 = 360 - abs(tmp1 - tmp2);
    } else {
        tmp3 = abs(tmp1 - tmp2);
    }
    double tmp4 = A*A + B*B - 2*A*B*cos(tmp3*(pai/180));
    double result = sqrt(tmp4);
    cout << setprecision(16) << result << endl;
    return 0;
}


Measured memory_bytes: 4192
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 1005;

int n;

struct P {
	ll x, y;
	P(ll _x = 0, ll _y = 0) {
		x = _x, y = _y;
	}
} a[N];

int pd(P a) {
	return abs(a.x + a.y) % 2;
}
P operator + (P a, P b) {
	return P(a.x + b.x, a.y + b.y);
}

P operator * (P a, ll b) {
	return P(a.x * b, a.y * b);
}

ll d[45], d0;

P mov[4] = {
	P(-1, 0), P(1, 0), P(0, -1), P(0, 1)
};

ll dis(P a) {
	return abs(a.x) + abs(a.y);
}

char cho[4] = {
	'L', 'R', 'D', 'U'
};

char ans[45];

int main() {
	scanf("%d", &n);
	fo(i, 1, n) scanf("%lld %lld", &a[i].x, &a[i].y);
	int jo = pd(a[1]);
	fo(i, 2, n) {
		if(pd(a[i]) != jo) {
			pp("-1\n"); return 0;
		}
	}
	if(!jo) d[++ d0] = 1;
	fo(i, 0, 31) d[++ d0] = 1ll << i;
	pp("%lld\n", d0);
	fo(i, 1, d0) pp("%lld ", d[i]); hh;
	fo(i, 1, n) {
		P t = a[i] * -1;
		fd(j, d0, 1) {
			int k = 0; ll s = dis(t + mov[0] * d[j]);
			fo(u, 1, 3) {
				ll s2 = dis(t + mov[u] * d[j]);
				if(s2 < s) k = u, s = s2;
			}
			t = t + mov[k] * d[j];
			ans[j] = cho[k];
		}
		fo(j, 1, d0) putchar(ans[j]);
		putchar('\n');
	}
}


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

long long n, a[100005], sum, z;

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

cin >> n; z = n * (n + 1) / 2;
  for(int i = 0; i < n; ++i) cin >> a[i], sum += a[i];
a[n] = a[0];
if(sum % z) return cout << "NO\n", 0;
for(int i = 0; i < n; ++i)
  if(-a[i + 1] + a[i] + sum / z < 0 || (-a[i + 1] + a[i] + sum / z) % n) return cout << "NO\n", 0;
cout << "YES\n";
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int count = 0;
  int s;
  vector<int> button(N);
  for (int i = 0; i < N; i++){
    cin >> button.at(i);
  }
  s = button.at(0);
  for (int i = 0; i < N; i++){
    count++;
    if (s == 2){
      cout << count << endl; 
      break;
    }
    if (i == N - 1){
      cout << -1 << endl;
      break;
    }
    s = button.at(s - 1);
  }
}

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

int main(){
    string s; cin>>s;
    if(s[0]=='A'){
        int n=0;
        for(int i=2;i<=s.length()-2;i++){
            if(s[i]=='C') n++;
        }
        if(n==1){
            bool flag=true;
            for(int i=1;i<s.length();i++){
                if(s[i]=='C') continue;
                if(s[i]<'a') flag=false;
            }
            if(flag){
                cout<<"AC"<<endl;
                return 0;
            }
        }
    }
    cout<<"WA"<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
  private static long gcd(long a, long b) {
    return a % b == 0 ? b : gcd(b, a % b);
  }
  
  private static long solve(int n, long[] ts) {
    long answer = 1;
    for (long t : ts) {
      long g = gcd(answer, t);
      answer /= g;
      answer *= t;
    }
    return answer;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    long[] ts = reader.nextLong(n);
    out.println(solve(n, ts));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // [b,c) イテレータ
#define MOD 1000000007
#define INF 1000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int64_t N; cin >> N;
VI A(N); rep(i, 0, N) cin >> A[i];

sort(ALL(A));
int c = 0;
VI edge(2, 0);
Rrep(i, N-1, 1){
    if (A[i] == A[i - 1]){
        edge[c] = A[i];
        ++c;
        --i;
    }
    if (c == 2) break;
}
cout << edge[0] * edge[1] << endl;
}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a==1)a=a+13;
        if(b==1)b=b+13;
        if(a>b)cout<<"Alice"<<endl;
        else if(a==b)cout<<"Draw"<<endl;
            else
            cout<<"Bob"<<endl;
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

M, D = map(int, input().split())
ans = 0

for i in range(1, M+1):
    for j in range(10, D+1):
        d0 = int(str(j)[0])
        d1 = int(str(j)[1])
        
        if d0>=2 and d1>=2 and i==d0*d1:
            ans += 1

print(ans)

Measured memory_bytes: 39536
#include <stdio.h>
int main(void)
{
    long int n;
    scanf("%ld",&n);
    int f=0;
    long int nn=n;
    while(nn>0)
    {
        f=f+nn%10;
        nn=nn/10;
    }
    if(n%f==0)printf("Yes");
    else printf("No");
}


Measured memory_bytes: 128
N,K=map(int, input().split())
ans=0
def asd(a, b):
  c = 0
  while a < b:
    a = a * 2
    c+=1
  return c
for i in range(N):
  ans += (1 / N) * pow(1 / 2, asd(i + 1, K))
print(ans)

Measured memory_bytes: 3060
"use strict";
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  let tmp = input[0].split(" ");
  //文字列から10進数に変換するときはparseIntを使います
  let h = parseInt(tmp[0], 10);
  let a = parseInt(tmp[1], 10);
  //出力
  console.log("%d", Math.ceil((1.0 * h) / a));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1000005];
int main()
{
	ll n,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i];
	sort(a+1,a+1+n);
//	for(int i=1;i<=n;i++)
//	cout<<a[i]<<" ";
//	cout<<"\n";
	for(int i=1;i<n;i++) 
	for(int j=i+1;j<=n;j++)
	{
		ans+=lower_bound(a+1,a+1+n,a[i]+a[j])-a-j-1;
		//cout<<ans<<" "<<lower_bound(a+1,a+1+n,a[i]+a[j])-a-1<<" "<<j<<"\n";
	}
	cout<<ans;
}

Measured memory_bytes: 256
/* EVERYTHING STARTS AS NOTHING ! :) */
#include<bits/stdc++.h>
using namespace std;

#define ull unsigned long long
#define ll long long
#define null NULL
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main (){
	string s ;
	cin >> s ;
	int n = (int)s.length() ;
	int st = 0,e = n-1 ;
	int mid = (st + e )/ 2 ;
	bool flag = true ;
	while (st<=e){
		if(s[st]==s[e]){
			st++;
			e--;
		}else {
			flag = false ;
			break ;
		}
	}
	if(!flag){
		cout << "No" ;
		return 0 ;
	}
	for(int i = 0,j=n-1;i<mid,j>mid;i++,j--){
		if(s[i]!=s[j])flag = false ;
	}
	if(!flag){
		cout << "No" ;
		return 0 ;
	}
	st = 0 ; e = mid - 1 ;
	while (st<=e){
		if(s[st]==s[e]){
			st++;
			e--;
		}else {
			flag = false ;
			break ;
		}
	}
	if(!flag){
		cout << "No" ;
		return 0 ;
	}
	cout << "Yes" ;

	return 0 ;
}
		

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

using ll = long long;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int res = 0;
    for(int i = 0; i < 101; ++i) {
        res += A + 1 <= i && i <= B && C + 1 <= i && i <= D;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize(2)
string s,t;
string ts[1010];//s的所有长度为t.size,左端点为i的子串 
int ans;
int main()
{
	cin>>s>>t;
	int len=t.size();
	ans=len;
	int lens=s.size();
	for(register int j=0;j+len<=lens;j++)
	{
		for(register int k=j;k-j+1<=len;k++)
		{
				ts[j]+=s[k];//长度为len,左端点为j; 
		}
	}
	
	for(int j=0;j+len<=lens;j++)
	{	
		int p=0;
		for(int k=0;k<len;k++)
		{
		if(ts[j][k]==t[k])
		p++;
		}
		ans=min(ans,len-p);	
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4052
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
string s;
bool d[110];
int main(){
	int ans=114514;
	cin>>s;
	for(int i=0;i<s.size();i++)d[i]=false;
	for(int i=0;i<s.size();i++){
		if(d[i]==false){
			int cnt=i,bef=i;
			for(int j=i+1;j<s.size();j++){
				if(s[j]==s[i]){
					cnt=max(cnt,j-bef-1);
					bef=j;
					d[j]=true;
				}
			}
			int r=s.size()-bef-1;
			cnt=max(cnt,r);
			ans=min(ans,cnt);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int MAX_N = 5000000;


int main(){
 int N,M,X;
  cin >>N>>M>>X;
  vector <int>C(12);
  vector <vector<int>>A(N,vector<int>(M));
  REP(i,N){
   cin >> C[i];
    REP(j,M)cin >> A[i][j];
  }
  
   int minC=MAX_N;
  bool atta =false;
  // すべての選び方を試す
  for (int tmp = 0; tmp < (1 << 12); tmp++) {
    bitset<20> s(tmp);  // 最大12個なので12ビットのビット列として扱う
 
    // ビット列の1のビットに対応する整数を選んだとみなして総和を求める
   int Csum = 0;
    vector<int>As(M,0);
    for (int i = 0; i < N; i++) {
      if (s.test(i)) {
        Csum += C.at(i);
        REP(j,M) As[j]+=A[i][j];
      }
    }
    bool xijyou=true;
    REP(j,M){
     if (As[j]<X) xijyou=false;
    }
    if(xijyou){
      minC = min(minC,Csum);
      atta = true;
    }
  }
  if(atta)cout <<minC <<endl;
  else cout << -1<<endl;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug(x) cout<<#x<<" = "<<x<<endl;

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

void solve()
{
    li n;

    cin>>n;

    li a[n+1];

    f(i,1,n)
    {
        cin>>a[i];
    }

    li ans=0;

    f(i,1,n)
    {
        if(i&1 && a[i]&1)
            ans++;
    }

    cout<<ans;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t=1;

    // cin>>t;

    while(t--)
    {
        solve();
    }

    return 0;
}

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

using namespace std;

int main()
{
unsigned long long h;
cin >> h;

for (int i=62; i>=0; i--)
    if ((h & (1ll<<i))!=0)
    {   //cout << i << "\n";
        long long x = (1ll<<(i+1)) - 1;
          //cout << 1ll * (1<<(i+1)) - 1ll;

        cout << x;

        break;
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var a = IO.RSInt;
            var h1 = a[0];
            var m1 = a[1];
            var h2 = a[2];
            var m2 = a[3];
            var k = a[4];

            var b = (h2 - h1) * 60;
            var c = m2 - m1;

            var ans = b + c - k;

            WriteLine(ans);


        }

        public class IO
        {
            #region Input
            public static int RInt => int.Parse(ReadLine());
            public static long RLong => long.Parse(ReadLine());
            public static double RDouble => double.Parse(ReadLine());

            public static string[] RSString => ReadLine().Split();
            public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
            public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }
    }
}

Measured memory_bytes: 28308
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    ll N;
    cin >> N;
    ll ans = 1e+15;
    for(ll i = 1; i*i <= N; i++){
        if(N%i == 0){
            ans = min(ans, i+(N/i)-2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main(int argc, char const *argv[])
{
    int n,i,x;
    cin >> n;
    vector<int> l;
    for (i=0;i<n;++i){
        cin >> x;
        l.push_back(x);
    }
    sort(l.begin(),l.end());
    int sum = accumulate(l.begin(),l.end()-1,0);
    l[n-1]<sum ? cout << "Yes":cout << "No";
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int n,a[200005];
class bit{
	public:
	int s[200005];
	void up(int p,int x){
		while(p<=n){
			s[p]+=x;
			p+=p&-p;
		}
	}
	int get(int p){
		int re=0;
		while(p){
			re=re+s[p];
			p-=p&-p;
		}
		RE re;
	}
	void clear(){
		FILL(s,0);
	}
}tree;
signed main(){
	int k;
	cin>>n>>k;
	FOR(i,1,n){
		cin>>a[i];
		a[i]-=k;
	}
	FOR(i,1,n)a[i]=a[i-1]+a[i];
	V<int> v;
	FOR(i,1,n)v.PB(a[i]);
	sort(ALL(v));
	v.erase(unique(ALL(v)),v.end());
	FOR(i,0,n)a[i]=lower_bound(ALL(v),a[i])-v.begin()+1;
	tree.up(a[0],1);
	int t,ans=0;
	FOR(i,1,n){
		ans+=tree.get(a[i]);
		tree.up(a[i],1);
	} 
	cout<<ans;
	RE 0;
}




Measured memory_bytes: 5104
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

string a(long long n){
    if(n==0)return "";
    n--;
    return a(n/26) + string(1,'a' + n%26);
}

int main(){
    long long n;
    cin >> n;
    cout << a(n) << endl;
}

Measured memory_bytes: 3596