akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(type, i, a, b) for( type i = a; i < b; i++ )
typedef long long ll;

using namespace std;

int main(void) {
    ll N, a, b, ans;
    map<ll,ll> mp1, mp2;
    scanf("%lld", &N);
    REP(int,i,0,N/2){
        scanf("%lld %lld", &a, &b);
        mp1[a]++;
        mp2[b]++;
    }

    ll maxVala  = 0;
    ll maxVala2 = 0;
    ll maxValb  = 0;
    ll maxValb2 = 0;
    ll labela2,labelb2;
    ll labela, labelb;
    for ( auto& p : mp1 ){
        if ( p.second > maxVala ){
            maxVala2 = maxVala;
            labela2  = labela;
            maxVala = p.second;
            labela  = p.first;
        }
        else if ( p.second > maxVala2 ){
            maxVala2 = p.second;
            labela2  = p.first;
        }
    }
    for ( auto& p : mp2 ){
        if ( p.second > maxValb ){
            maxValb2 = maxValb;
            labelb2  = labelb;
            maxValb = p.second;
            labelb  = p.first;
        }
        else if ( p.second > maxValb2 ){
            maxValb2 = p.second;
            labelb2  = p.first;
        }
    }

    /* cout << maxVala << " " << labela << endl;
    cout << maxVala2 << " " << labela2 << endl;
    cout << maxValb << " " << labelb << endl;
    cout << maxValb2 << " " << labelb2 << endl; */
    if ( labela == labelb ){
        ll maxkeyNum = max(maxVala + maxValb2, maxVala2 + maxValb);
        ans = N - maxkeyNum;
    }
    else ans = N - maxVala - maxValb;
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 987654321
#define PI 3.1415926535

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

    int n;
    cin >> n;

    int a;
    int cnt=0;
    for(int i=0; i<n; i++) {
        cin >> a;
        if(a==cnt+1) cnt++;
    }

    if(cnt==0) cout << -1;
    else cout << n-cnt;
}

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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x;
  cin >> x; 
  cout << x/500 * 1000 + (x % 500) / 5 * 5 << "\n";
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reps(i,a,b) for(int i= a; i < b; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll n;
  cin >> n;
  vector<ll> vec(n);
  for(int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  ll cn = 1;
  ll cnt = 0;
  rep(i, n) {
    if (vec.at(i) == cn) {
      cnt++;
      cn++;
    }
  }
  if (cnt) {
    cout << n - cnt << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 4816
import sys

n, k = map(int, sys.stdin.readline().split())
weights = [int(sys.stdin.readline()) for _ in range(n)]


def acceptable(p):
    rest = k
    capacity = p
    for w in weights:
        if w > capacity:
            rest -= 1
            if rest == 0:
                return False
            capacity = p - w
        else:
            capacity -= w
    return True


left = max(weights) - 1
right = sum(weights)

while left + 1 < right:
    mid = (left + right) // 2
    if acceptable(mid):
        right = mid
    else:
        left = mid

print(right)



Measured memory_bytes: 9560
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn read_str_as_char_vec() -> Vec<char> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().chars().collect()
}

fn read_str_as_T<T>() -> T
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().unwrap()
}

fn main() {
    let in_vec: Vec<usize> = read_line();
    let mut res_i = 0;

    for i in 1..=5 {
        if in_vec[i - 1] == 0 {
            res_i = i;
        }
    }

    println!("{}", res_i);
}


Measured memory_bytes: 2108
S = input()
n = len(S) + 1
a = [0] * n

S = ('<' if S[0] == '>' else '>') + S \
    + ('<' if S[-1] == '>' else '>') # 最初と最後にダミー追加、長さn+1
    
for i in range(n):
    if S[i : i + 2] == '><': # 極小値
        for j in range(i, 0, -1):   # 左に辿る
            if S[j] == '<': break
            a[j - 1] = max(a[j - 1], a[j] + 1)
        for j in range(i + 1, n):   # 右に辿る
            if S[j] == '>': break
            a[j] = max(a[j], a[j - 1] + 1)

print(sum(a))

Measured memory_bytes: 23228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e6+7;
const int maxm = 2e6+7;
const ll mod = 1e9+7;
int n,m,ar[maxn];

int l[maxn],r[maxn];

int main()
{
    set<int> s;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int x;scanf("%d", &x);
        s.insert(x);
    }
    ar[0] = 1;
    for(int i=1;i<=n;i++){
        if(s.count(i))continue;
        if(i-1>=0 && s.count(i-1)==0)ar[i] += ar[i-1];
        if(i-2>=0 && s.count(i-2)==0)ar[i] += ar[i-2];
        ar[i] %= mod;
    }
    printf("%d\n", ar[n]);
    return 0;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

int main(void){
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  int count = 0;
  REP(i, n){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') count++;
    else chmax(ans, count), count = 0;
  }
  chmax(ans, count);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){
  long long int a,b,n,x,ans=0;
  scanf("%lld %lld %lld",&a,&b,&n);
  if(b-1<=n){
    x=b-1;
  }else{
    x=n;
  }
  ans=floor((a*x)/b)-(x/b);
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 100005;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    int n, tem;
    cin >> n;
    n--;
    int maxx, minn;
    cin >> tem;
    maxx = minn = tem;
    while(n--)
    {
        cin >> tem;
        maxx = max(maxx, tem);
        minn = min(minn, tem);
    }
    cout << maxx-minn;
    return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<vector<int64_t>> a(N+1);
  vector<pair<int,int64_t>> p(M);
  for(int i=0;i<M;++i){
    int P;
    int64_t Y;
    cin>>P>>Y;
    p.at(i)=make_pair(P,Y);
    a.at(P).push_back(Y);
  }

  for(int i=0;i<N+1;++i){
    if(a.at(i).size()>0){
    sort(a.at(i).begin(),a.at(i).end());
  }
  }

  for(int i=0;i<M;++i){
    int index=lower_bound(a.at(p.at(i).first).begin(),a.at(p.at(i).first).end(),p.at(i).second)-a.at(p.at(i).first).begin();
    printf("%06d%06d\n",p.at(i).first,index+1);
  }
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l,r,d;
  int count=0;
  cin>>l>>r>>d;
  for(int i=l;i<=r;i++){
    if(i%d==0){
      count++;
    }
     
  }
      cout<<count<<endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    vector<ll> P(A),Q(B),R(C);
    priority_queue<ll> PP,QQ,RR;
    priority_queue<ll, std::vector<ll>,std::greater<ll>> PPP,QQQ;
    rep(i,A){ cin >> P[i]; PP.push(P[i]);}
    rep(i,B){ cin >> Q[i]; QQ.push(Q[i]);}
    rep(i,C){ cin >> R[i]; RR.push(R[i]);}
    ll red=0,green=0;
    for(int i=0;i<X;i++){
        ll tmp = PP.top();
        red+=tmp;
        PP.pop();
        PPP.push(tmp);
    }
    for(int i=0;i<Y;i++){
        ll tmp = QQ.top();
        green+=tmp;
        QQ.pop();
        QQQ.push(tmp); 
    }
    //cout << red << "-" << green << endl;
    for(int i=0;i<C;i++){
        ll r,g,c;
        bool f = false;
        if(!PPP.empty()){
            r = PPP.top();
        }else{
            r = INF;
        }
        if(!QQQ.empty()){
            g = QQQ.top();
        }else{
            g = INF;
        }
        c = RR.top();
        if(r<g){
            if(r<c){
                red-=r;
                red+=c;
                PPP.pop();
                RR.pop();
            }else{
                f=true;
            }
        }else{
            if(g<c){
                green-=g;
                green+=c;
                QQQ.pop();
                RR.pop();
            }else{
                f=true;
            }
        }
        if(f){
            break;
        }
    }
    cout << red + green << endl;
    return 0;
}

Measured memory_bytes: 7156
import heapq
N,M=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
heapq.heapify(A)


for _ in range(M):
  ma=heapq.heappop(A)
  heapq.heappush(A,-((-ma)//2))
  
print(-sum(A))

Measured memory_bytes: 14180
#include <iostream>
#include <vector>
#include <cstring>

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

using namespace std;


typedef long long ll;
typedef pair<int, bool> IB;

struct P{
	int id;
	int tanka;
	int kosuu;
};
ll shain[4001];
bool used[4001];
bool more[4001];
int main()
{
	int n;

	while (cin >> n && n ){
		vector<P> data (n );
		rep (i, n ){
			cin >> data[i].id >> data[i].tanka >> data[i].kosuu;
		} // end rep
		memset (shain, 0LL, sizeof (shain ) );
		memset (used, false, sizeof (used ) );
		memset (more, false, sizeof (more ) );
		rep (i, n ){
			ll total = (ll)data[i].tanka*(ll)data[i].kosuu;
			shain[data[i].id] += total;
		} // end if
		for (int i = 1; i <= 4000; i++ ){
			if (shain[i] >= 1000000LL ){
				more[i] = true;
			} // end if
		} // end for
		bool found = false;
		rep (i, n ){
			if (more[data[i].id] && !used[data[i].id] ){
				cout << data[i].id << endl;
				used[data[i].id] = true;
				if (!found )
					found = true;
			} // end if
		} // end rep
		if (!found ){
			cout << "NA" << endl;
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, n, a, b, now, cnt = 0, ans[3] = {0, 0, 1};
  scanf("%lld", &n);
  vector<ll> vec[n];
  for(i = 0; i < n - 1; ++i) {
    scanf("%lld%lld", &a, &b);
    vec[--a].push_back(--b);
    vec[b].push_back(a);
  }
  bool d[n], flg[n];
  for(i = 0; i < n; ++i) flg[i] = true;
  flg[0] = false;
  queue<ll> q;
  d[0] = true;
  q.push(0);
  while(q.size()) {
    now = q.front(), q.pop();
    for(i = 0; i < vec[now].size(); ++i) if(flg[vec[now][i]]) {
      flg[vec[now][i]] = false;
      q.push(vec[now][i]);
      d[vec[now][i]] = !d[now];
    }
  }
  for(i = 0; i < n; ++i) cnt += d[i] ? 1 : 0;
  if(cnt > n - cnt) {
    for(i = 0; i < n; ++i) d[i] = !d[i];
    cnt = n - cnt;
  }
  if(cnt > n / 3) {
    for(i = 0; i < n; ++i) {
      if(d[i]) {
        if(ans[0] < (n + 2) / 3) printf("%lld ", ans[0] * 3 + 1), ans[0]++;
        else printf("%lld ", ans[2] * 3), ans[2]++;
      } else {
        if(ans[1] < (n + 1) / 3) printf("%lld ", ans[1] * 3 + 2), ans[1]++;
        else printf("%lld ", ans[2] * 3), ans[2]++;
      }
    }
  } else {
    for(i = 0; i < n; ++i) {
      if(d[i]) {
        printf("%lld ", ans[2] * 3), ans[2]++;
      } else {
        if(ans[0] < (n + 2) / 3) printf("%lld ", ans[0] * 3 + 1), ans[0]++;
        else if(ans[1] < (n + 1) / 3) printf("%lld ", ans[1] * 3 + 2), ans[1]++;
        else printf("%lld ", ans[2] * 3), ans[2]++;
      }
    }
  }
  return 0;
}
  

Measured memory_bytes: 15464
N = int(input())
A = [int(input()) for n in range(N)]

A.sort()

res = 0
s = 0
t = N - 1
a = A[s]
b = A[t]
res += b - a
for n in range((N - 1) // 2):
    if s + 1 != t - 1:
        a_2 = A[s + 1]
        b_2 = A[t - 1]
        if b - a_2 <= b_2 - a and b - a_2 <= b_2 - a_2:
            res += b_2 * 2- a - a_2
            a = A[s + 1]

        elif b - a_2 > b_2 - a and b_2 - a <= b_2 - a_2:
            res += b_2 - a_2 * 2 + b
            b = A[t - 1]

        else:
            res += b - a_2 + b_2 - a
            a = A[s + 1]
            b = A[t - 1]

        s += 1
        t -= 1
    else:
        c = A[s + 1]
        res += max(b - c, c - a)

print(res)


Measured memory_bytes: 7504
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
 
int find_t[101],end_t[101];
vector<queue<int> > vec(101);
int flag[101];
int t=1;
 
void DFS(int);
void Print();
 
int main(int argc,char* argv[]){
  int n,id,cnt,x;
   
  memset(find_t,255,sizeof(find_t));
  memset(end_t,0,sizeof(end_t));
  memset(flag,0,sizeof(flag));
 
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>id>>cnt;
    flag[id]=0;
    queue<int> tmp;
    for(int l=0;l<cnt;l++){
      cin>>x;
      tmp.push(x);
    }
    vec[id]=tmp;
  }
   
  for(int i=1;i<=n;i++){
    if(flag[i]==0)
      DFS(i);
  }
  Print();
   
  return 0;
}
 
void DFS(int p){
  if(flag[p]==0){
    find_t[p]=t++;
    flag[p]=1;
  }
  else
    return;
     
  queue<int> tmp=vec[p];
  while(!tmp.empty()){
    DFS(tmp.front());
    tmp.pop();
  }
 
  end_t[p]=t++;
}
 
void Print(){
  for(int i=1;i<=100;i++){
    if(find_t[i]!=-1)
      printf("%d %d %d\n",i,find_t[i],end_t[i]);
  }
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N;
  cin >> N;
  vector<ll> D;
  for (ll i = 1; i * i <= N; i++) {
    if (N % i == 0) {
      D.emplace_back(i);
      D.emplace_back(N / i);
    }
  }
  ll res = 0;
  for (int i = 0; i < (int)D.size(); i++) {
    ll k = D[i] - 1;
    if (k > 0 && N / k == N % k) {
      res += k;
    }
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 384
import sys
def line():return sys.stdin.readline().strip()

ops = {"+":lambda a,b:b + a,
     "-":lambda a,b:b - a,
     "*":lambda a,b:b * a,
     "/":lambda a,b:b / a}
while True:
    try:
        stack = []
        for s in line().split():
            if s in ops:
                stack.append(ops[s](stack.pop(),stack.pop()))
            else:
                stack.append(int(s))
        print(stack[0])
    except:
        break

Measured memory_bytes: 7632
n,m = map(int,input().split())
mod = 10**9+7
a = [int(input()) for _ in range(m)]
s = [0]*(n+1)
s[0],s[1]=1,1
for i in range(2,n+1):
  s[i] = (s[i-1]+s[i-2])%mod
if m == 0:
  print(s[n])
  quit()
ans = s[a[0]-1]
for i in range(1,m):
  if a[i]-a[i-1] == 1:
    print(0)
    quit()
  ans = (ans*s[a[i]-a[i-1]-2])%mod
print((ans*s[n-a[m-1]-1])%mod)

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

#define mp make_pair
typedef long long ll;
typedef pair<int,int>pii;
const int N = 1e5;
vector<pii>graph[N+100];
int color[N+100],ans;
void dfs(int u,int p,int c)
{
	for(auto it:graph[u])
	{
		if(it.first!=p)
		{
			c = (c+1)%ans;
			color[it.second] = c+1;
			dfs(it.first,u,c);
		}
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		graph[u].push_back(mp(v,i));
		graph[v].push_back(mp(u,i));
	}
	for(int i=1;i<=n;i++){
		ans = max(ans,(int)graph[i].size());
	}
	dfs(1,-1,-1);
	printf("%d\n",ans);
	for(int i=1;i<n;i++){
		printf("%d\n",color[i]);
	}
}


Measured memory_bytes: 7424
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
    int N;
    cin >> N;
    priority_queue<double , vector<double >, greater<double>> que;
    for (int i = 0; i < N; i++) {
        double v;
        cin >> v;
        que.push(v);
    }

    while (que.size() > 1) {
        double a = que.top(); que.pop();
        double b = que.top(); que.pop();
        que.push((a + b) / 2);
    }

    cout << que.top() << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long long int n,x,y,t,i;
    scanf("%lld",&n);
    t = n;
    for(i=sqrt(n);i>=2;i--)
    {
        if(n%i==0)
        {
            x=i;
            y=n/i;
            if(t>x+y-2)
                t=x+y-2;
        }
    }
    if(t==n)
        printf("%lld",n-1);
    else
        printf("%lld",t);
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,A[3];
int L[8];

signed main(){
    cin>>N;
    rep(i,3)cin>>A[i];
    rep(i,N)cin>>L[i];

    int ans=1001001001;

    rep(i,1<<(2*N)){
        int sum[4]={};
        int cost=-30;
        rep(j,N){
            sum[i>>(2*j)&3]+=L[j];
            if((i>>(2*j)&3)!=3)cost+=10;
        }
        rep(j,3)if(sum[j]==0)cost=1001001001;
        rep(j,3)cost+=abs(sum[j]-A[j]);
        chmin(ans,cost);
    }
    cout<<ans<<endl;
}


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

typedef long long int64;

int main()
{
    int64 x;
    int64 ans = 0;
    int64 mod;
    
    cin >> x;

    mod = x % 11;

    if (mod == 0) {
        cout << x / 11 * 2 << endl;
    } else if (mod <= 6) {
        cout << x / 11 * 2 + 1 << endl;
    } else {
        cout << x / 11 * 2 + 2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>


using namespace std;

typedef pair < int , int > pii;

typedef long long ll;
const int maxn = (int) 2e5 + 100;

int cnt;

int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        if(x != i){
            cnt++;
        }
    }
    if(cnt <= 2){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
using namespace std;
int main() {
    int a,b;
    cin>>a>>b;
    if(a*b%2!=0){
        cout<<"Odd"<<endl;

    }else{
        cout<<"Even"<<endl;
    }
}   



Measured memory_bytes: 256
// OURL: https://atcoder.jp/contests/abc138/tasks/abc138_d
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));  }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v);  }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", ";  } first = false; res += to_string(x);  } res += "}"; return res;  }

string to_string(string s) { return '"' + s + '"';  }
string to_string(const char* s) { return to_string((string) s);  }
string to_string(bool b) { return (b ? "true" : "false");  }
string to_string(vector<bool>::reference b) { return to_string(bool(b));  }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";  }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res; }

void debug_out() { cerr << endl;  }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...);  }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// void travase(int x, vector<vector<int>> &edge, vector<int> &counter) {
//   for (int p : edge[x]) {
//     if (p != x)
//   }
// }

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

  int n,q;
  cin >> n >> q;

  auto edge = make_v<int>(n, 0);
  REP(i,n-1) {
    int a, b;
    cin >> a >> b;
    edge[a-1].push_back(b-1);
    edge[b-1].push_back(a-1);
  }

  debug(edge);
  auto counter = make_v<int>(n);

  REP(i, q) {
    int p, x;
    cin >> p >> x;
    counter[p-1] += x;
  }

  debug(counter);

  queue<int> que;
  auto parent = make_v<int>(n);
  que.push(0);
  while(!que.empty()) {
    int x = que.front();
    que.pop();
    debug(x, que.size());
    for (int p : edge[x]) {
      debug(p);
      if (p != parent[x]) {
        que.push(p);
        parent[p] = x;
        counter[p] += counter[x];
      }
    }
    // return 0;
  }
  REP(i, n) {
    cout << counter[i] << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 16372
#include <stdio.h>

int f[200200], a[200200];
int n; char s[200200];

int main()
{
	for (int i = 1; i < 200200; i++){
		int t = i, pc = 0;
		while (t) pc++, t -= t & (-t);
		f[i] = f[i % pc] + 1;
	}

	scanf ("%d %s", &n, s);
	int pc = 0;
	for (int j = 0; j < n; j++) if (s[j] == '1') pc++;

	int r[2] = { pc - 1, pc + 1 };
	int d[2] = { 0, 0 }, u[2] = { 1, 1 };
	for (int k = 0; k < 2; k++) if (r[k] > 0){
		for (int j = 0; j < n; j++){
			d[k] = d[k] * 2 % r[k];
			if (s[j] == '1') d[k] = (d[k] + 1) % r[k];
		}
	}

	for (int j = n - 1; j >= 0; j--){
		if (s[j] == '1'){
			if (r[0] == 0) a[j] = 0;
			else a[j] = f[(d[0] + r[0] - u[0]) % r[0]] + 1;
		}
		else{
			a[j] = f[(d[1] + u[1]) % r[1]] + 1;
		}
		for (int k = 0; k < 2; k++) if (r[k] > 0){
			u[k] = u[k] * 2 % r[k];
		}
	}

	for (int j = 0; j < n; j++) printf ("%d\n", a[j]);

	return 0;
}

Measured memory_bytes: 4984
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
#include <numeric>
using namespace std;
using ll = long long;
using ld = long double;

const ll MOD = 998244353;
const ll INF = 1e+9;
const ld PI = acos((long double)(-1));

#define no "no"
#define No "No"
#define NO "NO"
#define yes "yes"
#define Yes "Yes"
#define YES "YES"
#define next '\n'
#define sp " "
#define print(x) cout << (x) << endl;
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define EPS 0.00000001

int main() {
    FAST;

    ll n;
    cin >> n;

    string ans;
    while(n > 0){
        n--;
        ans += 'a' + n % 26;
        n /= 26;
    }

    reverse(ALL(ans));
    print(ans);
}


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

int h,w,k;
char g[10][10];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        cin>>g[i];
    }
    int ans=0;
    for(int s=0;s<1<<h+w;s++){
        int c=0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                c+=!(s>>i&1)&&!(s>>h>>j&1)&&g[i][j]=='#';
            }
        }
        ans+=c==k;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3644
