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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

int main() {
  int n;
  cin >> n;
  vii G(n);
  rep (i, n - 1) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }

  vi c(n);
  rep (i, n) {
    cin >> c[i];
  }
  sort(all(c));

  priority_queue<pii, vector<pii>, greater<pii> > pq;
  vi adnum(n);
  rep (i, n) {
    pq.push(pii(G[i].size(), i));
    adnum[i] = G[i].size();
  }

  vector<bool> used(n);
  vi d(n);
  ll ans = 0;
  int idx = 0;
  while (!pq.empty()) {
    int u = pq.top().second;
    int num = pq.top().first;
    pq.pop();
    if (used[u]) continue;
    used[u] = true;
    rep (i, G[u].size()) {
      int v = G[u][i];
      if (used[v]) {
        continue;
      }
      adnum[v]--;
      pq.push(pii(adnum[v], v));
    }
    ans += num * c[idx];
    d[u] = c[idx];
    idx++;
  }
  cout << ans << endl;
  rep (i, n) {
    cout << d[i] << " ";
  }
  cout << endl;
  
}


Measured memory_bytes: 1152
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n;
struct point{double x,y;}st,ed;
struct circle{point p;double r;}cir[1010];
struct node{int to,nxt;double cost;}sq[2002000];
int all=0,head[1010];
double dis[1010];
bool vis[1010];
struct hnode{int u;double dis;};
bool operator <(hnode p,hnode q) {return p.dis>q.dis;}
priority_queue<hnode> q;

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

void add(int u,int v,double w)
{
	all++;sq[all].to=v;sq[all].nxt=head[u];sq[all].cost=w;head[u]=all;
}

double calc(point a,point b)
{
	return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
}

int main()
{
	st.x=read();st.y=read();ed.x=read();ed.y=read();
	n=read();
	rep(i,1,n) 
	{
		cir[i].p.x=read();cir[i].p.y=read();cir[i].r=read();
	}
	cir[++n]=(circle){st,0};
	cir[++n]=(circle){ed,0};
	rep(i,1,n) rep(j,i+1,n)
	{
		double dis=calc(cir[i].p,cir[j].p)-cir[i].r-cir[j].r;
		dis=max(dis,0.0);
		add(i,j,dis);add(j,i,dis);
	}
	rep(i,1,n) dis[i]=1e18;
	dis[n-1]=0;q.push((hnode){n-1,0});
	while (!q.empty())
	{
		int u=q.top().u;q.pop();
		if (vis[u]) continue;vis[u]=1;
		go(u,i)
		{
			int v=sq[i].to;
			if (dis[v]>dis[u]+sq[i].cost)
			{
				dis[v]=dis[u]+sq[i].cost;
				if (!vis[v]) q.push((hnode){v,dis[v]});
			}
		}
	}
	printf("%0.10lf",dis[n]);
	return 0;
}


Measured memory_bytes: 22512
"use strict";

const A_INDEX = 0;
const B_INDEX = 1;
const K_INDEX = 3;
const LIMIT = Math.pow(10, 18);

