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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

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

struct UnionFind{
    vector<int> parents;
    vector<int> rank;
    vector<ll> size;
    UnionFind(int n){
        parents.resize(n);
        rank.assign(n, 1);
        size.assign(n, 1);
        REP(i, n){
            parents[i] = i;
        }
    }
    int find(int x){
        if(parents[x] == x) return x;
        return parents[x] = find(parents[x]);
    }
    
    ll unite(int x, int y){
        x = find(x);
        y = find(y);
        ll res = size[x] * size[y];
        size[x] += size[y];
        parents[y] = x;
        return res;
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

int N;
ll a[200000 + 100];
ll b[200000 + 100];
int main(){
    ios::sync_with_stdio(false);
    cin >> N;
    UnionFind uf(200000 + 100);
    FOR(i, 1, N+1) {
        cin >>  a[i];
        b[a[i]] = i;
    }
    
    ll ans = 0;
    // 最大値から順番に区間をくっつける
    for(int j=N; j>=1; j--) {
        // 位置
        int i = b[j];
        ans += a[i];
        
        // 左側が存在 && a[i]より大きい
        if ( i - 1 >= 1 && a[i-1] > a[i] ) {
            ans += uf.unite(i-1, i) * a[i];
        }
        
        // 右側が存在 && a[i]より大きい
        if ( i + 1 <= N && a[i+1] > a[i] ) {
            ans += uf.unite(i + 1, i) * a[i];
        }
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 6656
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 100000000000000003;
int ne[200001], he[10001];
char C[1200100];

int num[2097153];
int kazu[2097153];
int atta[1000001];
const int ma = (1 << 21) - 1;
int cnt = 0;
int query(int n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 % 2097143;
	}
	num[n2] = n + 1;
	return kazu[n2] = ++cnt;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';

	ll dekai[100];
	int d = 0;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			dekai[d++] = (ll(n) << 30) + s[i] - C;
		}
	}

	ll kotae = 0;
	for (int M = 1; M <= 10000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			int mae = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = atta[mae];
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				int ct = S[i] - 'a';
				mae = query((mae << 5) + ct);
				kotae += k[ct];
				k[ct] = 0;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			atta[mae] |= 1 << (S[0] - 'a');
		}
	}
	sort(dekai, dekai + d);
	rep(p, d) {
		auto S = C + (dekai[p] & ma);
		int k[26] = {};
		int mae = 0;
		for (int i = (dekai[p] >> 30) - 1; i >= 1; i--) {
			int tmp = atta[mae];
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			int ct = S[i] - 'a';
			mae = query((mae << 5) + ct);
			kotae += k[ct];
			k[ct] = 0;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		atta[mae] |= 1 << (S[0] - 'a');
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 22892
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i=(ll)(r);i<(ll)(n);++i)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define PB(n) push_back(n)
#define endl '\n'
#define DOUT(x) cout << #x << " = " << (x) << endl
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c
#define VIN(V) for(ll ii = 0; ii < (ll)(V).size(); ii++) {cin >> (V).at(ii);}
#define OUT(n) cout << n << endl
#define OUT2(n1,n2) cout << n1 << " " << n2 << endl
#define OUT3(n1,n2,n3) cout << n1 << " " << n2 << " " << n3 << endl
#define VOUT(V) REP(ii,(V).size()){cout << (V)[ii] << " ";} cout<<endl;
#define VOUT2(V) REP(jj,(V).size()){VOUT(V[jj])}
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi > vvi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
constexpr long long MOD = 1000000007;
constexpr long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
ll n, m, k, ans, sum, cnt = 0; string s; char c; bool flg;

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  // cout << fixed << setprecision(numeric_limits<double>::max_digits10);
  ll a,b;
  IN3(n,a,b);

  FOR(i,1,n+1) {
    ll sum = 0;
    sum += i / 10000;
    sum += (i % 10000) / 1000;
    sum += (i % 1000) / 100;
    sum += (i % 100) / 10;
    sum += i % 10;
    if (a <= sum && sum <= b) {
      // OUT2(i, sum);
      ans += i;
    }
  }
  OUT(ans);
}


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

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 3005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
int cev;
string s;
double d[li],dp[li][li];
vector<int> v;

int main(void){
	scanf("%d",&n);
	FOR{
		scanf("%lf",&d[i]);
	}
	dp[1][0]=(1-d[1]);
	dp[1][1]=(d[1]);
	for(int i=2;i<=n;i++){
		for(int j=1;j<=i;j++){
			dp[i][j]+=dp[i-1][j-1]*d[i];
			dp[i][j]+=dp[i-1][j]*(1-d[i]);
		}
		dp[i][0]=dp[i-1][0]*(1-d[i]);
	}
	double cevap=0;
	for(int i=n;i>=n/2+1;i--)cevap+=dp[n][i];
	printf("%.18lf\n",cevap);
	return 0;
}


Measured memory_bytes: 68992
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int w, a, b;

int main() {
    cin >> w >> a >> b;

    int c = a + w;
    int d = b + w;

    // 2 5 6 9

    if(min(c, d) <= max(a, b)) {
        cout << min(abs(b - c), abs(d - a)) << '\n';
    }
    else {
        cout << 0 << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

int main() {
  IN(N); IN(M);

  int ans = 1;
  for (int gcd = M / N; gcd > 0; --gcd) {
    if (M % gcd == 0) {
      OUT(gcd);
      return 0;
    }
  }
  OUT(1);


  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        long m = sc.nextInt();

        long ans;
        if (n == 1) {
            if (m == 1) {
                ans = 1;
            } else {
                ans = m - 2;
            }
        } else {
            if (m == 1) {
                ans = n - 2;
            } else {
                ans = (n - 2) * (m - 2);
            }
        }

        System.out.println(ans);
        sc.close();
    }

}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <utility>
#include <iomanip>
#include <tuple>
#define ll long long int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
using namespace std;


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >>n;
	int a[n+1],b[n+1];
	rep(i,1,n+1) cin >> a[i];
	rep(i,1,n+1) cin >> b[i];
	int c[n];
	rep(i,1,n) cin >> c[i];
	int ans = 0;
	int locate=-1;
	rep(i,1,n+1){
		ans += b[a[i]];
		if(a[i]-1 == locate) ans += c[locate];
		locate = a[i];
	}
	cout << ans << endl;

}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import Data.Maybe
solve :: [Int] -> Int -> [Int]
solve [a,b] k
 | k < a = [a - k, b]
 | k < (a + b) = [0, b - (k - a)]
 | otherwise = [0,0]
main = do
 [a,b,k] <- map (fst . fromJust . (B.readInt)) . B.words <$> B.getLine
 putStr $ (\[x,y] -> (show x) ++ " " ++ (show y)) $ solve [a,b] k

Measured memory_bytes: 3780
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
typedef pair<int, int> PII;
typedef long long ll;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


int n;
bool judge = false;

int main() {

	cin >> n;

	REP(i, 1, 10) {
		REP(j, 1, 10) {
			if (n == i * j)judge = true;
		}
	}
	if (judge)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
typedef long double ld;
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <unordered_set>
#include <math.h>
#include <cstring>
#include <bitset>
#include <numeric>
#include <set>
#include <sstream>
#include <list>
#include <queue>
#define PI 3.14159265358979323846264338327950
#define mp make_pair
#define inf 1e9
//#define M 1000000007
#define M 10000000
#define N 100000

int p[110];
int main() {

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

	int x, n;
	cin >> x >> n;

	int a[n];

	int f = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];

		p[a[i]] = 1;

		if (a[i] == x) {
			f = 1;
		}
	}

