akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include <random>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

#define bsf __builtin_ctzll
ll gcd(ll a, ll b) {
  // a = abs(a); b = abs(b);
  if (!a || !b) return a|b;
  int t = bsf(a|b); a >>= bsf(a);
  do { b >>= bsf(b); if (a > b) swap(a, b); b -= a;} while (b);
  return a << t;
}


int main() {
  int n;
  scanf("%d",&n);
  vi a(n);
  cin >> a;
  string s1 = "First";
  string s2 = "Second";
  while (1) {
    int cnt = 0;
    rep(i,n) if (a[i]%2 == 0) cnt++;
    if (n == 1) {
      if (cnt) cout<<s1<<endl;
      else cout<<s2<<endl;
      return 0;
    }
    if (cnt&1) {
      cout<<s1<<endl;
      return 0;
    }
    if (n-cnt > 1) {
      cout<<s2<<endl;
      return 0;
    }
    int g = 0;
    rep(i,n) {
      if (a[i]&1) {
        if (a[i] == 1) {
          cout<<s2<<endl;
          return 0;
        }
        a[i]--;
      }
      g = gcd(g,a[i]);
    }
    rep(i,n) a[i] /= g;
    swap(s1,s2);
  }
  return 0;
}






















Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int sum = 0;
  if(A > K){
    sum+= K;
  }
  else if(A+B>=K){
    sum+= A;
  }
  else {
    sum+= A - (K-A-B);
  }
  cout << sum << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

ll gcd(ll x, ll y){
    if(y == 0) return x;
    return gcd(y, x % y);
}

int main(){
    ll a,  b;
    cin >> a >> b;
    cout << a / gcd(a, b) * b << endl;
}

Measured memory_bytes: 3568
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
using namespace std;
string a,b;
int c;
int main()
{
	cin>>a>>b;
	a+=b;
	for(int i=0;i<a.length();i++)
		c=c*10+a[i]-'0';
	if(int(sqrt(c))*int(sqrt(c))==c)
		puts("Yes");
	else
		puts("No");
}

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

int A, B, C;

