akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
struct P {
    ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//??£??\???????????¨???
    ll to, cost;
};
struct S {//???????????±?????\???????????°
    int from, to, cost;
};
struct H {
    int x, y;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
    if (i > j) swap(i, j);
    if (i == 0) return j;
    return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
    return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad?????§?¨???????2??????????????¢
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int n,a;
	cin>>n>>a;
	cout<<n*n-a<<endl;
    getchar(); getchar();
}


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

int main() {
   while (1) {
      string s;
      getline(cin, s);
      if (s == ".") break;

      int n = s.size();
      stack<char> stk;
      bool ok = false;
      for (int i = 0; i < n; i++) {
         if (s[i] == '(') stk.push(s[i]);
         if (s[i] == '[') stk.push(s[i]);

         if (s[i] == ')') {
            // )と対応しない
            if (stk.size() == 0 || stk.top() != '(') {
               ok = true;
               break;
            }
            // )と対応する
            stk.pop();
         }
         if (s[i] == ']') {
            // ]と対応しない
            if (stk.size() == 0 || stk.top() != '[') {
               ok = true;
               break;
            }
            // [と対応する
            stk.pop();
         }
      }
      if (!ok && stk.empty()) {
         puts("yes");
      } else {
         puts("no");
      }
   }

   return 0;
}


Measured memory_bytes: 3192
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
        int n,k;
        cin>>n>>k;
        int A[200000];
        for(int i=0;i<n;i++){
                cin>>A[i];
        }
        int num[200001]={0};
        for(int i=0;i<n;i++){
                num[A[i]]++;
        }
        int x=0;
        for(int i=1;i<=n;i++){
                if(num[i]>0){
                        x++;
                }
        }
        int ans=0;
        if(x>k){
                sort(num,num+(n+1));
                for(int i=n-x+1;i<n-k+1;i++){
                        ans=ans+num[i];
                }
        }
        cout<<ans;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    ll n;
    cin >> n;
    string ans;
    while (n > 0){
        int m = n % 26;
        n /= 26;
        if (m == 0){
            n--, m = 26;
        }
        ans += (char) ('a' + m - 1);
    }
    Reverse(ans);
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3652
x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))

    for i in range(101):
        if x-i not in p:
            print(x-i)
            break
        elif x+i not in p:
            print(x+i)
            break
else:
    print(x)

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

int main(void)
{
    int N, K;
    int m;
    int boat[51][50];
    int R;
    int p[1300], q[1300];
    int bunny[51];
    int b;
    int i, j;
    int count;
    
    scanf("%d%d", &N, &K);
    
    memset(boat, 0, sizeof(boat));
    for (i = 0; i < K; i++){
        scanf("%d", &m);
        for (j = 0; j < m; j++){
            scanf("%d", &b);
            boat[i][b] = 1;
        }
    }
    
    scanf("%d", &R);
    for (i = 0; i < R; i++){
        scanf("%d%d", &p[i], &q[i]);
    }
    
    memset(bunny, 0, sizeof(bunny));
    for (i = 0; i < K; i++){
        for (j = 0; j < R; j++){
            if (boat[i][p[j]] == 1 && boat[i][q[j]] == 1){
                bunny[p[j]] = 1;
                bunny[q[j]] = 1;
//printf("<%d %d>", p[j], q[j]);
            }
        }
    }
    
    count = 0;
    for (i = 1; i <= N; i++){
        count += bunny[i];
    }
    
    printf("%d\n", count);
    
    return (0);
}

Measured memory_bytes: 624
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	private static int binary(int[] array, int query) {
		int left = 0;
		int right = array.length - 1;
		
		while (left <= right) {
			int middle = (left + right)/2;
			
			if(array[middle] == query) {
				return 1;
			}
			
			if(array[middle] > query) {
				right = middle -1;
			}
			if(array[middle] < query) {
				left = middle +1;
			}
		}
		return 0;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = Integer.parseInt(in.next());
		int[] nArray = new int[n];
		
		for(int i = 0; i < n; i++) {
			int nString = Integer.parseInt(in.next());
			nArray[i] = nString;
		}

		int q = Integer.parseInt(in.next());
		int[] qArray = new int[q];
		
		for(int j = 0; j < q; j++) {
			int qString = Integer.parseInt(in.next());
			qArray[j] = qString;
		}
		
		int qCount = 0;
		for(int qStr : qArray) {
			qCount += binary(nArray, qStr);
		}
		System.out.println(qCount);
		in.close();
	}
}


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

