akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define _Pi 3.1415926535
using namespace std;
typedef long long ll;

int main(){
    int x,a,b;
    cin >> x >> a >> b;
    a -= x;
    b -= x;
    if(abs(a)<abs(b)) cout << "A" << endl;
    else cout << "B" << endl;    
    return 0;
}


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

int main(){
  string str;
  cin >> str;
  
  if(str[0] == str[1] || str[1] == str[2] || str[2] == str[3] || str[0] == str[1] == str[2] || str [1] == str[2] == str[3] || str[0] == str[1] == str[2] == str[3]){
    cout << "Bad" << endl;
  }
  else{
    cout << "Good" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define ull unsigned long long 
int main(){ 
  ll n,k;cin>>n>>k;
  vector<ll>p(n);
  rep(i,n)
  {
    cin>>p.at(i);
  }
  sort(p.begin(),p.end());
  ll ans=0;
  for(int i=n-k-1;i>=0;i--)
  {
    ans+=p.at(i);
  }
  cout<<ans;
}
    
    

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

int main(){
	string s; cin >> s;
  	vector<char> C;
  	for (int i=0; i<s.size();i++){
    	if(s.at(i) == '0'){C.push_back('0');}
      	else if(s.at(i) == '1'){C.push_back('1');}
      	else{
          if(C.size() !=0){
          	C.erase(C.begin() + (C.size()-1));
          }
        }
    }
  	for(int i=0 ; i<C.size(); i++){
    	cout << C.at(i);
    }
  	cout << endl;
  	
}

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

cnt = 0
for i in range(n - 2):
    permutation = [p[i], p[i + 1], p[i + 2]]
    permutation.pop(permutation.index(max(permutation)))
    if max(permutation) == p[i + 1]:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  string s;
  cin>>s;
  char prev = s[0];
  for(int i=1; i<4; i++) {
    if(prev == s[i]) {
      std::cout << "Bad" << std::endl;
      return 0;
    }
    prev = s[i];
  }
  std::cout << "Good" << std::endl;
  return 0;
}



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

int main() {
  int a, b;
  cin >> a >> b;
  int avg =  (a + b) / 2;
  int amari =  (a + b) % 2;
  int result =avg +  (amari / 1);
  cout << result << endl;
}

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

int main() {
string s;
cin>>s;
string br1, br2;
br1+=s[0]; br1+=s[1];
br2+=s[2]; br2+=s[3];
int a= stoi(br1);
int b= stoi(br2);
if(a==0&&b==0){cout<<"NA";return 0;}
if(a<=12&&b<=12&&a!=0&&b!=0)
{
	cout<<"AMBIGUOUS";
	return 0;
}
else if (b<=12&&b!=0)
{
		cout<<"YYMM";
	return 0;
}
else if(a<=12&&a!=0)
{
	cout<<"MMYY";
	return 0;
}
else
{
	cout<<"NA";
	return 0;
}

	
	
	
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.LongStream;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDecreaseContestantVer solver = new DDecreaseContestantVer();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDecreaseContestantVer {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long k = in.nextLong();
            int n = 50;
            long[] a = new long[n];
            Arrays.fill(a, 49);
            a = Arrays.stream(a).map(x -> x + k / n).toArray();
            for (int i = 0; i < n; i++) {
                if (i < k % n) {
                    a[i] += (n - k % n + 1);
                } else {
                    a[i] -= k % n;
                }
            }

            out.println(50);
            for (int i = 0; i < n; i++) {
                out.print(a[i] + " ");
            }
            out.println();


        }

    }
}



Measured memory_bytes: 27220
N=gets.to_i
a=gets.split.map(&:to_i)
an=Hash.new(0)
s = 0
a.each do |x|
  an[x]+=1
  s+=x
end
Q=gets.to_i
Q.times do
  b,c = gets.split.map(&:to_i)
  s += an[b]*(c-b)
  an[c]+=an[b]
  an[b]=0
  puts s
end


