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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

int main()
{
    ll X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;

    vector<ll> R(A);
    for(int i=0;i<A;i++)
    {
        cin >> R.at(i);
    }
    sort(ALL(R),greater<int>());

    vector<ll> G(B);
    for(int i=0;i<B;i++)
    {
        cin >> G.at(i);
    }
    sort(ALL(G),greater<int>());

    vector<ll> RG;
    for(int i=0;i<X;i++)
    {
        RG.emplace_back(R.at(i));
    }
    for(int i=0;i<Y;i++)
    {
        RG.emplace_back(G.at(i));
    }
    sort(ALL(RG));

    vector<ll> Colorless(C);
    for(int i=0;i<C;i++)
    {
        cin >> Colorless.at(i);
    }
    sort(ALL(Colorless),greater<int>());

    vector<ll> answer(X+Y);

    for(int i=0;i<X+Y;i++)
    {
        if(i<C)
        {
            if(RG.at(i) < Colorless.at(i))
            {
                answer.emplace_back(Colorless.at(i));
            }
            else
            {
                answer.emplace_back(RG.at(i));
            }
        }
        else
        {
            answer.emplace_back(RG.at(i));
        }
    }

    cout << accumulate(ALL(answer),0LL) << endl;

    return 0;
}

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

int main()
{
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<s.length()/2;i++){
        if(s[i]!=s[s.length()-1-i]){
            c++;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

bool isPrime(ll N){
  if(N <= 1) return false;
  if(N == 2) return true;
  if(N % 2 == 0) return false;

  for(ll i = 3 ; i * i <= N ; i += 2){
    if(N % i == 0) return false;
  }

  return true;
}

int main(){
  ll a, b;
  cin >> a >> b;

  vector<ll> da, db;
  for(ll i = 1; i * i <= a; i++){
    if(a % i == 0){
      da.push_back(i);
      if(i != a / i) da.push_back(a / i);
    }
  }
  for(ll i = 1; i * i <= b; i++){
    if(b % i == 0){
      db.push_back(i);
      if(i != b / i) db.push_back(b / i);
    }
  }

  sort(da.begin(), da.end());
  sort(db.begin(), db.end());

  set<ll> st;
  for(ll d : da){
    if(binary_search(db.begin(), db.end(), d)) st.insert(d);
  }

  int cnt = 1;
  for(auto it = st.begin(); it != st.end(); it++){
    if(isPrime(*it)) cnt++;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 640
n=int(input())
a=[int(i) for i in input().split()]
f=0
m=0
for i in range(n-1):
    if a[i]>m:
        a[i]-=1
    if a[i]>a[i+1]:
        f=1
        break
    if a[i]>m:
        m=a[i]
if f==1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define MAX 100100
#define inf 1e15
#define f first
#define s second
#define mp make_pair
using namespace std;

typedef long long ll;

int n,m,k,s,p,q;
int infect[MAX]={};
vector<int> e[MAX];
vector<int> K;

ll dijkstra(){
  ll d[MAX]={};
  for(int i=0;i<MAX;i++)d[i]=inf;
  priority_queue<pair<ll,int> > pq;
  d[0]=0;
  pq.push(mp(0,0));

  while(!pq.empty()){
    pair<ll,int> u = pq.top();
    pq.pop();
    ll cost = u.f*(-1);
    int now = u.s;

    if(now == n-1)return cost-p;
    if(d[now]<cost)continue;

    for(int i=0;i<e[now].size();i++){
      int next = e[now][i];
      if(infect[next]==2)continue;
      if(infect[next]==0 && cost+p<d[next]){
        d[next] = cost+p;
        pq.push(mp((-1)*(cost+p),next));
      }
      if(infect[next]==1 && cost+q<d[next]){
        d[next] = cost+q;
        pq.push(mp((-1)*(cost+q),next));
      }
    }
  }
}

int main()
{
  int a,b,x;

  cin>>n>>m>>k>>s;
  cin>>p>>q;
  for(int i=0;i<k;i++){
    cin>>x;
    x--;
    K.push_back(x);
  }

  for(int i=0;i<m;i++){
    cin>>a>>b;
    a--;b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }

  queue<pair<int,int> > q;
  for(int i=0;i<K.size();i++){
    infect[K[i]]=2;
    q.push(mp(K[i],s));
  }

  while(!q.empty()){
    pair<int,int> u=q.front();
    q.pop();
    int now=u.f;
    int c=u.s;
    if(c==0)continue;
    for(int i=0;i<e[now].size();i++){
      int next = e[now][i];
      if(infect[next]==0 && next!=0 && next!=n-1){
        infect[next]=1;
        q.push(mp(next,c-1));
      }
    }
  }

  ll ans = dijkstra();
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 9144
n = int(input())
s = input()

S1 = "SS"
S2 = "WW"
S3 = "SW"
S4 = "WS"
S_list = [S1, S2, S3, S4]
for S in S_list:
    last = ""
    for i in range(n):
        if i == 0:
            if S[0] == "S":
                if s[i] == "o":
                    last = S[1]
                else:
                    last = "S" if S[1] == "W" else "W"
            else:
                if s[i] == "o":
                    last = "S" if S[1] == "W" else "W"
                else:
                    last = "S" if S[1] == "S" else "W"

        elif 1 <= i < n - 1:
            if S[i] == "S":
                if s[i] == "o":
                    S += S[i-1]
                else:
                    S += "W" if S[i-1] == "S" else "S"
            else:
                if s[i] == "o":
                    S += "S" if S[i-1] == "W" else "W"
                else:
                    S += "S" if S[i-1] == "S" else "W"
        elif i == n - 1:
            if S[i] == "S":
                if s[i] == "o" and S[0] == S[i - 1] and S[i] == last:
                    print(S)
                    exit()
                if s[i] == "x" and S[0] != S[i - 1] and S[i] == last:
                    print(S)
                    exit()
            else:
                if s[i] == "o" and S[0] != S[i - 1] and S[i] == last:
                    print(S)
                    exit()
                if s[i] == "x" and S[0] == S[i - 1] and S[i] == last:
                    print(S)
                    exit()

print(-1)

Measured memory_bytes: 3572
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int MOD = (int) 1e9 + 7;

void smul(int &a, int b)
{
	a = (a * 1LL * b) % MOD;
}
const int N = (int) 1e5 + 100;
int a[N], b[N];


int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif


	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i] );
	for (int i = 0; i < n; i++)
		scanf("%d", &b[i] );
	sort(a, a + n);
	sort(b, b + n);

	int pa = 0, pb = 0;
	
	int cnt = 0;

	int ans = 1;
	a[n] = b[n] = (int) 1e9 + 7;
	while (pa < n || pb < n)
	{
		if (a[pa] < b[pb] )
		{
			if (cnt < 0)
				smul(ans, -cnt);
			cnt++;
			pa++;
		}
		else
		{
			if (cnt > 0)
				smul(ans, cnt);
			cnt--;
			pb++;
		}
	}

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

	return 0;
}



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

using ll = long long int;
using bigint = int64_t;

#define pll pair<ll, ll>
#define vll vector<ll>
#define vpll vector<pll>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define bitcount __builtin_popcount
#define endl "\n"
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define deb(x) cout << #x << " = " << x << endl;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define ffi(i,a,b,c) for(ll i = a ; i <= b ; i += c)
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
const int MOD = 1000000007;

void io_set() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve() {
    ll a, b, c, k, ans = 0;
    cin >> a >> b >> c >> k;
    while (b <= a) {
        b *= 2;
        ans++;
    }
    while (c <= b) {
        c *= 2;
        ans++;
    }
    cout << (ans > k ? "No" : "Yes") << endl;
}

int main() {
    IOS;
    //io_set();
    ll tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
_ = gets.chomp.to_i
ary = gets.chomp.split.map(&:to_i)
count = 0

ary.each do |ai|
  quot = ai/2
  remainder = ai%2
  while remainder == 0 && quot!=0
    count += 1
    remainder = quot%2
    quot /= 2
  end
end

puts count


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

int main(){
    int M,N;
    cin >> M >> N;
    if (M == N) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ctos(c) string(1,c)
#define all(c) (c).begin(), (c).end()
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

#define N_MAX 100100

long long modpow(long long a, long long b) {
  long long r = 1LL;

  while (b) {
    if (b & 1LL)r *= a;
    if (r >= MOD)r %= MOD;
    a *= a;
    if (a >= MOD)a %= MOD;
    b >>= 1LL;
  }
  return r;
}

long long fact[N_MAX];
long long rfact[N_MAX];

long long nCr(long long n, long long r) {
  long long ret = 1LL;
  ret *= fact[n];
  ret %= MOD;
  ret *= rfact[r];
  ret %= MOD;
  ret *= rfact[n - r];
  ret %= MOD;
  return ret;
}

vector<long long> p_decom(long long m) {
  vector<long long> v;
  while (m % 2 == 0) {
    v.push_back(2LL);
    m /= 2LL;
  }
  for (long long i = 3LL; i * i <= m; i += 2LL) {
    while (m % i == 0) {
      v.push_back(i);
      m /= i;
    }
  }
  if (m > 1LL) {
    v.push_back(m);
  }
  sort(all(v));
  return v;
}

int main() {
  clr(fact, 0);
  fact[0] = 1;
  rep(i, 1, N_MAX) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= MOD;
  }
  clr(rfact, 0);
  rfact[0] = 1;
  rep(i, 1, N_MAX) {
    rfact[i] = rfact[i - 1] * modpow(i, MOD - 2);
    rfact[i] %= MOD;
  }
  ll n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  vector<ll> v1 = p_decom(m);
  map<ll, ll> ma;
  rep(i, 0, v1.sz) {
    ma[v1[i]]++;
  }
  vector<ll> v;
  map<ll, ll>::iterator itr = ma.begin();
  while (itr != ma.end()) {
    ll a = (*itr).fi;
    ll b = (*itr).se;
    v.pb(b);
    itr++;
  }
  ll ans = 1;
  rep(i, 0, v.sz) {
    ll a = v[i];
    ll ans1 = 0;
    rep(j, 1, a + 1) {
      ll c = nCr(n, j);
      ll ans2 = 0;
      if (a - j == 0) {
        ans2++;
        ans2 %= MOD;
      }
      else if (a - j > 0) {
        ll n1 = a - j + (j - 1);
        ll r1 = a - j;
        ans2 += nCr(n1, r1);
        ans2 %= MOD;
      }
      ans1 += c * ans2;
      ans1 %= MOD;
    }
    ans *= ans1;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

struct edge{
    int to;
    ll cost;
    edge() = default;
    edge(int to, ll cost) : to(to), cost(cost) {}
};

int n;
vector<edge> graph[100005];
vector<ll> dist(100005, 1e+12);
bool used[100005];

bool dfs(int u = 1, int parent = -1){
    if(parent == -1){
        for(int i = 0; i < graph[u].size(); ++i){
            int v = graph[u][i].to;
            if(v == 0)  continue;
            if(!dfs(v, u))  return false;
        }
    }
    else{
        for(int i = 0; i < graph[u].size(); ++i){
            int v = graph[u][i].to;
            if(v == parent || v == 0)   continue;
            if(abs(dist[u] - dist[v]) != 1)    return false;
            if(!dfs(v, u))  return false;
        }
    }
    return true;
}

bool judge(){
    for(int i = 0; i < graph[0].size(); ++i){
        int v = graph[0][i].to;
        ll cost = graph[0][i].cost;
        if(dist[v] != cost) return false;

    }
    return true;
}

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

    cin >> n;
    for(int i = 0; i < n-1; ++i){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(edge(b, 1));
        graph[b].push_back(edge(a, 1));
    }
    int k;
    cin >> k;
    for(int i = 0; i < k; ++i){
        int v;
        ll p;
        cin >> v >> p;
        graph[0].push_back(edge(v, p));
        graph[v].push_back(edge(0, p));
        used[v] = true;
    }
    dist[0] = 0;
    priority_queue<Pl, vector<Pl>, greater<Pl>> que;
    que.push(Pl(0, 0));
    while(!que.empty()){
        P p = que.top();
        que.pop();
        ll d = p.first;
        int u = p.second;
        if(d > dist[u]) continue;
        for(int i = 0; i < graph[u].size(); ++i){
            int v = graph[u][i].to;
            ll cost = graph[u][i].cost;
            if(dist[v] > dist[u] + cost){
                dist[v] = dist[u] + cost;
                que.push(Pl(dist[v], v));
            }
        }
    }

    if(dfs() && judge()){
        cout << "Yes\n";
        for(int i = 1; i <= n; ++i) cout << dist[i] << "\n";
    }
    else    cout << "No\n";
}

Measured memory_bytes: 18680
using System;

namespace EX160511_1{
    public class Program{
        public static void Main(string[] args){
            var input = Console.ReadLine().Split(' ');
            var n = int.Parse(input[0]);
            var m = int.Parse(input[1]);

            var A = new int[n][];
            for(int i = 0; i < n; i++){
                A[i] = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            }

            var B = new int[m];
            for(int i = 0; i < m; i++){
                B[i] = int.Parse(Console.ReadLine());
            }

            var answer = new int[n];
            for(int i = 0; i < n; i++){
                for(int j = 0; j < m; j++){
                    answer[i] += A[i][j] * B[j];
                }
            }

            foreach(var ans in answer){
                Console.WriteLine(ans);
            }
        }
    }
}

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

string S;
int cnt = 0;

int main() {
  cin >> S;
  int i = 0, j = S.length()- 1;
  while (i < j) {
    if (S[i] != S[j])
      cnt++;
    i++;
    j--;
  }
  cout << cnt << endl;
}

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

int H,W;
int c[10][10];
int A[200][200];

int main(){
  scanf("%d%d",&H,&W);
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      scanf("%d",&c[i][j]);
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      scanf("%d",&A[i][j]);
    }
  }
  for(int k=0;k<10;k++){
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        if(c[i][j]>c[i][k]+c[k][j]) c[i][j]=c[i][k]+c[k][j];
      }
    }
  }
  int ans=0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(A[i][j]!=-1){
        ans+=c[A[i][j]][1];
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>

#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))
#define repr(i, m, n) for (int (i)(m - 1); (i)>=(n); --(i))
#define repv(i, v) for (unsigned (i)(0); (i)<(v.size()); ++(i))
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define sortgi(v) sort(all(v), greater<int>())
#define sortgd(v) sort(all(v), greater<double>())
#define sortgll(v) sort(all(v), greater<ll>())
#define debug(x) cerr << #x << ": " << x << '\n'

using namespace std;
using pii = pair<int, int>;
using pss = pair<string, string>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using ll = long long;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using pqi = priority_queue<int>;
using pqd = priority_queue<double>;
using pqll = priority_queue<ll>;
using pqvi = priority_queue<vi>;
using pqvll = priority_queue<vll>;

int main() {
	string s, t;
	cin >> s >> t;
	bool f = false;
	repv(i, s) {
		if (s == t) {
			f = true;
			break; 
		}
		s = s[s.size() - 1] + s;
		s.erase(s.size() - 1);
	}
	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 888
N = int(input())
h = list(map(int, input().split()))
dp = [0]*N
ans = int(0)
dp[1] = abs(h[1]-h[0])


for i in range(2,N):
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]),dp[i-2] + abs(h[i]-h[i-2]))