#[allow(unused_macros)]
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)*}
    };
}
#[allow(unused_macros)]
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)*}
    };
}
#[allow(unused_macros)]
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, 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")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        astrings: [String; n],
        bstrings: [String; m],
    }
    
    for i in 0..(n - m + 1) {
        for j in 0..(n - m + 1) {
            let mut flag: bool = true;
            for (idx, astring) in astrings[i..i+m].iter().enumerate() {
                let sliced_astring: &str = &astring[j..j+m];
                let bstring = &bstrings[idx];
                if sliced_astring != bstring {
                    flag = false;
                }
            }
            if flag {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
} 


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

int main() {
    vector<int> x(5);
    int ans;
    for (int i = 0; i < 5; i++) {
        cin >> x.at(i);
        if(x.at(i) == 0){
            ans = i + 1;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3588
#include <stdio.h>

int main(void) {
  int e, y;
  scanf("%d%d", &e, &y);
  if(!e) {
    if(y < 1912) printf("M%d\n", y - 1867);
    else if(y < 1926) printf("T%d\n", y - 1911);
    else if(y < 1989) printf("S%d\n", y - 1925);
    else printf("H%d\n", y - 1988);
  } else if(e == 1) printf("%d\n", y + 1867);
  else if(e == 2) printf("%d\n", y + 1911);
  else if(e == 3) printf("%d\n", y + 1925);
  else printf("%d\n", y + 1988);
  return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<vector<ll>> dp(N + 1, vector<ll>(K + 1, 0));
    dp[0][0] = 1;
    rep(i, N) {
        ll a = A[i];
        vector<ll> acc(K + 2, 0);
        rep(j, K + 1) {
            acc[j + 1] += acc[j] + dp[i][j];
        }
        rep(k, K + 1) {
            int idx = max(0LL, k - a);
            dp[i + 1][k] += acc[k + 1] - acc[idx];
            dp[i + 1][k] %= MOD;
        }
    }
    cout << dp[N][K] % MOD << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 80256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Problem.problemF_LCS();
    }
}

class Problem {
    static void problemF_LCS() {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        int n = s.length(), m = t.length();
        int[][] DP = new int[n+1][m+1];
        for (int i = 1; i <= n ; i++) {
            for (int j = 1; j <= m; j++) {
                if (s.charAt(i-1) == t.charAt(j-1))
                    DP[i][j] = DP[i - 1][j - 1] + 1;
                else
                    DP[i][j] = Math.max(DP[i - 1][j], DP[i][j - 1]);
            }
        }

        // retrieve the string
        int i = n, j = m;
        StringBuilder ans = new StringBuilder();
        while (i > 0 && j > 0) {
            if (DP[i][j] == DP[i][j-1])
                j--;
            else if (DP[i][j] == DP[i-1][j])
                i--;
            else {
                ans.append(s.charAt(i-1));
                i--; j--;
            }
        }
        System.out.println(ans.reverse().toString());
    }

}

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

int T;
ll A, B, C, D;

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

int main(void){
    
	cin >> T;
	
	for(int i = 0; i < T; ++i){
	    cin >> A >> B >> C >> D;
	    bool flag = true;
	    if(A < B || B > D) flag = false;
	    else if(B <= C) flag = true;
	    else{
	        ll g = gcd(B, D);
	        ll temp = B - g + (A % g);
	        if(temp > C) flag = false;
	    }
	    if(flag) cout << "Yes" << endl;
	    else cout << "No" << endl;
	}
    
    return 0;
}

Measured memory_bytes: 256
//条件を満たす分け方が2部グラフの変形であることに気づけば簡単。こちらがD問題で良いのでは？
//太郎 - 次郎 - 花子, という3段構造にしたい。もしこういう構造にできるなら, 2彩色できて, (太郎, 花子) -- 次郎, という2部グラフが作れる。
//よって, 2部グラフ判定をし, できなければ0通り. 2部グラフにできるなら, 次郎をどちらの色にするかが(グラフが連結より)2通りあるので試す.
//(太郎, 花子)の分け方だが, これは題意より高々1通りになる。(太郎, 花子) -- 次郎という構造(2通り)を決めたとき, (太郎, 花子)側の頂点が偶数個
//なら半分ずつ分ければよく、奇数個なら分けられない。
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int n, m;
vector<int> et[1000];
int color[1000];

bool bfs() {
	int i;
	
	for (i = 0; i < n; i++) color[i] = -1;
	queue<int> que;
	
	que.push(0);
	color[0] = 0;
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (i = 0; i < et[v].size(); i++) {
			int nv = et[v][i];
			if (color[nv] == -1) {
				color[nv] = !color[v];
				que.push(nv);
			}
			else if (color[nv] == color[v]) {
				return false;
			}
		}
	}
	return true;
}

int main() {
	while (cin >> n >> m) {
		if (!n) break;
		for (int i = 0; i < n; i++) { et[i].clear(); }
		for (int i = 0; i < m; i++) {
			int u, v;
			cin >> u >> v;
			u--; v--;
			et[u].push_back(v);
			et[v].push_back(u);
		}
		
		bool res = bfs();
		vector<int> ans;
		
		if (res) {
			int cnt = 0;
			for (int i = 0; i < n; i++) cnt += (color[i] == 1);
			
			if (cnt % 2 == 0) ans.push_back(cnt / 2);
			if ((n - cnt) % 2 == 0) ans.push_back((n - cnt) / 2);
			sort(ans.begin(), ans.end());
			ans.erase(unique(ans.begin(), ans.end()), ans.end());
		}
		
		cout << ans.size() << endl;
		for (int i = 0; i < ans.size(); i++) {
			cout << ans[i] << endl;
		}
	}
	return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
#define VL vector<lol>
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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 (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0}, hmax{-1};
    lol n; cin >> n;
    REP(i, n)
    {
        lol h; cin >> h;
        if(hmax > h)
        {
            result += (hmax - h);
        }
        hmax = max(hmax, h);
    }
    

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << min(A, B) + min(C, D) << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
using System;

namespace abc153_d
{
    static class Program
    {
        static void Main(string[] args)
        {
            // モンスターの体力
            var h = Console.ReadLine().ToLong();

            // 1 1 - 1
            // 2 (1 + 1)
            // 3 2 - 1 1 - 0 1 - 0
            // 4 (1 + 3)
            // 7 4 - 2 2
            //     - 2 1 1 - 2 0 1 - 2
            //     - 1 1 - 0 1 - 0
            // 7 (1 + 7)
            // 15 8- 4 4
            //     - 4 2 2
            //     - 4 2 1 1 - 4 2 0 1 - 4 2
            //     - 4 1 1 - 4 0 1 - 4
            //     - 2 2
            //     - 2 1 1 - 2 0 1 - 2
            //     - 1 1 - 0 1 - 0

            // 攻撃の回数
            var cnt = 1L;

            var length = (long)Math.Log(h, 2);
            for (var i = 0L; i < length; i++)
            {
                cnt = cnt * 2 + 1;
            }

            Console.WriteLine($"{cnt}");
        }

        static long ToLong(this string s)
        {
            return long.Parse(s);
        }
    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
int nxt[MAX_N * 2][26];

int main2() {

  CLR(nxt, -1);

  string s, t;
  cin >> s >> t;

  int N = s.size();
  for (int i = 0; i < 2*N; i++) {
    int j = i;
    int c = s[i%N] - 'a';
    while (j >= 0 && nxt[j][c] == -1) {
      nxt[j][c] = i - j + 1;
      j--;
    }
  }

  ll ans = 0;
  REP(i, t.size()) {
    int c = t[i] - 'a';
    if (nxt[ans%N][c] == -1) {
      ans = -1;
      break;
    }
    ans += nxt[ans % N][c];
  }

  if (ans == -1) {
    cout << ans << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 23424
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    cnt = 1
    ans = 1
    for i in range(1,N):        
        if(cnt*2 > N):
            ans = cnt
            break
        else:
            cnt *= 2
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include<stdio.h>
int main()
{
	int i, a, b;
	
	scanf("%d", &b);
	while(b!=0){
		for (i = 0; i < 9; i++){
			scanf("%d", &a);
			b -= a;
		}
		printf("%d\n", b);
		scanf("%d", &b);
	}
	return 0;
}

Measured memory_bytes: 600
//15-2
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    int h1,h2,k1,k2,a,b,c,d;
    cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
    int h = h1*a + h2*b + h1/10*c + h2/20*d;
    int k = k1*a + k2*b + k1/10*c + k2/20*d;
    if(h>k) cout << "hiroshi" << endl;
    if(h==k) cout << "even" << endl;
    if(h<k) cout << "kenjiro" << endl;
    return 0;
}



Measured memory_bytes: 3096
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n, d; cin >> n >> d;
    int ans = 0;
    rep(i, n) {
        int x, y; cin >> x >> y;
        if(sqrt((ld)(x * x) + (ld)(y * y)) <= (ld)d + eps) ++ ans;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a != b && b == c ){
    cout << "Yes" << endl;
  }
  else if (a != c && a == b){
    cout << "Yes" << endl;
  }
  else if (b != c && a == c){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
using ll = long long;
const int inf = 1e9;  // 1(1倍)e(指数)9(10^9)
int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    vector<ll> x(n);
    rep(i, n) scanf("%lld", &x[i]);

    // 単純に考えれば選ぶのは原点から近いもの。また、選ぶろうそくの間を開けるのは明らかに非効率です。よって、原点を含む連続したK本のろうそくの選び方のうち、一番短いものはどれか。
    ll ans = inf;
    for (int i = 0; i + k - 1 < n; ++i) {
        ll left = x[i], right = x[i + k - 1];
        // スタートする地点を右端からにするか左端からにするかは座標0から近い方を選んでる min(abs(left), abs(right))
        ans = min(ans, min(abs(left), abs(right)) + right - left);
    }

    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 4036
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;








int main(){
    ll n;
    cin>>n;
    ll mx=0,sum=0;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        sum+=a;
        mx=max(mx,a);
    }
    if(mx>=sum-mx){cout<<"No"<<endl;}
    else{cout<<"Yes"<<endl;}
    
    
    
    return 0;
}


Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-07 23:18:14
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  string s; cin >> s;
  int q; cin >> q;

  deque<char> ans;

  for (char c : s) ans.push_back(c);

  int rev = 0;

  for (int i = 0; i < q; ++i) {
    int op; cin >> op;
    if (op == 1) {
      ++rev;
    } else {
      int f; cin >> f; char c; cin >> c;
      if (f == 1) {
        if (rev & 1) {
          ans.push_back(c);
        } else {
          ans.push_front(c);
        }
      } else {
        if (rev & 1) {
          ans.push_front(c);
        } else {
          ans.push_back(c);
        }
      }
    }
  }

  string t = "";

  for (auto x : ans) {
    t += x;
  }
  if (rev & 1) reverse(all(t));

  cout << t << endl;

  return 0;
}

Measured memory_bytes: 1368
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

N, M = map(int, input().split())
xys = [list(map(int, input().split())) for _  in range(M)]

children = [[] for _ in range(N)]
for x, y in xys:
    children[x-1].append(y-1)

has_no_parent = [True] * N
has_no_child = [True] * N
for x, y in xys:
    has_no_child[x-1] = False
    has_no_parent[y-1] = False

lp = [None] * N
for node in range(N):
    if has_no_child[node]:
        lp[node] = 0

def dp(node):
    if lp[node] is not None:
        return lp[node]
    result = max([dp(child) + 1 for child in children[node]])
    lp[node] = result
    return result

for node in range(N):
    if lp[node] is None:
        dp(node)

print(max(lp))


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

int main(){
    double counter=0;
    double x=0;
    string str;
    int N;
    cin >> N;

    for(int i = 0;i < N;++i){
        cin >> x >> str;
        if(str == "BTC") x *= 380000;
        counter += x;
        x = 0;
    }

    cout << counter << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
 int A,B,C,K;
 cin>>A>>B>>C>>K;
 vector<int>k={A,B,C};
 sort(k.begin(),k.end());
 while(K--){
     k[2]*=2;
 }

 cout<<k[0]+k[1]+k[2]<<endl;
 return 0;}

Measured memory_bytes: 256