akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
using namespace std;
int main()
{
    // 整数の入力
    string s;
    cin >> s;
    //
    string ans = "No";
    string tmp = s.substr(1);
    int x=tmp.find(s[0]);
    if(x != string::npos){
      switch (x) {
        case 0:
          if(s[2]==s[3] && s[0]!=s[2]){
            ans="Yes";
          }
          break;
        case 1:
          if(s[1]==s[3] && s[0]!=s[1]){
            ans="Yes";
          }
          break;
        case 2:
          if(s[1]==s[2] && s[0]!=s[1]){
            ans="Yes";
          }
          break;
      }
    }
    // 出力
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  ABC160E

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm> // sort
using namespace std;
int main(int argc, const char * argv[]) {
    long long X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vector<long long>p(A);
    vector<long long>q(B);
    vector<long long>r(C);
    vector<long long>s;
    for (long long i=0; i<A; i++) {
        cin >> p.at(i);
    }
    sort(p.begin(),p.end(),greater<long long>());
    p.erase(p.begin()+X,p.end());
    for (long long i=0; i<B; i++) {
        cin >> q.at(i);
    }
    sort(q.begin(),q.end(),greater<long long>());
    q.erase(q.begin()+Y,q.end());
    for (long long i=0; i<C; i++) {
        cin >> r.at(i);
    }
    sort(r.begin(),r.end(),greater<long long>());
    s.insert(s.end(),p.begin(),p.end());
    s.insert(s.end(), q.begin(),q.end());
    s.insert(s.end(), r.begin(),r.end());
    sort(s.begin(),s.end(),greater<long long>());
    //s.erase(s.begin()+X+Y,s.end());
    //cout<<accumulate(s.begin(), s.end(), 0)<<endl;
    long long ans=0;
    for (long long i=0; i<(X+Y); i++) {
        ans+=s.at(i);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6592
#coding:UTF-8

while True:
    a,op,b = map(str,raw_input().split())
    a = int(a)
    b = int(b)
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a / b
    else:
        break

Measured memory_bytes: 4204
#include<iostream>

using namespace std;

int main(void) {
  int n, k;
  cin >> n >> k;
  char str[n+1];
  cin >> str;
  int s = 0, e = 0;
  int inner = 0;
  bool con = false;
  while(inner <= k) {
    e++;
    if (e == n) {
      cout << n << endl;
      return 0;
    }
    if (str[e-1] == '0' && str[e] == '1') {
      inner++;
    }
    if (str[e-1] == '1' && str[e] == '0' && inner == k) {
      break;
    }
  }
  int res = e - s;
  while(e < n) {
    while(true) {
      e++;
      if (e == n) {
        break;
      }
      if (str[e-1] == '1' && str[e] == '0') {
        break;
      }
    }
    while(true) {
      s++;
      if (str[s-1] == '0' && str[s] == '1') {
        break;
      }
    }
    res = max(res, e - s);
  }
  cout << res << endl;
  return 0;
}

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

int n;
char s[32];

void dfs(int i, int j) {
    if(i >= n) {
        puts(s);
        return;
    }
    for(int k = 0; k <= j; ++k) {
        s[i] = k + 'a';
        dfs(i + 1, j);
    }
    if(i && j + 1 < 26) {
        s[i] = j + 1 + 'a';
        dfs(i + 1, j + 1);
    }
}

int main() {
    scanf("%d", &n);
    dfs(0, 0);
    return 0;
}

Measured memory_bytes: 1536
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	  public static void main(String[] args){
			    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			    try{
			    String value = br.readLine();
			    int inputValue = Integer.valueOf(value);
			    System.out.println(inputValue * inputValue * inputValue);
			    }catch(IOException e){

			    }
			  }


}

Measured memory_bytes: 24136
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    B = il()
    ret = B[len(B) - 1] + B[0]
    for n in range(N - 2):
        ret += min(B[n+1], B[n])
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int N,M;
vector<P> adj[MAX+2]; //隣接リスト
int visited[MAX+2];
ll dist[MAX+2];

void dfs(int u){
    visited[u]=1;
    
    for(int i=0;i<adj[u].size();i++){
        int v=adj[u][i].first;
        int d=adj[u][i].second;
        
        if(visited[v]) continue;
        dist[v]=dist[u]+d;
        dfs(v);
    }
}

int main(){
    cin.tie(0);  ios::sync_with_stdio(false);
    
    cin>>N>>M;
    //一度グラフ構造を記録
    for(int i=0;i<M;i++){
        int u,v,d;
        cin>>u>>v>>d;
        u--; v--;
        
        adj[u].push_back(P(v,d));
        adj[v].push_back(P(u,-d));
    }
    
    for(int i=0;i<N;i++){
        if(!visited[i]){
            dist[i]=0;
            dfs(i);
        }
    }
    for(int u=0;u<N;u++){
        for(int i=0;i<adj[u].size();i++){
            int v=adj[u][i].first;
            int d=adj[u][i].second;
            
            if(dist[v]!=dist[u]+d){
                cout<<"No"<<"\n";
                return 0;
            }
        }
    }
    cout<<"Yes"<<"\n";
    return 0;
}



Measured memory_bytes: 12800
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

int main() {
	int n;
	std::cin >> n;

	std::string s;
	std::cin >> s;

	int min = 0;
	int d = 0;
	for (char c : s) {
		if (c == '(') {
			d++;
		} else {
			d--;
		}
		min = std::min(min, d);
	}

	s = std::string(-min, '(') + s;
	d += -min;

	s += std::string(d, ')');
	std::cout << s << std::endl;
}

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

template <class T>
inline void read(T &x) {
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar()) f ^= c == '-';
    for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x) {
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10) ++len;
    for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}