ans = dp[N-1]

print(ans)

Measured memory_bytes: 52208
#include<bits/stdc++.h>
using namespace std;
signed main(){
	long long n,a[100000];
  cin>>n;
  vector<pair<long long,long long > > pps(n);
  for(int i=0;i<n;i++){
	cin>>a[i];
    pps[i] = make_pair(a[i],i);
  }
  sort(pps.begin(),pps.end());
  for(int i=0;i<n;i++){
	cout<<pps[i].second+1<<" ";
  }
  cout<<"\n";
  return(0);
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    vector<vector<int>> v(10, vector<int>(10, 0));

    FOR(i, 1, n+1){
        int m = i;
        int last = m % 10;
        while(m / 10 > 0) m /= 10;
        int first = m;
        v[first][last]++;
    }

    ll ans = 0;
    REP(i, 10){
        REP(j, 10){
            ans += v[i][j] * v[j][i];
        }
    }

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

	private static Scanner sc;

	public static void main(String[] args) {
		Main instance = new Main();
		sc = instance.new Scanner();
		instance.solve();
	}

	private void solve() {
		try {
			int n = sc.nextInt(); // n = 3
			List<Integer> param = new ArrayList<>();
			for (int c = 0; c < n; c++) {
				param.add(sc.nextInt());
			}
			long sum = 0;
			for (Integer i : param) {
				if (i % 2 == 1) {
					sum++;
				}
			}
			if (sum % 2 == 0) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private class Scanner {
		String[] s;
		int i;
		BufferedReader br;
		String regex = " ";

		public Scanner() {
			s = new String[0];
			i = 0;
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		@Override
		protected void finalize() throws Throwable {
			try {
				super.finalize();
			} finally {
				destruction();
			}
		}

		private void destruction() throws IOException {
			if (br != null)
				br.close();
		}

		public String next() throws IOException {
			if (i < s.length)
				return s[i++];
			String st = br.readLine();
			while (st == "")
				st = br.readLine();
			s = st.split(regex, 0);
			i = 0;
			return s[i++];
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public Long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public Double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}

Measured memory_bytes: 34452
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#include <list>
using namespace std;
#define INF 100000000
typedef long long int lli;
typedef pair<int,int> P;

int x[3001];
int y[3001];
bool g[5001][5001];

int main(){
	int n,ans;
	while(cin>>n&&n){
		ans=0;
		for(int i=0; i<5001; ++i){
			for(int j=0; j<5001; ++j){
				g[i][j]=false;
			}
		}
		for(int i=0; i<n; ++i){
			cin >> x[i];
			cin >> y[i];
			g[x[i]][y[i]]=true;
		}
		for(int i=0; i<n; ++i){
			for(int j=0; j<n; ++j){
				int dy=y[j]-y[i];
				int dx=x[j]-x[i];
				if(x[j]>=x[i]&&y[j]>=y[i]&&0<=x[i]-dy&&x[i]-dy<=5000&&0<=y[i]+dx&&y[i]+dx<=5000&&0<=x[j]-dy&&x[j]-dy<=5000&&0<=y[j]+dx&&y[j]+dx<=5000){
					if(g[x[i]-dy][y[i]+dx]&&g[x[j]-dy][y[j]+dx]){
						ans=max(ans,dx*dx+dy*dy);
					}
				}
			}
		}
		cout << ans << "\n";
	}
	return 0;
}

Measured memory_bytes: 25608
#include <bits/stdc++.h>
using namespace std;
struct Edge { int to; long long cost; };

template<class T>
vector<T> Dijkstra(const vector<vector<Edge>> &G, int s, T def) {
    using P = pair<T, int>;
    priority_queue<P, vector<P>, greater<P>> pq;
    vector<T> dist((int)G.size(), def);
    pq.push({0, s});
    dist[s] = 0;
    while(!pq.empty()) {
        int cur = pq.top().second; pq.pop();
        for(auto &e : G[cur]) {
            if(dist[e.to] > dist[cur] + e.cost) {
                dist[e.to] = dist[cur] + e.cost;
                pq.push({dist[e.to], e.to});
            }
        }
    }
    return dist;
}

void solve() {
    int V, E, r;
    cin >> V >> E >> r;
    vector<vector<Edge>> G(V);
    for(int i = 0; i < E; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        G[a].push_back({b, c});
    }
    const long long INF = 1e18;
    for(auto &d : Dijkstra(G, r, INF)) {
        if(d == INF) cout << "INF" << '\n';
        else cout << d << '\n';
    }
}

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



Measured memory_bytes: 19308
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios::sync_with_stdio(false)
#define pb push_back
#define mp make_pair
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) (x).begin(), (x).end()
#define uint usigned int
typedef vector <ll> vi;
ll mod=1918;
//vi v1[200005],v2;
//bool visit[200005]={false};

/*void bfs(ll n){
    queue<ll> q;
    q.push(n);
    visit[n]=true;
    while(!q.empty()){
        ll t=q.front();
        q.pop();
        v2.pb(t);
        for(ll i=0;i<v1[t].size();i++){
            if(visit[v1[t][i]]==false){
                q.push(v1[t][i]);
                visit[v1[t][i]]=true;
            }
        }
    }
}*/
/*void dfs(ll n){
    for(ll i=0;i<v1[n].size();i++)
    {
        ll y=v1[n][i];
        if(visit[y]==0)
        {
            v2.pb(y);
            visit[y]=1;
            dfs(y);
        }
    }
}*/

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    ll i,e,k,x=0,p,y=200,ans=0,m=0;
    bool b[5]={false};
    ll a[5];
    for(i=0;i<5;i++){
         cin>>a[i];
         if(a[i]%10==0){
             ans+=a[i];
             b[i]=true;
         }
         else y=min(y,a[i]%10);
    }
    for(i=0;i<5;i++){
        if(b[i]==false){
        ans+=a[i];
        while(ans%10!=0) ans++;
        }
    }
    if(y==200) cout<<ans;
    else cout<<ans-(10-y);
    return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <string.h>         // memset()
#include <stdbool.h>

#define MAX_N (100 * 100)
#define MAX_V 1001

typedef struct doll_tbl
{
	int h;
	int r;
} doll_t;

int N;
doll_t size1[MAX_N];
doll_t size2[MAX_N];
int dp[MAX_V][MAX_V];

int
cmp_func1(const void *l_, const void *r_)
{
	const doll_t *l = (const doll_t*) l_;
	const doll_t *r = (const doll_t*) r_;

	if (l->h < r->h)
		return 1;

	if (l->h > r->h)
		return -1;

	if (l->r < r->r)
		return 1;

	if (l->r > r->r)
		return -1;

	return 0;
}

int
cmp_func2(const void *l_, const void *r_)
{
	const doll_t *l = (const doll_t*) l_;
	const doll_t *r = (const doll_t*) r_;

	if (l->r < r->r)
		return 1;

	if (l->r > r->r)
		return -1;

	if (l->h < r->h)
		return 1;

	if (l->h > r->h)
		return -1;

	return 0;
}

int
dfs(int lh, int lr)
{
	int h, r;
	int i;

	if (dp[lh][lr] != -1)
		return dp[lh][lr];

	for (i = 0; i < N; ++i)
	{
		if (size1[i].h < lh && size1[i].r < lr)
		{
			h = size1[i].h;
			r = size1[i].r;
			break;
		}
	}

	int a = 0;
	if (i < N)
		a = dfs(h, r) + 1;

	for (i = 0; i < N; ++i)
	{
		if (size2[i].h < lh && size2[i].r < lr)
		{
			h = size2[i].h;
			r = size2[i].r;
			break;
		}
	}

	int b = 0;
	if (i < N)
		b = dfs(h, r) + 1;

	dp[lh][lr] = (a > b) ? a : b;
	return dp[lh][lr];
}

int
solve()
{
	for (int i = 0; i < N; ++i)
		size2[i] = size1[i];

	qsort(size1, N, sizeof(doll_t), cmp_func1);
	qsort(size2, N, sizeof(doll_t), cmp_func2);

	memset(dp, 0xff, sizeof(dp));
	return dfs(1000, 1000);
}

int
main(int argc, char **argv)
{
	while (true)
	{
		int n, m;
		scanf("%d", &n);
		if (n == 0)
			break;

		N = 0;
		for (int i = 0; i < n; ++i)
		{
			scanf("%d%d", &size1[N].h, &size1[N].r);
			N++;
		}

		scanf("%d", &m);
		for (int i = 0; i < m; ++i)
		{
			scanf("%d%d", &size1[N].h, &size1[N].r);
			N++;
		}

		printf("%d\n", solve());
	}

	return 0;
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

int N,M;
const ll mod = 1000000007LL;

struct D2 {
  deque<int> d1,d2;
  bool operator < ( const D2 &data ) const {
    if( d1 != data.d1 ) return d1 < data.d1;
    return d2 < data.d2;
  }
};

set<D2> bf_S;

bool check(deque<int> &A, deque<int> &B) {
  set<int> SA,SB;
  rep(i,N) {
    if( A[i] == B[i] ) return false;
    if( SA.count(A[i]) ) return false;
    SA.insert(A[i]);
    if( SB.count(B[i]) ) return false;
    SB.insert(B[i]);
  }
  return true;
}

void bf_dfs(deque<int> &A, deque<int> &B) {
  if( (int)A.size() >= N ) {
    if( check(A,B) ) {
      bf_S.insert((D2){A,B});
    }
    return;
  }
  REP(a,1,M+1) {
    A.push_back(a);
    REP(b,1,M+1) {
      if( a == b ) continue;
      B.push_back(b);
      bf_dfs(A,B);
      B.pop_back();
    }
    A.pop_back();
  }
}

int bf() {
  deque<int> A,B;
  bf_S.clear();
  bf_dfs(A,B);
  /*
  for(auto d : bf_S) {
    deque<int> d1 = d.d1;
    deque<int> d2 = d.d2;
    puts("--");
    rep(i,(int)d1.size()) {
      cout << "(" << d1[i] << "," << d2[i] << ")" << endl;
    }
    puts("++");
    puts("");
  }
  */
  return (int)bf_S.size();
}

#define MAX 500010

long long extgcd(long long a,long long b,long long& x,long long& y)
{
  long long d = a;
  if(b != 0){
    d = extgcd(b,a%b,y,x);
    y -= (a/b)*x;
  }
  else
    x = 1,y = 0;
  return d;
}

long long mod_inv(long long a,long long m)
{
  long long x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}

const int MAXnCk = 600001;
ll fact[MAXnCk+1], fact_inv[MAXnCk+1];
void init_nCk(){
  fact[0] = fact_inv[0] = 1;
  REP(i,1,MAXnCk+1) {
    fact[i] = fact[i-1] * (ll)i % mod;
    fact_inv[i] = mod_inv(fact[i],mod);
  }
}

ll nCk(ll n,ll k){
  if( n < 0 || k < 0 || k > n ) return 0LL;
  if( n-k < k ) k = n-k;
  return fact_inv[k] * fact[n] % mod * fact_inv[n-k] % mod;
}

ll rP[MAXnCk];

ll nPk(ll n, ll k) {
  return ( nCk(n,k) * rP[k] ) % mod;
}

void solve() {
  rP[0] = 1;
  REP(i,1,MAXnCk) rP[i] = ( rP[i-1] * (ll)i ) % mod;
  //int bf_ans = bf();
  //cout << "Answer: " << bf_ans << endl;
  ll ans = nPk(M,N);
  ans = ( ans * ans ) % mod;
  ll h = 0;
  REP(k,1,N+1) {
    ll v = ( (k&1) ? 1 : -1 );
    v = ( v * nCk(N,k) ) % mod;
    ll x = nPk(M,k);
    ll w = nPk(M-k,N-k);
    w = ( w * w ) % mod;
    v = ( v * w ) % mod;
    v = ( v * x ) % mod;
    h = ( h + v ) % mod;
    while( h < 0LL ) ( h += mod ) %= mod;
  }
  ans = ( ans - h );
  while( ans < 0LL ) ( ans += mod ) %= mod;
  cout << ans << endl;
}

int main() {
  init_nCk();
  cin >> N >> M;
  solve();
  return 0;
}


Measured memory_bytes: 17664
A,B,C = map(int, input().split())
D,E,F = map(int, input().split())
G,H,I = map(int, input().split())

flag = False
for i in range(101):
    b1 = A-i
    b2 = B-i
    b3 = C-i
    if (D-b1 == E-b2)and(E-b2 == F-b3):
        if (G-b1 == H-b2)and(H-b2 == I-b3):
            flag = True

if flag == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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 int mod=1000000007;
const int INF=1001001001;


int main() {
  int N;
  cin>>N;
  vector<int>a(N),b(N),c(N);
  for(int i=0;i<N;i++){cin>>a[i];}
  for(int i=0;i<N;i++){cin>>b[i];}
  for(int i=0;i<N;i++){cin>>c[i];}
  sort(a.begin(),a.end());
  sort(c.begin(),c.end());

  int64_t sum=0;
  for(int i=0;i<N;i++){
    int64_t x=c.end()-upper_bound(c.begin(),c.end(),b[i]);
    int64_t y=lower_bound(a.begin(),a.end(),b[i])-a.begin();
    sum+=x*y;
  }
  cout<<sum<<endl;
  return 0;  
}

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

using namespace std;
typedef long long ll;

int h(int tp,int id,int len)
{
    return (tp+(id<<1)+(len<<7));
}

string rev(string s)
{
    reverse(s.begin(),s.end());
    return s;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    const int N=(1<<12);
    const ll inf=(1ll<<60);
    vector<array<ll,2>> v[N];
    int n;
    cin >> n;
    vector<string> s(n+1);
    vector<ll> c(n+1,0);
    for(int i=1;i<=n;i++) cin >> s[i] >> c[i];
    for(int i=1;i<=n;i++)
    {
        int one=s[i].size();
        for(int len=1;len<=one;len++)
        {
            for(int j=1;j<=n;j++)
            {
                int sz=s[j].size();
                //prefix-0
                if(sz<len&&s[i].substr(len-sz,sz)==rev(s[j])) v[h(0,i,len)].push_back({h(0,i,len-sz),c[j]});
                if(sz==len&&s[i].substr(0,len)==rev(s[j])) v[h(0,i,len)].push_back({0,c[j]});
                if(sz>len&&s[i].substr(0,len)==rev(s[j].substr(0,len))) v[h(0,i,len)].push_back({h(1,j,sz-len),c[j]});
                //suffix-1
                if(sz<len&&s[i].substr(one-len,sz)==rev(s[j])) v[h(1,i,len)].push_back({h(1,i,len-sz),c[j]});
                if(sz==len&&s[i].substr(one-len,len)==rev(s[j])) v[h(1,i,len)].push_back({0,c[j]});
                if(sz>len&&s[i].substr(one-len,len)==rev(s[j].substr(sz-len,len))) v[h(1,i,len)].push_back({h(0,j,sz-len),c[j]});
            }
        }
    }
    priority_queue<array<ll,2>,vector<array<ll,2>>,greater<array<ll,2>>> q;
    vector<ll> d(N,inf);
    auto mn=[](ll &a,ll b){a=min(a,b);};
    for(int i=1;i<=n;i++)
    {
        int sz=s[i].size();
        if(s[i]==rev(s[i])) mn(d[0],c[i]);
        //one
        for(int j=0;j<sz-j-1;j++) if(s[i].substr(0,j)==rev(s[i].substr(j+1,j))) mn(d[h(1,i,sz-(2*j+1))],c[i]);
        for(int j=sz-1;j>sz-j-1;j--) if(s[i].substr(j+1,sz-j-1)==rev(s[i].substr(j-(sz-j-1),sz-j-1))) mn(d[h(0,i,sz-(2*(sz-j-1)+1))],c[i]);
        //two
        for(int j=0;j<sz-j-2;j++) if(s[i].substr(0,j+1)==rev(s[i].substr(j+1,j+1))) mn(d[h(1,i,sz-(2*j+2))],c[i]);
        for(int j=sz-2;j>sz-j-2;j--) if(s[i].substr(j+1,sz-j-1)==rev(s[i].substr(j-(sz-j-1)+1,sz-j-1))) mn(d[h(0,i,sz-(2*(sz-j-2)+2))],c[i]);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            int one=s[i].size();
            int two=s[j].size();
            if(one==two&&s[i]+s[j]==rev(s[i]+s[j])) mn(d[0],c[i]+c[j]);
            if(one<two&&s[i]==rev(s[j].substr(0,one))) mn(d[h(1,j,two-one)],c[i]+c[j]);
            if(one>two&&s[i].substr(one-two,two)==rev(s[j])) mn(d[h(0,i,one-two)],c[i]+c[j]);
        }
    }
    for(int i=0;i<N;i++) if(d[i]<inf) q.push({d[i],i});
    while(!q.empty())
    {
        auto [da,a]=q.top();
        q.pop();
        if(d[a]<da) continue;
        for(auto [to,w]:v[a])
        {
            if(d[a]+w<d[to])
            {
                d[to]=d[a]+w;
                q.push({d[to],to});
            }
        }
    }
    if(d[0]==inf) d[0]=-1;
    cout << d[0] << "\n";
    return 0;
}


Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  vector<double> v1;
  double buf;
  while(cin >> buf) {
	v1.push_back(buf);
  }
  cout << *max_element(v1.begin(), v1.end()) - *min_element(v1.begin(), v1.end()) << endl;
  return 0;
}

Measured memory_bytes: 3216
#include<iostream>
#include<string>
using namespace std;
int main(){
  string S;
  string T;
  getline(cin,S);
  getline(cin,T);
  int n1=S.length();
  int check=0;
  for(int i=0;i<n1;i++){
      if(S[i]!=T[i]){
        check++;
      }
      else{
        continue;
      }
  }
  cout<<check<<endl;
  return 0;
}

Measured memory_bytes: 3916
import sys
sys.setrecursionlimit(100000)

def dfs(i, g, visited):
  visited.add(i)
  for j in g[i]:
    if not (j in visited):
      dfs(j, g, visited)

def main():
  n, m = map(int, input().split())
  p = (list(map(int, input().split())))
  g = [[] for i in range(n + 1)]
  for i in range(m):
    x, y = map(int, input().split())
    g[x].append(y)
    g[y].append(x)
  seen = [False for i in range(n + 1)]
  ans = 0
  for i in range(1, n):
    if not seen[i]:
      visited = set()
      dfs(i, g, visited)
      for j in visited:
        seen[j] = True
        if p[j - 1] in visited:
          ans += 1
  print(ans)

if __name__ == "__main__":
  main()

Measured memory_bytes: 85732
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define MAX_W 102
#define MAX_H 102

int H,W;
char f[MAX_H][MAX_W];

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

int dfs(int x, int y,char ch) {
    int nx,ny;
    for(int i=0;i<4;i++) {
        nx = x+dx[i];
        ny = y+dy[i];
        if(f[ny][nx]==ch) {
            f[ny][nx]=0;
            dfs(nx,ny,ch);
        }
    }
}

int solve() {
    int ans = 0;
    for(int i=1;i<=H;i++) {
        for(int j=1;j<=W;j++) {
            if(f[i][j] != 0) {
                dfs(j,i,f[i][j]);
                ans++;
            }
        }
    } 
    return ans;
}

main() {
    while(cin>>H>>W) {
        if(H==W&&H==0) break;
        fill((char*)f,(char*)(f+H),'0');
        for(int i=1;i<=H;i++) {
            for(int j=1;j<=W;j++) {
                cin>>f[i][j];
            }
        }
        cout << solve() << endl;
    }
}

Measured memory_bytes: 1640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char S[4];
	scanf("%s",S);
	int mx=-1;
	for(int i=0;i<3;i++){
		int c=0;
		while(S[i]=='R'&&i<3){
			c++;
			i++;
		}
		mx=max(mx,c);
	}
	printf("%d\n",mx);
	return 0;
}


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

int main()
{
  	int n, k, x, y;
  	cin>>n>>k>>x>>y;
  	if(n > k)
  		cout<<(k*x)+((n-k)*y)<<"\n";
  	else
      	cout<<n*x<<"\n";
	return 0;
}

Measured memory_bytes: 256
N = int(input())
L = [(N,0),(1,0), (2,1), (4,2), (8,3), (16,4), (32,5), (64,6),(128,7)]
sorted_L = sorted(L,key=lambda x:x[0])
for i,j in enumerate(sorted_L):
  if j[0] == N:
    if sorted_L[i][0] == sorted_L[i+1][0]:
      print(sorted_L[i][0])
      break
    else:
      print(sorted_L[i-1][0])
      break


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int R,G,B,N;
  cin>>R>>G>>B>>N;
  int count=0;
  for(int i=0;i<=N/R;i++){
    for(int j=0;j<=N/G;j++){
      if((N-(i*R+j*G))>0&&(N-(i*R+j*G))%B==0||i*R+j*G==N){
        count=count+1;
      }
      else{
      }
    }
  }
  cout<<count<<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
const int INF = 1 << 30;

int main()
{
	long double T[128][128], dp[128][128];
	int n, m;

	while(cin >> n >> m)
	{
		if(n == 0 && m == 0)
		{
			break;
		}

		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				cin >> T[i][j];
			}
		}
		
		memset(dp, 0, sizeof(dp));
	
		for(int i = 0; i < n; i++)
		{
			dp[0][i] = 1.0;
		}

		for(int i = 1; i < m; i++)
		{
			for(int j = 0; j < n; j++)
			{
				//dp[i][j] = -1.0;
				for(int k = 0; k < n; k++)
				{
					//dp[i][j] : i回目で肥料jを使った時の最大の苗木の大きさ
					dp[i][j] = max(dp[i][j], dp[i-1][k]*T[k][j]);
				}
			}
		}

		long double res = -1; 
		for(int i = 0; i < n; i++)
		{
			res = max(res, dp[m-1][i]);
		}
	
		printf("%.2Lf\n",res);
	}
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  string s,t;
  cin >> s >> t;

  int sz = t.size();

  int ans = 1000100101;
  rep(i,s.size() - t.size()+1) {
    int tmp = 0;
    rep(j,t.size()) {
      if(j > s.size()) continue;
      if(s.at(i+j) != t.at(j)) tmp++;
    }
    ans = min(ans,tmp);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
	char	*s = (char *)malloc(27);
	int		i = 0;
	int		j;
	s[0] = '\0';
	scanf("%s",s);  
	while(s[i]!='\0')
	{
		j=i+1;
		while(s[j] != '\0')
		{
			if (s[i] == s[j])
			{
				printf("no");
				return (0);
			}
			j++;
		}
		i++;
	}
	printf("yes");
  return (0);
}

Measured memory_bytes: 1728
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;

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

	int a, b, c;
	int count = 0;
	cin >> a >> b >> c;
	for (int i = a; i <= b; i++){
		if (c % i == 0){
			count++;
		}
	}
	cout << count << "\n";

	return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <cstdio>

using namespace std;


const int N = 100;

int a[N], c[N];

int main()
{
    //freopen("input.txt", "r", stdin);


    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", a + i);
        --a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        static int x;
        scanf("%d", &x);
        ans += x;
    }
    for (int i = 0; i < n - 1; ++i)
        scanf("%d", c + i);

    for (int i = 1; i < n; ++i)
    {
        if (a[i] == a[i - 1] + 1)
            ans += c[a[i - 1]];
    }

    printf("%d", ans);
}