Measured memory_bytes: 25760
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main() {
    fio;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    int n1;
    cin >> n1;
    cout << n*n1 << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


int main(){
	int N, M, r, q;
	while(cin>>N>>M){
		if(N==0 && M==0) break;
		cin>>r;
		vi t(r), n(r), m(r), s(r);
		rep(i, r){
			cin>>t[i]>>n[i]>>m[i]>>s[i];
		}
		cin>>q;
		vi ts(q), te(q), qm(q);
		rep(i, q){
			cin>>ts[i]>>te[i]>>qm[i];
		}

		vector<pair<pair<int,int>, int > >p[1010];
		for(int i = 0; i < r; i++){
			if(s[i]==0){
				p[n[i]].back().first.second=t[i];
			}
			else{
				p[n[i]].push_back(pair<pii, int>(pii(t[i], -1), m[i]));
			}
		}

		vector<pii> v[10010];
		for(int i = 0; i < 1010; i++){
			for(int j = 0; j < p[i].size(); j++){
				v[p[i][j].se].pb(p[i][j].fi);
			}
		}
		for(int i = 0; i < 10010; i++){
			sort(all(v[i]));
			vector<pii> tmp;
			if(v[i].size()>0){
				tmp.pb(v[i][0]);
				for(int j = 1; j < v[i].size(); j++){
					if(tmp.back().se >= v[i][j].fi){
						tmp.back().se = max(tmp.back().se, v[i][j].se);
					}
					else{
						tmp.pb(v[i][j]);
					}
				}
				v[i]= tmp;
			}
		}

		for(int i = 0; i <q; i++){
			int ans = 0;
			for(int j = 0; j < v[qm[i]].size(); j++){
				if(v[qm[i]][j].se >= ts[i] && v[qm[i]][j].fi <= te[i]){
					ans += min(v[qm[i]][j].se, te[i])-max(v[qm[i]][j].fi, ts[i]);
				}
			}
			cout<<ans<<endl;
		}
	}
}

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

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2,)(__VA_ARGS__)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define ten(n) ((int)1e##n)
#define fst first
#define snd second
using ll=long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pil=pair<int,ll>;using pli=pair<ll,int>;
using vs=vector<string>;using vvs=vector<vs>;using vvvs=vector<vvs>;
using vb=vector<bool>;using vvb=vector<vb>;using vvvb=vector<vvb>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template<class T> bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
ll ri(){ll l;cin>>l;return l;} string rs(){string s;cin>>s;return s;}
template<class T>T read(){T t;cin>>t;return t;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<'('<<p.fst<<", "<<p.snd<<')';}
ostream&operator<<(ostream&o,const vb&t){forr(e,t)o<<"#."[e];return o;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&t){o<<"{";forr(e,t)o<<e<<",";o<<"}"<<endl;return o;}
#ifdef LOCAL
vs s_p_l_i_t(const string&s,char c){vs v;stringstream ss(s);string x;while(getline(ss,x,c))v.emplace_back(x);return move(v);}
void e_r_r(vs::iterator it){cerr<<endl;}
template<class T,class... Args>void e_r_r(vs::iterator it,T a,Args... args){cerr<<it->substr((*it)[0]==' ',it->length())<<" = "<<a<<", ";e_r_r(++it,args...);}
#define out(args...){vs a_r_g_s=s_p_l_i_t(#args,',');e_r_r(a_r_g_s.begin(),args);}
#else
#define out(args...)
#endif

bool solve() {
  int a =ri();
  int b = ri();
  int c = ri();
  return (a <= c && c <= b);
}

void Main() {
  cout << (solve() ? "Yes" : "No") << endl;
}

int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <deque>
#include <set>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define FOR(i,a,b) for (ll i = (a) ; i <= (b); ++i)
#define RFOR(i,a,b) for (ll i = (a) ; i >= (b); --i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい



void Main(){
	string s, t;
	int ans=0;
	cin >> s >> t;

	rep(i, 3){
		if(s[i] == t[i]) ans++;
	}

	cout << ans << endl;

}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, r;
    cin >> n >> r;
    if (n >= 10) {
        cout << r << '\n';
    }
    else {
        cout << r + 100 * (10 - n) << '\n';
    }
}


Measured memory_bytes: 3620
s = input()

op = [['+', '+', '+'],
      ['+', '+', '-'], ['+', '-', '+'], ['-', '+', '+'],
      ['+', '-', '-'], ['-', '+', '-'], ['-', '-', '+'],
      ['-', '-', '-']]

for p in op:
   ans = int(s[0])
   for i in range(3):
      if (p[i] == '+'):
         ans += int(s[i+1])
      else:
         ans -= int(s[i+1])
   if (ans == 7):
      print(s[0]+p[0]+s[1]+p[1]+s[2]+p[2]+s[3]+'=7')
      exit()


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

int main(void){
    int g=0,p=0;
    char s[100020];
    scanf("%s",s);
    for (int i=0; i<strlen(s); i++){
        if (s[i]=='g'){
            g++;
        } else if (s[i]=='p'){
            p++;
        }
    }
    if ((g+p)/2==p){
        printf("0\n");
    } else {
        printf("%d\n",(g+p)/2-p);
    }
	return 0 ;
}

Measured memory_bytes: 256
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>

using namespace std;

typedef struct datum_name {
	int x;
	int y;
	int whosay;
	bool operator==(const datum_name& data) const
	{
		return (x == data.x && y == data.y);
	}
} datum;


bool cmp_who(const datum& left, const datum& right) {
	return left.whosay < right.whosay;
}