const main = arg => {
    const indexArr = arg.trim().split("\n")[0].split(" ");
    const ans = parseInt(indexArr[A_INDEX]) - parseInt(indexArr[B_INDEX]);
    const KString = indexArr[K_INDEX];
    const K = parseInt(KString.charAt(KString.length-1));

    if (Math.abs(ans) > LIMIT) {
        console.log("Unfair")
    } else {
        console.log(K % 2 === 0 || ans === 0 ? ans : -ans);
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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


int main(){

  int N;
  cin >> N;
  int ans = 0;
  if(N % 10 == 0) cout << 10 << endl;
  else{
    while(N > 0){
      ans += N % 10;
      N /= 10;
    }
    cout << ans << endl;
  }

  return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int n; cin >> n;
    vector<int> cnt(30,100);
    rep(i,n){
        string s;
        cin >> s;
        vector<int> tmp(30,0);
        rep(j,s.size()){
            tmp[s[j]-'a']++;
        }
        rep(j,30){
            cnt[j]=min(cnt[j],tmp[j]);
        }
    }

    string res;
    rep(i,26){
        rep(j,cnt[i]){
            res = res + (char)('a'+i);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define re register
using namespace std;
const int maxn=300+10;
template<typename T> void read(T &x){
	T f=1;x=0;
	char c=getchar();
	while(c<'0' || c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0' && c<='9'){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	x*=f;
}
int n;
int a[maxn];
double dp[maxn][maxn][maxn];
int cnt[4];
int main(){
	read(n);
	for(re int i=1;i<=n;i++){
		read(a[i]);
		cnt[a[i]]++;
	} 
	//dp[0][0][0]=1;
	for(re int k=0;k<=cnt[3];k++){
		for(re int j=0;j<=cnt[2]+cnt[3];j++){
			for(re int i=0;i<=cnt[1]+cnt[2]+cnt[3];i++){
				double sum=(i+j+k)*1.0;
				if(i) dp[i][j][k]+=dp[i-1][j][k]*i*1.0/sum;
				if(j) dp[i][j][k]+=dp[i+1][j-1][k]*j*1.0/sum;
				if(k) dp[i][j][k]+=dp[i][j+1][k-1]*k*1.0/sum;
				if(sum) dp[i][j][k]+=n*1.0/sum;
			}
		}
	}
	cout<<fixed<<setprecision(10)<<dp[cnt[1]][cnt[2]][cnt[3]]<<endl;
	return 0;
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int n, q;
    cin >> n >> q;

    v2_int g(n);
    
    irep(i, n-1) {
        int a, b;
        cin >> a >> b;
        g[a-1].push_back(b-1);
        g[b-1].push_back(a-1);
    }
    
    v_ll dist(n, 0);

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

    queue<int> que;
    que.push(0);
    v_bool used(n,false);
    used[0] = true;
    
    while(que.size()) {
        int now = que.front(); que.pop();
        for(auto node : g[now]) {
            if(used[node]) { continue; }
            dist[node] += dist[now];
            used[node] = true;
            que.push(node);
        }
    }
    irep(i,n) {
        cout << dist[i] << endl;
    }
    return 0;
} /*atcoder*/



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

#define fmm(x) cerr << "[!] " << #x << " e " << x << "\n";
using ll = long long;

using namespace std;

const int MAX = 1005;

int v[MAX];

int main(){
  // ENGAGE MODUL RACHETĂ ᕦ(ò_ó)ᕤ
  ios::sync_with_stdio(false);
  cin.tie(0);

  #ifdef ACAS_LA_SEFU
  freopen("valoare.in", "r", stdin);
  #endif

  int n, m; cin >> n >> m;
  int sum=0;
  for (int i=0; i<n; i++){
    cin >> v[i];
    sum += v[i];
  }
  int sol=0;
  double step = (1.0/(4*m))*sum;
  sort(v, v+n, greater<int>());
  for (int i=0; i<m; i++){
    if (v[i]>=step) sol++;
  }
  if (sol>=m) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
import java.io.*;
 
public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        String[] cut = input.split(" ");
        int noOne = Integer.parseInt(cut[0]);
        int noTwo = Integer.parseInt(cut[1]);
        int noThree = Integer.parseInt(cut[2]);
        
        
        if(noOne > noTwo || noTwo > noThree) {
            if(noOne > noTwo){
                int temp = noOne;
                noOne = noTwo;
                noTwo = temp;
            }
            if(noTwo > noThree){
                int temp = noTwo;
                noTwo = noThree;
                noThree = temp;
            }
            if(noOne > noTwo){
                int temp = noOne;
                noOne = noTwo;
                noTwo = temp;
            }
        }
        System.out.println(noOne + " " + noTwo + " " + noThree);
        
    }
}

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

/*

dp[i][j] consider first i element and max extends is j

no select i
dp[i][j] = dp[i-1][j] if j<x[i]

select i

dp[i][x[i]+d[i]-1] = \sum dp[i-1][j] if j<x[i]+d[i]

dp[i][j] = dp[i-1][j] if j>=x[i]+d[i]

dp[i][j] = 0 if x[i]<=j<x[i]+d[i]-1

*/

const int M=2e5+5;
const int INF=0x3f3f3f3f;
const int MO=998244353;


inline int add(int x,int y)
{
	x+=y;
	if(x>=MO) x-=MO;
	return x;
}
inline int sub(int x,int y)
{
	x-=y;
	if(x<0) x+=MO;
	return x;
}
inline int mul(int x,int y)
{
	return 1LL*x*y%MO;
}
inline void addv(int &x,int y)
{
	x+=y;
	if(x>=MO) x-=MO;
}
inline void subv(int &x,int y)
{
	x-=y;
	if(x<0) x+=MO;
}
inline void mulv(int &x,int y)
{
	x=1LL*x*y%MO;
}

struct SegT
{
	int sum[M*4],se[M*4];
	void pull(int o,int ls,int rs)
	{
		sum[o]=add(sum[ls],sum[rs]);
	}
	void push(int o,int ls,int rs)
	{
		if(se[o])
		{
			se[ls]=se[rs]=1;
			sum[ls]=sum[rs]=0;
			se[o]=0;
		}
	}
	int L,R;
	void upd_set(int o,int l,int r)
	{
		if(L<=l&&r<=R)
		{
			se[o]=1;
			sum[o]=0;
			return;
		}
		int mid=(l+r)>>1;
		int ls=o+1,rs=o+((mid-l+1)<<1);
		push(o,ls,rs);
		if(L<=mid) upd_set(ls,l,mid);
		if(mid<R) upd_set(rs,mid+1,r);
		pull(o,ls,rs);
	}
	int V;
	void upd_add(int o,int l,int r)
	{
		if(l==r)
		{
			sum[o]=V;
			return;
		}
		int mid=(l+r)>>1;
		int ls=o+1,rs=o+((mid-l+1)<<1);
		push(o,ls,rs);
		if(L<=mid) upd_add(ls,l,mid);
		else upd_add(rs,mid+1,r);
		pull(o,ls,rs);
	}
	int query(int o,int l,int r)
	{
		if(L<=l&&r<=R)
			return sum[o];
		int mid=(l+r)>>1;
		int ls=o+1,rs=o+((mid-l+1)<<1);
		push(o,ls,rs);
		int ans=0;
		if(L<=mid) addv(ans,query(ls,l,mid));
		if(mid<R) addv(ans,query(rs,mid+1,r));
		pull(o,ls,rs);
		return ans;
	}
}segt;

int x[M],d[M];
int n;
int id[M];
int xx[M*2],m;

int cmp(int a,int b)
{
	return x[a]<x[b];
}

int find(int v)
{
	return lower_bound(xx,xx+m,v)-xx;
}

int main()
{
	//freopen("F.in","r",stdin);
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&x[i],&d[i]);
		xx[i]=x[i];
		xx[i+n]=x[i]+d[i]-1;
		id[i]=i;
	}
	sort(id,id+n,cmp);
	xx[n*2]=-INF;
	sort(xx,xx+n*2+1);

	m=unique(xx,xx+n*2+1)-xx;

	segt.L=0;
	segt.V=1;
	segt.upd_add(0,0,m-1);
	for(int ii=0;ii<n;ii++)
	{
		//cout<<endl;
		int i=id[ii]; 
		int l=find(x[i]),r=find(x[i]+d[i]-1);
		//cout<<i<<" "<<l<<" "<<r<<endl;
		segt.L=0; segt.R=r;
		segt.V=segt.query(0,0,m-1);
		//cout<<segt.V<<endl;
		segt.L=r;
		segt.upd_add(0,0,m-1);
		r--;
		if(l<=r)
		{
			segt.L=l;
			segt.R=r;
			segt.upd_set(0,0,m-1);
		}
	}

	printf("%d\n",segt.sum[0]);

	return 0;
}

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;


struct NODE{
	int num;//team number
	vector<int> wrong;
	ll score;
	int solve;
	NODE(){}
	NODE(int num, int p):num(num), wrong(p, 0){score = 0; solve = 0;}
	
	bool operator<(const NODE r){
		if(solve != r.solve) return solve < r.solve;
		else if (score != r.score) return score > r.score;
		else return num > r.num;
	}
};

int main() {
	
	int t, p, r;
	while(cin >> t >> p >> r, t){
		vector<NODE> v(t);
		rep(i, t){
			v[i] = NODE(i, p);
		}
		
		rep(i, r){
			int tid, pid, time;
			string mes;
			cin >> tid >> pid >> time >> mes;
			tid--;
			pid--;
			if(mes == "CORRECT"){
				v[tid].score += (v[tid].wrong[pid] * 1200 + time);
				v[tid].solve++;
			}
			else{
				v[tid].wrong[pid]++;
			}
		}
		
		SORT(v);
		
		for(int i = t-1; i >=0; i--){
			cout << v[i].num+1 << " " << v[i].solve << " " << v[i].score << endl;
		}
	}
	
	return 0;
}

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

bool solve(int mx, int n, int order[])
{
	queue<int> search;
	queue<int> back[252];

	int start[252];
	for (int i = 0; i <= n + 1; i++) start[i] = false;
	start[0] = true;
	search.push(0);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		for (int i = 1; i <= mx; i++){
			int next;
			if (now + i <= 0) continue;
			else if (now + i > n + 1) next = n + 1;
			else if (now + i + order[now + i] <= 0) continue;
			else if (now + i + order[now + i] > n + 1) next = n + 1;
			else next = now + i + order[now + i];
			back[next].push(now);
			if (start[next]) continue;
			start[next] = true;
			search.push(next);			
		}
	}
	if (!start[n + 1]) return false;
	
	int goal[252];
	for (int i = 0; i <= n + 1; i++) goal[i] = false;
	goal[n + 1] = true;	
	search.push(n + 1);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		while (!back[now].empty()){
			int from = back[now].front();
			back[now].pop();
			if (goal[from]) continue;
			goal[from] = true;
			search.push(from);
		}
	}
	for (int i = 0; i <= n + 1; i++){
		if (start[i] && !goal[i]) return false;
	}
	return true;
}

int main()
{
	while (true){
		int mx;
		cin >> mx;
		if (!mx) break;
		int n, order[252];
		cin >> n;
		order[0] = order[n + 1] = 0;
		for (int i = 1; i <= n; i++){
			cin >> order[i];
		}
		if (solve(mx, n, order)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}

Measured memory_bytes: 1360
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
typedef long long ll;
int main(void)
{
    int N,M,X;
    int C[maxn];
    int A[15][15];

    scanf("%d%d%d",&N,&M,&X);
    ll cnt=1;
    for(int i = 0;i <N;i ++)
    {
        scanf("%d",&C[i]);
        for(int j = 0;j <M;j ++)
        {
            scanf("%d",&A[i][j]);
        }
        cnt = cnt << 1;
    }
    int ret = 0x3f3f3f;
    for(ll c = 0;c < cnt;c ++)
    {
        ll tmp = c;
        int p[M+3];
        int cost = 0;
        for(int j = 0;j < M;j ++) p[j]=0;

        for(int i = 0;i < N;i ++)
        {
            if(tmp&1)
            {
                cost += C[i];
                for(int j = 0;j < M;j ++)
                {
                    p[j]+=A[i][j];
                }
            }
            tmp = tmp >> 1;
        }
        bool ok = true;
        for(int j = 0;j < M;j ++)
        {
            if(p[j]<X)
            {
                ok = false;
                break;
            }
        }
        if(ok) ret = min(ret,cost);
    }
    if(ret == 0x3f3f3f) cout<<-1<<endl;
    else
    cout<< ret<<endl;
    return 0;
}


Measured memory_bytes: 3776
A,B,C,D = list(input())
def check(S):
    if eval(S)==7:
        print(S + "=7")
        quit()
check("%s%s%s%s%s%s%s" % (A,"+",B,"-",C,"-",D))
check("%s%s%s%s%s%s%s" % (A,"-",B,"+",C,"-",D))
check("%s%s%s%s%s%s%s" % (A,"-",B,"-",C,"+",D))
check("%s%s%s%s%s%s%s" % (A,"+",B,"+",C,"-",D))
check("%s%s%s%s%s%s%s" % (A,"+",B,"-",C,"+",D))
check("%s%s%s%s%s%s%s" % (A,"-",B,"+",C,"+",D))
check("%s%s%s%s%s%s%s" % (A,"+",B,"+",C,"+",D))
check("%s%s%s%s%s%s%s" % (A,"-",B,"-",C,"-",D))

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#include <vector>
using namespace std;
 
int main(){
  //入力
  int N;
  cin>>N;
  string S;
  cin>>S;
  if(N%2!=0){
    cout<<"No"<<endl;
    return 0;
  }
  string sub_a,sub_b;
  sub_a=S.substr(0,N/2);
  sub_b=S.substr(N/2);
  if(sub_a==sub_b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int X,Y;
    cin>>X>>Y;
    if((X*2<=Y && X*4>=Y)&&(Y%2==0)){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

 


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  ull K,A,B; cin>>K>>A>>B;
  ull have = 1;

  if(A >= B) {
    have += K;
  } else {
    for(ull i=0; i<K; i++) {
      if(have >= A && i != K - 1) {
        have -= A;
        have += B;
        i++;
      } else {
        have += 1;
      }
    }
    have = max(have, 1+K);
  }

  cout << have << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int n;
    string S;
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        
        int h=0,point=0,o=0;
        
        while(1){
            cin >> S;
            
            if(S == "HIT"){
                if(h>=3)
                    point++;
                else
                    h++;
            }else if(S == "HOMERUN"){
                point+=h+1;
                h=0;
            }else if(S == "OUT"){
                o++;
            }
            
            if(o>=3) break;
        }
        
        printf("%d\n",point);
    }
    
    return 0;
}

Measured memory_bytes: 1244
def main():
    N = int(input())
    data = list(input())

    righ_siro = data.count('.')
    righ_kuro = data.count('#')

    ans = min(righ_kuro, righ_siro)

    left_kuro = 0
    left_shiro = 0

    for i in range(N):
        if data[i] == '.':
            left_shiro +=1
            righ_siro -= 1
        else:
            left_kuro += 1
            righ_kuro -= 1

        kari = left_kuro + righ_siro

        if ans > kari:
            ans = kari

    print(ans)






if __name__ == '__main__':
    main()


Measured memory_bytes: 4840
s = str(input())

if 0 < int(s[:2]) <= 12:
    if 0 < int(s[2:]) <= 12:
        ans = "AMBIGUOUS"
    else :
        ans = "MMYY"
elif 0 < int(s[2:]) <= 12:
    ans = "YYMM"
else:
    ans = "NA"
print(ans)

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

int H, W;
vector<vector<int>> dp(1001, vector<int>(1001));
//dp[i][j]:i,j始点の経路の数
vector<vector<char>> a(1000, vector<char>(1000));

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> a.at(i).at(j);
        }
    }
    dp.at(H - 1).at(W - 1) = 1;
    for (int i = H - 1; i >= 0; i--) {
        for (int j = W - 1; j >= 0; j--) {
            if (i == H - 1 && j == W - 1) continue;
            if (a.at(i).at(j) == '#') continue;
            dp.at(i).at(j) = (dp.at(i + 1).at(j) + dp.at(i).at(j + 1)) % 1000000007;
        }
    }
    cout << dp.at(0).at(0) << endl;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define fe first
#define se second

using namespace std;

const int maxn = 105, mo = int(1e9) + 7;
const int inv_2 = 500000004, inv_6 = 166666668;
const int xy[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};

typedef pair<int,int> pi;

map<pi,bool> hole;

bool bl[maxn][maxn];
pi pos[maxn];
int H,W,n,new_r[maxn][2],new_c[maxn][2],w[maxn][maxn],r_cnt,c_cnt;
int ans;

int sq_sum(int l,int r)
{
	if (l > r) return 0;
	if (l > 1) return (sq_sum(1,r) - sq_sum(1,l - 1) + mo) % mo;
	return r * 1ll * (r + 1) % mo * (2ll * r + 1) % mo * inv_6 % mo;
}

int n_sum(int l,int r)
{
	if (l > r) return 0;
	return (l + r) * 1ll * (r - l + 1) % mo * inv_2 % mo;
}

void row_compress()
{
	sort(pos + 1,pos + n + 1);
	for(int i = 1;i <= n + 1;i ++)
	{
		int lr = pos[i - 1].fe + 1, rr = pos[i].fe - 1;
		if (lr <= rr)
		{
			new_r[++ r_cnt][0] = lr,new_r[r_cnt][1] = rr;
			long long C1 = 1 - i,C2 = (W * 1ll * H % mo - n + i - 1) % mo;
			ans = ((ans - W * 1ll * W % mo * sq_sum(lr,rr - 1)) % mo + 
					(C2 - C1) % mo * 1ll * W % mo * n_sum(lr,rr - 1) % mo) % mo;
			ans = (ans + C1 * 1ll * C2 % mo * (rr - lr)) % mo; 
		}
		if (pos[i].fe != pos[i - 1].fe && i != n + 1)
			new_r[++ r_cnt][0] = new_r[r_cnt][1] = pos[i].fe;
	}
}

void whole_dp()
{
	for(int i = 1;i <= n;i ++)
		hole[pos[i]] = 1;
	for(int i = 1;i <= r_cnt;i ++)
		for(int j = 1;j <= c_cnt;j ++)
		{
			w[i][j] = (new_r[i][1] - new_r[i][0] + 1) * 1ll * (new_c[j][1] - new_c[j][0] + 1) % mo;
			if (w[i][j] == 1)
				bl[i][j] = hole[pi(new_r[i][0],new_c[j][0])];
		}
	static int vis[maxn][maxn];
	int vis_cnt = 0;
	for(int i = 1;i <= r_cnt;i ++)
		for(int j = 1;j <= c_cnt;j ++)
			if (!bl[i][j])
			{
				static int que[maxn * maxn][3];
				++ vis_cnt;
				int en = 1;
				que[en][0] = i,que[en][1] = j,que[en][2] = 0;
				vis[i][j] = vis_cnt;
				for(int k = 1;k <= en;k ++)
				{
					int x = que[k][0],y = que[k][1],d = que[k][2];
					ans = (ans + w[i][j] * 1ll * w[x][y] % mo * d) % mo;
					for(int p = 0;p < 4;p ++)
					{
						int nx = x + xy[p][0],ny = y + xy[p][1];
						if (nx && ny && nx <= r_cnt && ny <= c_cnt && !bl[nx][ny] && vis[nx][ny] != vis_cnt)
						{
							vis[nx][ny] = vis_cnt;
							que[++ en][0] = nx, que[en][1] = ny, que[en][2] = d + 1;
						}
					}
				}
			}
}

int main()
{
	scanf("%d%d%d", &H, &W, &n);
	for(int i = 1;i <= n;i ++)
	{
		scanf("%d%d", &pos[i].fe, &pos[i].se);
		pos[i].fe ++, pos[i].se ++;
	}
	pos[n + 1] = pi(H + 1,W + 1);
	row_compress();
	swap(new_r,new_c),swap(r_cnt,c_cnt);
	for(int i = 1;i <= n + 1;i ++) swap(pos[i].fe, pos[i].se);
	swap(H,W);
	row_compress();
	ans = (ans + mo) % mo * 2ll % mo;
	whole_dp();
	printf("%d\n", ans * 1ll * inv_2 % mo);
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main() {
	
	int n;
	scanf("%d", &n);
	
	char s[n];
	scanf("%s", s);
	
	if (n%2==1){
		printf("No\n");
		return 0;
	}
	
	for(int i=0, j=n/2; j<n; i++, j++){
		if(s[i]!=s[j]){
			printf("No\n");
			return 0;
		}
	}

	printf("Yes\n");


    return 0;
}

Measured memory_bytes: 3156
n = int(input())
a = list(map(int,input().split()))
a = [0] + a + [0]
sum = 0
for i in range(n+1):
    sum += abs(a[i] - a[i+1])
for i in range(n):
    ans = (sum 
           - abs(a[i] - a[i+1]) 
           - abs(a[i+1] -a[i+2])
           + abs(a[i] - a[i+2]))
    print(ans)

Measured memory_bytes: 13920
#include<bits/stdc++.h>
#define rep2(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using lint = long long;//
template <typename T>
T sq (T x) {
  return x * x ;
}
signed main () {
  lint N,K;
  cin >> N >> K;
  set<int> Set;
  rep(i,K){
    int di;
    cin >> di;
      rep(j,di){
        int Ai;
        cin >> Ai;
        Set.insert(Ai);
      }
  }
  cout << N - Set.size() <<endl;
return 0;


}



Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, n) for (int i = 0; (i) < (int)(n); i++)
using namespace std;

int N, M, Q, A[55], B[55], C[55], D[55], S[15] = { 0 };
int maxD = 0;

void repeat(int n) {
	if (n == N) {
		int d = 0;
		rep(i, Q) {
			if (S[B[i] - 1] - S[A[i] - 1] == C[i]) {
				d += D[i];
			}
		}
		if (maxD < d) {
			maxD = d;
		}
		return;
	}
	for (int i = 1; i <= M; i++) {
		if (n > 0 && S[n - 1] > i) continue;
		S[n] = i;
		repeat(n + 1);
	}
}

int main() {
	cin >> N >> M >> Q;
	rep(i, Q) {
		cin >> A[i] >> B[i] >> C[i] >> D[i];
	}
	repeat(0);
	cout << maxD << endl;
	return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
using namespace std;

#define ll long long

ll MAX(ll a, ll b) {

	if (a > b)return a;
	else return b;

}
ll MIN(ll a, ll b) {

	if (a < b)return a;
	else return b;

}

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a < b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return a / gcd(a, b)*b;

}
//最小公倍数

int main() {

	int N;
	cin >> N;
	if (N <= 999)cout << "ABC" << endl;
	else cout << "ABD" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int N;
  
  scanf("%d",&N);
  
  N = N%100;
  
  switch(N%10) {
    case 0:puts("pon"); break;
    case 1:puts("pon"); break;
    case 2:puts("hon"); break;
    case 3:puts("bon"); break;
    case 4:puts("hon"); break;
    case 5:puts("hon"); break;
    case 6:puts("pon"); break;
    case 7:puts("hon"); break;
    case 8:puts("pon"); break;
    case 9:puts("hon"); break;
  }
  return 0;
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n;
cin >> n;
vector<char> vec(n);
vector<char> vec1(n);
  for (int i=0; i<n; i++){
  cin >> vec.at(i);
  }
  for (int i=0; i<n; i++){
  cin >> vec1.at(i);
  }

  for (int i=0; i<n; i++){
  cout << vec.at(i);
  cout << vec1.at(i);
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
vector<int> pr;
const int c=1e6;
bool prime[c+1];
void makeprime(){
	for(int i=2;i<=c;i++) prime[i]=true;
	for(int i=2;i*i<=c;i++) if(prime[i]) for(int j=2;j*i<=c;j++) prime[i*j]=0;
	rep(i,c) if(prime[i]) pr.push_back(i);
}
int main(){
	makeprime();
	while(true){
		int n,p;
		scanf("%d%d",&n,&p);
		if(n==-1) break;
		int f=upper_bound(pr.begin(),pr.end(),n)-pr.begin();
		vector<int> ans;
		rep(i,100) rep(j,i+1) ans.push_back(pr[f+i]+pr[f+j]);
		sort(ans.begin(),ans.end());
		printf("%d\n",ans[p-1]);
	}
}

Measured memory_bytes: 2416
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) ll((a).size())
#define out(a) cout<<(a)<<endl;
const ll inf=1e9;
const int MAX = 510000;
const ll MOD = 998244353;

inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
int f(ll i,vll a){
  if(a[i]<a[i+1])return 1;
  else if(a[i]==a[i+1])return 2;
  else return 3;
}
int main(){
  string s;cin>>s;
  ll cnt=0,ans=0;
  rep(i,0,s.size()){
    if(s[i]=='B')cnt++;
    else ans+=cnt;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3752
N,*H = map(int, open(0).read().split())
point = 0
max_count = 0

for i in range(N-1):
    if(H[i] < H[i+1]):
        if((i-point) > max_count):
            max_count = i-point
        point = i+1
if((N-point-1) > max_count):
  max_count = N-point-1

print(max_count)



Measured memory_bytes: 14092
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    L=[]
    for i in range(N):
        S,T=ST().split()
        T=int(T)
        L.append((S,T,i))
    L.sort(reverse=True,key=lambda x:x[1])
    L.sort(key=lambda x:x[0])
    print(*[i+1 for x,y,i in L],sep="\n")

if __name__ == '__main__':
    main()

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

int main () {
	int a, b, c;
	while ( cin >> a >> b >> c){
		if ( a == -1 && b == -1 && c == -1){
			break;
		}
		if ( a == -1 || b == -1){
			cout << "F" << endl;
			continue;
		}
		if ( a + b >= 80){
			cout << "A" << endl;
		}else if ( a + b >= 65){
			cout << "B" << endl;
		}else if ( a + b >= 50 || c >= 50){
			cout << "C" << endl; 
		}else if ( a + b >= 30){
			cout << "D" << endl; 
		}else {
			cout << "F" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3060
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,M,A[200303],B[200203]={},res=0,sum=0,cou=0;
string S,T;

int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    for(long long int i = 0; i < N-1; i++){
        cin>>A[i];
        B[A[i]]++;
    }
    for(long long int i = 1; i <= N; i++){
        cout<<B[i]<<endl;
    }
}    


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

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

    for(int i = 0; i < s.length(); i++) {
        int x = s[i] - 'A';
        x = (x + n) % 26;
        putchar(x+'A');
    }
    cout << endl;
}

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


int main(){
  int n;
  cin >> n;
  string s;
  map<string,int> tisa;
  int ans = 0;
  for(int i=0; i<n; i++){
    cin >> s;
    if(!tisa.count(s)){
      tisa[s] = 1;
      ans++;
    }
  }
  cout << ans << endl;
}

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

typedef struct P{
	int ax,ay,bx,by;
}P;
P q[30000],sq[30000],s;
int qn,sqn;
char map[53][53];
char f[53][53][53][53];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int main(){
	int i,j,k,x,y,t;
	static char f[53][53][53][53];
	while(1){
		scanf("%d%d",&x,&y);
		if(x==0)break;
		scanf("%d%d",&s.ax,&s.ay);
		scanf("%d%d",&s.bx,&s.by);
		
		for(i=0;i<=x+1;i++)map[0][i]=map[y+1][i]=1;
		for(i=1;i<=y;i++){
			for(j=1;j<=x;j++)scanf("%d",&map[i][j]);
			map[i][0]=map[i][x+1]=1;
		}
		//for(i=0;i<=y+1;i++){for(j=0;j<=x+1;j++)printf("%d",map[i][j]);printf("\n");}
		q[0]=s;qn=1;
		t=0;
		memset(f,0,sizeof(f));
		f[s.ax][s.ay][s.bx][s.by]=1;
		while(qn!=0 && t<100){
			sqn=0;
			for(i=0;i<qn;i++){
				//printf("%d %d %d %d\n",s.ax,s.ay,s.bx,s.by);
				if(q[i].ax==q[i].bx && q[i].ay==q[i].by)goto nex;
				for(j=0;j<4;j++){
					s=q[i];
					s.ax+=dx[j];
					s.ay+=dy[j];
					s.bx+=dx[(j+2)%4];
					s.by+=dy[(j+2)%4];
					if(map[s.ay][s.ax]==1){
						s.ax-=dx[j];
						s.ay-=dy[j];
					}
					if(map[s.by][s.bx]==1){
						s.bx-=dx[(j+2)%4];
						s.by-=dy[(j+2)%4];
					}
					if(f[s.ax][s.ay][s.bx][s.by]==1)continue;
					f[s.ax][s.ay][s.bx][s.by]=1;
					sq[sqn++]=s;
					//if(sqn==9999)goto nex;
				}
			}
			memcpy(q,sq,sizeof(P)*sqn);
			qn=sqn;
			t++;
			//printf("\n");
		}
		nex:
		if(t==100 || qn==0)printf("NA\n");
		else printf("%d\n",t);
	}
	
	return 0;
}

Measured memory_bytes: 9324
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
//struct area

//function area

//main area
int main(){
    int a, b;
    cin >> a >> b;
    cout << (a*b%2==1 ? "Yes" : "No") << endl;
}
/*



*/

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  int max=a[0];
  for(int i=1;i<n;i++)
  {
  if(a[i]>max)
  max=a[i];
  if(a[i]<max-1)
  {
    cout<<"No\n";return 0;
  }
  }

  cout<<"Yes\n";
  return 0;
}


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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin >>s;
	int cur=0;
	for (auto x : s)
	if (x=='o') cur++;
	cout<<700+100*cur<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream> 
#include<bits/stdc++.h> 
using namespace std;
vector<vector<int>> adj;
vector<bool> used;
vector<int> dp;
int dfs_visit(int u){ 
	used[u]=true; 
	int val; 
	dp[u]=0; 
	for(int v: adj[u]){ 
		if(not used[v]){
			dfs_visit(v); 
		}
		dp[u]=max(dp[v]+1,dp[u]); 
	} 
	return dp[u]; 
		
}

void dfs(){ 
	int N=adj.size(); 
	int ma=dfs_visit(0); 
	for(int i=1;i<N;i++){ 
		if(!used[i]){
		       ma=max(dfs_visit(i),ma); 
		} 
	} 		
	cout<<ma; 


}


int main(){ 
	ios::sync_with_stdio(false); 
	cin.tie(0); 
	int N,M;
	cin>>N>>M; 
	adj.resize(N); 
	used.assign(N,false); 
	dp.assign(N,0); 
	int x,y;
	for(int i=0;i<M;i++){ 
		cin>>x>>y;
		x--;
		y--;
		adj[x].push_back(y); 
	} 
	dfs();
	
	return 0;
} 



Measured memory_bytes: 8192
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
vector<int> L;
int N, A, B, C;
#define inf 1000000000
int dfs(int n, int a, int b, int c) {
	if (n == N) {
		if (min(a, min(b, c)) == 0) {
			return inf;
		}
		else {
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		}
	}
	int cost0, cost1, cost2, cost3;
	cost0= dfs(n + 1, a, b, c);
	cost1=dfs(n + 1, a + L[n], b, c)+10;
	cost2=dfs(n + 1, a, b + L[n], c)+10;
	cost3=dfs(n + 1, a, b, c + L[n])+10;
	return min(cost0, min(cost1, min(cost2, cost3)));
}

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

	int l;
	for (int i = 0; i < N; i++) {
		cin >> l;
		L.push_back(l);
	}
	cout << dfs(0, 0, 0, 0);


	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s,t;
  while(cin>>s>>t&&t!="X") {
    vector<string> words;
    int last = 0;
    REP(i, 0, s.size()) {
      if (s[i] == '_') {
        words.push_back(s.substr(last, i - last));
        last = i + 1;
      }
      if (s[i] <= 'Z' && i > 0) {
        words.push_back(s.substr(last, i - last));
        last = i;
      }
    }
    words.push_back(s.substr(last));
    if (t == "U" || t == "L") {
      REP(i, 0, words.size()) {
        if (i > 0 || t == "U") words[i][0] = toupper(words[i][0]);
        else words[i][0] = tolower(words[i][0]);
        cout << words[i];
      }
      cout << endl;
    } else {
      REP(i, 0, words.size()) {
        if (i > 0) cout << "_";
        transform(words[i].begin(), words[i].end(), words[i].begin(), ::tolower);
        cout << words[i];
      }
      cout << endl;
    }
  }
}



Measured memory_bytes: 3124
h, w = map(int, input().split())

w1 = ['#']*(w+2)

ans = []
ans.append(w1)

for i in range(h):
    tmp = ["#"]+list(input())+["#"]
    ans.append(tmp)

ans.append(w1)

for j in ans:
    for k in j:
        print(k, end="")
    print()

Measured memory_bytes: 9244
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

int h,w;

vector<vector<int>> visited;
ll bc,hc;

void dfs(int i, int j, vector<string> s){
    
    visited[i][j] = 1;
    
    if(s[i][j] == '.') hc ++;
    else bc++;
    
    rep(k,4){
        
        
        if(i+dy[k] >= 0 && i + dy[k] <h && j + dx[k] >= 0 && j + dx[k] <w){
            
            if(s[i][j] == s[i+dy[k]][j+dx[k]])continue;
            if (visited[i+dy[k]][j+dx[k]] == 1)continue;
            
            dfs(i+dy[k],j+dx[k],s);
            
        }
        
    }
    
 }

int main() {

    cin>>h>>w;
    vector<string> s(h);
    visited.resize(h);
    rep(i,h){
        cin>>s[i];
        visited[i].resize(w);
    }
    
    rep(i,h)rep(j,w) visited[i][j] = 0;
    
    ll ans = 0;
    rep(i,h){
        rep(j,w){
            if(s[i][j] == '#')continue;
            if(visited[i][j]==1)continue;
            bc = 0;
            hc = 0;
            dfs(i,j,s);
            ans += bc*hc;
            
        }
    }
    
    cout<<ans<<endl;
    
   
    return 0;
}












Measured memory_bytes: 596480
<?php
fscanf(STDIN, "%d", $n);
if ($n >= 64) {
  $res = 64;
} else if ($n >= 32) {
  $res = 32;
} else if ($n >= 16) {
  $res = 16;
} else if ($n >= 8) {
  $res = 8;
} else if ($n >= 4) {
  $res = 4;
} else if ($n >= 2) {
  $res = 2;
} else if ($n >= 1) {
  $res = 1;
}
echo $res;

Measured memory_bytes: 3576
#include<iostream>
#include<string>
#include<algorithm>
#define int long long
using namespace std;
int ok[213456];
int i[213456], j[213456], k[213456], r[213456];
signed main() {
	for (int un = 0; un < 100; un++) {
		for (int in = 0; in < 213456; in++) {
			ok[in] = 0; i[in] = 0; j[in] = 0; k[in] = 0; r[in] = 0;
		}
		int n, a, b, c, I, J, K, R; cin >> a >> b >> c;
		if (a == 0 && b == 0 && c == 0) { return 0; }
		cin >> n;
		for (int h = 0; h < n; h++) {
			for (int z = 0; z < n; z++) {
				if (h == 0) {
					cin >> I >> J >> K >> R;
					i[z] = I; j[z] = J; k[z] = K; r[z] = R;
				}
				if (r[z] == 1) {
					ok[i[z]] = 1; ok[j[z]] = 1; ok[k[z]] = 1;
				}
				else {
					if (ok[i[z]] == 1 && ok[j[z]] == 1) { ok[k[z]] = 2; }
					if (ok[i[z]] == 1 && ok[k[z]] == 1) { ok[j[z]] = 2; }
					if (ok[j[z]] == 1 && ok[k[z]] == 1) { ok[i[z]] = 2; }
				}
			}
		}
		for (int h = 1; h <= a + b + c; h++) {
			cout << 2 - ok[h] << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 11416
n = int(input())
 
travel = []
for i in range(n):
    t,x,y = map(int, input().split())
    tmp = [t,x,y]
    travel.append(tmp)
 
now = [0, 0]
pre_time = 0
for tra in travel:
    diff_time,x,y = tra[0]-pre_time,tra[1],tra[2]
    for _ in range(diff_time):
        if now[0] < x:
            now[0] += 1
        elif x < now[0]:
            now[0] -= 1
        elif now[1] < y:
            now[1] += 1
        elif y < now[1]:
            now[1] -= 1
        else:
            now[1] -= 1
    
    if now[0] == x and now[1] == y:
        pass
    else:
        print('No')
        exit()

    pre_time = tra[0]
 
print('Yes')

Measured memory_bytes: 59608
#B
def dist(x1, tmpx):
    d2 = 0
    for k in range(len(x1)):
        d2 += (x1[k] - tmpx[k])**2
    d = d2 ** (1/2)
    return d

n,d = map(int, input().split())
x1 = []
x1.append(list(map(int,input().split())))
cnt = 0
for i in range(1,n):
    tmpx = list(map(int,input().split()))
    for j in range(0,i):
        d = dist(x1[j],tmpx)
        if d == int(d):
            cnt += 1
    x1.append(tmpx)
print(cnt)


Measured memory_bytes: 3064
package main

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

func main() {
	var x, n int
	var in []int
	var ou1 = map[int]int{}
	var ou2 = map[int]int{}

	fmt.Scanf("%d %d", &x, &n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	inst := strings.Split(sc.Text(), " ")
	for _, i := range inst {
		t, _ := strconv.Atoi(i)
		in = append(in, t)
	}
	ou2[0]++
	for _, i := range in {
		if i >= x {
			ou1[i-x]++
		} else {
			ou2[x-i]++
		}
	}
  //fmt.Println(ou1)
  //fmt.Println(ou2)

	for i := 0; ; i++ {
		_, ok2 := ou2[i]
		if !ok2 {
			fmt.Println(x - i)
			return
		}
		_, ok1 := ou1[i]
		if !ok1 {
			fmt.Println(x + i)
			return
		}

	}

}



Measured memory_bytes: 1860