Measured memory_bytes: 256
N, K = map(int, input().split())
Nlist = {}
Alist = {}
visit = {}
count = 1
for a in input().split():
    a = int(a)
    Alist[count] = a
    count = count+1

count = 1
visit[0] = 1
Nlist[1]=0
while True:
    if Alist[visit[count-1]] in Nlist:
        memo = Alist[visit[count-1]]
        break
    visit[count] = Alist[visit[count-1]]
    Nlist[visit[count]] = count
    count = count+1

if K < count:
    print(visit[K])
else:

    loop = count-Nlist[memo]
    K = K-(count-loop)
    K = K % loop
    K = K+Nlist[memo]
    print(visit[K])


Measured memory_bytes: 65088
#include<bits/stdc++.h>
#define lli long long int
#define ulli unsigned long long int
#pragma GCC target ("sse4.2")
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define time cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";

int main()
{


    fast;
    lli n,m;
    cin>>n>>m;
    set<lli>st;
    map<lli,lli>mp;
    lli p=0;
    for(lli i=0;i<m;i++)
    {
        lli a;
        string s;
        cin>>a>>s;
        if(s=="WA"&&st.find(a)==st.end())
        {
            mp[a]++;
        }
        if(s=="AC"&&st.find(a)==st.end())
        {
            st.insert(a);
            p+=mp[a];
        }
    }
    cout<<st.size()<<" "<<p;
    return 0;


}


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