int main()
{
	int A, B;
	cin >> A >> B;
	int C;
	if (A != 1 && B != 1) C = 1;
	if (A != 2 && B != 2) C = 2;
	if (A != 3 && B != 3) C = 3;
	cout << C << endl;
	return 0;

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
N, M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

ninki = 0
s = sum(A)
for i in range(N):
    if A[i] >= s / (4 * M):
        ninki += 1
if ninki >= M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38384
#include<iostream>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include <algorithm>
using namespace std;
#define P pair<int, int>

		vector<P> vec;

void loop(int p, int s);
void disp();

int main(){
	int n, w, d;
	while(cin >>n >>w >>d){
		vec.clear();
		if(n == 0 && w == 0 && d == 0) break;
		vec.push_back( make_pair(w, d) );
		for(int i = 0; i < n; i++){
			int p, s;
			cin >>p >>s;
			loop(p, s);
			//cout<< i << " " << vec.size() << endl;
		}
		vector<int> se;
		for(int i = 0; i < vec.size(); i++) se.push_back(vec[i].first * vec[i].second);
		sort(se.begin(), se.end());
#ifdef DEBUG
		cout << "SIZE = " << se.size() << endl;
#endif		
		vector<int>::iterator it = se.begin();
		cout << (*it);
		for( it++ ; it != se.end(); it++) cout <<" " <<(*it);
		cout << endl;
		
	}
}

void loop(int p, int s){
	P nowp = vec[p - 1];
//	vector<P>::iterator it = vec.begin();
//	for(int i = 0; i < (p - 1); i++) it++;
	vec.erase(vec.begin() + p - 1);
	int x1, y1, x2, y2;
	while(s > nowp.first + nowp.second) s -= (nowp.first + nowp.second);
#ifdef DEBUG
	cout <<"s = " <<s <<endl;
#endif
	if(s > 0 && s < nowp.first){
#ifdef DEBUG
		cout <<"!" <<endl;
#endif
		x1 = nowp.first - s; y1 = nowp.second;
		x2 = s; y2 = nowp.second;
	} else{
#ifdef DEBUG
		cout <<"!!" <<endl;
#endif
		x1 = nowp.first; y1 = s - nowp.first;
		x2 = nowp.first; y2 = nowp.first + nowp.second - s;
	}
	if((x1 * y1) > (x2 * y2)){
		vec.push_back( make_pair(x2, y2) );
		vec.push_back( make_pair(x1, y1) );
	} else{
		vec.push_back( make_pair(x1, y1) );
		vec.push_back( make_pair(x2, y2) );
	}
#ifdef DEBUG
	disp();
#endif
}

void disp(){
	cout <<endl;
	for(int i = 0; i < vec.size(); i++) cout <<vec[i].first <<"," <<vec[i].second <<" || ";
	cout <<endl;
}

Measured memory_bytes: 0
#スペース区切りの文字をint型でリスト化
li = list(map(int,input().split())) #[A,B,C,K]

counter_1=li[0]
counter_0=li[1]
counter_m1=li[2]
counter_choice=li[3]

if counter_choice > counter_1:
    sumpoint=1*counter_1
    counter_choice = counter_choice - counter_1
else:
    sumpoint=1*counter_choice
    print(sumpoint)
    counter_choice=-999

if counter_choice != -999:
    if counter_choice > counter_0:
        sumpoint = sumpoint + 0*counter_0
        counter_choice = counter_choice - counter_0
    else:
        sumpoint = sumpoint + 0*counter_choice
        print(sumpoint)
        counter_choice=-999

if counter_choice != -999:
    if counter_choice > counter_m1:
        sumpoint = sumpoint + (-1)*counter_m1
        counter_choice = counter_choice - counter_m1
    else:
        sumpoint = sumpoint + (-1)*counter_choice
        print(sumpoint)
        counter_choice=-999

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


int main()
{


     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
  
 
  int first,second,third;

  cin>>first>>second>>third;

  int total=1<<first;

  vector<int>price;
  vector<vector<int>>all;
  for(int i=0;i<first;i++)
  {
    int pr;
    cin>>pr;
    price.push_back(pr);
    vector<int>temp;
    for(int j=0;j<second;j++)
    {
        int alltemp;
        cin>>alltemp;
        temp.push_back(alltemp);
    }
    all.push_back(temp);
  }


   long long int ans=INT_MAX;
  for(int i=1;i<total;i++)
  {
    long long int tempprice=0;
    vector<long long int>nish(second+1,0);
    for(int j=0;j<first;j++)
    {
        if(i&(1<<j))
        {
            tempprice+=price[j];
            for(int k=0;k<second;k++)
            {
                nish[k]+=all[j][k];
            }

        }
    }
    int flag=0;
    for(int j=0;j<second;j++)
    {
        if(nish[j]<third){
            flag=1;
            break;}
    }


    if(!flag)
     ans=min(ans,tempprice);
  }

  if(ans!=INT_MAX)
      cout<<ans<<endl;
  else
    cout<<"-1"<<endl;



  return 0;

}

Measured memory_bytes: 3652
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>

using namespace std;
#define ll          long long
#define endl        "\n"
#define inf         10000000002
#define pb          push_back
#define pf          push_front
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(a)      a.begin(),a.end()
#define mp          make_pair
#define MAX         100
#define yes         cout<<"YES"<<endl
#define no          cout<<"NO"<<endl
#define bye         return 0

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

int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      //freopen("inputNew.txt", "r", stdin);

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

      int cnt=0;
      for(int i=0; i<n; i+=2){
            if(arr[i]%2) cnt++;
      }
      cout<<cnt<<endl;


      bye;
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define LOWER(a,x) lower_bound(ALL(a), x) - a.begin() - 1;
#define COUNT(a,x)  upper_bound(ALL(a), x) - lower_bound(ALL(a), x);
#define MCOUNT(a,x,y) upper_bound(ALL(a), y) - lower_bound(ALL(a), x);
#define INF 111111111111111111
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0, ma = 0, mi = 0;
string s;
bool flag, ok;
ll dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
ll ddx[8] = { 1,-1,0,0,1,1,-1,-1 }, ddy[8] = { 0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 111111



int main(void) {
  cin >> s;
  n = s.length();
  flag = false;
  if (n != 2) {
	FOR(i, 2, n) {
	  if (s[i - 2] == s[i - 1] || s[i - 2] == s[i] || s[i - 1] == s[i]) {
		ans = i;
		flag = true;
		break;
	  }
	}
  }
  else {
	if (s[0] == s[1]) {
	  cout << "1 2" << endl;
	  return 0;
	}
  }
  if (flag) {
	cout << ans - 1 << " " << ans + 1 << endl;
  }
  else {
	cout << "-1 -1" << endl;
  }

  return 0;
}

Measured memory_bytes: 512
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
    }

    let mut edges = vec![];

    if n % 2 == 0 {
        for i in 1..n {
            for j in i+1..=n {
                if i + j == n + 1 {
                    continue;
                }
                edges.push((i, j));
            }
        }
    } else {
        for i in 1..n {
            for j in i+1..=n {
                if i + j == n {
                    continue;
                }
                edges.push((i, j));
            }
        }
    };

    println!("{}", edges.len());
    for (a, b) in edges {
        println!("{} {}", a, b);
    }
}


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

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