int main()
{
    string s,t,u;
    cin>>s>>t;
    int a,b;
    cin>>a>>b;
    cin>>u;
    if(u == s){
        cout<<a-1<<" ";
    }else
        cout<<a<<" ";
    if(u == t)
        cout<<b-1<<endl;
    else
        cout<<b<<endl;

    return 0;
}


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

int main(){
    int N,M,C; cin >> N >> M >> C;
    vector <int> B(M);
    rep(i,M) cin >> B[i];
    vector<vector<int>> A(N,vector<int>(M));
    rep(i,N){
        rep(j,M) cin >> A[i][j];
    }
    
    int ans=0;
    vector<int> SUM(N);
    rep(i,N){
        rep(j,M){
            SUM[i]+=A[i][j]*B[j];
        }
        if (SUM[i]+C>0) ans++;
    }
    
    cout << ans;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;
#include<algorithm>
#include<vector>
#include<cstdio>
#include<random>
#include<functional>

int main(){
string S;
cin >> S;
bool YN = true;
  bool NN = true;
for(int i =0; i<S.size(); i++){
 if(S[i] != 'L' && S[i] != 'U' && S[i] != 'D' && i%2==1){ YN = false;}
 if(S[i] != 'R' && S[i] != 'U' && S[i] != 'D' && i%2==0){NN = false;}
}
if(YN && NN){cout<< "Yes";}else{cout << "No";}
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
#define rrep(i, n) for(i = n - 1; i >= 0; i--)
using namespace std;

void chmin(int &a, int b) { a = min(a, b); }
void chmax(int &a, int b) { a = max(a, b); }

int INF = 1e+15;
int n, q;
int w[100], v[100];
int dp[110001];

signed main() {
	int i, j;
	
	cin >> n >> q;
	rep(i, n) cin >> w[i] >> v[i];
	rep(i, 110001) dp[i] = INF;
	
	dp[0] = 0;
	rep(i, n) {
		rrep(j, 100001) {
			chmin(dp[j + v[i]], dp[j] + w[i]);
		}
	}
	
	rrep(j, 100001) if (dp[j] <= q) break;
	cout << j << endl;
	return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
  if (!first) {
    res += ", ";
  }
  first = false;
  res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
  res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
  if (!first) {
    res += ", ";
  }
  first = false;
  res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() {cout<<endl;}
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 0
#endif


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n; cin>>n;
    vector<int> a(n), p(n), q(n);
    iota(a.begin(), a.end(), 1);
    for (int i=0; i<n; ++i){
    	cin>>p[i];
    }
    for (int i=0; i<n; ++i){
    	cin>>q[i];
    }
    int done=0;
    int pos[2];
    int cnt=1;
    do{
    	debug(a, p, q);
    	if (a==p){
    		done++;
    		pos[0]=cnt;
    	}
    	if (a==q){
    		done++;
    		pos[1]=cnt;
    	}
    	cnt++;
    } while (next_permutation(a.begin(), a.end()) && done<2);
    cout<<abs(pos[0]-pos[1]);

    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o; for (auto e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	cout << fixed << setprecision(12);
	double d; cin >> d;
	for (int i = 0; i < 30; i++) {
		if (sqrt(1.0 + i*i) > d) {
			if (i <= d)
				cout << max(sqrt(2.0)*d, i + 1.0) << endl;
			else
				cout << sqrt(2.0)*d<< endl;
			break;
		}
	}
	return 0;
}

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

int main(){
    long long X;
    long long sum=100;
    cin>> X ;

    for(int i=1; i<X; i++){
        sum+=(sum/100);

        if(sum>=X){
            cout << i <<endl;
            break;
        }
    }
    
    
}

Measured memory_bytes: 3588
import math

while True:
    a, op, b = map(str, input().split())
    a = int(a)
    b = int(b)
    if 0 <= a and b < 20001:
        if op == "+":
            answer = a + b
            print(answer)
        elif op == "-":
            answer = a - b
            print(answer)
        elif op == "*":
            answer = a * b
            print(answer)
        elif op == "/":
            answer = a / b
            print(math.floor(answer))
        elif op == "?":
            break
    else:
        if op == "?":
            break
        else:
            continue

Measured memory_bytes: 7684
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];


int main()
{
    ll a,b,c,d,i,j;
    cin>>a>>b>>c>>d;
    for(i=1;;i++){
        if(i&1){
            c-=b;
            if(c<=0){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
        else{
            a-=d;
            if(a<=0){
                cout<<"No"<<endl;
                return 0;
            }
        }

    }
return 0;
}


Measured memory_bytes: 8312
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> food(m);
  
  REP(i,n){
    int k;
    cin >> k;
    REP(i,k){
      int a;
      cin >> a;
      --a;
      food[a]++;
    }
  }
  int cnt = 0;
  REP(i,m){
    //cout << food[i] << endl;
    if(food[i] == n) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}


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

int main(void) {
    string o, e;
    cin >> o >> e;
    for (int i = 0; i < (int)e.size(); i++) {
        cout << o.at(i) << e.at(i);
    }
    if ((int)o.size() - (int)e.size() == 1) {
        cout << o.back();
    }
    return 0;
}

Measured memory_bytes: 3572
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    string s;
    cin >> s;
    ll sum = 0;
    rep(i, s.size()){
        sum += s[i] - '0';
    }
    if(sum % 9 == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}   

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

#define ll long long
#define ld double
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
const int INF=0x3f3f3f3f;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

bool cmp(pair<ll,ll> a, pair<ll,ll> b)
{
	if(a.ss != b.ss)
		return a.ss<b.ss;
	else
		return a.ff>b.ff;
}

int main()
{
	vivek_ghosh;
	
	cin>>n;
	pair<ll,ll> a[n];
	for(i=0;i<n;i++)	
	{
		cin>>a[i].ff>>a[i].ss;
	}
	
	sort(a,a+n,cmp);
	
	ll currTime = 0;
	bool valid = 1;
	for(i=0;i<n;i++)
	{
		if((a[i].ff + currTime) > a[i].ss)
		{
			valid = 0;
			break;
		}
		else
		{
			currTime += a[i].ff;
		}
	}
	
	if(valid)	
		cout<<"Yes";
	else
		cout<<"No";
	cout<<endl;
	
	return 0;
}




Measured memory_bytes: 3456
A, B, N = map(int, input().split())
ans = 0
if ((B == 1) or (A == 1)):
  ans = 0
elif (N < B):
  z = N
  p = (((A * z) / B) // 1)
  q = A * ((z / B) // 1)
  ans = p - q
else:
  z = B - 1
  p = (((A * z) / B) // 1)
  q = A * ((z / B) // 1)
  ans = p - q
print(int(ans))

Measured memory_bytes: 9060
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N = INT()
A = LIST()

ans = 0
for i in range(N):
    if A[i] % 2 == 1 and (i+1) % 2 == 1:
        ans += 1
print(ans)


Measured memory_bytes: 9516
#include<stdio.h>
int main()
{
	int d,r;
	int a,b;
	scanf("%d%d",&a,&b);
	d = a / b;
	r = a % b;
	printf("%d %d", d, r);
	double x, y;
	double  f;
	x = a;
	y = b;
	f = x / y;
	printf(" %f\n", f);
	return 0;
}

Measured memory_bytes: 2732
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int cnt=0;
    char s[101];
    
    scanf("%s", s);
      
    rep(i, strlen(s)){
        if (i%2==0&&(s[i]=='R'||s[i]=='U'||s[i]=='D')) {
            cnt++;
        } else if (i%2!=0&&(s[i]=='L'||s[i]=='U'||s[i]=='D')) {
            cnt++;
        }
    }
    
    if (cnt==strlen(s)) {
        printf("Yes");
    } else {
        printf("No");
    }
    
    return 0;
}



Measured memory_bytes: 1716
#include <bits/stdc++.h>
using namespace std;
/*
int64_t lucas1(int n){
  if(n == 0){
    return 2;
  }else if(n == 1){
    return  1;
  }else{
    return lucas1(n-1) + lucas1(n-2);
  }
}
*/
int64_t lucas2(int n){
  int64_t L0 = 2;
  int64_t L1 = 1;
  int64_t L2 = 3;
  if(n == 0){
    return L0;
  }
  if(n == 1){
    return L1;
  }
  for(int i=0;i<n-1;i++){
    L2 = L1 + L0;
    L0 = L1;
    L1 = L2;
  }
  return L2;
}

int main(void){
  int n;
  cin >> n;
  //cout << lucas1(n) << endl;
  cout << lucas2(n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

vector<vector<ll>> pascals_triangle(int n) {
    vector<vector<ll>> combi(n + 1, vector<ll>(n + 1));
    REP(i, n + 1) REP(j, i + 1) {
        if (j == 0 || j == i) combi[i][j] = 1LL;
        else combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
    }
    return combi;
}

ll gcd(ll m, ll n) {
    return n != 0 ? gcd(n, m % n) : m;
}

ll lcm(ll m, ll n) {
    // If both m and n are large numbers, the result is overflow without parentheses.
    return m * (n / gcd(m, n));
}

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << b + min(c, a + b + 1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>

ll INF = 1000000007;


//-----------------//
  #define amin main
//-----------------//


int amin()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,x,t;
	string s;
	cin>>s;
	ll cur = 0;
	for(ll i=0;i<s.length();i++)
	{
		cur += s[i] -'0';
	}
	if(cur%9==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;	
	


	
	return 0;
}

Measured memory_bytes: 3704
from collections import Counter


def get_color(rating):
    if rating >= 3200:
        return 8
    else:
        return rating // 400


input()
a = Counter(map(lambda x: get_color(int(x)), input().split()))
min_color_cnt = len([i for i in a if i < 8])
print(max(1, min_color_cnt), min_color_cnt + a[8])


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

template<typename T>
void chmin(T &a,T b){
  if(a>b)a=b;
}
typedef pair<int,int> P;
const int INF=1e8;

int main(){
  int n;cin>>n;
  int ans=INF;
  set<P> ry,ly,ux,dx,rp,rm,lp,lm,up,um,dp,dm;
  ry.insert(P(-INF,-INF));ry.insert(P(INF,INF));
  ly.insert(P(-INF,-INF));ly.insert(P(INF,INF));
  ux.insert(P(-INF,-INF));ux.insert(P(INF,INF));
  dx.insert(P(-INF,-INF));dx.insert(P(INF,INF));
  rp.insert(P(-INF,-INF));rp.insert(P(INF,INF));
  rm.insert(P(-INF,-INF));rm.insert(P(INF,INF));
  lp.insert(P(-INF,-INF));lp.insert(P(INF,INF));
  lm.insert(P(-INF,-INF));lm.insert(P(INF,INF));
  up.insert(P(-INF,-INF));up.insert(P(INF,INF));
  um.insert(P(-INF,-INF));um.insert(P(INF,INF));
  dp.insert(P(-INF,-INF));dp.insert(P(INF,INF));
  dm.insert(P(-INF,-INF));dm.insert(P(INF,INF));
  for(int i=0;i<n;i++){
    int x,y;cin>>x>>y;
    char c;cin>>c;
    if(c=='R'){
      ry.insert(P(y,x));
      rp.insert(P(x+y,x));
      rm.insert(P(x-y,x));
    }
    if(c=='L'){
      ly.insert(P(y,x));
      lp.insert(P(x+y,x));
      lm.insert(P(x-y,x));
    }
    if(c=='U'){
      ux.insert(P(x,y));
      up.insert(P(x+y,x));
      um.insert(P(x-y,x));
    }
    if(c=='D'){
      dx.insert(P(x,y));
      dp.insert(P(x+y,x));
      dm.insert(P(x-y,x));
    }
  }
  for(P R:ry){
    P L=*ly.lower_bound(R);
    if(L.first==R.first&&L.second>R.second)chmin(ans,(L.second-R.second)*5);
  }
  for(P U:ux){
    P D=*dx.lower_bound(U);
    if(D.first==U.first&&D.second>U.second)chmin(ans,(D.second-U.second)*5);
  }
  for(P R:rp){
    P U=*up.lower_bound(R);
    if(R.first==U.first&&R.second<U.second)chmin(ans,(U.second-R.second)*10);
  }
  for(P R:rm){
    P D=*dm.lower_bound(R);
    if(R.first==D.first&&R.second<D.second)chmin(ans,(D.second-R.second)*10);
  }
  for(P L:lp){
    P D=*--dp.lower_bound(L);
    if(L.first==D.first&&L.second>D.second)chmin(ans,(L.second-D.second)*10);
  }
  for(P L:lm){
    P U=*--um.lower_bound(L);
    if(L.first==U.first&&L.second>U.second)chmin(ans,(L.second-U.second)*10);
  }
  if(ans==INF)cout<<"SAFE"<<endl;
  else cout<<ans<<endl;
}


Measured memory_bytes: 31780
#include<bits/stdc++.h>
using namespace std;
main(){
	int n , a , b ;
	cin >> n >> a >> b;
	int sum1 = 0 , sum2 = 0;
	sum1 = a*n;
	sum2 = b;
	if(sum1 > sum2)
		cout<<sum2<<endl;
	else 
		cout<<sum1<<endl;
	return 0;
	 
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	while(true){
		int cur = 0 ,d[5];
		rep(i,5){
			if(cin >> d[i]) d[i]-- ,  cur |= (1<<d[i]);
			else return 0;
		}
		if(__builtin_popcount(cur) == 2){
			rep(i,5)
				cout << 2 - !!count(d,d+5,(d[i]+1)%3) << endl;
		}else{
			rep(i,5)cout << 3 << endl;
		}
	}
}

Measured memory_bytes: 0
#include <string.h>
#include <iostream>
#include <utility>
#include <math.h>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d) {
        cout << "Yes" << endl;
    } else if (abs(a - b) <= d && abs(b - c) <= d) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl; 
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cassert>
#include <vector>
#include <algorithm>

const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;

using namespace std;

int v, e;
vector< vector<int> > g;
vector<int> color;

int Search( int curr ) {

    color[curr] = GRAY;
	
    for ( int j : g[curr] ) {

	if ( color[j] == GRAY ) return 1;

	if ( color[j] == WHITE && Search( j ) ) return 1;
		
    }

    color[curr] = BLACK;

    return 0;
}
    
void solve(){

    scanf("%d %d", &v, &e);

    g.resize( v );
    color.resize( v, WHITE );

    int s, t;
    for ( int i=0; i<e; ++i ) {
	scanf("%d %d", &s, &t);
	g[s].push_back( t );
    }
    
    for ( int i=0; i<v; ++i ) {

	fill( color.begin(), color.end(), WHITE );
	
	if ( Search( i ) ) {
	    printf("1\n");
	    return;
	}
    }

    printf("0\n");
}

int main() {
    solve();
    return 0;
}




Measured memory_bytes: 2772
import sys
from collections import deque


input = sys.stdin.readline


def main():
    while que:
        nn = que.popleft()
        for n in edges[nn-1]:
            if D[n-1] == INF or D[n-1] > D[nn-1] + 1:
                D[n-1] = D[nn-1] + 1
                que.append(n)
                if n > 1:
                    B[n-2] = nn
    print("Yes")
    for b in B:
        print(b)


if __name__ == "__main__":
    N, M = map(int, input().split())
    edges = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        edges[a-1].append(b)
        edges[b-1].append(a)
    B = [0]*(N-1)
    que = deque([1])
    INF = 10**10
    D = [INF]*N
    D[0] = 0
    main()


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

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

ll mypow(ll a,int b){
  ll res=1;
  rep(i,b)res*=a;
  return res;
}

int main() {
  int n,k;cin>>n>>k;
  ll x=n/k;ll y=n%k;
  ll ans=mypow(x,3);
  if(k%2){cout << ans;return 0;}
  ans+=(y<k/2?ans:mypow(x+1,3));
  cout << ans;
}

Measured memory_bytes: 256
import sys

lines = sys.stdin.readlines()

for n, c in enumerate(lines[0]):
  if n == 0:
  	res = '2'
  elif n == 1:
    res += '0'
  elif n == 2:
    res += '1'
  elif n == 3:
    res += '8'
  else:
    res += c
print(res)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=100;i>=0;i--){
    int sum=0;
    for(int j=0;j<n;j++){
      if(a[j]>=i)sum++;
    }
    if(sum>=i){
      cout<<i<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;

int coudp[100001];

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2 << "\n";

	return 0;
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
const int inf = 1000000001;
const ll INF = 1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<<fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

int main() {
	int x, y, z, k, s;
	cin >> k >> s;
	ll cnt = 0;
	for (x = 0; x <= k; x++) {
		for (y = 0; y <= k; y++) {
			z = s - x - y;
			if (z >= 0 && z <= k) {
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
//この問題は
//・a[0],a[1],a[2],…,a[n-1]が与えられる。
//・,a[i], → +、a[i],→+、,a[i]→+のいずれかをおこなう。
//・+になってないa[i]の和がスコアになる。
//・スコアを最大化する。
//という問題。
//例を挙げると、
//a,b,c,d,e,f,g,h
//+ b,c,d,e,f,g,h
//+ b + d,e,f,g,h
//+ b + d,e + g,h
//+ b + d + + + h
//で, b + d + hがスコアになる感じ。
//
//こういうのは「ありえる状態」を考えると分かりやすい。状態の例として、
//exist[i] = a[i]がまだ+になっておらず残っている
//を考えると、連続する+は奇数個になるので、exist[i] = trueなるiの偶奇は全て等しくなる。
//逆に偶奇さえ等しければ、必ず残す方法が存在する。
//
//連続する+は奇数個の証明：
//・「隣り合う,の間の文字数が奇数」と仮定すると、3つの奇数の和は奇数なので、操作後も「」が成り立つ。
//・最初は「」が真なので、帰納法より常に「」が真。
//・連続する+は、もともと隣り合う,の間の文字だったので、「」より連続する+は奇数個
//
//よって、この問題は、
//・偶数番目について、a[i] >= 0なるiを残す
//・奇数番目について、a[i] >= 0なるiを残す
//の2パターンを考えて、スコアが大きい方を採用すると、解くことができる。
//復元は頑張る。必ず1個以上は要素を残す必要があることに注意する。

#include <iostream>
#include <algorithm>
#include <vector>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int a[1000];

signed main() {
	int i, j;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	
	int maxId = 0;
	rep(i, n) {
		if (a[maxId] < a[i]) maxId = i;
	}
	if (a[maxId] <= 0) {
		cout << a[maxId] << endl;
		cout << n - 1 << endl;
		rep(i, maxId) cout << 1 << endl;
		rep(i, n - 1 - maxId) cout << n - maxId - i << endl;
		return 0;
	}
	
	int sum[2] = {0};
	vector<int> vec[2];
	rep(i, n) {
		if (a[i] >= 0) {
			sum[i % 2] += a[i];
			vec[i % 2].push_back(i);
		}
	}
	
	vector<int> ids;
	if (sum[0] > sum[1]) ids = vec[0];
	else ids = vec[1];
	
	//復元(ids.size() > 0)
	vector<int> ans;
	int length = n;
	rep(i, ids[0]) {
		ans.push_back(0);
		length--;
	}
	rep(i, (int)ids.size() - 1) {
		int mid = (ids[i + 1] - ids[i]) / 2;
		rep(j, mid) {
			ans.push_back(mid - j);
			length -= 2;
		}
	}
	rep(i, n - ids[ids.size() - 1] - 1) ans.push_back(length - 1 - i);
	
	//答え
	cout << max(sum[0], sum[1]) << endl;
	cout << ans.size() << endl;
	rep(i, ans.size()) { cout << ans[i] + 1 << endl; }
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define input(x) x; cin >> x;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

int main(){
  int input(a);
  cout << (24 - a) + 24 << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        String S = scanner.next();
        int Q = scanner.nextInt();
        List<TreeSet<Integer>> maps = new ArrayList<>();
        for (int i = 0; i < 26; i++) {
            maps.add(new TreeSet<>());
        }
        StringBuilder sb = new StringBuilder(S);
        for (int i = 0; i < S.length(); i++) {
            char c = S.charAt(i);
            maps.get(c - 'a').add(i);
        }

        for (int i = 0; i < Q; i++) {
            int type = scanner.nextInt();
            int left = scanner.nextInt() - 1;
            if (type == 1) {
                String right = scanner.next();
                int mapIndex = sb.charAt(left) - 'a';
                maps.get(mapIndex).remove(left);
                maps.get(right.charAt(0) - 'a').add(left);
                sb.setCharAt(left, right.charAt(0));
            } else {
                int right = scanner.nextInt() - 1;
                int count = 0;
                for (int j = 0; j < 26; j++) {
                    TreeSet<Integer> set = maps.get(j);
                    Integer floor = set.floor(right);
                    if (floor != null && floor >= left) {
                        count++;
                    }
                }
                System.out.println(count);
            }
        }
    }
}


Measured memory_bytes: 106060
#include <iostream>
#include <string>
#include <algorithm>

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif
	int n = 0;
	std::string str0;
	std::string str1;
	int score0 = 0;
	int score1 = 0;

#if INPUT_FROM_FILE
	ifs >> n;
#else
	std::cin >> n;
#endif
	
	for(int i = 0; i < n; i++){
#if INPUT_FROM_FILE
		ifs >> str0 >> str1;
#else
		std::cin >> str0 >> str1;
#endif
		if(str0 > str1){
			score0 += 3;
		}
		else if(str1 > str0){
			score1 += 3;
		}
		else{
			score0++;
			score1++;
		}
	}
	std::cout << score0 << " " << score1 << std::endl;
	return 0;
}

Measured memory_bytes: 3148
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<50;
const double pi=acos(-1);
const double eps=1e-8;
const int mod=1e9+7;
const vi emp;
const int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

const int D=86400,S=10800,T=14400;

int n;

int main(){
	cin>>n;
	vi s(D+1);
	int now=0,num=0;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		(now+=a)%=D;
		int A=T-now,B=S+T-now+1;
		if(A<0&&B<0){
			A+=D;
			B+=D;
		}
		if(A<0){
			s[0]++;
			s[B]--;
			s[A+D]++;
			s[D]--;
		}
		else if(B>D){
			s[0]++;
			s[B-D]--;
			s[A]++;
			s[D]--;
		}
		else{
			num++;
			s[A]++;
			s[B]--;
		}
		(now+=b)%=D;
	}
	int ans=s[0];
	for(int i=1;i<=D;i++){
		s[i]+=s[i-1];
		ans=max(ans,s[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s="",t="";
  for(int i=0; i<n; i++) {
      string a;
      cin >> a;
      s+=a;
  }
  int m;
  cin >> m;
  for(int i=0; i<m; i++) {
      string b;
      cin >> b;
      t+=b;
  }
  if(s<t) {
      cout << 1 << endl;
  }
  else {
      cout << 0 << endl;
  }
}


Measured memory_bytes: 3204
package main

import (
	"unicode/utf8"

	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	var s, ans string
	var len int

	firstArg := nextLine()
	nSlice := strings.Split(firstArg, " ")

	s = nSlice[0]
	len = utf8.RuneCountInString(s)
	ans = strings.Repeat("x", len)

	fmt.Print(ans)
}

Measured memory_bytes: 640
using System;

namespace ABC108A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            if (a % 2 == 0)
                Console.WriteLine((a / 2) * (a / 2));
            else
                Console.WriteLine((a / 2 + 1) * (a / 2));
            Console.ReadLine();

        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
    int N, M, X, resR, resL;
    cin >> N >> M >> X;
    vector<int> A(N,0);
    resR = resL = 0;
    for (int i = 0; i < M; i++) {
        int Ai;
        cin >> Ai;
        A[Ai]++;
    }
    for (int i = X; i < N; i++) { resR += A[i]; }
    for (int i = X; i >= 0; i--) { resL += A[i]; }
	cout << min(resR, resL) << endl;
	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

ll powmod(ll a, ll n, ll mod) {
	ll ret = 1;
	while (n > 0) {
		if (n % 2 == 1) { ret = ret * a % mod; }
		a = a * a % mod;
		n /= 2;
	}
	return ret;
}

void solve()
{
	int n;
	cin >> n;

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

	ll ans = 0;
	for(int i = 0; i < 60; ++i)
	{
		ll d0 = 0, d1 = 0;
		for(int j = 0; j < n; ++j)
		{
			// i 桁目が 1 か 0 か
			if((a[j] >> i) & 1) ++d1;
			else ++d0;
		}

		// i 桁目が 1 である個数
		ll n = d0 * d1 % MOD;

		// i 桁目の総和 (= 2^i * d0 * d1)
		ll tmp = powmod(2, i, MOD) * n % MOD;

		ans = (ans + tmp) % MOD;
	}
	cout << ans << endl;	
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 2e3+5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}


int n, x, y; vector <int> adj[N];
int dis[N]; bool vis[N];
int ans[N]; 

void solve()
{
    cin >> n >> x >> y;
    for (int i=1; i<n; ++i) {
    	adj[i].pb(i+1); 
    	adj[i+1].pb(i);
    }
    adj[x].pb(y);
    adj[y].pb(x);
    fill(ans,ans+n+2,0);
    for (int i=1; i<n; ++i) {
    	fill(dis,dis+n+2,0); fill(vis,vis+n+2,false);
    	queue <int> q; vis[i]=true; dis[i]=0; q.push(i);
    	while (!q.empty()) {
    		int s=q.front(); q.pop();
    		for (auto u : adj[s]) {
    			if (vis[u]) continue;
    			vis[u]=true;
    			dis[u]=dis[s]+1;
    			q.push(u);
    		}
    	}
    	for (int j=1; j<=n; ++j) {
    		//sout(dis[j]);
    		if (j>i) ans[dis[j]]++;
    	}//cout << endl;
    }
    for (int i=1; i<n; ++i) nout(ans[i]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
using namespace std;
int main(void){
  
    int r,d,x;
    
    cin >> r >> d >> x;
        
    for(int i=0; i < 10; i++){
        int nextx = r*x-d;
        cout << nextx << endl;
        x=nextx;
    }
    
    return 0;
}


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

#define MOD 1000000007
#define INF 100000000000

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


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const vector<vector<T>>&obj) {
    o << "[" << endl; for (int i = 0; i < (int)obj.size(); ++i) o << "  " << obj[i] << endl; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}

vector<vector<int>> G;
vector<int> dp;

int rec(int v) {
    if (dp[v] >= 0) return dp[v];
    int ret = 0;
    for (int u : G[v]) {
        ret = max(ret, rec(u) + 1);
    }
    return dp[v] = ret;
}

int main(int argc, char const *argv[]) {
    int N, M, X;
    cin >> N >> M >> X;

    vector<ll> C(N);
    vector<vector<ll>> A(N, vector<ll>(M));
    for (int n = 0; n < N; ++n) {
        cin >> C[n];
        for (int m = 0; m < M; ++m) {
            cin >> A[n][m];
        }
    }
    
    ll ans = -1;
    for (int s = 0; s < (1 << N); ++s) {
        ll cost = 0;
        vector<ll> skills(M, 0);
        for (int n = 0; n < N; ++n) {
            if ((s >> n) & 1) {
                cost += C[n];
                for (int m = 0; m < M; ++m) {
                    skills[m] += A[n][m];
                }
            }
        }
        bool achieved = true;
        for (int m = 0; m < M; ++m) {
            if (skills[m] < X) {
                achieved = false;
                break;
            }
        }

        if (achieved && (ans == -1 || ans > cost)) {
            ans = cost;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string tmp;
  int ans = 0;
  int anum=0, bnum=0, banum=0;
  bool notba = false;
  for(int i=0;i<N;++i) {
    cin>>tmp;
    for(int i=0;i<tmp.size()-1;++i) {
      if(tmp[i]=='A' && tmp[i+1]=='B') ans++;
    }
    if(tmp[0]=='B' && tmp[tmp.size()-1]=='A') {
      anum++;
      bnum++;
    }
    else if(tmp[0]=='B') {
      bnum++;
      notba = true;
    }
    else if(tmp[tmp.size()-1]=='A') {
      anum++;
      notba = true;
    }
  }
  if(notba) cout<<ans+min(anum, bnum)<<endl;
  else if(min(anum, bnum)>0) cout<<ans+min(anum, bnum)-1<<endl;
  else cout<<ans<<endl;
}



Measured memory_bytes: 3560
// https://abc102.contest.atcoder.jp/tasks/abc102_a

function f(n) {
  return n % 2 === 0 ? n : n * 2
}

module.exports = {
  f,
}

function Main(input) {
  const n = parseInt(input.trim(), 10)

  console.log(f(n))
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 11468