int n, x, a, sum, ans = 1;

int main() {
	read(n), read(x);
	for (int i = 1; i <= n; ++i) {
		read(a);
		sum += a;
		if (sum > x) break;
		++ans;
	}
	write(ans);
	putchar('\n');
	return 0;
}

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

void Main() {
    // input
    u_int32_t H, N;
    cin >> H >> N;
    u_int32_t sum = 0;
    for (u_int32_t i = 0; i < N; i++) {
        u_int32_t A;
        cin >> A;
        sum += A;
    }


    // process


    // output
    if (sum >= H) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

//struct position{int x;};

int main(void){
	ll a,b,c;
	cin>>a>>b>>c;
	ll na,nb,nc;
	ll ans=0;
	while(a%2==0&&b%2==0&&c%2==0){
		na = (b+c)/2;
		nb=(c+a)/2;
		nc=(a+b)/2;
		if(min(na,min(nb,nc)) == min(a,min(b,c)) && max(na,max(nb,nc)) == max(a,max(b,c))){
			cout<<-1<<endl;
			return 0;
		}
		a=na;
		b=nb;
		c=nc;
		ans++;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int cnt_div2(int a) {
  int cnt = 0;
  while (a%2 == 0) {
    a /= 2;
    cnt++;
    if (cnt == 2) break;
  }
  return cnt;
}

int main () {
  int N; cin >> N;
  vi a(N); REP(i,N) cin >> a[i];

  int cnt_2 = 0;
  int cnt_4 = 0;
  REP(i,N) {
    if (cnt_div2(a[i]) == 1) {
      cnt_2++;
    }
    else if (cnt_div2(a[i]) == 2) {
      cnt_4++;
    }
  }

  cout << (cnt_4 >= (N-max(0,cnt_2-1))/2 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
/* ~/lib/template.cを引用 */
#include<stdio.h>
#include<stdlib.h>
// #inclide<math.h>

int main(int argc, char *argv[]){

  int a, b;

  scanf("%d%d", &a, &b);

  if(a < -1000 || 1000 < b) exit(0);

  if(a < b) printf("a < b\n");
  if(a > b) printf("a > b\n");
  if(a == b) printf("a == b\n");


  return 0;
}



Measured memory_bytes: 2052
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;

int main()
{
    int a,i,sum,t,n;
    while(scanf("%d%d",&a,&n) != EOF)
    {
        sum = 0;
        for(i = 0;i < n;i++)
        {
            scanf("%d",&t);
            sum += t;
        }
        if(sum >= a) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>//コレは必須
using namespace std;//Pythonにして、ココでエラーが出た

int main(){//まずは絵を描いて方針を決めよう
  double a,b,x;//intだと正しい答が出ない、小数点の関係か？
  cin>>a>>b>>x;//入力を忘れずに
  
  double S=x/a;//シンプル化、二次元で考える
  double ans=0;//答も当然、double
  double PI=acos(-1);//パイの実装
  double rad;//ラジアンを使おう
  
  //場合分け
  if (S>a*b/2){//台数の場合
    double h=(a*b-S)*2/a;//全体から水部分を引いて空き空間を求める
    //逆転の発想
    rad=atan2(h,a); //角度の問題ではatan2を使う 
  } else{//三角形の場合
    double w=2*S/b;//三角形の面積から逆算
    rad=atan2(b,w);//台形の時と異なるので注意
  }
  
  ans=rad*180/PI;//弧度法ラジアンから角度へ
  printf("%.10f\n",ans);//小数点10件表示、正確に
  return 0;//main内なら、return 0;は無くてもOK
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1001001001
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
int main() {
    string S;cin >> S;
    if(S[2]==S[3] && S[4]==S[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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


class SHOP{
public:
  int A;
  int B;
  SHOP(int _A,int _B){
    A=_A;
    B=_B;
  }
  bool operator<(const SHOP &shop2) const
  {
    return A<shop2.A;
  }
};

int main(){
  int N,M;
  cin >> N >> M;
  vector<SHOP> shop;
  for(int i=0;i<N;i++){
    int A,B;
    cin >> A >> B;
    SHOP t_shop(A,B);
    shop.push_back(t_shop);
  }
  sort(shop.begin(),shop.end());

  long long sum=0;
  for(int i=0;i<N;i++){
    if(M-shop[i].B<0){
      sum+=(long long)M*(long long)shop[i].A;
      break;
    }
    sum+=(long long)shop[i].B*(long long)shop[i].A;
    M-=shop[i].B;
  }

  cout << sum << endl;

  return 0;
}

Measured memory_bytes: 1400
import sys
input = sys.stdin.readline

from collections import Counter

N = int(input())
S = input().rstrip()

left = [('','')]
for s in S[:N]:
    left = [(x[0]+s,x[1]) for x in left] + [(x[0],x[1]+s) for x in left]
left = [x+' '+y for x,y in left]
counter_L = Counter(left)

right = [('','')]
for s in S[N:][::-1]:
    right = [(x[0]+s,x[1]) for x in right] + [(x[0],x[1]+s) for x in right]
right = [x+' '+y for x,y in right]

answer = sum(counter_L[s] for s in right)
print(answer)

Measured memory_bytes: 118600
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
	int a,b;
    cin>>a>>b;
   for(int i=0;i<=10000;i++){
   	   int x = i*8/100;
       int y = i*10/100;
       if(a == x && b == y){
       		cout<<i<<endl;
            return 0;
       }
   }
  cout<<"-1"<<endl;
    
}

Measured memory_bytes: 256
# include <iostream>
# include <cstdio>
# include <string>
# include <cstring>
using namespace std;
int main(){
    int N;
    int a[105];
    while(scanf("%d",&N)!=EOF){
        int sum = 0;
        for(int i = 1;i <= N;++i){
            scanf("%d",&a[i]);
            sum += a[i];
        }
        int aver1 = sum/N;
        int aver2 = sum/N +1;
        int ans1 = 0;
        for(int i = 1;i <= N;++i)
            ans1 += (a[i]-aver1)*(a[i]-aver1);
        int ans2 = 0;
        for(int i = 1;i <= N;++i)
            ans2 += (a[i]-aver2)*(a[i]-aver2);
        printf("%d\n",ans1<ans2?ans1:ans2);
    }
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(N)]

from collections import defaultdict
d = defaultdict(lambda: [])

for a,b in AB:
    d[a].append(b)

import heapq
class Heapq:
    def __init__(self, arr, desc=False):
        if desc:
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)

    def pop(self):
        return heapq.heappop(self.hq) * self.sign

    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)

    def top(self):
        return self.hq[0] * self.sign

    def size(self):
        return len(self.hq)

q = Heapq([], True)

ans = 0
for i in range(1,M+1):
    for b in d[i]:
        q.push(b)
    if q.size():
        ans += q.pop()
print(ans)


Measured memory_bytes: 38020
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <cstring>
#include <list>  
#include <cassert>
#include <climits>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
std::mt19937 rnd((int)std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 2000;

int n, MOD;

int dp[3 * MAXN + 1][6 * MAXN + 1];

void inc(int &a, int b) { if ((a += b) >= MOD) a -= MOD; }
void incprod(int &a, int b, int c) { a = (a + (ll)b*c) % MOD; }
int solve() {
	int zero = 3 * n;
	REPE(i, 3 * n) FORE(bal, -3 * n, +3 * n) dp[i][zero + bal] = 0;
	inc(dp[0][zero], 1);
	REP(i, 3 * n) FORE(bal, -3 * n, +3 * n) if (dp[i][zero + bal] != 0) {
		int mx = min(3, 3 * n - i);
		FORE(sz, 1, mx) {
			int ni = i + sz, nbal = bal + (sz == 1 ? +1 : 0) + (sz == 2 ? -1 : 0);
			int mlt = 1; FORE(k, 2, sz) mlt *= ni - (k - 1);
			//printf("(%d,%d) with %d to (%d,%d): old=%d mlt=%d\n", i, bal, sz, ni, nbal, dp[i][zero + bal], mlt);
			incprod(dp[ni][zero + nbal], dp[i][zero + bal], mlt);
		}
	}
	//REPE(i, 3 * n) FORE(bal, -3 * n, +3 * n) if (dp[i][zero + bal] != 0) printf("dp[%d][%d]=%d\n", i, bal, dp[i][zero + bal]);
	int ret = 0; FORE(bal, 0, +3 * n) inc(ret, dp[3 * n][zero + bal]); return ret;
}

void run() {
	scanf("%d%d", &n, &MOD);
	printf("%d\n", solve());
}


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


Measured memory_bytes: 281600
def main():
  M=10**9+7
  r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
  d=[1]+[0]*12
  for c in input():
    if c>'9':
      d=[sum(d[j]for j in k)%M for k in r]
    else:
      d=[d[(int(c)-k)*9%13]for k in range(13)]
  print(d[5])
main()

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++)
        cin >> p[i];
    int ret = 0;
    for (int i = 1; i < n - 1; i++)
    {
        if (p[i - 1] < p[i] && p[i] < p[i + 1])
            ret++;
        else if (p[i + 1] < p[i] && p[i] < p[i - 1])
            ret++;
    }
    cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int  heads,legs;
    string ans = "No";

    cin >> heads >> legs;

    for(int i=0;i<=heads;i++){
        if(legs==(i*2+(heads-i)*4)){
            ans="Yes";
            break;
        }
        
    }
    
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int N = 305;
const double INF = 2e9;

double dp[N][N][N];
int n;
int ak, bk, ck;
int x;

void load() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;

    for(int i = 0; i < n; ++i) {
        cin >> x;

        ak += x == 1;
        bk += x == 2;
        ck += x == 3;
    }
}

void solve() {
    /*for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j)
            for(int k = 0; k < N; ++k)
                dp[i][j][k] = INF;*/
    // dp[ak][bk][ck] = 0;
    // printf("ak %d bk %d ck %d\n", ak, bk, ck);


    for(int c = 0; c <= n; ++c)
        for(int b = 0; b + c <= n; ++b)
            for(int a = 0; a + b + c <= n; ++a) {
                if(!a && !b && ! c)
                    continue;

                dp[a][b][c] += 1.0 * n;
                if(a)
                    dp[a][b][c] += 1.0 * dp[a - 1][b][c] * a;
                if(b)
                    dp[a][b][c] += 1.0 * dp[a + 1][b - 1][c] * b;
                if(c)
                    dp[a][b][c] += 1.0 * dp[a][b + 1][c - 1] * c;
                dp[a][b][c] /= 1.0 * (a + b + c);
            }

    cout << fixed << setprecision(10) << dp[ak][bk][ck] << endl;
}

int main() {
    load();
    solve();

    return 0;
}



Measured memory_bytes: 219392
#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 gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    bool ok = false;
    rep(i,n) {
        cin >> a.at(i);
    }

    sort(a.rbegin(), a.rend());
    int g = 1e9 + 5;
    if (k <= a.at(0)) {
        rep(i,n) {
            if (k == a.at(i)) ok = true;
            if (0 < i) g = min(g, gcd(a.at(i), a.at(i-1)));
        }
    }

    if (k % g == 0) ok = true;

    if (ok) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
int main(){

    int a,b,c;
    cin>>a>>b>>c;
    if(a+b>=c){
        cout<<"Yes"<<endl;
        
    }else{
        cout<<"No"<<endl;
    }
    





return 0;
}


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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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

void solve() {
    int N;
    cin >> N;
    map<int,int> mp;
    REP(_,N) {
        int n;
        cin >> n;
        if(!mp.count(n)) mp[n] = 0;
        mp[n]++;
    }

    bool is_first = true;
    for(const auto &p: mp) {
        auto cnt = p.second;
        auto val = p.first;
        REP(_,cnt) {
            if(is_first) is_first = false;
            else cout << " ";
            cout << val;
        }
    }
    cout << endl;
}

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


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

int main(){
    int N;
    cin >> N;
    vector<int> a1(N), a2(N);
    for(int i = 0; i < N; ++i) {
        cin >> a1[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> a2[i];
    }
    int ret = accumulate(a2.begin(), a2.end(), 0) + a1[0];
    int temp = ret;
    for(int i = 1; i < N; ++i) {
        temp += a1[i] - a2[i-1];
        if(temp > ret)
            ret = temp;
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
m = n
k = 0
while m >0:
    k += 1
    m = m//10
if (n+1) % (10**(k-1)) == 0:
    print(n//(10**(k-1))+9*(k-1))
else:
    print(n//(10**(k-1))-1+9*(k-1))

Measured memory_bytes: 38256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
	int n, m;//n偶数m奇数 の個数
	cin >> n >> m;
	if (n == 1 && m == 1) {
		cout << 0 << endl;
	}
	else if (m == 1&&n==2) {
		cout << 1 << endl;
	}
	else if (n == 1 && m == 2) {
		cout << 1 << endl;
	}
	else {
		cout << n*(n - 1) / 2 + m*(m - 1) / 2 << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v, y, m; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

double f(int ox, int oy, int dx, int dy, int x1, int y1, int x2, int y2) {
	int _x1 = x1 - ox, _y1 = y1 - oy, _x2 = x2 - ox, _y2 = y2 - oy;
	x1 = _x1 * dx + _y1 * dy;
	y1 = -_x1 * dy + _y1 * dx;
	x2 = _x2 * dx + _y2 * dy;
	y2 = -_x2 * dy + _y2 * dx;
	if (y1 * y2 > 0) return -1;
	double x = (double)((ll)x1 * y2 - (ll)x2 * y1) / (y2 - y1);
	if (x < -EPS || x > dx * dx + dy * dy + EPS) return -1;
	return x;
}

int main() {
	for (;;) {
		int n; cin >> n;
		if (n == 0) break;
		vector<int> x1(n), y1(n), x2(n), y2(n);
		for (int i = 0; i < n; i++)
			cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
		int ans = 1;
		for (int i = 0; i < n; i++) {
			int ox = x1[i], oy = y1[i];
			int dx = x2[i] - x1[i], dy = y2[i] - y1[i];
			vector<double> v(2);
			v[0] = 0; v[1] = dx * dx + dy * dy;
			for (int j = 0; j < i; j++) {
				double x = f(ox, oy, dx, dy, x1[j], y1[j], x2[j], y2[j]);
				if (x != -1) v.push_back(x);
			}
			sort(v.begin(), v.end());
			for (int k = 0; k + 1 < v.size(); k++)
				if (v[k + 1] - v[k] > EPS * 100)
					ans++;
		}
		cout << ans << endl;
	}
}

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

using namespace std;
using ll = long long;
#define int ll
using PII = pair<int, int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T> using VVV = vector<VV<T>>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll INF = (1LL<<60);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int n;
  cin >> n;
  VV<int> g(n);
  REP(i, n) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].PB(b);
    g[b].PB(a);
  }

  // 足を削る
  V<int> v;
  REP(i, n) if(g[i].size() == 1) v.PB(i);
  V<int> asi(n);
  int cnt = 1;
  REP(i, v.size()) {
    int num = v[i], prev = -1;
    while(1) {
      int tmp = 0;
      for(auto j: g[num]) if(asi[j] == 0) tmp++;
      if(tmp >= 2) break;

      asi[num] = cnt;
      for(auto j: g[num]) {
        if(asi[j]) continue;
        prev = num;
        num = j;
        break;
      }
    }
    // asi[num] = cnt;
    cnt++;
  }

  int q;
  cin >> q;
  REP(i, q) {
    int a, b;
    cin >> a >> b;
    a--, b--;

    if(asi[a] == 0 && asi[b] == 0) cout << 2 << endl;
    else cout << 1 << endl;
  }
  
  return 0;
}



Measured memory_bytes: 9392
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 2e5 + 5;
int n, a[M], b[M];
 
int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	sort(a, a + n);
	sort(b, b + n);
	cout << (n & 1 ? b[n / 2] - a[n / 2] : b[n / 2] + b[n / 2 - 1] - a[n / 2] - a[n / 2 - 1]) + 1;
    	return 0;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(abs(a-c)<=d) cout << "Yes" << "\n";
    else if(abs(a-b)<=d && abs(b-c)<=d) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>

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

using namespace std;

typedef long long int lli;
typedef vector<int> vi;

int main() {
	string s;
	int n, x;

	cin >> s;

	x = -1;
	rep(s.length() - 2) {
		n = 0;
		for (int j = 0; j < 3; j++)
			n = n * 10 + (s[i + j] - '0');
		if (x < 0 || abs(n - 753) < x)
			x = abs(n - 753);
	}

	cout << x;


	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
struct NUM
{
    int P, Q;
} num[5001];
bool cmp(const NUM &A, const NUM &B)
{
    if (A.P == B.P)
    {
        return A.Q < B.Q;
    }
    return A.P < B.P;
}
int n, x[51], y[51], cnt, p, q, now, ans;
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d%d", &x[i], &y[i]);
        for (int j = 1; j < i; ++j)
        {
            ++cnt;
            num[cnt].P = x[i] - x[j];
            num[cnt].Q = y[i] - y[j];
            ++cnt;
            num[cnt].P = x[j] - x[i];
            num[cnt].Q = y[j] - y[i];
        }
    }
    sort(num + 1, num + 1 + cnt, cmp);
    for (int i = 1; i <= cnt; ++i)
    {
        if (q != num[i].Q || p != num[i].P)
        {
            q = num[i].Q;
            p = num[i].P;
            ans = max(now, ans);
            now = 0;
        }
        ++now;
    }
    ans = max(now, ans);
    printf("%d", n - ans);
    return 0;
}


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

using namespace std;

unordered_map<long, unordered_set<long>> children;
vector<long> X(1010, 0);

// color, rest_color
pair<long,  long> rec(long node) {
  if (children[node].size() == 0) {
    return make_pair(X[node], 0);
  }
  unordered_map<long, long> foo;
  foo[0] =  0;
  for (auto c: children[node]) {
    unordered_map<long, long> next;
    unordered_set<long> next_checked;
    auto c_res = rec(c);
    if (c_res.second == -1) return make_pair(X[node], -1);
    for (auto it: foo) {
      {
        long next_first = it.first + c_res.first;
        long next_second  = it.second +  c_res.second;
        if (next_first <= X[node] and (next_checked.count(next_first) == 0 or next[next_first] > next_second)) {
          next[next_first] = next_second;
          next_checked.insert(next_first);
        }
      }
      {
        long next_first = it.first + c_res.second;
        long next_second  = it.second +  c_res.first;
        if (next_first <= X[node] and (next_checked.count(next_first) == 0 or next[next_first] > next_second)) {
          next[next_first] = next_second;
          next_checked.insert(next_first);
        }
      }
    }
    foo = next;
  }
  long minimum = -1;
  for (auto it: foo) {
    if (minimum == -1 or minimum > it.second) minimum = it.second;
  }
  return make_pair(X[node], minimum);
}

int main(void) {
  cout.precision(12);

  long N;
  cin >> N;

  for (long i = 2; i <= N; i++) {
    long p;
    cin >> p;
    children[p].insert(i);
  }
  for (long i = 1; i <= N; i++) cin>> X[i];

  auto result = rec(1);
  if (result.second != -1) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}


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

ll L[MAX], R[MAX], ara[MAX];

int main()
{
   ll n;
   cin >> n;

   for(int i = 1 ; i <= n; i++){
    cin >> ara[i];
   }
   L[0] = 0;
   ll gc = 0;

   for(int i = 1; i <= n; i++){
    L[i] = gc;
    gc = __gcd(ara[i], gc);
   }
   R[n + 1] = 0;
   gc = 0;
   for(int i = n + 1; i >= 1;i--){
    R[i] = gc;
    gc = __gcd(gc, ara[i]);
   }

   ll mx = 0;

   for(int i = 1; i <= n;i++){
    mx = max(mx, __gcd(L[i],R[i]));
   }



   cout << mx << endl;
}


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

int main() {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	if(a==0) cout << 1 << endl;
	if(b==0) cout << 2 << endl;
	if(c==0) cout << 3 << endl;
	if(d==0) cout << 4 << endl;
	if(e==0) cout << 5 << endl;
	
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>

using namespace std;

int n;
char c[505][505];
bool have[505];
vector<int> vec;

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			cin >> c[i][j];
		}
	}
	
	for(int i = 1; i <= n; i++){
		bool flag = false;
		for(int j = 1; j <= n; j++){
			if(c[i][j] == '#') flag = true;
		}
		if(flag) vec.push_back(i);
	}
	if(vec.size() == 0){
		cout << -1 << endl;
		return 0;
	}
	
	int full = 0;
	for(int j = 1; j <= n; j++){
		bool flag = true;
		for(int i = 1; i <= n; i++){
			if(c[i][j] == '.') flag = false;
			else have[j] = true;
		}
		if(flag) full++;
	}
	
	int ans = 1e9;
	for(int i = 1; i <= n; i++){
		int cnt = n;
		for(int j = 1; j <= n; j++){
			if(c[i][j] == '#') cnt--;
		}
		if(cnt == 0){
			ans = 0;
			break;
		}
		if(have[i]){
			ans = min(ans, cnt);
			continue;
		}
		cnt++;
		for(int j = 0; j < vec.size(); j++){
			if(c[vec[j]][i] == '#'){
				cnt--;
				break;
			}
		}
		ans = min(ans, cnt);
	}
	
	ans += n-full;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace lec12C
{
    public class Ver
    {
        public int id;
        public int state = 0;
        public int d;
        public int p;
        public int[] arr;

        public Ver(int n)
        {
            arr = new int[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = Program.Inf;
            }
        }

    }
    class Program
    {
        public const int Inf = 1000000000;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Ver[] array = new Ver[n];
            for (int i = 0; i < n; i++)
            {
                string[] inp = (Console.ReadLine()).Split(' ');
                int x = int.Parse(inp[0]);
                int deg = int.Parse(inp[1]);
                array[x] = new Ver(n);

                for (int j = 3; j <= ((deg * 2) + 2); j += 2)
                {
                    int v = int.Parse(inp[j - 1]);
                    int c = int.Parse(inp[j]);
                    array[x].arr[v] = c;
                }
                array[x].d = Inf;
                array[x].id = x;
            }

            Dijkstra(array, n);

            for (int i = 0; i < n; i++)
            {

                Console.WriteLine(i + " " + array[i].d);
            }


            Console.ReadLine();

        }

        static void Dijkstra(Ver[] v, int n)
        {
            int minv;
            v[0].d = 0;
            v[0].state = 1;

            while (true)
            {
                minv = Inf;
                int u = -1;
                for (int i = 0; i < n; i++)
                {
                    if (v[i].state != 2 && v[i].d < minv)
                    {
                        minv = v[i].d;
                        u = i;
                    }
                }

                if (u == -1)
                {
                    break;
                }

                v[u].state = 2;

                for (int i = 0; i < n; i++)
                {
                    if (v[i].state != 2 && v[u].arr[i] < Inf)
                    {
                        if (v[u].arr[i] + v[u].d < v[i].d)
                        {
                            v[i].d = v[u].arr[i] + v[u].d;
                            v[i].state = 1;
                        }
                    }
                }
            }
        }
    }
}





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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>

int N;
int X[100010], L[100010];
vector<pii> V;

signed main()
{
    cin >> N;
    rep(i, N)
    {
        int x, l;
        cin >> x >> l;
        V.push_back({x + l, x - l});
    }

    sort(V.begin(), V.end());

    int ans = 0;
    int now = -2000000000;
    for(auto ele : V)
    {
        if(now <= ele.second)
        {
            ans++;
            now = ele.first;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5256
#include<stdio.h>
#include<math.h>

int main(void){
    int hour,minute,hand_hour,hand_minute;
    double angle=0;
    scanf("%d",&hand_hour);
    scanf("%d",&hand_minute);
    scanf("%d",&hour);
    scanf("%d",&minute);
    minute=minute+60*hour;
    angle=minute*11.0*atan(1.0)/90.0;/*時針と分針の間の角度(ラジアン)*/
    printf("%.10f\n",sqrt(hand_hour*hand_hour+hand_minute*hand_minute-2.0*hand_hour*hand_minute*cos(angle)));/*余弦定理より*/
    return 0;
}


Measured memory_bytes: 2608
#include<iostream>
using namespace std;
int main(){
    int N, A, B;
    cin >> N >> A >> B;

    int a[5];
    int sum;
    int total = 0;
    for(int i = 1; i <= N; i++){
        a[5] = {};
        a[0] = i / 10000;
        a[1] = (i - 10000 * a[0]) / 1000;
        a[2] = (i - 10000 * a[0] - 1000 * a[1])/ 100;
        a[3] = (i - 10000 * a[0] - 1000 * a[1] - 100 * a[2] ) /10;
        a[4] = (i - 10000 * a[0] - 1000 * a[1] - 100 * a[2] - a[3] * 10);

        sum = a[0] + a[1] + a[2] + a[3] + a[4];
        if (sum >= A && sum <= B) total += i;
    }
    cout << total << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ppi pair<int, pii>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const int inf = 1e9;

ll power(ll x, ll p){
    ll r = 1ll;
    x = x % mod;
    while(p > 0){
        if(p & 1) r = (r * x) % mod;
        p = p >> 1;
        x = (x * x) % mod;
    }
    return r;
}

void solve(){
    int n;
    cin >> n;
    vi a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    sort(all(a));
    sort(all(b));
    if(n % 2 == 1){
        cout << b[n/2] - a[n/2] + 1 << endl;
        return;
    }
    cout << b[n/2] + b[(n-1)/2] - a[n/2] - a[(n-1)/2] + 1 << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);//cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ll t,p;
    t=1;
    //cin>>t;
    for(p=1;p<=t;p++){
        //cout << power(2, 5);
        solve();
    }
    return 0;
}


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

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

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int d, t, s; cin >> d >> t >> s;
        if (s * t >= d) cout << "Yes";
        else cout << "No";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int a[5];
int main(){
	for(int i=0;i<5;i++){
		cin >> a[i];
		if(a[i]==0){
			cout << i+1;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

int main() {
  string s; cin >>s;
  bool jouken1=!(s.size()%2);
  bool jouken2=(s[0]==s[s.size()-1]);
  if (jouken1!=jouken2) cout <<"Second" <<endl;
  else cout <<"First" <<endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n; cin >> n;
    int a[100010] = {};
    int even = 0, odd = 0;
    rep(i,0,n) {
        cin >> a[i];
        if(a[i] % 2) odd++;
        else even++;
    }

    int e = odd / 2;
    even += e;
    odd -= e * 2;
    if(odd == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    char s[123] , t[123];
    Scs(s);
    Scs(t);

    int cnt1[163] = {};
    int cnt2[163] = {};
    int leng;
    leng = strlen(s);
    Rep(i,leng){
        cnt1[s[i]-'a']++;
    }
    int hit = 0;
    Rep(i,41){
        while(cnt1[i]--){
            s[hit++] = i + 'a';
        }
    }
    leng = strlen(t);
    Rep(i,leng){
        cnt2[t[i]-'a']++;
    }
    hit = 0;
    for (int i = 50; i >= 0 ; i--){
        while(cnt2[i]--){
            t[hit++] = i + 'a';
        }
    }

    bool ans = 0;
    Rep(i,'z'+1){
        if( t[i] == 0){
            break;
        }
        if( s[i] == 0){
            ans++;
            break;
        }
        if( s[i] < t[i] ){
            ans++;
            break;
        }
        if( s[i] > t[i] ){
            break;
        }
    }

    YesNo(ans);

    return 0;
}



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

int main(){
	int a, b;
	cin >> a >> b;
	if((a * b) % 2 == 0) cout << "Even" << endl;
	else cout << "Odd" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	string s;cin>>s;
	bool ok = 1;
	For(i,0,s.size()){
		if(i%2==0 && s[i]=='L') ok =0;
		if(i%2==1 && s[i]=='R') ok = 0;
	}
	if(ok){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}































	
}

Measured memory_bytes: 256