akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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

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


int N;
vector<P> v;

int main () {
  cin >> N;

  Rep(i, N) {
    ll a, b;
    cin >> a >> b;
    v.emplace_back(b, a);
  }

  sort(All(v));

  ll tmp = 0;
  bool ans = true;

  Rep(i, N) {
    P p = v[i];
    tmp += p.second;
    // cout << p.first << p.second << "\n";
    if (tmp > p.first) {
      ans = false;
      break;
    }
  }

  cout << (ans ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int h;
int calc(int x){
    if(x==1)return 1;
    return 1+calc(x/2)*2;
}
signed main(){
    cin>>h;
    cout<<calc(h)<<endl;
    return 0;
}

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

  
int main()
{
	ll a,b,c,d,k;
	cin>>a>>b>>c>>d>>k;
	ll x = (c-a)*60;
	ll y = (d -b);
	ll z = (x + y) - k;
	cout<<z<<endl;
	
}


Measured memory_bytes: 3648
#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 REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0; i < n; i++)
#define int long long
using namespace std;

int h, w;
string s[400];
int _xor[400][400];
bool used[400][400];
int dy[4] = {-1, 0, 1, 0};
int dx[4] = {0, 1, 0, -1};

signed main() {
	int i, j;
	
	cin >> h >> w;
	rep(i, h) cin >> s[i];
	
	rep(i, h) {
		rep(j, w) {
			int v = (s[i][j] == '#');
			_xor[i][j] = ((i + j) % 2 != v);
			//cout << _xor[i][j];
		}
		//cout << endl;
	}
	
	int ans = 0;
	typedef pair<int, int> P;
	queue<P> que;
	rep(i, h) {
		rep(j, w) {
			int wcnt = 0;
			int bcnt = 0;
			if (used[i][j]) continue;
			
			used[i][j] = true;
			que.push(P(i, j));
			if (s[i][j] == '.') wcnt++; else bcnt++;
			while (!que.empty()) {
				P now = que.front(); que.pop();
				int y = now.first;
				int x = now.second;
				int dir;
				rep(dir, 4) {
					int ny = y + dy[dir];
					int nx = x + dx[dir];
					if (ny < 0 || ny >= h || nx < 0 || nx >= w || used[ny][nx] || _xor[ny][nx] != _xor[y][x]) continue;
					que.push(P(ny, nx));
					used[ny][nx] = true;
					if (s[ny][nx] == '.') wcnt++; else bcnt++;
				}
			}
			ans += wcnt * bcnt;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1920
//#include<iostream>
//#include<vector>
//#include<math.h>
#include<bits/stdc++.h>


using namespace std;
#define rep(i,n) for(int i = 0; i<(int)(n);i++)
#define rep2(i,n) for(int i = 2; i<(int)(n); i++)

bool check(int x){
    rep2(i, x){
        if(x % i == 0){
            return false;
        }
        
    }
    return true;
}

int main (void){
    
    int N;
    cin >> N;

    vector<int> s;
    
    rep2(i,55555){
        if(i % 5 == 1){
            if(check(i)){
                s.push_back(i);
            }
        }
    }

   /* rep(i, s.size()){
        cout << s[i] << endl;
    }*/

    vector<int> a(N);

    /*rep(i, N){
        a[i] = s[i];
    }
*/
    rep(i, N){
        cout <<s[i]<<" ";
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>		//线段树维护区间和
#define ll long long
#define inf 0x3f3f3f3f 
using namespace std;
const int maxn = 1e5+10;

int main(){
	int k;
	scanf("%d", &k);
	ll n = 7;
	int ans = 1;
	if(k%2==0 || k%5==0){
		printf("-1");
		return 0;
	}
	while(1){
		if(n % k==0){
			printf("%d", ans);
			break;
		}
		ans ++;
		n = n*10+7;
		n%=k;
	}

	return 0;
}



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

int main(int argc, char const *argv[])
{
	int n, a, b; cin >> n >> a >> b;
	vector<int> p(n); rep(i, n) cin >> p[i];
	sort(p.begin(), p.end());

	int d1 = 0, d2 = 0, d3 = 0;
	for (auto u : p) {
		if (u <= a) d1++;
		else if (u <= b) d2++;
		else d3++;
	}
	cout << min({d1, d2, d3}) << endl;
	return 0;
}


Measured memory_bytes: 256
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int inverse(int x){
    return binpow(x, MOD - 2, MOD);
}
int ncr(int n, int k) 
{ 
    int ne = 1, de = 1; 
    if (k > n - k) k = n - k;
    for (int i = 0; i < k; ++i) { 
        de = (de * (i + 1)) % MOD;
        ne = (ne * (n - i)) % MOD;
    }
    return ne * inverse(de) % MOD;
} 
void solve()
{
    int N, A, B;
    cin >> N >> A >> B;
    int ans = binpow(2, N, MOD) - 1 - ncr(N, A) - ncr(N, B);
    if(ans < 0) ans = (ans % MOD + MOD) % MOD;
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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


int main(void) {
    using namespace std;

    long n, m;
    string s;
    cin >> n >> m >> s;

    vector<long> mi = {n};

    while(1) {
        long cur = mi.back();

        long i=cur-m;
        if(i <= 0) break;

        for(; i!=cur; i++) {
            if(s[i] == '0') break;
        }
        if(i==cur) {
            cout << -1 << endl;
            return 0;
        }
        mi.push_back(i);
    }

    cout << mi.back() << endl;
    for(auto it=mi.rbegin(); *it != n; it++) {
        cout << *(it+1) - *it << endl;
    }

    return 0;
}


Measured memory_bytes: 1528
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

//#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long int
#define pb push_back

int main() {
  int N, M, a;
  cin >> N >> M;
  ll sum = 0;
  rep(i, M){
    cin >> a;
    sum += a;
  }
  
  int ans = N-sum;
  if (ans < 0) ans = -1;
  cout << ans << endl;

}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long
#define MAX_N 500001

using namespace std;

long long MOD = 1000000007;

struct BIT{
   int tree[MAX_N];
   int N;

   BIT (int n){
      for(int i=0; i<=n; i++){
         tree[i]=0;
      }
      N=n;
   }

   void add(int x, int a){
      while(x<=N){
         tree[x]+=a;
         x+=x&(-x);
      }
   }

   int query(int x){
      int ret=0;
      while(x>0){
         ret+=tree[x];
         x-=x&(-x);
      }
      return ret;
   }
};

template<typename T>
void cout_vec(vector<T> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

template<typename T>
void cout_mat(vector<vector<T>  > &mat){
    for(int i=0; i<mat.size(); i++){
        vector<T> vec = mat[i];
        cout_vec(mat[i]);
    }
}

int main(){
   int N, Q;
   cin >> N >> Q;
   vector<int> prev(N,-1);
   vector<vector<int>> pnt={{-2,(int)MOD}};
   for(int i=0; i<N; i++){
      int c;
      cin >> c;
      c--;

      if(prev[c]>=0){
         pnt.push_back({prev[c],i});
      }
      prev[c]=i;
   }
   sort(pnt.rbegin(),pnt.rend());

   vector<vector<int>> query(0);
   for(int i=0; i<Q; i++){
      int l, r;
      cin >> l >> r;
      l--;
      query.push_back({l,r,i});
   }
   sort(query.rbegin(),query.rend());
   query.push_back({-1000,0,10000000});

   //cout_mat(pnt);
   //cout_mat(query);
   //return 0;

   BIT bt(N);
   vector<int> ans(Q);
   int j=0;
   for(int i=0; i<(int)pnt.size(); i++){
      while(pnt[i][0]<query[j][0]){
         ans[query[j][2]]=query[j][1]-query[j][0]-bt.query(query[j][1]-1);
         j++;
      }
      if(i==N)break;
      bt.add(pnt[i][1],1);
   }

   for(auto &a:ans){
      cout << a << '\n';
   }
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define FOR_IN(i, a, b) for(int (i) = (a); (i) < (b); (i)++)
#define IN(x, a, b) ((x) >= (a) && (x) <= (b))

using namespace std;
//n m
int n,m;
vector<vector<bool> > connected(8, vector<bool>(8, false));
int perm[8];

int main(){
  cin >> n >> m;
  REP(i, m){
    int a,b;
    cin >> a >> b;
    connected[a-1][b-1]=true;
    connected[b-1][a-1]=true;
  }

  REP(i, n)
    perm[i]=i;

  int ans=0;
  do{
    if(perm[0]!=0)
      continue;
    bool f=true;
    REP(i, n-1){
      f = f && (connected[perm[i]][perm[i+1]]);
    }
    ans += f ? 1 : 0;
  }while(next_permutation(perm, perm+n));

  cout << ans << endl;

  return 0;
}


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

#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
#define ll long long

int main(void)
{
    int a1,a2,i,j,w;
    while(1)
    {
        scanf("%d%d",&a1,&a2);
        if(a1==0&&a2==0)
        break;
        for(i=0;i<a1;i++)
        {
            if(i%2==0)w=1;
            else w=0;
            for(j=0;j<a2;j++)
            {
               printf("%c",(w==1)?'#':'.');
               if(w==1)w=0;
               else w=1;
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}




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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

typedef long long ll;

void solve(long long L)
{
    double len = L / 3;
    printf("%8.12lf\n", L * L * L / 27.0);
}

int main()
{
    long long L;
    scanf("%lld", &L);
    solve(L);
    return 0;
}


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

int main() {
	
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    
      long long n,i,j,k,sum=0,count=0,ans=0,x=0,y=0,l,r,m;
      cin>>n>>k;
      long long a[n],b[n];
      k=k*k;
      for(i=0;i<n;i++)
      {
          cin>>a[i]>>b[i];
          count=a[i]*a[i]+b[i]*b[i];
          if(count<=k)
          ans++;
      }
      cout<<ans;
      
	return 0;
}

Measured memory_bytes: 6736
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S, W = map(int, input().split())

if W >= S:
    ans = "unsafe"
else:
    ans = 'safe'

print(ans)


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

using namespace std;

int dp[3001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int a, b, c, d, e, f;
	int x = 0, y = 0;
	
	cin>>a>>b>>c>>d>>e>>f;
	
	for (int cap = 1; cap <= f; ++cap)
	{
		if (cap >= c)
			dp[cap] = max(dp[cap], dp[cap - c] + c);
		if (cap >= d)
			dp[cap] = max(dp[cap], dp[cap - d] + d);
	}
	
	for (int p = 0; p * 100 * a <= f; ++p) for (int q = 0; (p * a + q * b) * 100 <= f; ++q)
	{
		int m = (p * a + q * b) * 100;
		int n = dp[min((p * a + q * b) * e, f - m)];
		m += n;
		
		if (x == 0 && y == 0 || n * x > y * m)
			x = m, y = n;
	}
	
	cout<<x<<' '<<y<<'\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

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

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

vector<int> dy = { 0,0,1,-1 };
vector<int> dx = { 1,-1,0,0 };

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; 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 vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; 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 <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	int N; cin >> N;
	V<ll> a(N+1,0); REP(i, N) cin >> a[i];
	sort(ALL(a),greater<ll>());
	ll ans = 0;
	REP(i,N){
		ll cnt = a[i] - a[i + 1];
		if (cnt == 0) continue;
		if (cnt % 2 == 1) ans ^= (i + 1);
	}
	if (ans == 0) cout << "second" << endl;
	else  cout << "first" << endl;



	return 0;
}



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

using namespace std;

template<class T>
ostream& operator<<(ostream& os, const vector<T> &vec){
    os << "[";
    for(int i=0;i<vec.size();i++){
        os << (i==0?"":" ") << vec[i];
    }
    os <<  "]";
    return os;
}


int main(){
    long long n;
    cin >> n;
    vector<long long> a(n);
    vector<long long> diff(n);
    long long accum = 0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        accum += a[i];
    }
    if((2*accum)%(n*(n+1))){
        cout << "NO" << endl;
        return 0;
    }

    long long num = (2*accum)/(n*(n+1));
    long long cnt = 0;
    for(int i=0;i<n;i++){
        diff[i] = a[i] - a[(i+1)%n];
        diff[i] += num;
        if(diff[i] < 0 || diff[i]%n){
            cout << "NO" << endl;
            return 0;
        }
        else{
            cnt += diff[i] / n;
        }
    }
    cout << (cnt==num?"YES":"NO") << endl;

    return 0;
}


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

int main(){

  int K,S;

  cin >> K >> S;

  int count = 0;

 for(int X = 0;X <= K;X++){

   for(int Y = 0;Y <= K;Y++){


     if(S - X - Y >= 0 and K >= S - X - Y) count++;


   }

 }

  cout << count << "\n";

}


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

typedef unsigned long long ullong;
ullong N;
ullong P;

ullong prim_fact() {
    ullong ans = 1;
    
    for (ullong i = 2; (i * i) <= P; i++) {
        ullong cnt = 0;
        ullong p = P;
        while ((p % i) == 0) {
            cnt++;
            p /= i;
        }
        
        if (cnt >= N) {
            ans = i;
        }
    }
    
    return ans;
}

int main(int argc, const char * argv[]) {
    cin >> N >> P;
    
    if (N == 1) {
        cout << P << endl;
    } else {
        cout << prim_fact() << endl;
    }
    
    return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;


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

	int n;cin>>n;

	writeln(pow(n,3));


}




Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<string>
#include <cstring>
#include <stack>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
using namespace std;
#define INF 0x3f3f3f3f
#define mod 998244353
int main() {
	int a, b, k;
	set<int> s;
	cin >> a >> b >> k;
	for (int i = a; i <= a + k - 1 && i <= b; ++i) {
		s.insert(i);
	}
	for (int i = b; i >= b - k + 1 && i >= a; --i) {
		s.insert(i);
	}
	for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
		cout << *it << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def main():
    N = int(readline())
    divisors = make_divisors(N)
    le = len(divisors)
    if le % 2 == 1:
        print(len(str(divisors[le//2])))
    else:
        print(len(str(divisors[le//2])))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    long long N;
    cin >> N;
    long long A,B;
    string S;
    S=to_string(N);
    long long ans=S.length();
    long long num=0;
    double res=sqrt(N);
    for(long long i=2;i<=res;++i){
        if(N%i==0){
            A=i;
            B=N/i;
            num=max(A,B);
            S=to_string(num);
            num=S.length();
            ans=min(ans,num);
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i, a, n) for(LL i = (a), i##_max = (n); i < i##_max; ++i)
#define REM(i, a, n) for(LL i = (LL)(n) - 1, i##min = (a); i >= i##min; --i)
#define ALL(arr) (arr).begin(), (arr).end()
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(NULL); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
template <class T>
T Next() { T buf; cin >> buf; return buf; }

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#include "Segment_Tree.h"
#include "Rational.h"
#include "Position.h"
#include "Factorization.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
template <class T>
auto Is(const T& value) { return [value](const auto& comparand) -> bool { return comparand == value; }; }
#endif

int N;
int A[100];
int main() {
	cin >> N;
	REP(i, 0, N) {
		cin >> A[i];
	}

	int cnt = 0;
	REP(i, 0, N) {
		if (i != 0 && A[i] == A[i - 1]) {
			A[i] = INF;
			++cnt;
		}
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
n=int(input())
l=len(str(n))
if l<3:
  print(0)
else:
  ans=set()
  b=[0,3,5,7]
  for i in range(4**l-1):
    a=0
    c=1
    while i>0:
      a+=c*b[i%4]
      i//=4
      c*=10
    if "3" in str(a) and "5" in str(a) and "7" in str(a):
      if n>=a:
        if "0"not in str(a):
          ans.add(a)
  print(len(ans))
      
      

Measured memory_bytes: 6256
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int prime[1000000];
bool is_prime[1000001];

int sieve(int n)
{
	int p = 0;
	rep(i, 0, n + 1)is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	rep(i, 2, n + 1)
	{
		if (is_prime[i])
		{
			prime[p++] = i;
			for (int j = i + i; j <= n; j += i)is_prime[j] = false;
		}
	}
	return p;
}

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

	int pn = sieve(55555);

	int N;
	cin >> N;

	int pi = 0;
	rep(i, 0, N)
	{
		while (prime[pi] % 5 != 1)pi++;
		cout << prime[pi] << " ";
		pi++;
	}

	cout << endl;

	return 0;
}

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

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF 1e9
#define MOD 1000000007

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

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

void solve() {
  int n, m;
  map<string, int> mp;
  cin >> n;
  rep(i,n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  
  cin >> m;
  rep(i,m) {
    string s;
    cin >> s;
    mp[s]--;
  }
  int ans = 0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    ans = max(ans, itr->second);
  }
  cout << ans << endl;

}

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

Measured memory_bytes: 256
d=gets.to_i
c=gets.split.map(&:to_i)
s=[]
d.times do
  s << gets.split.map(&:to_i)
end
l=[0]*26
a=0
d.times do |i|
  m=0
  mi=0
  26.times do |j|
    l[j]+=1
  end
  26.times do |j|
    cs=c[j]*l[j]+s[i][j]
    if cs>m
      m=cs
      mi=j
    end
  end
  puts mi+1
  l[mi]=0
end


Measured memory_bytes: 14296
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;


public class Main{
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) throws Exception {
		int n = sc.nextInt();
		int w = sc.nextInt();
		int[] arr = input(n);
		boolean[]dp = new boolean[w+1];
		dp[0] = false ;
		for(int i = 1 ;i <= w;i++) {
			for(int val : arr) {
				if(val <=i) {
					dp[i] |=  (!dp[i - val]);
				}
			}
		}
		if(dp[w])
		System.out.println("First");
		else
			System.out.println("Second");

		
	}
	public static int[] input(int n) throws Exception {

		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}
	public static long[][] input(int n , int m ) throws Exception {

		long[][] arr = new long[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {

				arr[i][j] = sc.nextInt();
			}
		}
		return arr;
	}

}


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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
vector<int>s(n);
int sum=0;
vector<int> sub;
rep(i,n){
    cin>>s[i];
    sum+=s[i];
    if(s[i]%10!=0){
        sub.pb(s[i]);
    }
}
int l = sub.size();
if(l==0){
    cout<<0<<endl;
}
else if(sum%10!=0){
    cout<<sum<<endl;
}
else{
    sort(sub.begin(),sub.end());
    cout<<sum-sub[0]<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for(int i=0; i<M; i++) cin >> B[i];
  vector<vector<int>> A(N, vector<int>(M));
  for(int i=0; i<N; i++){
    for(int j=0; j<M; j++){
      cin >> A[i][j];
    }
  }
  int ans=0;
  for(int i=0; i<N; i++){
    int sum=0;
    for(int j=0; j<M; j++){
      sum+=A[i][j]*B[j];
    }
    sum+=C;
    if(sum>0) ans++;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <numeric>
using namespace std;
using Int = long long;
#define DUMP(range) do{for(auto& x:range){cout<<x<<' ';}cout<<endl;}while(0)
int main()
{
    int H, W, N; cin >> H >> W >> N;
    map<pair<int, int>, int> count;
    for (int i = 0; i < N; i++) {
        int x, y; cin >> y >> x;
        x--, y--;
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                count[make_pair(x-j, y-k)]++;
            }
        }
    }
    Int ans[10] = {};
    for (auto p : count) {
        int x, y;
        tie(x, y) = p.first;
        if (0 <= x && x < W - 2 && 0 <= y && y < H - 2) {
            ans[p.second]++;
        }
    }
    ans[0] = (Int)(H-2) * (W-2) - accumulate(&ans[1], &ans[10], (Int)0);
    for (int i = 0; i < 10; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 56448
#
# abc071 a
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 2 7"""
        output = """B"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """1 999 1000"""
        output = """A"""
        self.assertIO(input, output)


def resolve():
    x, a, b = map(int, input().split())
    if abs(x-a) > abs(x-b):
        print("B")
    else:
        print("A")


if __name__ == "__main__":
    # unittest.main()
    resolve()


Measured memory_bytes: 16096
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>

using namespace std;



int main() {
    int d,d1,i,j,k;
    int c[26];
    int s[365][26];
    cin >> d;
    d1 = 0;
    for(i = 0; i < 26; ++i) cin >> c[i];
    for(i = 0; i < d; ++i) for(j = 0; j < 26; ++j) cin >> s[i][j];

    int arr[365] = {};

    int t1,t2,s1,s2, diff, count;
    count = 0;
    int max, loc;
    int a[26];
    for(int i = 0; i < 26; ++i) a[i] = 1;
    int b[26] = {};
    for(i = 0; i < 365; ++i) {
        for(j = 0; j < 26; ++j) {
            b[j] = s[i][j]+a[j]*c[j];
            a[j]++;
        }
        max = *max_element(b,b+26);
        loc = find(b,b+26,max)-b;
        arr[i] = loc;
        a[loc] = 1;
    }
    
    
    while(true) {
        label2:
        if(d1==d) break;
        for(i = 0; i < 26; ++i) {
            b[i] = s[d1][i]+a[i]*c[i];
            a[i]++;
        }
        max = *max_element(b,b+26);
        loc = find(b,b+26,max)-b;
        arr[i] = loc;
        a[loc] = 1;
        d1++;
        count = 0;


        label1:
        for(i = 0; i < d1; ++i) {
            for(j = 0; j < 26; ++j) {
                if(arr[i]==j) continue;
                if(count>50000) goto label2;
                ++count;
                for(s1 = i+1; s1 < d; ++s1) {
                    if(arr[s1]==arr[i]) break;
                }
                for(t1 = i-1; t1 >= 0; --t1) {
                    if(arr[t1]==arr[i]) break;
                }
                for(s2 = i+1; s2 < d; ++s2) {
                    if(arr[s2]==j) break;
                }
                for(t2 = i-1; t2 >= 0; --t2) {
                    if(arr[t2]==j) break;
                }
                diff = s[i][j]-s[i][arr[i]]+(((s1-i)*(s1-i-1))/2+((i-t1)*(i-t1-1))/2-((s1-t1)*(s1-t1-1))/2)*c[arr[i]] + (-((s2-i)*(s2-i-1))/2-((i-t2)*(i-t2-1))/2+((s2-t2)*(s2-t2-1))/2)*c[j];
                if(diff>0) {
                    arr[i] = j;
                    goto label1;
                }
            }
        }
    }
    for(i = 0; i < d; ++i) {
        cout<<(arr[i]+1)<<"\n";
    }


    return 0;
}

Measured memory_bytes: 3616
while True:
  try:
    sum = int(input())
    result = 0
    for i in range(10):
      for j in range(10):
        for k in range(10):
          for l in range(10):
            if i+j+k+l == sum:
              result+=1
    print(result)
  except EOFError:
    break


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

int findSumDigit(int x){
  int sum=0;
  while(true){
    sum += x%10;
    if(x/10==0)break;
    x /= 10;
  }
  return sum;
}

int main(){
  int N,A,B;
  cin >> N >> A >> B;

  int ans=0;
  for (int i = 0; i <= N; i++){
    int s = findSumDigit(i);
    if(A<=s && s<=B)ans += i;
  }
    
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int n;
vector<pint> ans;
int main(){
    cin>>n;
    if(n&1){
        rep(i,n)FOR(j,i+1,n)if(i+1+j+1!=n){
            ans.pb(i+1,j+1);
        }
    }
    else{
        rep(i,n)FOR(j,i+1,n)if(i+1+j+1!=n+1){
            ans.pb(i+1,j+1);
        }
    }
    cout<<ans.size()<<endl;
    for(auto it:ans) cout<<it.first<<" "<<it.second<<endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt(), y = sc.nextInt(), z = sc.nextInt();
    int tmp = y;
    y = x;
    x = z;
    z = tmp;
    System.out.println(x + " " + y + " " + z);
  }
}

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

int main() {
	long n,m,i,j,k,ans=0;
	cin >> n;
	vector<long> a(n),b(n-1);
	for(i=0; i<n-1; i++){
		cin >> b[i];
	}
	for(i=0; i<n; i++){
		a[i]=100000;
	}
	a[0]=b[0];
	for(i=1; i<n-1; i++){
		a[i]=min(a[i],min(b[i],b[i-1]));
	}
	a[n-1]=min(a[n-1],b[n-2]);
	for(i=0; i<n; i++){
		ans+=a[i];
	}
	cout << ans;
	return 0;
}

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

const int N = 1000 * 100 + 10;
int sz[N], n;
vector<int> adj[N];

void dfs(int root, int par = 0) {
	int res = 0;
	for (auto u: adj[root])
		if (u ^ par) {
			dfs(u, root);
			sz[root] += sz[u];
			res += sz[u] % 2;
		}
	sz[root]++;
	res += (n - sz[root]) % 2;
	if (res > 1) {
		cout << "First\n";
		exit(0);
	}
}

int main() { 
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1, v, u; i < n; i++) {
		cin >> v >> u;
		adj[v].push_back(u);
		adj[u].push_back(v);
	}
	if (n & 1)
		return cout << "First\n", 0;
	dfs(1);
	cout << "Second\n";
	return 0;
}


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

int main(){
  int n;
  int k;
  string s;
  cin >> n >> k >> s;

  vector<int> nums;

  int now = 1;
  int cnt=0;
  for(int i = 0; i < n; i++)
  {
      if(s[i]-'0'==now){
          cnt++;
      }
      else {
          nums.push_back(cnt);
          now=1-now;
          cnt=1;
      }
  }
  nums.push_back(cnt);
  if(nums.size()%2==0) nums.push_back(0);

  int tmp=0;
  int left=0,right=0;
  int ans = 0;  
  for(int i = 0; i < (int)nums.size(); i+=2)
  {
      int nextleft=i;
      while(left<nextleft){
          tmp-=nums[left];
          left++;
      }

      int nextright=min(i+2*k+1,(int)nums.size());
      while(right<nextright){
          tmp+=nums[right];
          right++;
      }
      ans = max(tmp,ans);
  } 

  cout << ans << endl;
}

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

using namespace std;

int main() {
#ifdef  DEBUG
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
#endif  // for local.
  int n, i, ans = 0;
  char s, ps = ' ';
  
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s;
    if (ps != s) {
      ps = s;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
//    cin>>t;
    while(t--)
{
    ll n,p;
    cin>>n>>p;
    p+=3*n;
    cout<<p/2;
}
    return 0;
}

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

int main() {
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    cout << s1[0] << s2[1] << s3[2] << endl;
    return 0;
}


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

using ll = long long;
const int INF = 1e9+100;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int d,t,s;
	cin>>d>>t>>s;
	if (d/s + (d%s>0) > t){
		cout<<"No\n";
	}else{
		cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const db pi = acos(-1);
const int N = 3010;
int n, l, p[N];
db ansx, ansy;
int main() {
  read(n), read(l);
  rep (i, 1, n) read(p[i]);
  rep (i, 1, n) rep (j, i+1, n) {
    db x = cos((p[i] + p[j]) / (2.0 * l) * 2 * pi);
    db y = sin((p[i] + p[j]) / (2.0 * l) * 2 * pi);
    ansx += x * 6 / n / (n-1) / (n-2) * (i-1 + n-j);
    ansy += y * 6 / n / (n-1) / (n-2) * (i-1 + n-j);
    x = -x, y = -y;
    ansx += x * 6 / n / (n-1) / (n-2) * (j-i-1);
    ansy += y * 6 / n / (n-1) / (n-2) * (j-i-1);    
  }
  printf("%.10lf %.10lf\n", ansx, ansy);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int n,m; cin >> n >> m;
 vector<string> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
      a[i]=a[i]+'#';
      a[i]='#'+a[i];
  }
 
  for(int i=0;i<m+2;i++){
  cout << '#';
  }
  cout << endl;
  for(int i=0;i<n;i++){
  cout << a[i] << endl;
  }
  for(int i=0;i<m+2;i++){
  cout << '#';
  }
  cout << endl;
 
}

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

ll N,M,K;
vector<ll> A,B;

int main(){
    cin >> N >> M >> K;
    A.resize(N+1); B.resize(M+1);
    vector<ll> a(N+1),b(M+1);
    ll sum = 0;
    rep(i,0,N){
        cin >> A[i];
        sum+=A[i];
        a[i+1]=sum;
    }
    sum = 0;
    rep(i,0,M){
        cin >> B[i];
        sum+=B[i];
        b[i+1]=sum;
    }

    ll ans = -1;
    sum = 0;
    rep(i,0,N+1){
        sum = a[i];
        ll na = i;
        if(sum==K){
            ans = max(ans,na);
            continue;
        }
        if(sum<K){
            auto lb = lower_bound(b.begin(),b.end(),K-sum);
            ll nb = distance(b.begin(),lb);
            if(*lb==K-sum){
                ans = max(ans,na+nb);
            }else{
                ans = max(ans,na+nb-1);
            }
        }
    }
    if(ans==-1){
        cout << 0 << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9596
class HeapQueue:
    """
    q = HeapQueue()
    q.append(p, v)
    v = q.pop()
    """
    from heapq import heappop, heappush, heappushpop, heapreplace

    def __init__(self, reverse=False):
        self.reverse = reverse
        self.heap = []

    def __len__(self):
        return len(self.heap)

    def append(self, p, v):
        self.heappush(self.heap, (-p if self.reverse else p, v))

    def appendpop(self, p, v):
        return self.heappushpop(self.heap, (-p if self.reverse else p, v))[1]

    def popappend(self, p, v):
        return self.heapreplace(self.heap, (-p if self.reverse else p, v))[1]

    def pop(self):
        return self.heappop(self.heap)[1]

    def front(self):
        return self.heap[0][1]


N = int(input())
A = [int(s) for s in input().split()]
S = []
T = []

S.append(sum(A[:N]))
q = HeapQueue()
for a in A[:N]:
    q.append(a, a)
for a in A[N:2*N]:
    m = q.appendpop(a, a)
    S.append(S[-1] + a - m)

T.append(sum(A[-N:]))
q = HeapQueue(reverse=True)
for a in A[-N:]:
    q.append(a, a)
for a in A[-N-1:N-1:-1]:
    m = q.appendpop(a, a)
    T.append(T[-1] + a - m)
ans = max([S[i] - T[N - i] for i in range(N + 1)])
print(ans)


Measured memory_bytes: 38536
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, M;
  cin >> N >> M;
  vector<int> As(N);
   for (int i = 0; i<N; i++) cin >> As[i];
  int c = 0;
  int s = accumulate(As.begin(), As.end(),0);       //sums up all the array sum
  //cout<<s;
  for (int i = 0; i<N; i++)
    {if (4 * M * As[i] >= s) ++c;}
  (M <= c) ? cout<<"Yes" : cout<<"No";
  }


Measured memory_bytes: 3628