using namespace std;
int main()
{
    int h,n,i,sum=0;
    cin>>h>>n;
    int a[n];
    for (i=0;i<n;i++)
    {
        cin>>a[i];
        h=h-a[i];

    }
    if(h<=0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
   /* for(i=0;i<n;i++)
    {
        sum+=a[i];
    }
    if(a[0]>=h)
        cout<<"No"<<endl;
    else if(sum>=h)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;*/


   return 0;
}


Measured memory_bytes: 4004
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

C = [list(input()) for _ in range(3)]
print(C[0][0]+C[1][1]+C[2][2])

Measured memory_bytes: 65464
from collections import defaultdict


def f(edges, start):
    mp = defaultdict(lambda: [])
    for a, b in edges:
        mp[a].append(b)
        mp[b].append(a)

    res = {start}
    q = [start]

    while True:
        if len(q) == 0:
            return res
        i = q.pop()
        nei = mp[i]
        for j in nei:
            if j in res:
                continue
            res.add(j)
            q.append(j)
    return res


def check(n, edges, start):
    a = f(edges, start)
    return len(a) != n


def main():
    n, m = [int(a) for a in input().split()]
    ab = [
        [int(a) - 1 for a in input().split()]
        for _ in range(m)
    ]

    c = 0
    for i in range(m):
        if check(n, ab[:i] + ab[i + 1:], ab[i][0]):
            c += 1
    print(c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; ++i)
#define RREP(i, n) for (int i = n; 0 <= i; --i)
#define FOR(i, start, end) for (int i = start; i < end; ++i)
#define RFOR(i, start, end) for (int i = start; end <= i; --i)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    ll N, M; cin >> N >> M;

    priority_queue<long long> que;
    for (int i = 0; i < N; ++i) {
        ll A; cin >> A; que.push(A);
    }
    for (int i = 0; i < M; ++i) {
        ll t = que.top(); que.pop();
        que.push(t/2);
    }

    ll ans = 0;
    while (!que.empty()) ans += que.top(), que.pop();
    cout << ans << endl;

    return 0;
}



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

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		int x = in.nextInt();
		int y = in.nextInt();
		out.print(x*y);
		out.print(" ");
		out.println((2*x + 2*y));
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}


Measured memory_bytes: 26036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){   
    ll n,cnt = 0,hit_a,hit_b;
    cin>>n;
    vector<ll>a(n),b(n),comp(n,1);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)comp[i + 1] += comp[i];
    do{
        bool flag = true;
        rep(i,n)if(a[i] != comp[i])flag = false;
        if(flag)hit_a = cnt;
        flag = true;
        rep(i,n) if(b[i] != comp[i])flag = false;
        if(flag)hit_b = cnt;
        cnt++;
    }while(next_permutation(all(comp)));

    cout<<abs(hit_a-hit_b)<<endl;

}


Measured memory_bytes: 256