akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    map<int, int> m;
    for(int i = 0; i < N; i++) {
        int D;
        cin >> D;
        if(m.count(D) == 0)
            m.emplace(D, 1);
        else
            m[D]++;
    }

    int M;
    cin >> M;
    for(int i = 0; i < M; i++) {
        int T;
        cin >> T;
        if(m.count(T) == 0) {
            cout << "NO";
            return 0;
        } else {
            m[T]--;
            if(m[T] < 0) {
                cout << "NO";
                return 0;
            }
        }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 9600
#include <stdio.h>

const int Mod = 998244353;
long long seq[200001], pow[200001];

typedef struct {
	int left, right, flag;
	long long val;
} lazy_seg_node;

void init_node(lazy_seg_node v[], int k, int l, int r)
{
	v[k].left = l;
	v[k].right = r;
	v[k].flag = 0;
	v[k].val = seq[r-l+1];
	if (l < r) {
		init_node(v, k << 1, l, (l + r) / 2);
		init_node(v, (k << 1) ^ 1, (l + r) / 2 + 1, r);
	}
}

void update_segment(lazy_seg_node v[], int k, int l, int r, int d)
{
	int i, j;
	if (v[k].left > r || v[k].right < l) return;
	else if (v[k].left >= l && v[k].right <= r) {
		v[k].flag = d;
		v[k].val = seq[v[k].right - v[k].left + 1] * d % Mod;
		for (j = k, i = j >> 1; i > 0; j = i, i >>= 1) {
			if ((j & 1) == 0) v[i].val = (v[j].val * pow[v[j^1].right - v[j^1].left + 1] + v[j^1].val) % Mod;
			else v[i].val = (v[j^1].val * pow[v[j].right - v[j].left + 1] + v[j].val) % Mod;
		}
	} else {
		if (v[k].flag != 0) {
			v[k<<1].val = seq[v[k<<1].right - v[k<<1].left + 1] * v[k].flag % Mod;
			v[(k<<1)^1].val = seq[v[(k<<1)^1].right - v[(k<<1)^1].left + 1] * v[k].flag % Mod;
			v[k<<1].flag = v[k].flag;
			v[(k<<1)^1].flag = v[k].flag;
			v[k].flag = 0;
		}
		update_segment(v, k << 1, l, r, d);
		update_segment(v, (k << 1) ^ 1, l, r, d);
	}
}

int main()
{
	int i, N, Q;
	scanf("%d %d", &N, &Q);
	
	for (i = 1, seq[0] = 0, pow[0] = 1; i <= N; i++) {
		seq[i] = (seq[i-1] * 10 + 1) % Mod;
		pow[i] = pow[i-1] * 10 % Mod;
	}
	
	lazy_seg_node v[600001];
	init_node(v, 1, 1, N);
	
	int l, r, d;
	for (i = 1; i <= Q; i++) {
		scanf("%d %d %d", &l, &r, &d);
		update_segment(v, 1, l, r, d);
		printf("%lld\n", v[1].val);
	}
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 17748
x,d,m[];main(h,X,Y,S){for(;x?x--:~scanf("%d,%d,%d",&X,&Y,&S,x=99);)hypot(x%10-X,x/10-Y)*2<=S+1?h-=!m[x],d=fmax(++m[x],d):0;d=!printf("%d\n%d\n",99+h,d);}

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

struct Result{
  int p, value;
  Result(int p, int v) : p(p), value(v) {}
};

string s;
Result dfs(int k){
  if(s[k] == '['){
    k++;
    vector<int> v;
    while(s[k] != ']'){
      Result r = dfs(k);
      v.push_back(r.value);
      k = r.p;
    }
    sort(v.begin(), v.end());
    int sum = 0;
    REP(i, v.size() / 2 + 1){
      sum += v[i];
    }
    k++;
    return Result(k, sum);
  }else{
    int res = 0;
    while(isdigit(s[k])){
      res = res * 10 + s[k++] - '0';
    }
    return Result(k, res / 2 + 1);
  }
}

int main(){
  int n;
  cin >> n;
  while(cin >> s){
    Result r = dfs(0);
    cout << r.value << endl;
  }
  return 0;
}

Measured memory_bytes: 1276
h, w = map(int, input().split())
a = [["."] + list(input()) + ["."] for i in range(h)]
a = [["."] * (w + 2)] + a + [["."] * (w + 2)]
b = []
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if a[i][j - 1] == "." and a[i][j] == "#" and a[i][j + 1] == ".":
            b.append([i, j])
for i in b:
    x, y = i
    if a[x - 1][y] == "." and a[x + 1][y] == ".":
        print("No")
        break
else:
    print("Yes")

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

struct edge {
    int to;
    ll cost;
};

int N, Q, K;
vector<edge> G[100100];
bool v[100100];
ll dis[100100];
void bfs() {
    dis[K] = 0;
    v[K] = true;
    queue<int> que;
    que.push(K);

    while (!que.empty()) {
        int p = que.front();
        que.pop();
        for (int i = 0; i < G[p].size(); i++) {
            edge e = G[p][i];
            if (!v[e.to]) {
                dis[e.to] = dis[p] + e.cost;
                que.push(e.to);
                v[e.to] = true;
            }
        }
    }
}

int main() {
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }
    cin >> Q >> K;
    K--;
    bfs();
    for (int i = 0; i < Q; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        cout << dis[x] + dis[y] << endl;
    }
}

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

#define ll long long
#define debug(x) cerr << fixed << #x << " is " << x << endl;

const int MAX = 100005;
int v[MAX];

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

	int n, Max = -1;
	cin >> n;

	for(int i = 0; i < n; i++)
	{
		cin >> v[i];
		Max = max(Max, v[i]);
	}

	int get1 = Max/2, get2 = (Max+1)/2;
	int best, Min = INT_MAX;

	for(int i = 0; i < n; i++)
	{
		if(v[i] == Max)
			continue;
		if(abs(get1-v[i]) < Min)
		{
			Min = abs(get1-v[i]);
			best = v[i];
		}
		if(abs(get2-v[i]) < Min)
		{
			Min = abs(get2-v[i]);
			best = v[i];
		}
	}

	cout << Max << " " << best << endl;

	return 0;
}