fn main() {
  let _a: f64 = read();
  let a: u32 = _a as u32;
  let b = 10f64.powi(_a.log10() as i32) as u32;
  if a == b {
    println!("{}", 10);
  } else {
    println!("{}", sum_digit_num(a));
  }
}

fn sum_digit_num(a: u32) -> u32{
  let mut b = a/10*10;
  let mut diff = a-b;
  let mut res = diff;
  let mut x = a/10;
  loop {
    b = x/10*10;
    diff = x-b;
    res += diff;
    if b == 0 { break;}
    x = x/10;
  }
  return res
}


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

int main() {
  ll h;
  cin >> h;
  
  ll i = 1;
  ll ans = 0;
  while (i <= h) {
    ans += i;
    i *= 2;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define ABS(x)		((x)<0 ? -(x):(x))

int main(){
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  
  if( ABS(a-c) <= d ){ printf("Yes\n"); return 0; }
  if( ABS(a-b) <= d && ABS(b-c) <=d ){ printf("Yes\n"); return 0; }
  
  printf("No\n");
  return 0;
}

Measured memory_bytes: 1616
import fractions

A,B,C,D=map(int,input().split())
lcm=int(C*D/(fractions.gcd(C,D)))

if B//lcm==0:
    num_CD=0
else:
    num_CD=B//lcm-(A-1)//lcm


if B//C==0:
    num_C=0
else:
    num_C=B//C-(A-1)//C



if B//D==0:
    num_D=0
else:
    num_D=B//D-(A-1)//D


ans=B-A+1-num_C-num_D+num_CD


print(int(ans))

Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

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

int main() {
    // input
    int n, k;
    cin >> n >> k;
    int p[n];
    double e[n];
    rep(i, n) {
        cin >> p[i];
        e[i] = (p[i] + 1) / 2.0;
    }
    // solve
    double s[n+1];
    rep(i, n+1) {
        if (i == 0) s[i] = 0.0;
        else s[i] = s[i-1] + e[i-1];
    }
    double max_e = 0.0;
    rep(i, n-k+1) {
        chmax(max_e, s[i+k]-s[i]);
    }
    // output
    cout << fixed << setprecision(10) << max_e << endl;
}

Measured memory_bytes: 7668
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s,x;
int i, n, m, j, k, l, r;
int main() {
    cin>>s;
    n=s.size();
    for(i=0;i<n;i++){
        if(s[i]=='S')l++;
        else r++;
        if(l==r){l=r=0;}
        if(l<r){
            k+=r-l;
            l=r=0;
        }
    }
    cout<<k*2;
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main() {
	int c,i,alphabet_num[26]={0};
	char alphabet[26] = "abcdefghijklmnopqrstuvwxyz";
	
	while((c = getchar()) != EOF) {
		if(c >= 'A' && c <= 'Z') {
			c = c - 'A' + 'a';
		}
		if(c >= 'a' && c <= 'z') {
			for(i = 0;i < 26;i++) {
				if(c == 'a' + i) {
					alphabet_num[i] += 1;
					break;
				}
			}
		}
	}
	for(i = 0; i< 26; i++) {
		printf("%c : %d\n", alphabet[i], alphabet_num[i]);
	}
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <math.h>
#include <iomanip>
#include <bits/stdc++.h>
#include <string.h>
#include <string>
#include <algorithm>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define N 100005
#define inf 1e18
#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

ll binomialCoeff(ll n,ll k)
{
    ll res = 1;
    if(k >n - k)
        k = n - k;
    for(int i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll power(ll x,ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = power(x, y/2);
    if (y%2 == 0)
        return temp*temp;
    else
        return x*temp*temp;
}


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

void Sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}

//******************************************************    CHECK CONSTRAINTS   ***************************************************************//

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
    int n;
    cin >> n;
    ll arr[n];
    ll sum[n];
    for(int i=0;i<n;i++)
        cin >> arr[i];
    ll dp[405][405];
    for(int i=0;i<405;i++)
        for(int j=0;j<405;j++)
            dp[i][j] = 1e18 + 5;
    for(int i = n-1;i>=0;i--)
    {
        for(int j = i;j<n;j++)
        {
            if(i==j)
                dp[i][j] = 0;
            else if(i+1==j)
                dp[i][j] = arr[i]+arr[j];
            else
            {
                ll sum = 0;
                for(int k=i;k<=j;k++)
                    sum += arr[k];
                for(int k = i;k<=j-1;k++)
                {
                    dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k+1][j] + sum);
                }
            }
        }
    }
    cout << dp[0][n-1];
}


Measured memory_bytes: 1536
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=input.trim().split("\n");
while(true){
   var nm=Arr.shift().split(" ").map(Number);
   var n=nm[0];
   var m=nm[1];
   if(n==0 && m==0)break;
   var arr=[];
   for(var i=0;i<n;i++)arr.push(0);
   arr.unshift("X");
   arr.push("X");
   for(var I=0;I<m;I++){
      var v=Arr.shift();
      if(v=="A"){
         for(var i=1;i<arr.length-1;i++){
            if(arr[i]==0){arr[i]="A";break;}
         }
      }
      if(v=="B"){
         var flag=false;
         for(var i=arr.length-2;i>=1;i--){
            if(arr[i-1]!="A" && arr[i]==0 && arr[i+1]!="A"){
               arr[i]="B";
               flag=true;
               break;
            }
         }
         if(flag)continue;
         for(var i=1;i<arr.length-1;i++){
            if(arr[i]==0){arr[i]="B";break;}
         }
      }
      if(v=="C"){
         var flag=false;
         for(var i=1;i<arr.length-1;i++){
            if(arr[i]!=0){
               if(arr[i+1]==0){arr[i+1]="C";flag=true;break;}
               else if(arr[i-1]==0){arr[i-1]="C";flag=true;break;}
            }
         }
         if(flag)continue;
         if(n%2==1)arr[(n-1)/2+1]="C";
         else arr[n/2+1]="C";
      }
      if(v=="D"){
         var max=[0,0];
         for(var i=1;i<arr.length-1;i++){
            if(arr[i]!=0)continue;
            var jA=i;
            var jB=i;
            var cnt=0;
            while(true){
               if(arr[jA]!="X")jA--;
               if(arr[jB]!="X")jB++;
               if(arr[jA]=="X" && arr[jB]=="X")break;
               if(arr[jA]!="X" && arr[jA]!=0)break;
               if(arr[jB]!="X" && arr[jB]!=0)break;
               cnt++;
               if(max[1]<cnt)max=[i,cnt];
            }
         }
         if(max[0]!=0 && max[1]!=0){arr[max[0]]="D";}
         else{
            for(var i=1;i<arr.length-1;i++){
               if(arr[i]==0){arr[i]="D";break;}
            }
         }
      }
   }
   arr.shift();
   arr.pop();
   var str=arr.join("").replace(/0/g,"#");
   console.log(str);
}

Measured memory_bytes: 10556
chomp (my ($n, $m) = split / /, <STDIN>);
my $MOD = 1_000_000_007;
sub nPk {
  my ($n, $k) = @_;
  my $r = 1;
  while ($k) {
    $r *= $n;
    $r %= $MOD;
    $n -= 1;
    $k -= 1;
  }
  $r;
}
if (abs($n - $m) > 1) {
  print "0\n";
} elsif ($n == $m) {
  print (nPk($n, $n) * nPk($m, $m) * 2 % $MOD), "\n";
} else {
  print (nPk($n, $n) * nPk($m, $m) % $MOD), "\n";
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<vector>
#include<set>
#define N 500005
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios::sync_with_stdio(false)
#define INF 1000000010
template<typename T> inline T max(T a,T b,T c){
    return max(a,max(b,c));
}
template<typename T> inline T min(T a,T b,T c){
    return min(a,min(b,c));
}
template<typename T> inline T max(T a,T b,T c,T d){
    return max(a,max(b,c,d));
}
template<typename T> inline T min(T a,T b,T c,T d){
    return min(a,min(b,c,d));
}
const int  dx[]={0,1,0,-1,0,1,-1,1,-1};
const int  dy[]={0,0,1,0,-1,1,-1,-1,1};

typedef long long ll;
using namespace std;
//coding...........................................
int main()
{
     char a[100];
     char b[100];
     scanf("%s",a);
     int len=strlen(a),flag=0;
     for (int i=0;i<len;i++)
     {
         if (a[i]=='K'&&a[i+1]=='I'&&a[i+2]=='H'&&i<=1)
         {
             if (a[i+3]=='A'&&a[i+4]=='B'&&a[i+5]=='A'&&a[i+6]=='R'&&a[i+7]=='A'&&i+7==len-1)
                flag=1;
             else if (a[i+3]=='A'&&a[i+4]=='B'&&a[i+5]=='R'&&i+5==len-1)
                flag=1;
             else if (a[i+3]=='A'&&a[i+4]=='B'&&a[i+5]=='A'&&a[i+6]=='R'&&i+6==len-1)
                flag=1;
            else if (a[i+3]=='A'&&a[i+4]=='B'&&a[i+5]=='R'&&a[i+6]=='A'&&i+6==len-1)
                flag=1;
            else if (a[i+3]=='B'&&a[i+4]=='R'&&i+4==len-1)
                flag=1;
            else if (a[i+3]=='B'&&a[i+4]=='A'&&a[i+5]=='R'&&i+5==len-1)
                flag=1;
             else if (a[i+3]=='B'&&a[i+4]=='A'&&a[i+5]=='R'&&a[i+6]=='A'&&i+6==len-1)
                flag=1;
                else if (a[i+3]=='B'&&a[i+4]=='R'&&a[i+5]=='A'&&i+5==len-1)
                    flag=1;
         }
         else if (a[i]!='A')
                 break;

     }

    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
using namespace std;
int main()
{
  int64_t N,b,e,m,count=0;
  vector<int64_t> L(pow(2,16));
  cin>>N;
  rep(i,N){cin>>L.at(i);}
  sort(L.begin(),L.end(),greater<int>());
  rep(i,N-2)
  {
    for(int64_t j=i+1;j<N-1;j++)
    {
      b=j;
      e=N;
      while(e-b>1)
      {
        m=(b+e)/2;
        if(L.at(i)<L.at(j)+L.at(m))b=m;
        else e=m;
      }
      count+=b-j;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define vecc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)

int main(){
    int A, B;
    cin >> A >> B;
    int ans=0;
    for(int i=A; i<=B; i++) if((i/10000 == i%10) && (((i/1000)%10) == (i%100)/10)) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long int ll;
using namespace std;
ll a[105]; 
int main(){
	io;
	ll n,m;
	cin >> n >> m;
	ll tol = 0;
	ll f = 4*m;
	for(ll i = 0;i < n;++i){
		cin >> a[i];
		tol += a[i];
		a[i] *= f;
	}
	ll coun = 0;
	for(ll i = 0;i < n;++i){
		if(a[i] >= tol){
			coun += 1;
		}
	}
	if(coun >= m){
		cout << "Yes";
		}
	else{
		cout << "No";
	}
	return 0;
}

Measured memory_bytes: 256
from collections import deque
from bisect import bisect_left

N = int(input())
A = [int(input()) for _ in range(N)]

t = deque([A[0]])
for a in A[1:]:
    if a <= t[0]:
        t.appendleft(a)
    else:
        t[bisect_left(t, a) - 1] = a
print(len(t))


Measured memory_bytes: 8956
n,m=map(int,input().split())
AC=[0]*n
WA=[0]*n
for _ in range(m):
    p,s=input().split()
    p=int(p)
    if s=="AC":
        AC[p-1]=1
    else:
        if AC[p-1]==0:
            WA[p-1]+=1
ans_AC=sum(AC)
ans_WA=0
for i in range(n):
    if AC[i]==1:
        ans_WA+=WA[i]
print(ans_AC,ans_WA)

Measured memory_bytes: 4596
c=[m:=0]*6**8
n,a=open(0)
for a in a.split():c[int(a)]+=1
print(('not','psaeitr'[any([(m:=max(m,sum(c[i::i])))>1for i in range(2,6**8)])::2]+'wise')[m<int(n)],'coprime')

Measured memory_bytes: 101212
#!/usr/bin/env python3

#import
#import math
#import numpy as np
#= int(input())
#= input()
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
MAX_ANS = 10**9
ans = MAX_ANS

for i in range(2 ** N):
    buy = []
    for j in range(N):
        if (i >> j) & 1:
            buy.append(j)

    understand = [0] * (M + 1)
    money = 0
    for b in buy:
        money += CA[b][0]
        for i in range(1, M + 1):
            understand[i] += CA[b][i]

    isok = True
    for i in range(1, M + 1):
        if understand[i] < X:
            isok = False
            break

    if isok:
        ans = min(ans, money)

if ans == MAX_ANS:
    print(-1)
else:
    print(ans)


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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch)
{
    if('A' == ch) return 1;
    else if('C' == ch) return 2;
    else if('G' == ch) return 3;
    else if('T' == ch) return 4;
    else return 0;
}

long long getKey(char str[])
{
    long long sum = 0, p =1, i;
    for (i = 0; i < strlen(str); ++i)
    {
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key)
{
    return key % M;
}

int h2(int key)
{
    return 1+(key % (M-1));
}

int find(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for(i=0;;++i)
    {
        h = (h1(key)+i*h2(key)) % M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h])==0) return 0;
    }
    return 0;
}

int insert(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for(i=0; ; ++i)
    {
        h = (h1(key)+i*h2(key)) %M;
        if(strcmp(H[h], str) == 0) return 1;
        else if(strlen(H[h]) == 0)
        {
            strcpy(H[h], str);
            return 0;
        }
    }
}

int main(int argc, char const *argv[])
{
    int i, n;
    char str[L], com[9];
    for (i = 0; i < M; ++i)
    {
        H[i][0] = '\0';
    }
    scanf("%d", &n);
    for(i=0; i<n; ++i)
    {
        scanf("%s %s", com, str);
        if('i' == com[0]) insert(str);
        else
        {
            if(find(str))
            {
                printf("yes\n");
            }
            else printf("no\n");
        }
    }
    return 0;
}

Measured memory_bytes: 17044
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

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

const int MAX_N = 31;

int main() {
    IOS
    ll dp[MAX_N] = {};
    dp[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        dp[i] += dp[i-1];
        if (i > 1) dp[i] += dp[i-2];
        if (i > 2) dp[i] += dp[i-3];
    }
    int n;
    while (cin >> n, n) {
        ll t = ceil(dp[n] / 3650.0);
        cout << t << endl;
    }
}


Measured memory_bytes: 3028
#include <bits/stdc++.h>
#define endl '\n'
#define pi 3.1415926535897932384626433832
#define ll long long
using namespace std;
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / __gcd(a, b); }
bool isPrime(int n) {if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;}

void lok(){
    double d,k;
    cin>>d>>k;
    double xh=k;
    double dak=(1800-k)*(1800-k)/3600;
    xh+=dak+(1800-k/2)*k/1800;
    cout<<xh<<endl;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a;
    cin>>a;
    if(a>=30){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3632
n = int(input())
b = list(map(int,input().split()))
src = []
for ni in range(n):
    if ni == 0:
        src.append(b[0])
    elif ni == n-1:
        src.append(b[ni-1])
    else:
        src.append(min(b[ni],b[ni-1]))
print(sum(src))

Measured memory_bytes: 3060
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <random>
#pragma comment(linker, "/STACK:836777216")

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))

char s[10];

int main(void) {
	scanf("%s", &s);
	string a = (string)s;
	if (a[2] == a[3] && a[4] == a[5]) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;

int primes[N], cnt;
bool st[N];

void init(int n)
{
    for(int i = 2; i <= n; i++)
    {
        if(!st[i]) primes[cnt++] = i;
        for(int j = 0; primes[j] * i <= n; j++)
        {
            st[primes[j] * i] = true;
            if(i % primes[j] == 0) break;
        }
    }
}

int main()
{
    init(100010);

    int x;
    cin >> x;
    for(int i = 0; i < cnt; i++)
        if(primes[i] >= x)
        {
            cout << primes[i] << endl;
            break;
        }
    return 0;
}


Measured memory_bytes: 384
def resolve():
    N = int(input())
    S = input()

    # '#.'という箇所が1箇所でもあるとダメなので、ある場所に黒が現れたら
    # 、そこから右は全て黒にならないといけない

    Wt = [0] * (N + 1)
    Bl = [0] * (N + 1)

    for i in range(N):
        if S[i] == "#":
            Bl[i + 1] = Bl[i] + 1
            Wt[i + 1] = Wt[i]
        else:
            Wt[i + 1] = Wt[i] + 1
            Bl[i + 1] = Bl[i]

    ans = 1 << 60
    for i in range(N + 1):
        tmp = 0
        # left を全部白に
        tmp += Bl[i] - Bl[0]

        # right を全部黒に
        tmp += Wt[N] - Wt[i]

        ans = min(ans, tmp)

    print(ans)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 18748
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する

ll grandy(ll N,ll K){
    if(N < K){
        return 0;
    }
    if(N % K == 0){
        return N / K;
    }else{
//        if(N / K == 0){
//            return grandy(K,K)
//        }
//        return grandy(N - N/K - 1,K);
        ll div = N / K + 1;
        ll target = N / K * K;
        ll nextN = N;
        nextN -= (N - target) / div * div;
        if(nextN > target) nextN -= div;
        return grandy(nextN,K);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
//    if(true){
//        cout << grandy(2147,1000);
//        return 0;
//    }

    int N;
    cin >> N;
    ll nim = 0;
    rep(i,0,N){
        ll A,B;
        cin >> A >> B;
        nim ^= grandy(A,B);
    }
    if(nim == 0){
        cout << "Aoki" << endl;
    }else{
        cout << "Takahashi" << endl;
    }



    return 0;
}


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

int main(){
  int n, ans = 0;
  cin >>n;
  for(int i =0; i < n; i++){
    for(int j =0; j < n; j++){
    	for(int k =0; k <n; k++){
          ans++;
        }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();
		char[] l = new char[n];
		char[] r = new char[n];
		for(int i=0;i<n;i++) {
			l[i] = s.charAt(i);
			r[i] = s.charAt(2*n-1-i);
		}
		char[][] buf = new char[2][n];
		long count = 0;
		for(int i=0;i<(1<<n);i++) {
			int[] p = new int[2];
			for(int j=0;j<n;j++) {
				int k = (i>>j)&1;
				buf[k][p[k]++] = l[j];
			}
			long[][] dp = new long[p[0] + 1][p[1] + 1];
		    dp[0][0] = 1;
		    for (int x = 0; x <= p[0]; x ++) {
		      for (int y = 0; y <= p[1]; y ++) {
		        if (x < p[0] && r[x + y] == buf[0][x]) {
		          dp[x + 1][y] += dp[x][y];
		        }
		        if (y < p[1] && r[x + y] == buf[1][y]) {
		          dp[x][y + 1] += dp[x][y];
		        }
		      }
		    }
		    count += dp[p[0]][p[1]];
		}
		System.out.println(count);
		in.close();
	}

}

Measured memory_bytes: 91600
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
   int a,b;
   cin>>a>>b;
   int c=floor(double(a)/0.08);
   int d=floor(double(b)/0.1);
   
   int i=ceill(double(a)/0.08);
   int j=ceill(double(b)/0.1);
   
   int m=max(i,j);
   int mx=max(c,d);
   
   int x=m*0.08;
   int y=m*0.1;
   
   int f=mx*0.08;
   int k=mx*0.1;
   //cout<<f<<" "<<k<<"\n";
   int n=0;
   if(x==a and y==b){n=1;}
   int l=0;
   if(f==a and k==b){l=1;}
   if(n and l) cout<<min(m,mx);
   else if(n) cout<<m<<"\n";
   else if(l)  cout<<mx<<"\n";
   else cout<<"-1"<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << (x) << endl
using namespace std;

const int N = 500005;

int n;
long long a[N], suf[N], mx[N];
bool flag = true;

int main () {
	scanf("%d", &n);
	for (int i = 0; i <= n; i++) scanf("%lld", &a[i]);

	suf[n] = a[n];
	for (int i = n - 1; i >= 0; i--) suf[i] = suf[i + 1] + a[i];

	mx[0] = 1ll;
	for (int i = 1; i <= n; i++) {
		if (mx[i - 1] < a[i - 1]) mx[i] = 0ll;
		else mx[i] = min(suf[i], (mx[i - 1] - a[i - 1]) * 2ll);
	}

	for (int i = 0; i <= n; i++) {
		if (mx[i] < a[i]) flag = false;
	}
	if (flag) {
		long long ans = 0ll;
		for (int i = n; i >= 0; i--) {
			ans += a[i];
			if (i) a[i - 1] += min(a[i], mx[i - 1] - a[i - 1]);
		}
		printf("%lld\n", ans);
	}
	else printf("-1\n");
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    for(int i=0; i<m; i++)
    {
        cin >> a.at(i) >> b.at(i);
    }

    string num = "";
    for(int i=0; i<n; i++)
    {
        num.push_back('a');
    }

    for(int i=0; i<m; i++)
    {
        int dg = a.at(i);
        if(dg > n)
        {
            cout << -1 << endl;
            return 0;
        }
        else if(num.at(dg - 1) == 'a')
        {
            num.at(dg - 1) = '0' + b.at(i);
        }
        else if(num.at(dg - 1) != '0' + b.at(i))
        {
            cout << -1 << endl;
            return 0;
        }
    }
    if(num.at(0) == '0' && n != 1)
    {
        cout << -1 << endl;
        return 0;
    }
    else if(num.at(0) == 'a' && n != 1)
    {
        num.at(0) = '1';
    }
    for(char& c : num)
    {
        if(c == 'a')
        {
            c = '0';
        }
    }
    cout << num << endl;

    return 0;
}


Measured memory_bytes: 256