	if (f == 0) {
		cout << x << endl;
		return 0;
	}

	sort(a, a + n);

	int diff = 1e5;
	int ans = 0;

	for (int i = 0; i < 105; i++) {
		if (p[i] == 0) {

			if (abs(x - i) < diff) {
				diff = abs(x - i);
				ans = i;
			}
		}
	}

	cout << ans << endl;
}



Measured memory_bytes: 3596
using System;
    class Replacing
    {
      static int[] counts = new int[100001];
      static long sum;
      static void Main()
      {
        int n = int.Parse(Console.ReadLine());
        var _line = Console.ReadLine().Split(" ");
        for (int i = 0; i < n; i++)
        {
          int num = int.Parse(_line[i]);
          sum += num;
          counts[num]++;
        }
        int q = int.Parse(Console.ReadLine());
        for (int i = 0; i < q; i++)
        {
          _line = Console.ReadLine().Split(" ");
          int b = int.Parse(_line[0]);
          int c = int.Parse(_line[1]);
          sum += (c - b) * counts[b];
          Console.WriteLine(sum);
          counts[c] += counts[b];
          counts[b] = 0;
        }
      }
    }

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

int main()
{
    int A[5];
    vector<int> p = {0,1,2,3,4};
    cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
    int ansMin = 1000000;

    do
    {
        int ans = 0;
        for(int i = 0; i < 5; i++)
        {
            while(ans % 10 != 0)ans += 1;
            ans += A[p[i]];
        }
        

        ansMin = min(ans,ansMin);
    } while (next_permutation(p.begin(),p.end()));

    cout << ansMin << endl;   
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

void ABC104C()
{
	int D, G;
	cin >> D >> G;
	vector<int> p(D), c(D);
	for (int i = 0; i < D; ++i)
	{
		cin >> p[i] >> c[i];
	}

	vector<int> maxScore(D);
	for (int i = 0; i < D; ++i)
	{
		maxScore[i] = 100 * (i+1) * p[i] + c[i];
	}

	int minCt = 100000000;
	for (int i = 0; i < (1 << D); ++i)
	{
		int sum = 0;
		int ct = 0;
		for (int j = 0; j < D; ++j)
		{
			if (1 & (i >> j))
			{
				ct += p[j];
				sum += maxScore[j];
			}
		}
		if (sum >= G)
		{
			minCt = min(ct, minCt);
		}
		else
		{
			int diff = G - sum;
			for (int j = D - 1; j > -1; --j)
			{
				if (0 == (1 & (i >> j)))
				{
					int n = (diff-1) / (100 * (j+1)) + 1;
					n = min(n, p[j] - 1);
					ct += n;
					sum += 100 * (j+1) * n;
					if (minCt <= ct)
						break;
					if (sum >= G)
					{
						minCt = ct;
						break;
					}
				}
			}
		}
	}
	cout << minCt << endl;
}
int main()
{
	ABC104C();
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
p = [set() for _ in range(100)]
sp = [set() for _ in range(n)]
k = int(s[-1])
sp[-1].add(k)
ful = False
for j in range(n-2,1,-1):
    if ful:
        sp[j] = {0,1,2,3,4,5,6,7,8,9}
    tmp = set(sp[j+1])
    if len(tmp) == 10:
        ful = True
    tmp.add(int(s[j]))
    sp[j] = tmp

s10 = [[99999 for _ in range(2)] for _ in range(10)]
for i,d in enumerate(s):
    c = int(d)
    if s10[c][0] == 99999:
        s10[c][0] = i
    elif s10[c][1] == 99999:
        s10[c][1] = i
g = 0
for i in range(10):
    for j in range(10):
        ans = 0
        nexid = min(s10[i])
        if nexid != 99999:
            for r in range(nexid+1,n-1):
                if int(s[r]) == j:
                    ans = len(sp[r+1])
                    break
            g += ans
print(g)

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

int main(){
  int n,k;
  cin >> n >> k;
  int x[n],y[n];
  char c[n];
  for(int i=0;i<n;i++) cin >> x[i] >> y[i] >> c[i];
  for(int i=0;i<n;i++){
    if(c[i]=='W'){
      x[i]+=k;
    }
    x[i]%=2*k,y[i]%=2*k;
  }
  int a[2*k+1][2*k+1];
  for(int i=0;i<2*k+1;i++){
    for(int j=0;j<2*k+1;j++){
      a[i][j]=0;
    }
  }
  for(int i=0;i<n;i++){
    a[x[i]][y[i]]++;
  }
  int ans=0;
  int sum[4*k+1][4*k+1];
  for(int i=0;i<4*k+1;i++) sum[i][0]=0,sum[0][i]=0;
  for(int i=1;i<4*k+1;i++){
    for(int j=1;j<4*k+1;j++){
      sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[(i-1)%(2*k)][(j-1)%(2*k)];
    }
  }
  for(int i=0;i<2*k+1;i++){
    for(int j=0;j<2*k+1;j++){
      int point=sum[i+k][j+k]+sum[i][j]-sum[i][j+k]-sum[i+k][j];
      point+=(sum[i+2*k][j+2*k]+sum[i+k][j+k]-sum[i+2*k][j+k]-sum[i+k][j+2*k]);
      ans=max(ans,point);
    }
  }
  /*for(int i=0;i<4*k+1;i++){
    for(int j=0;j<4*k+1;j++){
      cout << sum[i][j] << " ";
    }
    cout << endl;
  }*/
  cout << ans << endl;
}

Measured memory_bytes: 79360
#include <iostream>
#include <cstdio>
#include <algorithm>
#define rep(i,a,n) for(int i=a; i<n; i++)
using namespace std;

const int SIZE = 1 << 10;
const int MAXV = 40;
const int MAXN = 10;
const double INF = 1e9;
int N, M, P, A, B;
double t[MAXN], dist[MAXV][MAXV];
double dp[SIZE][MAXV];

int main() {
    while(cin >> N >> M >> P >> A >> B, N||M||P||A||B) {
        A--; B--;
        rep(i,0,N) scanf("%lf", &t[i]);
        rep(i,0,MAXV) rep(j,0,MAXV) dist[i][j] = INF;
        rep(i,0,P) {
            int x, y, z; scanf("%d%d%d", &x, &y, &z);
            x--; y--;
            dist[x][y] = z;
            dist[y][x] = z;
        }

        double ans = INF;
        rep(i,0,SIZE) rep(j,0,MAXV) dp[i][j] = INF;
        dp[0][A] = 0;

        rep(bit,0,1<<N) {
            rep(j,0,M) {
                rep(to,0,M) {
                    if(j == to) continue;
                    rep(i,0,N) {
                        if(bit >> i & 1) continue;
                        if(dist[j][to] == INF) continue;
                        int nbit = bit | (1 << i);
                        double cost = dist[j][to] / t[i];
                        dp[nbit][to] = min(dp[nbit][to], dp[bit][j] + cost);
                    }
                }
                if(j == B) ans = min(ans, dp[bit][j]);
            }
        }
        if(ans != INF) printf("%.6f\n", ans);
        else printf("Impossible\n");
    }
    return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll t=1e6;
  ll ans=LINF;
  reps(i,t){
    if(n%i==0) chmin(ans,(ll)i+n/i-2);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>

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

  int a[n];
  double sum = 0;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
    sum += a[i];
  }

  std::sort(a, a + n, std::greater<int>());

  if (a[m - 1] < sum / (4 * m)) {
    std::cout << "No" << '\n';
  } else {
    std::cout << "Yes" << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
}

Measured memory_bytes: 3632
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

result = False

big_a = sum([ai - bi for ai, bi in zip(a,b) if ai > bi])
big_b = sum([(bi - ai) // 2 for ai, bi in zip(a,b) if bi > ai])
sum_diff = sum(b) - sum(a)

if big_a <= big_b:
  result = True

ans = "Yes" if result else "No"
print(ans)

Measured memory_bytes: 10572
<?php
list($n, $m) = explode(" ", trim(fgets(STDIN)));

if ($n==1 && $m==1) {
    $result = 0;
}

if ($n<=1) {
    $a = 0;
} else {
    $a = kaijou($n)/(2*kaijou($n-2));
}

if ($m<=1) {
    $b = 0;
} else {
    $b = kaijou($m)/(2*kaijou($m-2));
}
$result = $a + $b;

echo $result;

function kaijou($num) {
    $t = 1;
    for ($i=1; $i<=$num; $i++) {
        $t *= $i;
    }
    return $t;
}

?>

Measured memory_bytes: 4728
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;
using namespace std;

int main(){
    int n, ma=1, mi=INF;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++){
        cin>>a[i];
        ma=max(ma, a[i]);
        mi=min(mi, a[i]);
    }
    cout<<ma-mi<<endl;
}


Measured memory_bytes: 256
#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<string,int>;

bool is_Prime(ll N){
  if(N == 1)return false;
  for(ll i =2; i*i <= N; i++){
    if(N % i == 0)return false;
  }
  return true;
}

int main(){
  ll X;
  cin >> X;
  while(true){
    if(is_Prime(X)){
      cout << X << endl;
      return 0;
    }
    else X++;
  }
  
}

Measured memory_bytes: 3564
using System;
class Program{
	private int max(int x ,int y){
		return (x > y) ? x : y;
	}
	public static void Main(){
		Program prog = new Program();
		int N = int.Parse(Console.ReadLine());
		int[,] A = new int[2,N];
		int p, q;
		string[] str;
		for (p = 0 ;p < 2 ;p++ ){
			str = Console.ReadLine().Split(' ');
			for (q = 0 ;q < N ;q++){
				A[p,q] = int.Parse(str[q]);
			}
		}
		int[,] B = new int[2,N];
		B[1,N-1] = A[1,N-1];
		B[0,N-1] = A[0,N-1] + A[1,N-1];
		if (N >= 2){
			for (q = 1 ;q < N ;q++ ){
				B[1,N-1-q] = A[1,N-1-q] + B[1, N-q];
				B[0,N-1-q] = prog.max(B[1,N-1-q],B[0,N-q]) + A[0,N-1-q];
			}
		}
		Console.WriteLine(B[0,0]);
	}
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using vt = vector<T>;
template<class T> using vvt = vector<vt<T>>;
template<class T> using ttt = tuple<T,T>;
using tii = tuple<int,int>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define DIV int(1e9+7)
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
//const double PI = M_PI;  
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}

/* Coding space */

#define MAX_V 5010
struct Edge{int to,cap,rev;};
typedef vector<Edge> Edges;
Edges G[MAX_V];
bool used[MAX_V];//for DFS
 
void add_Edge(int from,int to,int cap){
  G[from].pb((Edge){to,cap,(int)G[to].size()});
  G[to].pb((Edge){from,0,(int)G[from].size()-1});
}
 
int dfs(int v,int t,int f){
  if(v == t) return f;
  used[v] = true;
  rep(i,G[v].size()){
    Edge &e = G[v][i];
    if(!used[e.to] && e.cap > 0){
      int d = dfs(e.to,t,min(f,e.cap));
      if(d > 0){
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}
 
int Ford_Fulkerson(int s,int t){
  int flow = 0;
  while(1){
    memset(used,0,sizeof(used));
    int f = dfs(s,t,INF);
    if(f == 0) return flow; //max flow
    flow += f;
  }
}

int main(){
  int n; cin >> n;
  vector<tii> vtii1;
  rep(i,n){
    int x,y; cin >> x >> y;
    vtii1.pb(tii{x,y});
    add_Edge(0,i+1,1);
  }
  rep(i,n){
    int x,y; cin >> x >> y;
    rep(j,n){
      int px,py; tie(px,py) = vtii1[j];
      if(px < x && py < y) add_Edge(j+1,i+n+1,1);
    }
    add_Edge(i+n+1,1000,1);
  }
  cout << Ford_Fulkerson(0,1000) << endl;
}

Measured memory_bytes: 512
def solve():
    from collections import defaultdict
    class UnionFind():
        def __init__(self, n):
            self.n = n
            self.par = [-1] * n

        def find(self, x):
            if self.par[x] < 0:
                return x
            else:
                self.par[x] = self.find(self.par[x])
                return self.par[x]

        def unite(self, x, y):
            x = self.find(x)
            y = self.find(y)

            if x == y:
                return

            if self.par[x] > self.par[y]:
                x, y = y, x

            self.par[x] += self.par[y]
            self.par[y] = x

        def size(self, x):
            return -self.par[self.find(x)]

        def same(self, x, y):
            return self.find(x) == self.find(y)

    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    mp = defaultdict(int)
    uf = UnionFind(n)

    for i in range(n):
        uf.unite(i, p[i] - 1)

    for i in range(n):
        mp[uf.find(i)] += c[i]

    ans = -10 ** 14
    for i in range(n):
        roop = uf.size(i)
        times = (k - 1) // roop if mp[uf.find(i)] > 0 else 0
        over = max(min(roop, k - roop * times), 1)
        tmp = 0
        s = -10 ** 10
        idx = i
        for j in range(over):
            tmp += c[idx]
            s = max(s, tmp)
            idx = p[idx] - 1
        s += times * mp[uf.find(i)]
        ans = max(ans, s)
    print(ans)


solve()


Measured memory_bytes: 76288
#include <iostream>
#include <vector>
#include <string>

using namespace std;

string S;

int main(){
    cin >> S;
    int ans = 0;
    char last = S[0];
    for (int i = 1; i < S.size(); ++i) {
        if (last != S[i]) {
            last = S[i];
            ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <vector>
#include <iostream>
#include <cstdlib>
#include <map>
#include <stack>
using namespace std;
template<typename T, typename S> vector<T>& operator<<(vector<T>& a, S b) { a.push_back(b); return a; }
#define rep(i,n) for(int i=0;i<n;i++)


int v,d;
bool graph[1001][1001];


int main(){
	int fib[1001];
	fib[0] = 2 , fib[1] = 3;
	for(int i=2;i<1001;i++){
		fib[i] = (fib[i-1]+fib[i-2])%1001;
	}
	while(cin >> v >> d){
		bool done[1001] = {0};
		int ret = 0;
		rep(i,1001)rep(j,1001)graph[i][j] = false;
		rep(i,v)rep(j,v){
				if(abs(fib[j]-fib[i]) < d)graph[i][j] = true;
		}
		rep(i,v){
			if(done[i])continue;
			else ret++;
			stack<int> S;
			S.push(i);
			done[i] = true;
			while(S.size()){
				int pos = S.top(); S.pop();
				rep(j,v){
					if(graph[pos][j] && !done[j]){
						S.push(j);
						done[j] = true;
					}
				}
			}
		}
		cout << ret << endl;
	}
}

Measured memory_bytes: 1896
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1], C = ip[2];
	(A + B >= C ? "Yes" : "No").writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)


#include<iostream>
#include<algorithm>

//#include<unordered_map>
#include<fstream>
#include<iomanip>
#include<string>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<sstream>
#include<cstdio>
#include<ctime>
#include<cstdlib>
#define INF 0x3f3f3f3f
#define inf 0x7FFFFFFF
#define MOD 1000000007
#define pii pair<ll,ll>
#define eps 1e-8
#define equals(a,b) (fabs(a-b)<eps)
#define bug puts("bug")
#define re  register
#define fi first
#define se second
const int maxn = 1e7+ 5;
const double Inf = 10000.0;
const double PI = acos(-1.0);
typedef  long long ll;
using namespace std;


ll inv[maxn];
ll n, m;

void inver(ll p) {
	inv[0] = 1;
	inv[1] = 1;
	for (int i = 2; i <= m; i++) {
		inv[i] = (p - p / i) * inv[p % i] % p;
	}
}


ll c[maxn];
ll fac[maxn];

ll quickPower(ll a, ll b, ll m) {   //计算a的b次方
	ll ans = 1;
	ll base = a;
	while (b) {
		if (b & 1) {
			ans *= base;
			ans %= m;
		}
		base *= base;
		base %= m;
		b >>= 1;   //注意是b>>=1 not b>>1
	}
	return ans;
}

ll get_inv(ll x) {
	return quickPower(x, MOD - 2, MOD);
}

void get_fac() {
	fac[0] = 1;
	for (int i = 1; i <= m; i++) {
		fac[i] = (fac[i - 1] * i)%MOD;
	}
}

void get_C(ll n) {
	c[0] = 1;
	for (int i = 0; i < n; i++) c[i + 1] = ((c[i] * (n - i)) % MOD * inv[i + 1]) % MOD;
}

int main() {
	scanf("%lld%lld", &n, &m);
	inver(MOD);
	get_fac();
	get_C(n);
	ll res = (1 * ((fac[m] * get_inv(fac[m - n])) % MOD * get_inv(fac[m - n])) % MOD)%MOD;
	ll tmp = fac[m];
	int f = 1;
	for (int i = 1; i <= n; i++) {
		tmp = (tmp + ((-1ll * f) * ((c[i] * fac[m - i]) % MOD))+MOD) % MOD;
		f *= -1;
	}
	//cout << res << tmp << endl;
	printf("%lld", (tmp * res) % MOD);
}

Measured memory_bytes: 15420
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef struct {
    int m[6];
} Dice;
 
Dice D[100], d[2];
int n;
string s = "NNENN", w = "HHHH";
 
void roll(char c, Dice *d) {
    switch (c) {
    case 'N':
        swap(d->m[0], d->m[1]);
        swap(d->m[1], d->m[5]);
        swap(d->m[5], d->m[4]);
        break;
    case 'S':
        swap(d->m[0], d->m[4]);
        swap(d->m[4], d->m[5]);
        swap(d->m[5], d->m[1]);
        break;
    case 'E':
        swap(d->m[0], d->m[3]);
        swap(d->m[3], d->m[5]);
        swap(d->m[5], d->m[2]);
        break;
    case 'W':
        swap(d->m[0], d->m[2]);
        swap(d->m[2], d->m[5]);
        swap(d->m[5], d->m[3]);
        break;
    case 'H':
        swap(d->m[1], d->m[2]);
        swap(d->m[2], d->m[4]);
        swap(d->m[4], d->m[3]);
        break;
    }
}
bool isDifferent(Dice *d, Dice *e) {
    for (unsigned i = 0; i < s.size() + 1; i++) {
        for (unsigned j = 0; j < w.size(); j++) {
            for (int k = 0; k < 6; k++) {
                if (d->m[k] != e->m[k]) break;
                if (k == 5) return false;
            }
            roll(w[j], d);
        }
        if (i < s.size()) roll(s[i], d);
    }
    return true;
}
int main() {
    int ans = 0;
    cin >> n;
    for (int i = 0; i < n; i++) for (int j = 0; j < 6; j++) cin >> D[i].m[j];
    for (int i = 0; i < n - 1; i++) {
        d[0] = D[i];
        for (int j = i + 1; j < n; j++) {
            d[1] = D[j];
            if (!isDifferent(&d[0], &d[1])) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 3228
/* ex3_3
   urah  */

#include <stdio.h>

int main(void){
    int num, base_number;
    int count = 1;   // 何桁かを数えていく変数

    // 入力の受け取り
    scanf("%d\t%d", &num, &base_number);

    // ループを利用して数えていく
    while (num >= base_number){
        num = num/base_number;
        count++;
    }

    // 結果の出力
    printf("%d\n", count);

    return 0;
}


Measured memory_bytes: 128
n = gets.to_i
yam = gets.chomp.split(" ").map(&:to_i)
if yam.count < 2
  p nil
else
  yam = yam.take(n)
  sum = 0

  yam.combination(2).each do |set|
    sum += set[0]*set[1]
  end

  p sum
end

Measured memory_bytes: 1788
### constant

CS = ['J', 'O', 'I']
CHASH = {'J' => 0, 'O' => 1, 'I' => 2}

### main

m, n = gets.strip.split(' ').map(&:to_i)

flags = []

m.times do
  flags << gets.strip
end
#p flags

e00, e01 = gets.strip.split('')
e10, e11 = gets.strip.split('')

count = 0

for y in (0...(m - 1))
  for x in (0...(n - 1))
    if flags[y][x] == e00 && flags[y][x + 1] == e01 &&
        flags[y + 1][x] == e10 && flags[y + 1][x + 1] == e11
      count += 1
    end
  end
end
#p count

max_plus = 0

for y in (0...m)
  for x in (0...n)
    c0 = flags[y][x]
    pluses = [0] * 3

    for i in (0..2)
      c = CS[i]
      if y > 0
        if x > 0 &&
            flags[y - 1][x - 1] == e00 && flags[y - 1][x] == e01 &&
            flags[y][x - 1] == e10 && c == e11
          pluses[i] += 1
        end
        if x < n - 1 &&
            flags[y - 1][x] == e00 && flags[y - 1][x + 1] == e01 &&
             c == e10 && flags[y][x + 1] == e11
          pluses[i] += 1
        end
      end
      if y < m - 1
        if x > 0 &&
            flags[y][x - 1] == e00 && c == e01 &&
            flags[y + 1][x - 1] == e10 && flags[y + 1][x] == e11
          pluses[i] += 1
        end
        if x < n - 1 &&
            c == e00 && flags[y][x + 1] == e01 &&
            flags[y + 1][x] == e10 && flags[y + 1][x + 1] == e11
          pluses[i] += 1
        end
      end
    end

    plus = pluses.max - pluses[CHASH[c0]]
    max_plus = plus if max_plus < plus
  end
end
#p max_plus

puts (count + max_plus)

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

double t,x;

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	scanf("%lf%lf",&t,&x);
	printf("%.10lf",(double)t/x);
	return 0;
}

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

typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_v(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << endl; }
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
inline int powi(int x,int y) {int p=1; while(y--) p*=x; return p;}
template<class T> inline bool is_overlap(const T& as, const T& ae, const T& bs, const T& be)
{ return bs <=ae && as <= be; }
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    int N; cin >>N;
    string S; cin >> S;
    
    int ans = 0;

    for (int i = 0; i < S.size() - 1; i++) {
        string a = S.substr(0, i + 1);
        string b = S.substr(i + 1, S.size() - (i + 1));
        vector<int> achars(26, 0);
        vector<int> bchars(26, 0);
        
        for (int k = 0; k < a.size(); k++)
            achars[a[k]-'a']++;
        for (int k = 0; k < b.size(); k++)
            bchars[b[k]-'a']++;

        int c = 0;
        for (int k = 0; k < 26; k++)
            if (achars[k] > 0 && bchars[k] > 0)
                c++;

        chmax(ans, c);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
r,c = [int(i) for i in input().split()]

a = [[0 for i in range(c)]for j in range(r)]


for s in range(r):
    a[s] = [int(x) for x in input().split()]

for t in range(r):
    a_sum = sum(a[t])
    a[t].append(a_sum)

lastline = [0 for i in range(c+1)]
for t in range(r):
    for s in range(c+1):
        lastline[s] += a[t][s]
a.append(lastline)

for i in a:
    output = [str(j) for j in i]
    print(' '.join(output))

Measured memory_bytes: 7768
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

int main() {
  int n, q;
  while(cin >> n >> q && (n|q)) {
    map<int, int> mp;
    for(int i=0; i<n; i++) {
      int k; cin >> k;
      for(int j=0; j<k; j++) {
	int x; cin >> x;
	mp[x] ++;
      }
    }
    
    int mx = q-1;
    int num;
    map<int, int>::iterator it;
    for(it = mp.begin(); it!=mp.end(); it++) {
      if(mx < it->second) {
	num = it->first;
	mx = it->second;
      }
    }
    if(mx == q-1) cout << 0 << endl;
    else cout << num << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1196
from math import sqrt

def colinear(x1, y1, x2, y2, x3, y3):
	a = x1 * (y2 - y3) +  x2 * (y3 - y1) +  x3 * (y1 - y2)
	if a == 0:
		return True
	else:
		return False 



def distance(x1, y1, x2, y2):
	xd = (x1 - x2) ** 2
	yd = (y1 - y2) ** 2
	return sqrt(xd + yd)


def check(cx, cy, r, x, y, n):
	for i  in range(n):
		d = distance(cx, cy, x[i], y[i])
		if d - r > 00.1:
			return False
	return True
	


def circlebydiaendpoints(x1, y1, x2, y2):
	cx = (x1 + x2) / 2
	cy = (y1 + y2) / 2
	r = distance(cx, cy, x1, y1)
	return cx, cy, r


def makeCircumcircle(x1, y1, x2, y2, x3, y3):

	ox = (min(min(x1, x2), x3) + max(min(x1, x2), x3)) / 2
	oy = (min(min(y1, y2), y3) + max(min(y1, y2), y3)) / 2
	ax = x1 - ox
	ay = y1 - oy
	bx = x2 - ox
	by = y2 - oy
	cx = x3 - ox
	cy = y3 - oy
	d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2
	x = ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d
	y = ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d
	cx = ox + x
	cy = oy + y
	r = max(max(distance(cx, cy, x1, y1), distance(cx, cy, x2, y2)), distance(cx, cy, x3, y3))
	return cx, cy, r


def main():
	n = int(input())
	x = []
	y = []
	for _ in range(n):
		a, b = input().split(' ')
		a = float(a)
		b = float(b)
		x.append(a)
		y.append(b)
	ans = -1
	for i in range(n - 1):
		for j in range(i + 1, n):
			cx, cy, r = circlebydiaendpoints(x[i], y[i], x[j], y[j])
			if check(cx, cy, r, x, y, n):
				if ans == -1:
					ans = r
				elif ans > r:
					ans = r



	for i in range(n - 2):
		for j in range(i + 1, n - 1):
			for k in range(j + 1, n):
				if colinear(x[i], y[i], x[j], y[j], x[k], y[k]):
					continue
				else:
					cx, cy, r = makeCircumcircle(x[i], y[i], x[j], y[j], x[k], y[k])
					if check(cx, cy, r, x, y, n):
						if ans == -1:
							ans = r
						elif ans > r:
							ans = r


	print(ans)
	
	
if __name__ == "__main__":
	main()



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

A = list(map(int, input().split()))

cnt2 = 0
cnt4 = 0

for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

cnt2_2 = cnt2 // 2 * 2

if (cnt2_2 + cnt4*2+1) >= N or  cnt2 == N:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 15020
#encoding=utf-8

import sys
for i in sys.stdin:
	ans, num = 0.0, []
	num = map(int, i.split(","))
	x, y = float(num[10]), float(num[11])
	del num[10:12]
#	print sum(num)*(x/(x+y)), sum(num)*(y/(x+y))
	for i in xrange(10):
		ans += num[i]
#		print i,ans, sum(num)*(x/(x+y))
		if ans >= (sum(num)*(x/(x+y))):
			break
	print i + 1

Measured memory_bytes: 6304
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>

using namespace std;

int main() {
	// 1 2: 4.5
	// 1 1: 3
	// 0 2: 4
	// 0 1: 2
	// 0 0: 0
	double n;
	scanf("%lf", &n);
	int cnt[4], lim[5];
	memset(cnt, 0, sizeof cnt);
	memset(lim, 0, sizeof lim);
	for(int i=0; i<n; i++) {
		int x;
		scanf("%d", &x);
		cnt[x]++;
	}
	for(int i=3; i>=1; i--) {
		lim[i] = lim[i+1] + cnt[i];
	}
	double dp[lim[1]+1][lim[2]+1][lim[3]+1];
	dp[0][0][0] = 0.0;
	for(int three=0; three<=lim[3]; three++) {
		for(int two=0; two<=lim[2]; two++) {
			for(int one=0; one<=lim[1]; one++) {
				if(one==0 && two==0 && three==0)
					continue;
				dp[one][two][three] = 0.0;
				double sum = (one+two+three);
				if(one>0) dp[one][two][three] += (one/sum)*(dp[one-1][two][three]);
				if(two>0 && one+1<=lim[1]) dp[one][two][three] += (two/sum)*(dp[one+1][two-1][three]);
				if(three>0 && two+1<=lim[2]) dp[one][two][three] += (three/sum)*(dp[one][two+1][three-1]);
				dp[one][two][three] += n/sum;
			}
		}
	}
	printf("%.10lf\n", dp[cnt[1]][cnt[2]][cnt[3]]);
    return 0;
}

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

using namespace std;
#define INF 1000000001

int main()
{
    int N,M = 0,temp;
    string S;
    cin >> N;
    map<string,int> m;

    for(int i = 0;i < N;i++){
        cin >> S;
        auto itr = m.find(S);
        if(itr != m.end()){
            itr->second++;
            temp = itr->second;
        } 
        else {
            m.insert(make_pair(S,1));
            temp = 1;
        }
        M = max(M,temp);
    }

    for(auto itr = m.begin(); itr != m.end();itr++){
        if(itr->second == M) cout << itr->first << endl;
    }


    return 0;
}



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

using namespace std;

typedef pair<int, int> P;

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

int main(void){
  int h , w;
  cin >> h >> w;

  char s[h][w];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> s[i][j];
    }
  }

  int max = 0;
  for(int y = 0; y < h; y++){
    for(int x = 0; x < w; x++){
      if(s[y][x] == '#'){
        continue;
      }

      int maze[h][w];
      for(int j = 0; j < h; j++){
        for(int i = 0; i < w; i++){
          maze[j][i] = -1;
        }
      }
      
      maze[y][x] = 0;
      queue<P> que;
      que.push(P(x, y));

      while(!que.empty()){
        P p = que.front();
        que.pop();

        int u = p.first, v = p.second;

        for(int k = 0; k < 4; k++){
          int du = u + dx[k];
          int dv = v + dy[k];

          if(du < 0 || du >= w || dv < 0 || dv >= h) continue;
          if(s[dv][du] == '#') continue;

          if(maze[dv][du] == -1){
            maze[dv][du] = maze[v][u] + 1;
            que.push(P(du, dv));
          }
        }
      }

      for(int j = 0; j < h; j++){
        for(int i = 0; i < w; i++){
          if(max < maze[j][i]) max = maze[j][i];
        }
      }
    }
  }

  cout << max << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
const int MOD = 1000000007;

int main()
{
  int N,d[101];
  set<int> sets;
  cin >> N;
  REP(i,N){cin >> d[i];
    sets.insert(d[i]);
  }
  cout << sets.size() << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            System.out.println(new Main().run(sc));
        }
    }

    public String run(Scanner sc) {
        int[] vars = Arrays.stream(sc.nextLine().split(" ")).mapToInt(s -> Integer.parseInt(s)).toArray();
        for(int i = 0; i < vars.length; i++) {
            if (vars[i] == 0) {
                return String.valueOf(i + 1);
            }
        }
        return "foo";
    }
}


Measured memory_bytes: 35956
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	
	int W, H, N;
	cin >> W >> H >> N;
	vector<int> x(N), y(N), a(N);
	vector<vector<int>> s(H, vector<int>(W,0));
	for (int i=0; i<N; i++) cin >> x.at(i) >> y.at(i) >> a.at(i);
	
	for (int i=0; i<N; i++){
		
		if (a.at(i) == 1){
			for (int j=0; j<H; j++){
				for (int k=0; k<x.at(i); k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 2){
			for (int j=0; j<H; j++){
				for (int k=x.at(i); k<W; k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 3){
			for (int j=0; j<y.at(i); j++){
				for (int k=0; k<W; k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 4){
			for (int j=y.at(i); j<H; j++){
				for (int k=0; k<W; k++){
					s.at(j).at(k) = 1;
					
				}
			}
		}
		
	}
	int sum = 0;
	for (int i=0; i<H; i++){
		sum += count(s.at(i).begin(), s.at(i).end(), 0);
	}
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



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

  ll N , M; cin >> N >> M ;
  if(N==1 && M==1) cout <<1 << endl;
  else if(N==1) cout << max(M-2, (ll)0) << endl;
  else if(M ==1) cout << max(N-2, (ll)0) << endl;
  
  else cout << max((N-2)*(M-2),(ll)0) << endl;
  
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


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

using namespace std;


int main() {
    int n, k;
    cin>>n>>k;
    vector<int> A(n);
    for(int i=0;i<n;i++) {
        cin>>A[i];
    }

    vector<bool> dp(k + 1, 0);
    for(int i = 0;i<=k;i++) {
        for(auto a : A) {
            if(i >= a && !dp[i - a]) {
                dp[i] = 1;
            }
        }
    }
    //for(auto i : dp) cout<<i<<" ";
    cout<<(dp[k] ? "First":"Second")<<'\n'; 
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

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

	s += t[t.size() - 1];

	if (s == t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 3584