// int main()
// {
// 	ll fat[11], comb[11][11];
// 	fat[0] = 1;
// 	for(int i = 1; i < 11; i++)
// 		fat[i] = i*fat[i-1];
// 	for(int i = 0; i < 11; i++)
// 		for(int j = 0; j < i; j++)
// 			comb[i][j] = fat[i]/(fat[j]*fat[i-j]);
// 	int t = 10;
// 	while(t--)
// 	{
// 		int n = rand()%11, Max = -1, best = -1, aux = INT_MAX;
// 		cin >> n;
// 		int v[n];
//
// 		for(int i = 0; i < n; i++)
// 		{
// 			v[i] = ((rand())%11+1000000)%11;
// 			Max = max(Max, v[i]);
// 		}
// 		int get = Max/2;
// 		for(int i = 0; i < n-1; i++)
// 		{
// 			if(v[i] == Max)
// 				continue;
// 			if(abs(get-v[i]) < aux)
// 			{
// 				aux = abs(get-v[i]);
// 				best = v[i];
// 			}
// 		}
// 		cout << Max << " " << best << endl;
// 	}
// }


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

int main() {
    cout << fixed << setprecision(10);
    ll W, H, x, y;
    cin >> W >> H >> x >> y;
    ll size = W * H;
    ll two_way = ((W / 2. == x) && (H / 2. == y)) ? 1 : 0;
    cout << size / 2. << " " << two_way << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c[10000],d,e,f=0,g,h;
	while(1)
	{
	scanf("%d",&b);
	if (b==0)
	{
		break;
	}
	for(a=1;a<=b;a++)
	{
		scanf("%d %d %d",&c[a],&d,&e);
		g=d+e;
		
		if(f<g)
		{
			f=g;
			h=c[a];
		}
	}
	printf("%d %d\n",h,f);
	h=0;
	f=0;
	}
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <map>
#include <list>

using namespace std;

typedef pair<int, int> P;

/* 右からdigit桁と残りの積 */
/* 桁が大きい時は-1を返す */
int CutMul(int num, int digit) {
	int pow = 1;
	for(int i = 0; i < digit; i++) { pow *= 10; }
	if(pow > num) { return -1; }
	return (num / pow) * (num % pow);
}

int main()
{
	int q;
	cin >> q;
	while(q--) {
		bool inf = false;
		int n, a, count = 0;
		set<int> snum;
		cin >> n;
		a = n;
		snum.insert(n);
		while(1) {
			int max = 0;
			if(a / 10 == 0) break;
			for(int i = 1; ; ++i) {
				int m = CutMul(a, i);
				if(m == -1) break;
				max = (m > max ? m : max);
			}
			if(snum.find(max) != snum.end()) {
				inf = true;
				break;
			}
			++count;
			snum.insert(max);
			a = max;
		}
		cout << (inf ? n : count) << endl;
		snum.clear();
	}
	return 0;
}

Measured memory_bytes: 1200
N = int(input())
A = list(map(int, input().split()))

cnt = 0
flag = 0

for i in range(N-1):
  if A[i+1]-A[i] > 0:
    if flag == 1:
      cnt +=0
    elif flag == -1:
      cnt +=1
      flag = 0
    elif flag ==0:
      flag = 1
  elif A[i+1]-A[i] < 0:
    if flag == 1:
      cnt +=1
      flag =0
    elif flag ==-1:
      cnt +=0
    elif flag ==0:
      flag = -1
  elif A[i+1]-A[i] == 0:
    flag += 0
      
    
print(cnt+1)

Measured memory_bytes: 14436
#include<bits/stdc++.h>
using namespace std;
const int mod=2019;
string s;
int ans,g[200001],a[2019],ls;
signed main()
{
	int x,y=0;
	g[0]=1;
	for(int i=1;i<=200000;i++)
	g[i]=g[i-1]*10%mod;
	cin>>s;
	ls=s.size();
	a[0]=1;
	for(int i=ls-1;i>=0;i--)
	{
		x=(s[i]-'0')*g[ls-i-1]%mod;
		ans+=a[(x+y)%mod];
		a[(x+y)%mod]++;
		y=(x+y)%mod;
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 4612
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
int S,h,m,s;
cin >> S;
h = S / (60*60);
m = (S - 60 * 60 * h) / 60;
s = S - 60 * 60 * h - 60 * m;
cout << h << ":" << m << ":" << s << endl;
return 0;
}


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

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

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
#define pi (2*acos(0.0))
int main()
{
  int a,b,h,m,l;
  cin>>a>>b>>h>>m;
  double x,y,z,p,q;
  x=(30*(double)(h))+((double )(m)*0.5);
   y=(6*double(m));
   if(x==0)
    x==360;
   if(y==0)
    y=360;
   l=2*a*b;
   z=cos(abs(x-y)*pi/180.00);

    if(abs(x-y)!=90)
  p=(double(a)*double(a))+double(b)*double(b)-(z*double(l));
  else
    p=double(a)*double(a)+double(b)*double(b);
  cout << setprecision(10);
   cout<<sqrt(p)<<endl;
}


Measured memory_bytes: 4224
#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(){
  int n,m,ans=0;
  int tmp=0,ac=0,wa=0;
  cin >> n >> m;
  vector<int> p(m);
  map<int, int> t;
  vector<string> s(m);
  rep(i,m) cin >> p[i] >> s[i];
  rep(i,m){
    if(s[i]=="AC"){
      if(t[p[i]]<=0){
	ac+=1;
	wa-=t[p[i]];
	t[p[i]] = 1;
      }
    }
    else{
      if(t[p[i]]<=0){
	t[p[i]]-=1;
      }
    }
  }
  cout << ac << " " << wa << endl;
  return 0;
}


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int, int> pii;
const int mod = (int)1e9 + 7;


int main()
{

	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, x;
	cin >> n >>x;
	VI a(n);
	rep(i,n) cin >>a[i];
	ll ans =0;
	rep(i,n-1){
		if(a[i] > x){ ans += a[i] - x; a[i] = x;  }
		if(a[i] + a[i+1] > x){
			ans += a[i+1]  - x + a[i] ;
			a[i+1] = x - a[i];
		}
		
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  string s, t;
  cin >> s >> t;
  RREP(i, N + 1) {
    bool ok = true;
    REP(j, i) if (s[j + N - i] != t[j]) ok = false;
    if (ok) {
      cout << N * 2 - i << endl;
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << 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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll sum = 0;
  rep(i,n){
    ll p = 0;
    ll q = 0;
    for (ll j = i + 1; j < n; j++){
      if(a[i]>a[j]){
        p++;
      }
    }
    for (ll j = 0; j < i+1;j++){
      if(a[i]>a[j]){
        q++;
      }
    }
    sum += p * k;
    sum %= MOD;
    sum += (p+q) * (k * (k - 1) / 2 %MOD);
    sum %= MOD;
  }
  sum %= MOD;
  print(sum);
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(void)
{
    char ch;

    while (scanf("%c", &ch) != EOF) {
        if (ch >= 'a' && ch <= 'z')
            printf("%c", ch - 'a' + 'A');
        else
            printf("%c", ch);
    }

    return 0;
}


Measured memory_bytes: 2044
//Moh_K_Imar .......
//28/08/2020  ... 11,59.
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a;
    cin>>a;
    ll RE=0,TLE=0,WA=0,AC=0;
    for(ll i=0;i<a;i++){
        string s;
        cin>>s;
        if(s=="AC")AC++;
        else if(s=="WA")WA++;
        else if(s=="TLE")TLE++;
        else if(s=="RE")RE++;
    }
    cout<<"AC x "<<AC<<endl;
    cout<<"WA x "<<WA<<endl;
    cout<<"TLE x "<<TLE<<endl;
    cout<<"RE x "<<RE<<endl;

    return 0;
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
    
int main(void){
    int h, w, k; cin >> h >> w >> k;
    vector<vector <char>> c(h, vector<char>(w));
    
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> c.at(i).at(j);
        }
    }
    

    int ans = 0;
    for(int x = 0; x < (1 << h); x++){
        for(int y = 0; y < (1 << w); y++){
            int sum = 0;
            bitset<6> tmp_x(x);
            bitset<6> tmp_y(y);
//            cout << "row, col: " << tmp_x << " " << tmp_y << endl; 
            
            for(int i = 0; i < h; i++){
                for(int j = 0; j < w; j++){
                    if(tmp_x.test(i) == 1){
                        break;
                    }
                    if(tmp_y.test(j) == 1){
                        continue;
                    }
                   
                    if(c.at(i).at(j) == '#'){
                        sum+=1;
                    }
                }
            }
            
            if(sum == k){
                ans += 1;
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;

#define PB push_back
#define SZ(a) (int)a.size()
#define MP make_pair

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;

int main() {

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

	VI perm(N);

	for(int i = 0; i < N; i++) scanf("%d", &perm[i]);

	int minp = N+1;
	int ans = 0;

	for(int p : perm) {
		if(p < minp) ans++;
		minp = min(p, minp);
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		int max = 0;
		int[] cnt = new int[100];
		while(sc.hasNext()) {
			int n = sc.nextInt()-1;
			cnt[n]++;
			max = max(max, cnt[n]);
		}
		
		for(int i=0;i<100;i++) if( cnt[i] == max ) System.out.println((i+1));
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
/*--------------------------*/
// p.82
// 4.2 スタック 
//
// 逆ポーランド記法
//
// 入力例： 1 2 + 3 4 - *
// 出力例：-3
/*--------------------------*/

// memo: scanf("%s", s) != EOF は，UNIXでは「Ctrl + D」がEOFになる

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];

void push(int x){
  /* topを加算してからその位置へ挿入 */
  S[++top] = x;
}

int pop(){
  /* topが差していた要素を返す */
  top--;
  return S[top + 1];
}

int isEmpty(){
  if (0 == sizeof(S) / sizeof(int)) {
    return 1;
  } else {
    return 0;
  }
}

int main(){
  int a, b;
  top = 0;
  char s[100];

  while(scanf("%s", s) != EOF){
    if (s[0] == '+'){
      b = pop();
      a = pop();
      push(a + b);
    }else if (s[0] == '-'){
      b = pop();
      a = pop();
      push(a - b);
    }else if (s[0] == '*'){
      b = pop();
      a = pop();
      push(a * b);
    }else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());
  return 0;
}




Measured memory_bytes: 2064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define deb(x) cout << #x << " = "<< x << "\n";

signed main() {
	//freopen("in.txt", "r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int n; cin >> n;
	vector<int> a(n), b(n);
	int x = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(i) b[i] = a[0] ^ a[i];
		if(i > 2 && i & 1) x ^= (a[i] ^ a[i-1]);
	}
	if(n == 2) {
		cout << a[1] << " " << a[0] << "\n";
		return 0;
	}
	
	x ^= a[1];
	for(int i = 0; i < n; i++) {
		cout << (x ^ b[i]) << " ";
	}
	cout << "\n";
}


Measured memory_bytes: 6356
#include<stdio.h>

int main(void){
    long N;

    scanf("%ld", &N);
    
    if(N%2!=0){
        printf("0");
        return 0;
    }
    
    long zlen=0;
    
    N/=10;
    zlen+=N;
    
    while(N!=0){
        N/=5;
        zlen+=N;
    }
    
    printf("%ld", zlen);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define f(i,a,n)        for(ll i=a;i<n;i++)
#define ve              vector
#define ss              second 
#define ff              first
#define pf              pop_front
#define pob             pop_back
#define psf             push_front
#define res(x)          cout<<x<<'\n'
#define read(t)         ll t;cin>>t

#define pii             pair<ll,ll>
#define vii             vector<ll,ll>
#define INFI            1000000000000000000;


int main(){
   int n;
   cin>>n;
   int a[n];
   f(i,0,n){
       cin>>a[i];
   }
  int cnt=0;
   for(int i=0;i<n-2;i++){
       for(int j=i+1;j<n-1;j++){
           for(int k=j+1;k<n;k++){
                 if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]){
                     if(a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i]){
                         cnt++;
                     }
                 }
           }
       }
   }
   cout<<cnt<<endl;

}

Measured memory_bytes: 3648
//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

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

int n,q;
string s;
int board[200010];
vector<pair<char,char>> spell;
char t,d;

int simulate(int x){
    for (auto sp: spell){
        if(s[x] == sp.first){
            x += sp.second == 'L' ? -1 : 1;
        }
        if (x < 0 || x >= n) return x;
    }
    return x;
}

signed main(){
    I(n); I(q);
    cin >> s;
    REP(i,q) {
        cin >> t >> d;
        spell.eb(t,d);
    }
    int lout = 0;
    if (simulate(0) < 0){
        int lo = 0;
        int hi = n;
        while(abs(lo-hi) > 1){
            int mid = (lo+hi)/2;
            if (simulate(mid) < 0){
                lo = mid;
            } else {
                hi = mid;
            }
        }
        lout = lo+1;
    }
    int rout = 0;
    if (simulate(n-1) >= n){
        int lo = n-1;
        int hi = -1;
        while(abs(lo-hi) > 1){
            int mid = (lo+hi) / 2;
            if (simulate(mid) >= n){
                lo = mid;
            } else {
                hi = mid;
            }
        }
        rout = n-lo;
    }
    cout << n - lout - rout << endl;

}

Measured memory_bytes: 1024
N, C = list(map(int, input().split()))
D = []
t = [[0 for j in range(30)] for i in range(3)]
for i in range(C):
    D.append(list(map(int, input().split())))
for i in range(N):
    l = list(map(int, input().split()))
    for j in range(N):
        t[(i+j)%3][l[j]-1] += 1
res = float('inf')
for i in range(C):
    for j in range(C):
        if i != j:
            for k in range(C):
                if i != k and j != k:
                    tt = 0
                    for l in range(C):
                        tt += D[l][i]*t[0][l]
                        tt += D[l][j]*t[1][l]
                        tt += D[l][k]*t[2][l]
                    if tt < res:
                        res = tt
print(res)


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

int main()
{
  long long X;
  cin >> X;
  long long money = 100;
  int cnr = 0;

  while (X >= money)
  {
    if (X != money)
    {
      money *= 1.01;
      cnr++;
    }
    else
    {
      break;
    }
  }
  cout << cnr << endl;
}


Measured memory_bytes: 3636
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <iostream>
using namespace std;
const int N=100005;
int n,fa[N];
inline int Find(int x){return fa[x]==x?x:fa[x]=Find(fa[x]);}
typedef pair<int,int> P;
map<P,int>mp;
queue<P>q;
set<int>s[N];
int main()
{
	int i,x,y,to,re=0; scanf("%d",&n); for(i=1;i<=n;i++)fa[i]=i;
	for(i=1;i<=n*2-2;i++)
	{
		scanf("%d%d",&x,&y); mp[P(x,y)]++; mp[P(y,x)]++; if(mp[P(x,y)]==2)q.push(P(x,y)); s[x].insert(y); s[y].insert(x);
	}set<int>::iterator it;
	while(!q.empty())
	{
		x=q.front().first; y=q.front().second; q.pop(); x=Find(x); y=Find(y); s[x].erase(y); s[y].erase(x);
		for(it=s[y].begin();it!=s[y].end();it++)
		{
			to=*it; s[to].erase(y); s[to].insert(x); s[x].insert(to); mp[P(y,to)]=mp[P(to,y)]=0; mp[P(x,to)]++; mp[P(to,x)]++; if(mp[P(x,to)]==2) q.push(P(x,to));
		}fa[y]=x; s[y].clear();
	}for(i=1;i<=n;i++)re+=(fa[i]==i); if(re==1)printf("YES\n");else printf("NO\n");
}

Measured memory_bytes: 61568
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
#define pb push_back

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;
const double PI = acos(-1.0);


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * b / g;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}



const int MAX_N = 100010;

int dp[10][10];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n; cin >> n;
	
	for (int a = 1; a <= n; a++) {
		string tmp = to_string(a);
		int b = tmp[0] - '0';
		int c = tmp[tmp.size() - 1] - '0';
		//cout << a << endl;
		if (b == 0 || c == 0)continue;
		dp[c-1][b-1]++;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		string s = to_string(i);
		int a = s[0] - '0';
		int b = s[s.size() - 1] - '0';
		if (a == 0 || b == 0)continue;
		ans += dp[a-1][b-1];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
n, y = map(int, input().split())

for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
#include "stdio.h"
#include "string.h"
int main()
{
	char a[5];
	while(gets(a))
	{
		int i,j,f=1;
		for(i=0,j=2;i<j;i++,j--)
			if(a[i]!=a[j])
			{
				f=0;
				break;
			}
		if(f==1)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define dbg() cerr <<
#define name(x) (#x) << ": " << (x) << ' ' <<

using namespace std;

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

  int n, k; cin >> n >> k;
  vector<bool> bad(10);
  for (int i = 0; i < k; ++i) {
    int x; cin >> x;
    bad[x] = true;
  }

  auto Check = [&](int x) {
    while (x) {
      if (bad[x % 10]) return false;
      x /= 10;
    }
    return true;
  };

  for (int ans = n; ; ++ans) {
    if (Check(ans)) {
      cout << ans << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3604
N = int(input())

def ask(n) :
    print(n, flush=True)
    s = input()
    if s == "Vacant" :
        exit()
    return s

def condition(L,R,resp_L, resp_R) :
    if (R-L)%2 == 1 :
        return resp_L == resp_R
    else :
        return resp_L != resp_R

resp = ask(0)

L = 0
R = N
resp_L = resp_R = resp

for i in range(19) :
    M = (L+R)//2
    resp_M = ask(M)
    if condition(L,M,resp_L,resp_M) :
        R,resp_R = M,resp_M
    else :
        L,resp_L = M,resp_M


Measured memory_bytes: 3660
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <limits>
#include <iomanip>
#include <stdlib.h>
#include <stack>



using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define ll  long long int
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define MOD 1000000007

/*
 * Author : Avish Cheetaram
 * Date: 29/3/2020
 * I think it is possible for ordinary people to choose to be extraordinary ~ Elon Musk
*/


int main()
{
    ios_base::sync_with_stdio(0);

    string s;

    cin >> s;

    if(s[2] == s[3] and s[4] == s[5]){
        cout<< "Yes";
    } else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int lli;
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a,b;
    cin>>a>>b;
    int m=a-2*b;
    if(m>0) cout<<m;
    else cout<<0;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
int n, m;

bool test(int x){
    int sum = 0;
    while(x != 0){
        x /= 10;
        ++sum;
    }
    //cout << sum << endl;
    if(sum % 2 == 1)return true;
    return false;
}

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

Measured memory_bytes: 256
# coding: utf-8
"""this is python work script"""

def sum_digits(i):
    """return sum input digits"""
    sum_tmp = 0
    quotient = i

    for _ in range(5):
        quotient, mod = divmod(quotient, 10)
        sum_tmp += mod
        if quotient == 0:
            break
    return sum_tmp

def solve(N, num_min, num_max):
    """solve problem"""
    result = 0
    for i in range(1, N+1):
        sum_d = sum_digits(i)
        if num_min <= sum_d <= num_max:
            result += i
    return result

def main():
    """main method"""
    N, A, B = list(map(int, input().split(' ')))
    answer = solve(N, A, B)
    print(answer)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

public class Main {
    public static PrintWriter out;
    public static FastScanner in;

    private void solve(){
        int[] cntFact = new int[1001];
        boolean[] hash = new boolean[1001];
        int n = in.nextInt();
        Arrays.fill(hash,false);
        Arrays.fill(cntFact,0);

        for(int i=2;i<=n;i++){
            if(!hash[i]){
                for(int j=i;j<=n;j+=i){
                    int k = j;
                    while(k%i == 0){
                        cntFact[i]++;
                        k/=i;
                    }
                    hash[j] = true;
                }
            }
        }

        long ans = 1;
        long mod = (long)1e9+7;
        for(int i=0;i<=n;i++){
            ans=(ans*(cntFact[i]+1))%mod;
        }
        out.print(ans);

    }

    private void runIO() {
        in = new FastScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        solve();
        out.close();
    }
    private static class FastScanner {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;

        private FastScanner() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }

        private String next() {
            if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private String nextLine() {
            String ret = "";
            try {
                ret = bufferedReader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return ret;
        }
    }

    public static void main(String[] args) {
        new Main().runIO();
    }
}


Measured memory_bytes: 23124
#include<stdio.h>
#define MAX 100005

typedef struct pp {
	char name[100];
	int t;
} P;

P Q[MAX+1];//構造体増産

int head, tail, n;


void enqueue(P x) {
	
	Q[tail]=x;
	tail++;
	if(MAX<tail){
		tail=0;
	}
	
}

P dequeue() {
	
	P x=Q[head];
	head++;
	if(MAX<head){
		head=0;
	}
	return x;
}


int main() {
	int elaps = 0, c;
	int i, q;
	P a;
head = 1;
  tail = 1;
	
	scanf("%d %d", &n, &q);

	for ( i = 1; i <= n; i++) {
		scanf("%s %d", Q[i].name, &Q[i].t);
		
		enqueue(Q[i]);
	}
	
	
	while(head!=tail){
		
		a=dequeue();
		
		if(a.t<=q){
			elaps+=a.t;
			printf("%s %d\n", a.name, elaps);
			//count++;
		}
		else{
			elaps+=q;
			a.t-=q;
			enqueue(a);
		}
	}	
	return 0;
}
	


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

typedef long long ll;
const ll MOD = 998244353;

int arr[3010];

int main()
{
    int n, s;
    scanf("%d%d", &n, &s);
    for(int i=1; i<=n; ++i) scanf("%d", &arr[i]);
    vector<ll> f(s+1), g(s+1);
    f[0] = g[0] = 1;
    for(int i=1; i<=n; ++i){
        int a = arr[i];
        vector<ll> fn(s+1), gn(s+1);
        fn = f; gn = g;
        for(int p=a; p<=s; ++p){
            gn[p] += g[p-a];
            gn[p] %= MOD;
        }
        for(int p=0; p<=s; ++p) fn[p] = (fn[p] + gn[p])%MOD;
        gn[0] = (gn[0] + 1)%MOD;
        f = fn; g = gn;
    }
    printf("%lld\n", f[s]);
}

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

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

using namespace std;

int main(){
	int l,r,d; scanf("%d%d%d",&l,&r,&d);
	printf("%d\n",r/d-(l-1)/d);
	return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define MAX 20000
using namespace std;

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

  int n; cin >> n;
  vector< vector<int> > v(n, vector<int>(n));
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      cin >> v[i][j];
      if(v[i][j] == -1) v[i][j] = MAX;
    }
  }

  vector<int> cost(n, MAX), used(n, false);
  cost[0] = 0;
  int ans = 0;
  int t;

  while(true){
    t = -1;
    for(int i = 0; i < n; i++){
      if(!used[i] && (t == -1 || cost[t] > cost[i])) t = i;
    }
    if(t == -1) break;
    used[t] = true;
    ans += cost[t];

    for(int i = 0; i < n; i++){
      cost[i] = min(cost[i], v[t][i]);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX = 100000;
const ll inf = 5e18;

int main() {
	fastio;
	ll k,sum=0;
	cin>>k;
	f(a,1,k+1){
		f(b,1,k+1){
			f(c,1,k+1){
				sum+=__gcd(a,__gcd(b,c));
			}
		}
	}
	cout<<sum<<endl;
return 0;
}

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

ll x;

int main() {
    cin >> x;

    ll ans = x/11 * 2;
    if (x % 11 > 0 && x % 11 <= 6) {
        ans++;
    }
    else if (x % 11 >= 7) {
        ans += 2;
    }

    cout << ans << endl;
    
    
    return 0;
}


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

int main(void){
    int n,m; cin>>n>>m;
    int k[10];
    int s[10][10];
    for (int i = 0; i <m; i++){
        cin>>k[i];
        for (int j = 0;  j< k[i]; j++){
            cin>>s[i][j];
            s[i][j]--;
        }
    }
    int p[10];
    for(ll i=0;i<m;i++) cin>>p[i];

    int ans=0;
    for (int i = 0; i < (1<<n); i++){
        int t[n];//電球が光っているか否か（1||0）
        int tmp=i;
        for (int j = 0; j < n; j++){
            t[j]=tmp&1;//t[j]==1||0
            tmp>>=1;//tmp=tmp>>1
        }
        bool now=true;
        for (int i = 0; i < m; i++){
            int sum=0;
            for (int j = 0; j < k[i]; j++){
                sum+=t[s[i][j]];
            }
            if(sum%2!=p[i]){
                now=false;
                break;
            }
        }
        if(now) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n,a,b=gets.split.map &:to_i
s=gets.chomp
s.chars do |e|
  if e==?a
    if a+b>0
      puts :Yes
      a-=1
    else
      puts :No
    end
  elsif e==?b
    if a+b>0 && b>0
      puts :Yes
      b-=1
    else
      puts :No
    end
  else
    puts :No
  end
end

Measured memory_bytes: 2428
#include <stdio.h>

int A[20];
int solve(int i, int m, int n) {
  int res;
  if (m == 0) {
    return 1;
  } else if (i >= n) {
    return 0;
  } else {
    res = solve(i + 1, m, n) || solve(i + 1, m - A[i], n);
    return res;
  }
}

int main() {
  int n, q, m[200], i;

  scanf("%d",&n);
  for (i = 0; i < n; i++) {
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for (i = 0; i < q; i++) {
    scanf("%d",&m[i]);
  }

  for(i = 0; i < q; i++) {
    if (solve(0, m[i], n) == 1) {
      printf("yes\n");
    } else {
      printf("no\n");
    }
  }
  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e12+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;
#define print1(x) cerr << "x = " << x << endl;
#define print2(x, y) cerr<< "x,y = "  << x << "," << y << endl;
#define print3(x, y, z) cerr << "x,y,z = " << x << "," << y << "," << z << endl;
#define print4(x, y, z, w) cerr << "x,y,z,w = " << x << "," << y << "," << z << "," << w << endl;

#define K_MAX 161 * 50
int A[100][100];
int cand[81][81][K_MAX];

int main()
{
    int H, W;
    cin >> H >> W;
    rep(i, H){
        rep(j, W){
            cin >> A[i][j];
        }
    }
    rep(i, H){
        rep(j, W){
            int tmp;
            cin >> tmp;
            tmp -= A[i][j];
            A[i][j] = abs(tmp);
        }
    }

    //cand[0][0][0] = 1;
    rep(i, H){
        
        rep(j, W){
            if (i == 0 && j == 0){
                cand[i][j][A[i][j]] = 1;
            }
            if (i >= 1){
                for (int k = 0; k < K_MAX; k++){
                    if (cand[i - 1][j][k]){
                        if (k + A[i][j] < K_MAX){
                            cand[i][j][k + A[i][j]] = 1;
                        }
                        cand[i][j][(abs(k - A[i][j]))] = 1;
                    }
                }
            }
            if (j >= 1){
                for (int k = 0; k < K_MAX; k++){
                    if (cand[i][j - 1][k]){
                        if (k + A[i][j] < K_MAX){
                            cand[i][j][k + A[i][j]] = 1;
                        }
                        cand[i][j][(abs(k - A[i][j]))] = 1;
                    }
                }
            }
        }
    }
    for (int k = 0; k < K_MAX; k++){
        if (cand[H - 1][W - 1][k]){
           cout << k;
           return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 203904
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int A = stdIn.nextInt();
        int B = stdIn.nextInt();
        int C = stdIn.nextInt();
        stdIn.close();

        if (A == B && B != C) {
            System.out.println("Yes");
        } else if(A == C && B != C) {
            System.out.println("Yes");
        } else if(B == C && A != C) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

int main()
{
	double W, H, x, y;
	cin >> W >> H >> x >> y;

	int multiple = 0;
	if (2 * x == W && 2 * y == H) {
		multiple = 1;
	}
	printf("%10f %d\n", W * H / 2, multiple);

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    ll A;
    long double B;
    cin >> A >> B;
    ll ans = (ll)((long double)A * B);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
long long a[200], b[200], c, m[200][200000];
int n;
int main()
{
    scanf("%d %llu", &n,&c);
    for(int i=1; i<=n; i++)
        scanf("%llu %llu", &a[i], &b[i]);
    for(int i=1; i<=n; i++)
        for(int j=0; j<=c; j++)
        {
            m[i][j] = m[i-1][j];
            if(j>=a[i])
                m[i][j] = max(m[i][j], m[i-1][j-a[i]] + b[i]);
        }
    printf("%llu", m[n][c]);
}


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

int main(){
	double x_1, y_1, x_2, y_2;
	cin >> x_1 >> y_1 >> x_2 >> y_2;
	double D = sqrt((x_2 - x_1) * (x_2 - x_1) + (y_2 - y_1) * (y_2 - y_1));
	//AIZU??§???sqrt??????????????????????????¨????????????
	cout << fixed << setprecision(8) << D << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string> vec(n);
    for(int i=0;i<n;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    int cnt;
    for(int i=0;i<n-1;i++){
        if(vec.at(i)!=vec.at(i+1)){
            cnt++;
        }
    }
    cout<<cnt+1<<endl;
}

Measured memory_bytes: 9520
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

int vs[100000+10];
map<int, int> hist;
int res[100000+10];
int n;

bool solve(void) {
  sort(vs, vs + n);
  res[0] = vs[0];
  res[1] = vs[n-1];
  hist[vs[0]]--;
  hist[vs[n-1]]--;
  for(int i = 2; i < n; ++i) {
    res[i] = res[i-1] ^ res[i-2];
    if(hist[res[i]] <= 0) {
      cerr << "NG " << i << endl;
      return false;
    }
    hist[res[i]]--;
  }
  if((res[n-2] ^ res[n-1]) != res[0]) {
    cerr << "NG " << 0 << endl;
    return false;
  }
  if((res[n-1] ^ res[0]) != res[1]) {
    cerr << "NG " << 1 << endl;
    return false;
  }
  return true;
}

int main(void) {
  scanf("%d", &n);
  REP(i, n) {
    scanf("%d", &vs[i]);
    hist[vs[i]]++;
  }
  puts(solve() ? "Yes" : "No");
  
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>


long N, M, Q;
vvl Que;

long dfs(vl A, int Next){
    if(A.size() == N){
        long point = 0;
        REP(i, 0, Q){
            if(A[Que[i][1]] - A[Que[i][0]] == Que[i][2]) point += Que[i][3];
        }
        return point;
    }else{
        long max_p = 0;
        for(long n = Next; n <= M; n++){
            vl B;
            copy(A.begin(), A.end(), back_inserter(B));
            B.push_back(n);
            long point2 = dfs(B, n);
            max_p = (max_p > point2) ? max_p : point2;
        }
        return max_p;
    }
}

int main() {
    cin>>N>>M>>Q;
    Que.resize(Q);
    REP(i, 0, Q){
        Que[i].resize(4);
    }
    vl A;

    REP(i, 0, Q){
        long a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--;
        Que[i][0] = a;
        Que[i][1] = b;
        Que[i][2] = c;
        Que[i][3] = d;
    }
    long max = dfs(A, 1);
    cout << max << endl;
}

Measured memory_bytes: 3604
#include <cstdio>

using namespace std;

int W, H;
char M[22][22];

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

int ans;

void dfs(int y, int x) {
    if (M[y][x] == '#' || M[y][x] == '@') { return; }

    ans++;
    M[y][x] = '@';
    for (int i = 0; i < 4; i++) {
        dfs(y + dy[i], x + dx[i]);
    }
}

int solve() {
    int sx, sy;
    for (sy = 1;; sy++) {
        for (sx = 1; sx <= W; sx++) {
            if (M[sy][sx] == '@') { goto found; }
        }
    }
found:

    ans = 0;
    M[sy][sx] = '.';
    dfs(sy, sx);
    return ans;
}

int main() {
    for (;;) {
        scanf("%d%d ", &W, &H);

        if (!W && !H) { break; }

        for (int i = 0; i < 22; i++) {
            for (int j = 0; j < 22; j++) {
                M[i][j] = '#';
            }
        }
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) {
                scanf("%c", &M[i][j]);
            }
            char d;
            scanf("%c", &d);
        }
        printf("%d\n", solve());
    }
}

Measured memory_bytes: 1044