int main() {
    cin >> A >> B >> C;

    map<int, int> mp;
    mp[A]++;
    mp[B]++;
    mp[C]++;

    if (mp[5] == 2 && mp[7] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;  

    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};

fn main() {
    input!{
        s: chars
    }
    if s[0] == s[1] || s[1] == s[2] || s[2] == s[3] {
        println!("Bad");
    } else {
        println!("Good");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
/*
 * k <= a % b
 * ありうる(a,b)の組を求めよ
 *
 * どこで計算量を落とすか
 * b > a のとき, あまりは絶対a(a < b <= n)
 * b <= a のとき, 余りは0~a-1で周期を持つ
 *
 * bを固定(b < a)
 * ex) b = 5, k = 3 ..余り3or4のときだけ
 * (n/5) * (b-k)
 * s = (n/5) * 5とおくと,
 * あとは, s+1~nまでの余りを考えればOK
 */
ll n, k;

int main() {
	cin >> n >> k;
	if(k==0) {
		cout << n*n << endl;
		return 0;
	}
	ll cnt = 0;
	for(ll b=1;b<=n;b++) {
		cnt += (n/b)*max((ll)0, b-k);
		if(n%b >= k) {
			cnt += (n%b - k + 1);
		}
	}
	/*
	// a < k のとき: そもそも無理(理由: あまり0~a < k)
	for(int a=k;a<=n;a++) {
		for(int b=1;b<=a;b++) {
			if(a%b >= k)
				cnt++;
		}
		if(a >= k)
			cnt += (n-a);
	}
	*/
	cout << cnt << endl;
}

Measured memory_bytes: 256
N,M,Q=map(int,input().split())
table=[[0]*N for _ in range(N)]
for i in range(M):
    l,r=map(int,input().split())
    table[l-1][r-1]+=1
dp=[[0]*(N+1) for _ in range(N+1)]
for i in range(N):
    for j in range(N):
        dp[i+1][j+1]=dp[i+1][j]+dp[i][j+1]-dp[i][j]+table[i][j]
for i in range(Q):
    p,q=map(int,input().split())
    a=dp[q][q]
    b=dp[p-1][q]
    c=dp[q][p-1]
    d=dp[p-1][p-1]
    print(a-b-c+d)

Measured memory_bytes: 60632
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 1e5+7;
const ll mod = 1e9+7;
int a[N];
int n,k,ans,now;
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    if(a[n]<=0){
        ans=-a[n+1-k];
    }
    else if(a[1]>=0){
        ans=a[k];
    }
    else{
        ans=1e9;
        int m;
        for(int i=1;i<=n;i++){
            if(a[i]>=0){
                m=i;break;
            }
        }
        for(int i=max(1,m-k);i<=min(m,n+1-k);i++){
            now=a[i+k-1]-a[i];
            if(a[i+k-1]<=0){
                ans=min(ans,now-a[i+k-1]);
            }
            else if(a[i]>=0){
                ans=min(ans,now+a[i]);
            }
            else{
                ans=min(ans,now-a[i]);
                ans=min(ans,now+a[i+k-1]);
            }
        }
    }
    printf("%d\n",ans);
}


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

int ceil(int n, int d) {
    return (n+d-1)/d;
}

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

    int a, b;
    cin>>a>>b;
    cout<<ceil(a, b)<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/python3

import math

M = 1000000007

def normalize(v):
    (a, b) = v
    if a * b > 0:
        return (a, b)
    else:
        if a > 0:
            return (-b, a)
        else:
            return (b, -a)
    
def inv(v):
    (a, b) = v
    if a > 0:
        return (-b, a)
    else:
        return (b, -a)
    
    
n = int(input())

vs = {}
zc = 0
azc = 0
bzc = 0

for i in range(n):
    (a, b) = map(int, input().split())
    if b < 0:
        a = -a
        b = -b

    g = math.gcd(a, b)
        
    if a == 0 and b == 0:
        zc += 1
        continue

    if a == 0:
        azc += 1
        continue

    if b == 0:
        bzc += 1
        continue

    (a, b) = (a // g, b // g)
    if (a, b) in vs:
        vs[(a, b)] += 1
    else:
        vs[(a, b)] = 1

wp = set()
for v in vs:
    if inv(v) in vs:
        wp.add(normalize(v))

#print(zc, azc, bzc, vs, wp)
        
c = 1
if azc == 0 or bzc == 0:
    c = c * pow(2, azc + bzc, M) % M
else:
    c = c * (pow(2, azc, M) - 1 + pow(2, bzc, M) - 1 + 1) % M

r = n - azc - bzc
for p in wp:
    invp = inv(p)
    c = c * (pow(2, vs[p], M) - 1 + pow(2, vs[invp], M) - 1 + 1) % M
    r -= vs[p] + vs[invp]

r -= zc
c = c * pow(2, r, M) % M
c = (c + zc) % M
c = (c - 1) % M

print(c)





    


Measured memory_bytes: 118136
<?php

fscanf(STDIN, "%s", $elements);

// $elements = explode(' ',trim(fgets(STDIN)));
$cnt_max = 0;

for ($i=0; $i < 3; $i++) { 
    $cnt = 0;
    if ($elements[$i] == 'R'){
        $cnt++;
        for($j = $i + 1; $j < 3;$j++){
            if($elements[$i] == $elements[$j]){
                $cnt++;
            } else {
            break;
            }
        }
        if($cnt_max < $cnt){
            $cnt_max = $cnt;
        }
    }
}

echo $cnt_max;


Measured memory_bytes: 16208
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

template <class T>
struct SegmentTree{
  using F = function<T(T,T)>;
  F f;
  T inf;
  int n;
  vector<T> node;

  SegmentTree(vector<T> v,T inf,F f):inf(inf),f(f){
    n = 1; while(n < v.size()) n *= 2;
    node.resize(2*n-1,inf);
    for(int i = 0; i < v.size(); i++) node[i+n-1] = v[i];
    for(int i = n-2; i >= 0; i--) node[i] = f(node[2*i+1],node[2*i+2]);
  }

  void update(int k,T val){
    k += n-1;
    node[k] = val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  void add(int k,T val){
    k += n-1;
    node[k] += val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1],node[2*k+2]);
    }
  }

  T getval(int a,int b){ return getval(a,b,0,0,n); }
  T getval(int a,int b,int k,int l,int r){
    //区間[a, b)の値を返す
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return node[k];
    T vl = getval(a, b, 2*k+1, l, (l+r)/2);
    T vr = getval(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }
};

signed main(){

  int n,c; cin >> n >> c;
  vector<int> x(n+2),v(n+2);
  x[0] = v[0] = 0;
  for(int i = 1; i <= n; i++){
    cin >> x[i] >> v[i];
  }
  x[n+1] = c,v[n+1] = 0;

  vector<int> dp(n+2,0),dp2(n+2,0);
  for(int i = 1; i <= n+1; i++){
    dp[i] = dp[i-1] + v[i] - (x[i] - x[i-1]);
  }
  for(int i = n; i >= 0; i--){
    dp2[i] = dp2[i+1] + v[i] - (x[i+1] - x[i]);
  }

  SegmentTree<int> seg(dp,-1,[&](int x,int y){
    return max(x,y);
  });
  SegmentTree<int> seg2(dp2,-1,[&](int x,int y){
    return max(x,y);
  });

  int ans = 0;
  for(int i = 0; i <= n+1; i++){
    ans = max(ans,max(dp[i],dp[i] + seg2.getval(i+1,n+2) - x[i]));
    ans = max(ans,max(dp2[n+1-i],dp2[n+1-i] + seg.getval(0,n+1-i) - (c-x[n+1-i])));
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

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

const int INF = 1000000000;
const int MOD = 1000000007;
const double eps = 1e-9;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if (a + b == c || a + c == b || b + c == a) cout << "Yes" << endl;
    else cout << "No" << endl; 
    return 0;
}

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

int main()
{
 int H;
 int W;
 char a[10005];
 char a2[10005];
 char a3[10005];
 char temp[105];
 int rows[105];
 int cols[105];
 int H2;
 int W2;
 int i;
 int j;
 int count;

 scanf("%d %d",&H,&W);
 H2=H;
 W2=W;
 for(i=0;i<W;i++) cols[i]=0;
 for(j=0;j<H;j++) rows[j]=0;
 for(j=0;j<H;j++)
 {
  scanf("%s",&temp);
  for(i=0;i<W;i++)
  {
   a[i+j*W]=temp[i];
   if(a[i+j*W]=='.')
   {
    cols[i]++;
    rows[j]++;
   }
  }
 }

for(j=0;j<H;j++) if(rows[j]==W) H2--;
for(i=0;i<W;i++) if(cols[i]==H) W2--;

 count=0;
 for(j=0;j<H;j++)
 {
  if(rows[j]!=W)
  { 
   for(i=0;i<W;i++)
   { 
    a2[count]=a[i+j*W];
    count++;
   }
  }
 }

 count=0;
 for(j=0;j<H2;j++)
 {
  for(i=0;i<W;i++) 
  {
   if(cols[i]!=H)
   {
    a3[count]=a2[i+j*W];
    count++;
   }
  }
 }


 for(j=0;j<H2;j++)
 {
  for(i=0;i<W2;i++) printf("%c",a3[i+j*W2]);
  printf("\n");
 }

 return 0;
}


Measured memory_bytes: 256
const BKRT = "\n";
const SPAC = " ";
const NOSP = "";

function Main(input){
	input = [].concat(...input.split(BKRT).map(a=>a.split(SPAC)));
  const strShift = ()=>input.shift();
  const intShift = ()=>~~input.shift();
  
  var A = intShift();
  var B = intShift();
  var X = intShift();
  
  if(A > X)return"NO";
  if(A + B < X)return"NO";
  return "YES";
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
3 5 4
`);

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,m,a,b,ans;
bool memo[50][50][50];

signed main() {
    cin >> n >> m;
    rep(i,m) {
        cin >> a >> b;
        a--;b--;
        rep(j,m) if (i^j) memo[j][a][b] = memo[j][b][a] = true;
    }
    rep(hoge,m) {
        rep(k,n) rep(i,n) rep(j,n) memo[hoge][i][j] = memo[hoge][i][j] | (memo[hoge][i][k] & memo[hoge][k][j]);
        rep(i,n) rep(j,n) if (!memo[hoge][i][j]) {ans++;goto double_loop_break;}
        double_loop_break:;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,y,i,j,k,ans,flag=0;
 cin>>n>>y;
	for(i=0;i<=n;i++){
    for(j=0;j<=n-i;j++){
    		ans=(10000*i)+(5000*j)+(1000*(n-i-j));
     	if(ans==y){flag=1;break;}
    }
    if(flag) break;
	}
 if(flag) cout<<i<<" "<<j<<" "<<n-i-j;
 else cout<<-1<<" "<<-1<<" "<<-1;
}

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

/*
,,,,
　　　　　　　　　　　　　　　　　　　　　　　　　　,.斗*''“i:i:{
　　　　　　　　　　　　　,.　｡. . . * : : : ''' : : : :” :”“ ''ｰ - 弋,,_
　　　　　 　 　 ,.斗*''“ : : : : : : : : : : : : : ' ' ' ' ' ' : : : : : : : : : : :”: '':* ｡ ,
　　　 ,.斗*''“ ” ＼：　　 ”・・． ' ' ' '　　　　　　　　 ' ' ' ' : : : : : : : : : : : : ”ミ*｡,,,,,,　　　　　　 　 　 　 ＿
　　く.　 ◎　 ﾞ:.ﾞ:..　ﾟ:,　:　───────────　　　--　　,,,,,,__ ' ' ' :.:.:.:.:.”≧s｡.　　＿,,,｡s*i:i:i:i:<
　　ﾏ*s｡ :,　 }　ﾟ:,　 :}　　　　　　　　　　　　　　　　　　　　　　　　　　　　”　''　-　”””：：”：：`*｡i:i:i:i:i:i:i;:’
　　　` .｡`　 ,　,ノ ／｡ ,,,_　　　　　　　　　　　　　　　　　　　　　　　　　　　　　＿＿`　　} }　　ﾉi:i:i:i:i:ﾂ
　　　　　 `　*　｡　　`*｡i:i:i::*=-　　　　　　　　　　　＿＿　　　　　　,,,....｡s*'i,:’　　　”`*｡＿,*’i:i:i:i:r’
　　　　　　　　　　　”　─ --　　　　｡｡｡｡｡　　 -　－`''''''''ヽ ─ '''”　　　｀ｰ“　　　　　　　`*｡i:i:i:i:i:i:
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*｡i:i:::
　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　　`*ﾟ:,
         fozubaoyou    no BUGs alive!
*/

typedef long long ll;
//{
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define dumo dump
//}

#define debug_interval ','
#define dump_interval endl
#define debug_toggle 0

//{
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();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cout<<endl;}
template<class...A> inline void debug_rest() {cout<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cout<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cout<<first,debug_rest(rest...);}
//}

int a,b,c,d,ans,n;
string s,t,u;

int main(){
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;){
    while(!(a[i]%2)){
      a[i]/=2;
      ans++;
    }
    i++;
  }
  dump(ans);
}

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

int main(){
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> P(N,K-Q);
  for(int i=0;i<Q;i++){
    int x;
    cin >> x;
    P.at(x-1) ++;
  }
  for(int i=0;i<N;i++){
    if(P.at(i)>0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1024
a, b = map(int,input().split())

while a!=0 and b!=0:
    a,b = max(a,b),min(a,b)
    a %= b

# print(b)

bb = b

ans = 1
i = 2
end = int((b+1)**0.5)+2
while i < end:
    t = 0
    while b % i == 0:
        b //= i
        # print(b)
        t = 1
        end = int((b+1)**0.5)+2
        if b==1:
            break
    ans += t
    if b==1:
        break
    i += 1

if b != 1 and bb != 1:
    ans += 1
    
print(ans)

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

typedef long long ll;

int N;
vector<int> A;

int main() {
    scanf("%d", &N);
    A.resize(N);
    for(int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }

    int mn = 2;
    ll ans = (A[0] - 1);
    for(int i = 1; i < N; i++) {
        if(A[i] == mn) {
            mn++;
            continue;
        }
        ans += (A[i] - 1) / mn;
    }

    cout << ans;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n; cin >>n;
    vector<int> a1(n); REP(i, n) cin >> a1[i];
    vector<int> a2(n); REP(i, n) cin >> a2[i];

    int res = 0;
    for (int i = 0; i < n; i++) {
        int res_i = 0;
        for (int j = 0; j <= i; j++) {
            res_i += a1[j];
        }
        for (int j = i; j < n; j++) {
            res_i += a2[j];
        }
        res = max(res, res_i);
    }

    cout << res << endl;

    return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int main() {
    int N, M;
    cin >> N >> M;

    vector<vector<int>> graph(N, vector<int>(N, inf));
    vector<pair<int, int>> edges(M);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        graph[a][b] = graph[b][a] = 1;
        edges[i] = {a, b};
    }

    int ans = 0;
    for (auto &e : edges) {
        vector<vector<int>> d(graph);
        d[e.first][e.second] = d[e.second][e.first] = inf;

        for (int k = 0; k < N; ++k) {
            for (int i = 0; i < N; ++i) {
                for (int j = 0; j < N; ++j) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        bool isBridge = false;
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                if (d[i][j] == inf) {
                    isBridge = true;
                }
            }
        }

        ans += isBridge;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int N, W, dp[101][10001], v[101], w[101];

int main(void) {
    cin >> N >> W;
    for (int i = 1; i <= N; i++)
        cin >> v[i] >> w[i];
    
    for (int i = 1; i <= N; i++)
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) dp[i][j] = dp[i - 1][j];
            else dp[i][j] = max(dp[i - 1][j], dp[i][j - w[i]] + v[i]);
        }
    
    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 6976
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
const int mod = 998244353;

ll a, b, v, w, t;

inline int addMod(int a, int b) {
	return (a += b) >= mod ? a - mod : a;
}

inline ll quickpow(ll base, ll pw) {
	ll ret = 1;
	while (pw) {
		if (pw & 1) ret = ret * base % mod;
		base = base * base % mod, pw >>= 1;
	}
	return ret;
}

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

int main() {
	read(a), read(v), read(b), read(w), read(t);
	cout << (t * (v - w) >= abs(a - b) ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 3624
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var rDx2000 = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        var (r, D, x2000) = (rDx2000[0], rDx2000[1], rDx2000[2]);

        var xi = x2000;

        for (int i = 0; i < 10; i++)
        {
            xi = r * xi - D;
            WriteLine(xi);
        }
    }
}


Measured memory_bytes: 28176
#pragma region template
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define vint vector<int>
#define vll vector<ll>
#define vstr vector<string>
#define vbl vector<bool>
#define pb push_back
using namespace std;
using ll = long long;
static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}
#pragma endregion template

void solve(string S) {
  bool valid = true;
  int cnt = 0;
  if (S.at(0) != 'A') valid = false;
  for (int i = 2; i < (int)S.size() - 1; i++) cnt += (S.at(i) == 'C');
  for (int i = 1; i < S.size(); i++) valid &= (S.at(i) == 'C' || (S.at(i) - 'a' >= 0 && S.at(i) - 'a' <= 25));
  cout << ((valid && cnt == 1) ? "AC" : "WA") << endl;
}

int main() {
  string S;
  cin >> S;
  solve(S);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
 int n;
  cin >> n;
  char s;
  bool res=false;
  for(int i=0;i<n;i++){
    cin >> s;
    if(s=='Y') res=true;
  }
  
  if(res) cout << "Four" << endl;
  else cout << "Three" << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>  
using namespace std;
int c[10][10],n,m,i,j,k,sum=0;
int main(){
	scanf("%d%d",&n,&m);
	for(i=0;i<=9;i++)
		for(j=0;j<=9;j++)
		cin>>c[i][j];
	for(k=0;k<=9;k++)
		for(i=0;i<=9;i++)
			for(j=0;j<=9;j++)
			if(i!=j&&i!=k&&j!=k&&c[i][k]+c[k][j]<c[i][j])c[i][j]=c[i][k]+c[k][j];
	for(i=1;i<=n*m;i++)
		{
			cin>>k;
			if(k==1||k==-1)continue;
			sum+=c[k][1];
		}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    n.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn insertion_sort(a: &mut Vec<i32>, n: i32) {
    let mut a = (*a).clone();
    print_vec_split_whitespace(&a);
    for i in 1..n {
        let v = a[i as usize];
        let mut j = i - 1;
        while j >= 0 && a[j as usize] > v {
            a[(j + 1) as usize] = a[j as usize];
            j -= 1;
        }
        a[(j + 1) as usize] = v;
        print_vec_split_whitespace(&a);
    }
}

fn print_vec_split_whitespace<T: std::fmt::Display>(a: &Vec<T>) {
    let len = (*a).len();
    for i in 0..len-1 {
        print!("{} ", (*a)[i]);
    }
    print!("{}\n", (*a)[len-1]);
}

fn main() {
    let n = read::<i32>();
    let mut a = read_vec::<i32>();

    insertion_sort(&mut a, n);
}


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

int main() {

  int N;
  int y, m, d;
  int temp;
  
  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> y >> m >> d;

    temp = (1000 - 1 - y) * 200 + (11 - 1 - m) * 20 + (21 - 1 - d) + 1;
    if( y % 3 != 0 ) temp -= (10-m)/2+1;
    for(int j = y+1; j < 1000; ++j) {
      if( j % 3 != 0 ) {
        temp -= 5;
      }
    }

    std::cout << temp << std::endl;
  }

  return 0;
}

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

#define all(v)  begin(v), end(v)
#define int     long long
#define pii     pair<int, int>
#define endl    '\n';

inline int f(int n) {
    return (int) (-1 + sqrt(1 + 8*n)) / 2;
}

int primeFactors(int n)  {  
    int ans = 0;

    int cnt = 0;
    while (n % 2 == 0)  {  
        n = n/2;  
        cnt++;
    }  
  
    ans += f(cnt);
 
    for (int i = 3; i <= sqrt(n); i = i + 2) {  
        cnt = 0;
        while (n % i == 0) {  
            n = n/i;  
            cnt++;
        }  
        ans += f(cnt);
    }  

    if (n > 2) ans++;

    return ans;
}  

int32_t main() { 
    ios_base::sync_with_stdio(0); 
    cin.tie(0);

    int a; cin >> a;
    cout << primeFactors(a) << endl;
}

Measured memory_bytes: 3696
package main

import (
    "fmt"
    "os"
    "bufio"
    "strings"
    "strconv"
)

func main() {
    var fp *os.File = os.Stdin
    reader := bufio.NewReaderSize(fp, 1024)

    line := readLine(reader)
    N, _ := strconv.Atoi(line)
    line = readLine(reader)
    arr := strings.Split(line, " ")
    var num int
    var blocks []int
    var length int

    for i := 0; i < N; i++ {
        num, _ = strconv.Atoi(arr[i])
        length = len(blocks)

        if num == 1 {
            if length == 0 {
                blocks = append(blocks, num)
            }
        } else {
            if length > 0 {
                if num == blocks[length-1] + 1 {
                    blocks = append(blocks, num)
                }
            }
        }
    }

    if len(blocks) == 0 {
        fmt.Println(-1)
    } else {
        fmt.Println(len(arr) - len(blocks))
    }
}

func readLine(reader *bufio.Reader) string {
    buf := make([]byte, 0, 1024)

    for {
        l, p, _ := reader.ReadLine()

        buf = append(buf, l...)

        if !p {
            break
        }
    }

    return string(buf)
}

Measured memory_bytes: 13184
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int d = max(max(a,b),c);
    cout << 9*d + a + b + c << endl;
}

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

int main() {
  int N;
  scanf("%d", &N);

  int x[105] = {0};
  int y[105] = {0};
  int h[105] = {0};
  int p = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d%d%d", &x[i], &y[i], &h[i]);
    if (h[i] > 0) p = i;
  }

  int ans[3] = {0};
  for (int cx = 0; cx <= 100; cx++) {
    for (int cy = 0; cy <= 100; cy++) {
      bool is_center = true;
      int gh = abs(x[p] - cx) + abs(y[p] - cy) + h[p];
      for (int i = 0; i < N; i++) {
        if (max(gh - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]) {
          is_center = false;
          break;
        }
      }
      if (is_center) {
        ans[0] = cx;
        ans[1] = cy;
        ans[2] = gh;
      }
    }
  }

  printf("%d %d %d", ans[0], ans[1], ans[2]);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
using namespace std;

int main(void)
{
    char *ptr; // char型のポインタの宣言
    string str;
    cin >> str;
    // str = "htht";
    // str = "abaccaba";
    // cout << sizeof(str) << '\n';
    map<char, int> mp;

    // 文字列長さの分だけ繰り返す
    for (int i = 0; i < str.length(); i++)
    {
        // printf("%d番目の文字は%c\n", i + 1, str[i]);
        string names[] = {str};
        mp[str[i]] += 1;
    }

    for (auto i = mp.begin(); i != mp.end(); ++i)
    {
        int vnum = i->second;
        // std::cout << i->first << " " << i->second << "\n";
        // cout << vnum << '\n';
        if (vnum % 2 == 1)
        {
            cout << "No" << '\n';
            return 0;
        }
    }
    cout << "Yes" << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define ll long long
#define ldb long double
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)


const int MOD = 1e9+7;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n){
	ll res=1;

	while(n){
		if(n%2)
		res*=a;
		a*=a;
		n/=2;
	}
	
	return res;
}

int main(){
	fast;
	
	int n,m;
	cin>>n>>m;
	
	if(m==n)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


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


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

	cin >> N >> A >> B ;

	if (B>N*A)
	{
		cout << N * A << endl;

	}
	else { cout << B << endl; }

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int ans = N;
        for(int i = 0; i <= N; i++ ) {
            int cc = 0;
            int x6 = i;
            while( x6 > 0 ) {
                cc += x6 % 6;
                x6 /= 6;
            }
            
            int x9 = N - i;
            while( x9 > 0 ) {
                cc += x9 % 9;
                x9 /= 9;
            }
            ans = Math.min(ans, cc);
        }
        
        System.out.println( ans );
        
    }
}


Measured memory_bytes: 35800
#include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
char map[55][55];
int mine[55][55];
int next_to[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
int n,m;
int search(int i,int j)
{
	int k,ans=0,x,y;
	for(k=0;k<8;k++)
	{
		x=i+next_to[k][0];
		y=j+next_to[k][1];
		if(x<0 || x>n || y<0 || y>m) continue;
		if(map[x][y]=='#') ans++;
	}
	return ans;
}
int main()
{
	int i,j;
	memset(mine,0,sizeof(mine));
	while(~scanf("%d%d",&n,&m))
	{
		for(i=0;i<n;i++)
		{
			scanf("%s",map[i]);
		}
		for(i=0;i<n;i++)
		{
			for(j=0;j<m;j++)
			{
				if(map[i][j]=='.') 
				{
					printf("%d",search(i,j));
				}
				else printf("#");
			}
			printf("\n");
		}
	}
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

const ll lim = 1000000000000000000LL;
int main() {
    int n;
    cin >> n;
    vector<ll>a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) {
        if(a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll res = 1;
    rep(i,n) {
        if(res > lim/a[i]) {
            cout << -1 << endl;
            return 0;
        }
        res *= a[i];
    }
    if(res > lim) {
        cout << -1 << endl;
        return 0;
    }
    cout << res << endl;    
}


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

using namespace std;
#define ll long long
#define r(i, n) for(int i=0;i<n;i++)

int main() {
    set<int> s;
    int q, x, c;
    cin >> q;
    while (q--) {
        cin >> c;
        if (c == 0) {
            cin >> x;
            s.insert(x);
            cout << s.size() << endl;
        } else if (c == 1) {
            cin >> x;
            if (s.find(x) != s.end()) { cout << 1 << endl; }
            else cout << 0 << endl;
        } else {
            cin >> x;
            s.erase(x);
        }
    }
    return 0;
}


Measured memory_bytes: 12460
#include<stdio.h>
#include<string.h>
int dp[1000005][2],num[1000005]={0};
char tmp[1000005];
int min(int a,int b){
	return a<b?a:b;
}
int main()
{
	int len,ans;
    for(int i=0;i<1000005;i++)for(int j=0;j<2;j++)dp[i][j]=99;
    scanf("%s",tmp);
    len=strlen(tmp);
    for(int i=1;i<=len;i++)num[i]=tmp[i-1]-'0';
    dp[len][0]=num[len];dp[len][1]=10-num[len];
    for(int i=len-1;i>=0;i--)
    {
    	/*数位*/
    	dp[i][0]=min(dp[i+1][0]+num[i],dp[i+1][1]+num[i]+1),
        dp[i][1]=min(10+dp[i+1][0]-num[i],10+dp[i+1][1]-(num[i]+1));
	}
	ans=min(dp[0][0],dp[0][1]);
    printf("%d\n",ans);
}

Measured memory_bytes: 12800
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))


n = int(input())
p = []
for _ in range(n):
    p.append(int(input()))
print(sum(p)-int(max(p)/2))


Measured memory_bytes: 2940
#include <stdio.h>
#include <algorithm>
#include <functional>
typedef long long ll;

ll min(ll a, ll b) {
  return a < b ? a : b;
}

int main(void) {
  ll i, j, n, a, b, f, l, ans = 0;
  scanf("%lld%lld%lld", &n, &a, &b);
  ll v[n], cmb[52][52];
  for(i = 0; i < 52; ++i) for(j = 0; j < 52; ++j) cmb[i][j] = 0;
  for(i = 0; i < 52; ++i) cmb[i][0] = 1;
  for(i = 1; i <= 50; ++i) for(j = 1; j <= 50; ++j) cmb[i][j] = cmb[i - 1][j - 1] + cmb[i - 1][j];
  for(i = 0; i < n; ++i) scanf("%lld", &v[i]);
  std::sort(v, v + n, std::greater<ll>());
  for(i = a - 1; i >= 0; --i) if(v[i] == v[a - 1]) f = i;
  for(i = a - 1; i < n; ++i) if(v[i] == v[a - 1]) l = i;
  for(i = 0; i < a; ++i) ans += v[i];
  printf("%.6lf\n", (double)ans / (double)a);
  ans = 0;
  if(!f) {
    for(i = a; i <= min(b, l + 1); ++i) ans += cmb[l + 1][i];
  } else {
    ans = cmb[l - f + 1][a - f];
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  
  map<char,int> memo;
  memo[ s[0] ]++;
  memo[ s[1] ]++;
  memo[ s[2] ]++;
  
  if(memo['a'] && memo['b'] && memo['c']){
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    N,C,K = map(int,input().split())
    T = [int(input()) for _ in range(N)]

    T.sort()

    ans,time,rider = 1,T[0],0
    for i in range(N):
        if T[i] <= time + K and rider < C:
            rider += 1
        else:
            ans += 1
            time = T[i]
            rider = 1

    print(ans)

if __name__ == "__main__":
    main()


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

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

#define MAXN 100004

struct Day {
    int a, b, c;
};

vector<Day> vacation;
int dp[MAXN][4];

int solve(int n, int prev, int N) {
  if (n == N) return 0;
  if (dp[n][prev] != -1) return dp[n][prev];
  int ans = 0;
  if (prev != 1) {
    ans = max(ans, solve(n+1, 1, N)+vacation[n].a);
  }
  if (prev != 2) {
    ans = max(ans, solve(n+1, 2, N)+vacation[n].b);
  }
  if (prev != 3) {
    ans = max(ans, solve(n+1, 3, N)+vacation[n].c);
  }
  return dp[n][prev] = ans;
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef _DEBUG
  freopen("/Users/huogenx/Desktop/__RUN__/input.txt", "r", stdin);
#endif
  int N; cin >> N;
  vacation.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> vacation[i].a >> vacation[i].b >> vacation[i].c;
  }
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0, N) << "\n";
}

Measured memory_bytes: 9216
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <int, int>
#define mp make_pair
#define PI 3.1415926535897
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

int a[100100];

int getIncrLength(int p, int n) {
	int res = 1;
	while ((p + 1 < n) && (a[p + 1] >= a[p])) {
		res++;
		p++;
	}
	return res;
}


int getDecrLength(int p, int n) {
	int res = 1;
	while ((p + 1 < n) && (a[p + 1] <= a[p])) {
		res++;
		p++;
	}
	return res;
}

int main()
{
#ifdef Fcdkbear
	freopen("in.txt", "r", stdin);
	double beg = clock();
	//freopen("out.txt", "w", stdout);
#endif

	int n;
	scanf("%d", &n);
	FOR(i, 0, n) {
		scanf("%d", &a[i]);
	}
	int p = 0;
	int res = 0;
	while (p < n) {
		int v = max(getIncrLength(p, n), getDecrLength(p, n));
		res++;
		p += v;
	}
	cout << res << endl;
	
#ifdef Fcdkbear
	double end = clock();
	fprintf(stderr, "*** Total time = %.3lf ***\n", (end - beg) / CLOCKS_PER_SEC);
#endif
	return 0;
}

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

int main() {
	double a, b, c, d, e, f;
	double x, y;
	while (cin >> a >> b >> c >> d >> e >> f) {
		double y = (a * f - c * d) / (a * e - b * d);
		double x = (c - b * y) / a;
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

int main() {
   int n, k;
   cin >> n >> k;
   vec<int> v(n);
   map<int, int> mp;
   set<int> s;
   rep (i, n) {
      cin >> v[i];
      mp[v[i]]++;
   }

   vec<int> a;
   for (auto x : mp) {
      a.push_back(x.second);
   }
   sort(all(a));
   int kind = a.size();

   // printA(a);

   int ans = 0;
   for (int i = 0; i < kind-k; i++) {
      ans += a[i];
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 11516
def II(): return int(input())
N=II()
def solve(n):
  tbl=[0]*100
  ans=0
  for i in range(1,n+1):
    i=str(i)
    tbl[int(i[0]+i[-1])]+=1
  for i in range(1,n+1):
    i=str(i)
    ans+=tbl[int(i[-1]+i[0])]
  return ans
a=solve(N)
print(a)      

Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                             \
  ifstream in("atcoder-problems/yahoo_procon2019_qual_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll K, A, B;
  cin >> K >> A >> B;

  if (K < A + 1 || B <= A + 2) {
    cout << K + 1 << endl;
    return 0;
  }

  ll k = K - (A - 1);
  k--;
  ll cookie = B;
  k--;

  cookie += (k / 2) * (B - A);
  cookie += k % 2;

  cout << cookie << endl;
}

Measured memory_bytes: 256
import collections as c
s=input()
t=input()
d=c.defaultdict(list)
d2=c.defaultdict(list)
for k,v in enumerate(s):
    d[v].append(k)
for k,v in enumerate(t):
    d2[v].append(k)
a=set(tuple(i) for i in d.values())
b=set(tuple(i) for i in d2.values())
if a==b:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 59068
#include <bits/stdc++.h>
#include <map>
#include <cmath>
typedef long long int ll;
using namespace std; 
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n;cin>>n;
	vector<pair<string,int> > vect;
	for(int i=0;i<n;i++){
		string s; int t;
		cin>>s>>t;
		vect.push_back(make_pair(s,t));
	}
	string x;cin>>x;
	int k=0;
	for(int i=0;i<n;i++){
		if(x.length()==vect[i].first.length()){
			bool flag = true;
			for(int j=0;j<x.length();j++){
				if(x[j]!=vect[i].first[j]){
					flag = false; break;
				}
			}
			if(flag==true){
				k = i+1; break;
			}
		}
	}
	ll sum=0;
	for(int i=k;i<n;i++){
		sum += vect[i].second;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    vector<int> A(N);
    REP (i, N) cin >> A[i];
    int l = 0, r = 0, bit = 0, ans = 0;
    while (l < N) {
        while (r < N && (bit & A[r]) == 0) {
            bit ^= A[r++];
        }
        ans += r - l;
        bit ^= A[l++];
    }
    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

bool dp(vector<int> V, int pos){
  int tot = 0;
  rep(i, V.size()) tot += V[i];

  if((tot - pos) % 2 == 1)
    return false;

  int targ = (tot - pos) / 2;
  vvl arr(V.size() + 1, vl(tot + 1, 0));
  arr[0][0] = 1;

  rep(i, V.size()){
    rep(j, targ + 1){
      if(j < V[i]){
	arr[i + 1][j] = arr[i][j];
      } else{
	arr[i + 1][j] = max(arr[i][j - V[i]], arr[i][j]);
      }
    }
  }

  return arr[V.size()][targ] == 1;
}

int main(){
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;

  queue<char> que;
  rep(i, s.size()) que.push(s[i]);
  
  vector<int> LR, UD;
  int tmp = 0;
  int sw = 0;

  while((!que.empty()) && (que.front() == 'F')){
    x--;
    que.pop();
  }

  if(que.empty()){
    if((x == 0) && (y == 0))
      cout << "Yes" << endl;
    else
      cout << "No" << endl;

    return 0;
  }
  
  while(!que.empty()){
    if(que.front() == 'F'){
      tmp++;
    } else{
      if(sw == 0){
	sw = 1;
	if(tmp > 0) LR.push_back(tmp);
      } else{
	sw = 0;
	if(tmp > 0) UD.push_back(tmp);
      }
      tmp = 0;
    }
    que.pop();
  }
  if(tmp > 0){
    if(sw == 0) LR.push_back(tmp);
    else UD.push_back(tmp);
  }

  if(LR.size() == 0){
    if(x != 0){
      cout << "No" << endl;
      return 0;
    }
  } else{
    if(!dp(LR, x)){
      cout << "No" << endl;
      return 0;
    }
  }

  if(UD.size() == 0){
    if(y != 0){
      cout << "No" << endl;
      return 0;
    }
  } else{
    if(!dp(UD, y)){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  
  return 0;
}


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

int main(){
	int n;
	cin >> n;
	int a[n];
	REP(i,n) cin >> a[i];
	sort(a, a + n);
	int min = 1e9,r;
	REP(i,n - 1){
		if(abs((double)(a[i] - (double)(a[n - 1] / 2.0))) < min){
			min = abs((double)(a[i] - (double)(a[n - 1] / 2.0)));
			r = a[i];
		}
	}
	cout << a[n - 1] << " " << r << endl;
}

Measured memory_bytes: 640