akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N; 
  cin >> N;

  int ans = INF;
  REP(i, N){
    int A;
    cin >> A;

    int ret = 0;
    while(A%2 == 0){
      A /= 2;
      ret++;
    }

    chmin(ans, ret);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
const int MOD = (int)1e9 + 7, INF = (1 << 27); const ll INFLL = (1LL << 55);
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
template<typename T, typename U> inline void chmax(T &x, U y) { if (x < y) x = y; }
template<typename T, typename U> inline void chmin(T &x, U y) { if (x > y) x = y; }


int main() {
    ll x, y; cin >> x >> y;
    if (x == y) {
        cout << -1 << "\n"; return 0;
    }

    ll st = max(x, y);
    for (ll i = st; i <= st + 2000000; i++) {
        if (i % x == 0 && i % y != 0 && i <= ll(1e18)) {
            cout << i << "\n";
            return 0;
        }
        if (i > ll(1e18)) break;
    }
    cout << -1 << "\n";
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
//using namespace __gnu_pbds;
//using namespace __gnu_cxx;


using ll = long long;

//#define int ll

using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;



const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 6e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


//template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, k, a[N], ans;
main() {
  file("lala");
  ios;
  char d;
  cin >> d;
  cout << (isupper(d) ? 'A' : 'a');
  return 0;
}
/**

*/


Measured memory_bytes: 3644
function Main (input) {
  const inputs = input.split(/\s/g).map((num) => parseInt(num))[0];
  if (inputs <= 999) return console.log('%s', 'ABC');
  if (inputs <= 1998) return console.log('%s', 'ABD');
}

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


Measured memory_bytes: 7372
using System;
using System.Collections.Generic;
using System.Linq;

class E
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = h[0], k = h[1];
		Console.WriteLine(Totients(k).Select((x, i) => i == 0 ? 0 : x * ((MInt)(k / i)).Pow(n)).Aggregate((x, y) => x + y));
	}

	static int[] Totients(int n)
	{
		var b = new bool[n + 1];
		for (int p = 2; p * p <= n; ++p) if (!b[p]) for (int x = p * p; x <= n; x += p) b[x] = true;
		var ps = new List<int>();
		for (int x = 2; x <= n; ++x) if (!b[x]) ps.Add(x);

		var r = new int[n + 1];
		r[1] = 1;
		for (int x = 2; x <= n; ++x)
			if (!b[x]) r[x] = x - 1;
			else foreach (var p in ps) if (x % p == 0)
					{
						var t = p;
						while (x % (t * p) == 0) t *= p;
						r[x] = x / t == 1 ? x / p * (p - 1) : r[t] * r[x / t];
						break;
					}
		return r;
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;

	public MInt Pow(int i) => MPow(V, i);
	public override string ToString() => $"{V}";

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


Measured memory_bytes: 28496
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k; cin >> n >> k;
  int res = 0;
  for (auto i = 0; i < n; i++) {
    int x; cin >> x;
    res += min(x, k - x);
  }
  cout << res * 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N,M;
	cin >> N >> M;
	V<int> who(M),p(M);
	rep(i,M){
		int n;
		cin >> n;
		rep(_,n){
			int x;
			cin >> x;
			x--;
			who[i] |= 1<<x;
		}
	}
	rep(i,M) cin >> p[i];
	int ans = 0;
	rep(b,1<<N){
		bool ok = true;
		rep(i,M){
			if(__builtin_popcount(b&who[i])%2 != p[i]) ok = false;
		}
		if(ok) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i=1 ; i<=(n) ; ++i)
typedef long long ll;
using namespace std;
const ll MAX = 2500LL;
typedef pair <ll, ll> P;
const double PI=3.14159265358979323846;

int main(){
  int a,b,h,m;
  cin >> a >> b >> h >> m;
  double x;
  double theta;
  theta = 2*PI*abs(m/60.0 - (h*60.0+m)/720.0);
  //cout << theta << endl;
  x = sqrt(a*a + b*b - 2*a*b*cos(theta));
  //cout << x << endl;
  cout << fixed << setprecision(15) << x << endl;
  return 0;
}

Measured memory_bytes: 4196
//*
#include <bits/stdc++.h>
//*/
/*
#include <iostream>
#include <vector>
#include <string.h>
//*/
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;
const ll LLINF = LLONG_MAX / 10;
typedef pair<int, int> P;
//typedef pair<double, double> P;

int N;
int A[310][310];
bool vis[310][310];

signed main()
{
    cin >> N;

    int sum = 0;
    REP(i,N) {
        REP(j,N) {
            cin >> A[i][j];
            sum += A[i][j];
        }
    }

    sum /= 2;

    memset(vis, 0, sizeof(vis));
    REP(k,N) REP(i,N) REP(j,N) {
        if (vis[i][j] || vis[j][i] || i == k || j == k) continue;
        if (A[i][k] + A[k][j] < A[i][j]) {
            cout << -1 << endl;
            return 0;
        } else if (A[i][k] + A[k][j] == A[i][j]) {
            vis[i][j] = true;
            sum -= A[i][j];
        }
    }

    cout << sum << endl;
}


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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 1e9+7;
const ll INF = 1e18;
const ld PI = asin(1) * 2;

ll pwr (ll a, ll p) {
    if (p == 0) return 1ll;
    if (p == 1) return a%MOD;
    ll ret = pwr (a, p/2);
    ret *= ret;
    ret %= MOD;
    if (p%2 == 1) ret *= a;
    return ret%MOD;
}
ll modInv (ll a) {
    return pwr(a%MOD, MOD-2);
}

ll fac[MAXN];
int n;
ll a[MAXN];

int main()
{
    FAST_IO;

    int k;
    cin >> n >> k;
    FOR(i, 1, n) cin >> a[i];
    ll ans = 0ll;
    sort(a+1, a+n+1);

    fac[0] = 1ll;
    FOR(i, 1, n) fac[i] = (fac[i-1]*((ll)i))%MOD;

    for (ll i = 1; i <= n; i++) {
          //  cout << " i=" << i << " a=" << a[i] << endl;
        if (i >= k) ans += (((a[i]*fac[i-1])%MOD)*((modInv(fac[k-1])*modInv(fac[i-k]))%MOD))%MOD;
        //if (i >= k) cout << "  if max: " <<(((a[i]*fac[i-1])%MOD)*((modInv(fac[k-1])*modInv(fac[i-k]))%MOD))%MOD << endl;
        ans %= MOD;
        ans += MOD;
        if (i+k-1 <= n) ans -= ( ((a[i]*fac[n-i])%MOD) * ((modInv(fac[k-1])*modInv(fac[n-i-k+1]))%MOD) )%MOD;
        //if (i+k-1 <= n) cout << "  if min: " << (((a[i]*fac[n-i])%MOD)*((modInv(fac[k-1])*modInv(fac[n-i-k+1]))%MOD))%MOD << endl;
        ans %= MOD;
    }

    cout << (ans%MOD) << endl;

    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

template <class T> inline bool chmin(T& a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}
int INF = 100100100;
int main() {
  int N, K;
  cin >> N >> K;

  vector<int> ngs(10, 0);
  int ng;
  for(int i = 0; i < K; ++i) {
    cin >> ng;
    ngs[ng]++;
  }
  vector<int> oks;
  for(int i = 0; i < 10; ++i) {
    if(ngs[i] == 0) {
      oks.push_back(i);
    }
  }
  queue<int> qs;
  for(auto ok : oks) {
    if(ok > 0) {
      qs.push(ok);
    }
  }
  int ans = INF;
  while(!qs.empty()) {
    auto v = qs.front();
    qs.pop();
    if(v >= N) {
      chmin(ans, v);
      continue;
    }
    for(auto ok : oks) {
      qs.push(v * 10 + ok);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int N;
	cin >> N;
	long long h[N];
	for (int i = 0; i < N; i++) cin >> h[i];
	long long dp[N];
	const long long INF = 1000000000000;
	for (int i = 0; i < N; i++) dp[i] = INF;
	dp[0] = 0;
	dp[1] = llabs(h[1] - h[0]);
	if (N > 2) {
		for (int i = 2; i < N; i++) {
			dp[i] = min(dp[i - 1] + llabs(h[i] - h[i - 1]), dp[i - 2] + llabs(h[i] - h[i - 2]));
		}
	}
	cout << dp[N - 1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    int x,y,k,ans=0;
    cin>>x>>y;
    vector<int> a,b;

    for(int i=0;i<x;i++){
        cin>>k;
        a.push_back(k);
    }
    for(int i=0;i<y;i++){
        cin>>k;
        b.push_back(k);
    }

    for(int i=0;i<y;i++){
        int s=i;
        for(int j=0;j<x;j++){
            if(a[j]==b[s]){
                s++;
            }
        }
      //cout<<s<<" "<<i<<endl;
        if(ans<s-i+1)ans=s-i;
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 3240
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
  int N, Q; cin >> N >> Q;
  string S; cin >> S;
  vector<int> L(Q);
  vector<int> R(Q);
  for (int i = 0; i < Q; i++) cin >> L[i] >> R[i];

  vector<int> s(N + 1);
  for (int i = 1; i < N; i++) {
    if (S[i] == 'C' && S[i - 1] == 'A') s[i + 1] = s[i] + 1;
    else s[i + 1] = s[i];
  }

  for (int i = 0; i < Q; i++) cout << s[R[i]] - s[L[i]] << endl;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define int long long
using namespace std;

int n,m,len=0,ans=0;
int a[3000005],tree[10000005],tag[10000005],dp[3000005];

inline void pushup(int rt)
{
	tree[rt]=max(tree[2*rt],tree[2*rt+1]);
}

inline void change(int nl,int l,int r,int rt,int k)
{
	if (l==r)
	{
		tree[rt]=max(tree[rt],k);
		return;
	}
	int mid=(l+r)>>1;
	if (nl<=mid)  change(nl,l,mid,2*rt,k);
	else change(nl,mid+1,r,2*rt+1,k);
	
	pushup(rt);
}

inline int query(int nl,int nr,int l,int r,int rt)
{
	int sumv=0,mid=(l+r)>>1;
	if (nl<=l&&r<=nr)  return tree[rt];
	if (nl<=mid)  sumv=max(sumv,query(nl,nr,l,mid,2*rt));
	if (nr>mid)  sumv=max(sumv,query(nl,nr,mid+1,r,2*rt+1));
	return sumv;
}

signed main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)  cin>>a[i],len=max(len,a[i]+m);
	for (int i=1;i<=n;i++)  a[i]++;
	for (int i=1;i<=n;i++)
	{
		int l=max(a[i]-m,1ll),r=a[i]+m;
		dp[i]=query(l,r,1,len,1)+1;
		change(a[i],1,len,1,dp[i]);
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 17596
n = int(input())
t, a = list(map(int, input().split()))
hs = list(map(int, input().split()))

dif_temps = [0] * n


for i in range(n):
  dif_temps[i] = abs(t - hs[i] * 0.006 - a)

min_dif = dif_temps[0]
min_dif_index = 0

for i in range(n):
  if min_dif > dif_temps[i]:
    min_dif = dif_temps[i]
    min_dif_index = i

print(min_dif_index + 1)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


int n;
string s;
int c[26];

int main()
{
	cin >> n;
	REP(i, 26)
		c[i] = 100;

	REP(i, n)
	{
		vi tmpc(26, 0);
		cin >> s;
		for (char c : s)
			++tmpc[c - 'a'];

		REP(i, 26)
			chmin(c[i], tmpc[i]);
	}

	ostringstream oss;

	REP(i, 26)
	{
		REP(j, c[i])
			oss << (char)(i + 'a');
	}

	cout << oss.str();
	
}


Measured memory_bytes: 256
/*
 * main.cpp
 *
 *  Created on: 2017/05/14
 *      Author: YamajiTakashi
 */

#include <iostream>
#include <stdint.h>
using namespace std;
int main(void) {
	uint32_t n;
	cin >> n;

	int32_t x0;
	cin >> x0;

	int32_t x, y;
	int32_t x_min = x0;
	int32_t y_max = 1-1000000000;

	for (uint32_t i = 1; i < n; i++) {
		cin >> x;
		y = x - x_min;
		if (y > y_max) {
			y_max = y;
		}
		if (x < x_min) {
			x_min = x;
		}
	}

	cout << y_max << endl;

}

Measured memory_bytes: 3084
// link:
// [prajwal1721]
// g++ -Wall -Wextra -Wshadow filename.cpp
// ./a.out >input <output
/*comments:
*/



#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b))
#define bits(x) __builtin_popcountll(x)
#define vi              vector<int>
#define vl              vector<ll>
#define all(v)          v.begin(),v.end()
#define UNIQUE(X)       (X).erase(unique(all(X)),(X).end())



typedef long long int ll;
void solve()
{
    ll n,t,m;cin>>n>>m;
    ll w[n+1],val[n+1];
    for(int i=0;i<n;i++){cin>>w[i]>>val[i];}
    ll dp[m+1]={0};
    for(int i=0;i<n;i++)
    {
        for(int j=m;j>=1;j--)
        {
            if((j-w[i]>0 && dp[j-w[i]]) || j==w[i])dp[j]=max(dp[j],dp[j-w[i]]+val[i]);
        }
        for(int j=1;j<=m;j++)
            dp[j]=max(dp[j],dp[j-1]);
    }
    // for(int j=1;j<=m;j++)
        // cout<<dp[j]<<" ";
    // cout<<"\n";
    cout<<dp[m]<<"\n";


}


int main()
{ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // ll t;cin>>t;
    // cout<<t<<"Hi test complete\n";
    // while(t--)
        {
            solve();
        }


    return 0;
}

Measured memory_bytes: 4432
#include <cstdio>

using namespace std;

int main()
{
	int pas, pas_min;
	int jui, jui_min;
	int i;
	bool flag = true;
	
	for (i = 0; i < 3; i++){
		scanf("%d", &pas);
		if (flag){
			pas_min = pas;
			flag = false;
		}
		if (pas_min > pas){
			pas_min = pas;
		}
	}
	
	flag = true;
	
	for (i = 0; i < 2; i++){
		scanf("%d", &jui);
		if (flag){
			jui_min = jui;
			flag = false;
		}
		if (jui_min > jui){
			jui_min = jui;
		}
	}
	
	printf("%d\n", pas_min + jui_min - 50);
	
	return (0);
}

Measured memory_bytes: 1020
#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>	
#include<cstring>
#include<iomanip>
#include <string>
#include <vector>	
#include<unordered_map>
#include<unordered_set>
using namespace std;


typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const int mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdoutn

int main()
{
	IO;
	map<char,int>m;
	string s;
	cin>>s;
	For(i,0,s.size())m[s[i]]++;
		for(auto m:m)if(m.second&1){cout<<"No\n";return 0;}
	cout<<"Yes\n";
	
	//system("pause");
	return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#define MAX 2000000
int H, A[MAX+1];
int left(int i){
  return 2*i;
}
int right(int i){
  return 2*i+1;
}
void maxHeapify(int  i){
  int t;
  int l=left(i);
  int r=right(i);
  int largest;
  if(l<=H&&A[l]>A[i]){
    largest=l;
  }
  else largest=i;
  if(r<=H&&A[r]>A[largest]){
    largest=r;
  }
  if(largest!=i){
    t=A[i];A[i]=A[largest];A[largest]=t;
    maxHeapify(largest);
  }
}
int main(){
  int i;
  scanf("%d",&H);
  for(i=1;i<=H;i++)
    scanf("%d",&A[i]);
  for(i=H/2;i>=1;i--)
    maxHeapify(i);
  for(i=1;i<=H;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  
  return 0;
}
  



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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

vector<char> gt(26, '@');
vector<char> gs(26, '@');

/*bool isHeiro(int start, int x, int cnt) {
  if (cnt == 27) {
    return false;
  }
  if (x == start || x == '@' - 'a') {
    return true;
  }
  isHeiro(start, gs[x] - 'a', cnt + 1);

}*/

int main()
{
  string S, T;
  cin >> S >> T;

  REP(i, S.size()) {
    if ((gt[T[i] - 'a'] != '@' && S[i] != gt[T[i] - 'a']) ||
         gs[S[i] - 'a'] != '@' && T[i] != gs[S[i] - 'a']) {
      cout << "No" << endl;
      return 0;
    } else {
      gt[T[i] - 'a'] = S[i];
      gs[S[i] - 'a'] = T[i];
    }
  }
  cout << "Yes" << endl;

	return 0;
}



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

ll gcd(ll a,ll b){
    if(a<b) swap(a,b);
    if(a%b==0) return b;
    else return gcd(b,a%b);
}

int main(){
    ll n,m;
    cin>>n>>m;
    string S,T;
    cin>>S>>T;
    ll g=gcd(n,m);
    ll l=n*m/g;
    map<ll,ll> ma;
    for(int i=0;i<n;i++){
        ma[i*l/n]=S[i]-'a'+1;
    }
    for(int i=0;i<m;i++){
        if(ma[i*l/m]>0&&ma[i*l/m]!=T[i]-'a'+1) {
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<l<<endl;
    return 0;
}

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

int m,M,*w,*v,*c,g,*n,cnt;

void solve(int i, int n){
	if(n==0){
		cnt++;
		return;
	}
	if(i == M)
		return;
	else if(c[i] > n){
		solve(i+1, n);
	}else{
		solve(i+1, n-c[i]);
		int x;
		for(x=1; i+x<M; x++)
			if(c[i+x] != c[i])
				break;
		solve(i+x, n);
	}
}

int main(){
	while(true){
		M = 0;
		cin >> m;
		if(!m)
			return 0;
		w = new int[m];
		v = new int[m];
		for(int i=0; i<m; i++){
			cin >> w[i] >> v[i];
			M += v[i];
		}
		c = new int[M];
		cnt = 0;
		for(int i=0; i<m; i++){
			for(int k=1; k<=v[i]; k++){
				c[cnt] = w[i];
				cnt++;
			}
		}
		cnt = 0;
		cin >> g;
		n = new int[g];
		for(int i=0; i<g; i++)
			cin >> n[i];
		for(int i=0; i<g; i++){
			cnt = 0;
			solve(0, n[i]);
			cout << cnt << endl;
		}
		delete[] w;
		delete[] v;
		delete[] c;
	}
}

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

using namespace std;

typedef unsigned long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 18) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(S == T) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inp_ll;

const int MAXN = 111;

int b[66666];

int main()
{
	
	for (int i = 2; i <= 55555; ++ i)
	{
		if (!b[i])
		{
			for (int j = i+i; j <= 55555; j += i)
				b[j] = 1;
		}
	}
	
	int n;
	scanf("%d", &n);
	for (int i = 2; i <= 55555; ++ i)
		if (!b[i] && i%10 == 1)
		{
			printf("%d ", i);
			if (-- n == 0)
				break;
		}
	
	return 0;
}


Measured memory_bytes: 512
#include <iostream>  
#include <vector>  
#include <string>  
#include <algorithm>  
#include <cstdio>  
#include <cstring>  
#include <ctime>  
#include <cstdlib>  
#include <set>  
#include <map>  
#include <cctype>  
#include <list>  
#include <cmath>  
#include <bitset>  
#include <queue>  
#include <stack>  
#include <sstream>  
#include <functional>  
#include <cassert>  
using namespace std;  
  
#define tmax(a, b) if (b > a) a = b  
#define tmin(a, b) if (b < a) a = b  
char inc() { char _[10]; scanf("%s", _); return _[0]; }  
int ini() { int _; scanf("%d", &_); return _; }  
long long inll() { long long _; scanf("%I64d", &_); return _; }  
double ind() { double _; scanf("%lf", &_); return _; }  
string ins() { string _; cin >> _; return _; }  
int inl(char _[]) { if (!fgets(_, (int)1e8, stdin)) return -1; int i = strlen(_); if (_[i - 1] == '\n') _[--i] = 0; return i; }  
  
typedef pair<int, int> pii;  
typedef pair<char, char> pcc;  
typedef long long LL;  
const int inf = 0x3f3f3f3f;  
const LL lnf = 0x3f3f3f3f3f3f3f3f;  
const double pi = 3.14159265358979323846;  
const double eps = 1e-8;  
const int mod = 1e9+7;  
const int maxn = 1e5 + 10;  
  
LL n, m;
  
int main() {  
    int CAS = 0;  
    //std::ios::sync_with_stdio(0);  
    //std::cin.tie(0);  
#ifdef NIGHT_13  
    freopen("in.txt", "r", stdin);  
   // freopen("out.txt", "w", stdout);  
    int time_night_13 = clock();  
#endif // NIGHT_13  
  
	while (scanf("%lld%lld", &n, &m) != EOF) {
		if (abs(n - m) <= 1) {

			LL ans = 1;
			if (n < m) swap(n, m);
			for (int i = n; i; --i) {
				ans = ans * i % mod;
			}
			for (int i = m; i; --i) {
				ans = ans * i % mod;
			}

			if (n == m) {
				ans = ans * 2 % mod;
			}
			printf("%lld\n", ans);
		} else {
			puts("0");
		}
	}
  
#ifdef NIGHT_13  
    fprintf(stderr, "\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");  
    fprintf(stderr, "\t   Time: %d ms", (int)clock() - time_night_13);  
    fprintf(stderr, "\n...........................................\n\n");  
#endif // NIGHT_13  
    return 0;  
}  

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

if N < 10:
  print(N)
elif N > 9 and N < 100:
  print(9)
elif N > 99 and N < 1000:
  print(9 + N - 99)
elif N > 999 and N < 10000:
  print(909)
elif N > 9999 and N < 100000:
  print(909 + N -9999)
else:
  print(90909)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdlib>
using namespace std;
int x,n,i;
float isprime(){
    int j=3;
    if(x==2)return true;
    else if(x<2||x%2==0)return false;
    else{
        while(j<=sqrt(x)){
            if(x%j==0){
                return false;
            }
            j=j+2;
        }
        return true;
    }
}
int main(){
    int count=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>x;
        isprime();
        if(isprime()==true)count++;
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3060
from bisect import bisect_right

n = int(input())
a = list(map(int, input().split()))

li = [[0, -1]]
for i, e in enumerate(a):
    if e > li[-1][0]:
        li.append([e, i])

li = li[::-1]

a.sort()
acc = [0] * (n + 1)
for i in range(n - 1, -1, -1):
    acc[i] = acc[i+1] + a[i]

ans = [0] * n
sub = 0
ans_prev = 0
for (ep, ip), (e, i) in zip(li, li[1:]):
    j = bisect_right(a, e)
    ans[ip] = acc[j] - e * (n - j)

i_prev = 0
for i in range(1, n):
    if ans[i]:
        ans[i_prev] -= ans[i]
        i_prev = i

print(*ans, sep="\n")


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

int main(){
    ll N;
    cin >> N;
    vector<vector<pair<ll, ll>>> G(N+1);
    vector<ll> dist(N+1, -1);
    rep(i, 0, N-1){
        ll u, v, w;
        cin >> u >> v >> w;
        G[u].push_back({v, w});
        G[v].push_back({u, w});
    }
    queue<ll> que;
    que.push(1);
    dist[1] = 0;
    while(!que.empty()){
        auto t = que.front();
        que.pop();
        for(auto g : G[t]){
            if(dist[g.first] != -1) continue;
            dist[g.first] = dist[t] + g.second;
            que.push(g.first);
        }
    }
    rep(i, 1, N+1) cout << dist[i]%2 << endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  string ans="No";
  
  for(int i=1;i<10;i++){
    if(N%i==0){
      if(N/i>0&&N/i<10){
        ans="Yes";
        break;
      }
    }
  }
  
  cout << ans <<endl;
  
}

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

using namespace std;

#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define MP make_pair
#define PB push_back
#define X first
#define Y second

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, k;
    cin >> n >> k;

    set<int> st;

    for (int i = 0; i < k; i++) {
        int d = 0;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int x = 0;
            cin >> x;
            st.insert(x);
        }
    }

    cout << n - st.size() << '\n';

    return 0;
}

// g++ sol.cpp -o sol.out -Wall -Wextra -Wshadow -fsanitize=undefined -std=c++17

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n,k;
  cin >> n >> k;
  int cnt = 0;

  while(true){
    if(n / (double)pow(k,cnt) < 1) {
      cout << cnt << endl;
      break;
    }
    else cnt++;
  }

  return 0;
}

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

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {

            String S = Console.ReadLine();
            String[] line = S.Split(' ');
            int N = int.Parse(line[0]);
            int D = int.Parse(line[1]);

            if (N % (D * 2 + 1) == 0)
            {
                Console.WriteLine(N / (D * 2 + 1));
            }
            else
            {
                Console.WriteLine(N / (D * 2 + 1) + 1);
            }
        }
    }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
	int n;
	cin >> n;
	priority_queue<pair<ll, ll>, vector<pair<ll, ll> >, greater<pair<ll, ll> > > pq;
	rep (i, n) {
	  ll a, b;
	  cin >> a >> b;
	  pq.push({b, a});
	}
	ll t = 0;
	while (!pq.empty()) {
	  ll lim, dur;
	  lim = pq.top().first, dur = pq.top().second;
	  pq.pop();
	  t += dur;
	  if (lim < t) {
		cout << "No" << endl;
		return 0;
	  }
	}
	cout << "Yes" << endl;
    
    return 0;
}



Measured memory_bytes: 7404
import math


S = input()
ls = len(S)
ans = [0] * ls
i = 0
while i < ls:
    r_count = 0
    l_count = 0
    j = i
    while j < ls and S[j] == 'R':
        r_count += 1
        j += 1

    k = j
    while k < ls and S[k] == 'L':
        l_count += 1
        k += 1
    ans[j - 1] = math.ceil(r_count / 2) + l_count // 2
    ans[j] = r_count // 2 + math.ceil(l_count / 2)
    i = k

print(' '.join(map(str, ans)))


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

class GModInt {
public:
	static int Mod;	int x; GModInt() : x(0) { }GModInt(signed sig) { if ((x = sig % Mod + Mod) >= Mod) x -= Mod; }GModInt(signed long long sig) { if ((x = sig % Mod + Mod) >= Mod) x -= Mod; }int get() const { return x; }	GModInt &operator+=(GModInt that) { if ((x += that.x) >= Mod) x -= Mod; return *this; }	GModInt &operator-=(GModInt that) { if ((x += Mod - that.x) >= Mod) x -= Mod; return *this; }GModInt &operator*=(GModInt that) { x = (unsigned long long)x * that.x % Mod; return *this; }GModInt &operator/=(GModInt that) { return *this *= that.inverse(); }GModInt operator+(GModInt that) const { return GModInt(*this) += that; }GModInt operator-(GModInt that) const { return GModInt(*this) -= that; }GModInt operator*(GModInt that) const { return GModInt(*this) *= that; }GModInt operator/(GModInt that) const { return GModInt(*this) /= that; }GModInt inverse() const { long long a = x, b = Mod, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }return GModInt(u); }bool operator==(GModInt that) const { return x == that.x; }bool operator!=(GModInt that) const { return x != that.x; }GModInt operator-() const { GModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
int GModInt::Mod = 0;
typedef GModInt mint;
mint operator^(mint a, unsigned long long k) {
	mint r = 1;
	while (k) {
		if (k & 1) r *= a;
		a *= a;
		k >>= 1;
	}
	return r;
}


#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)

using LL = long long;
vector<long long > make_prime(long long  N) {
	vector<long long >a;
	vector<bool> prime(N + 1);
	FOR(i, 0, N + 1) {
		prime[i] = 1;
	}prime[0] = prime[1] = 0;
	for (LL i = 2; i <= N; i++) {
		if (prime[i]) {
			a.push_back((long long)i);
			for (LL j = i * 2; j <= N; j += i)
				prime[j] = 0;
		}
	}
	return a;
}

map<LL, LL> make_factor(long long  n) {
	map<LL, LL>ans;
	for (long long i = 2; i * i <= n; i++) {
		while (n%i == 0) {
			ans[i]++;
			n /= i;
		}
	}
	if (n != 1)ans[n]++;
	return ans;
}

void solve_tenka1programmercontest2019_e() {
	int N; cin >> N;
	vector<LL>a(N + 1);
	for (int i = N; i >= 0; i--) {
		cin >> a[i];
	}
	set<int>cand; {
		auto m = make_factor(abs(a.back()));
		for (auto it : m) {
			cand.insert(it.first);
		}
		auto ps = make_prime(N);
		for (auto it : ps) {
			cand.insert(it);
		}

	}
	for (auto p : cand) {
		GModInt::Mod = p;


		vector<mint>b(N + 1,0);
		FOR(i, 0, N + 1) {
			b[i] += (a[i]%p)+p;
		}
		for (int i = N; i >= p; i--) {
			b[i - p + 1] += b[i];
			b[i] = 0;
		}
		bool ok = true;
		for (auto it : b) {
			if (it.get() != 0) {
				ok = false;
				break;
			}
		}
		if (ok) {
			cout << p << endl;
		}


	}


}

int main() {

	solve_tenka1programmercontest2019_e();
}



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

const double EPS = 1e-10;
const ll INF = 1000000000000000000;
const ll MOD = 1000000007;

ll n, m;
ll s, t;
vector<P> e[100000];
ll dist[2][100000];
ll cnt[2][100000];
bool ali[100000];

void dijk(int i, ll st) {
    rep(j,n) dist[i][j] = INF;
    rep(j,n) cnt[i][j] = 0;
    dist[i][st] = 0;
    cnt[i][st] = 1;
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, st));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        if (dist[i][p.second] < p.first) continue;
        rep(j,e[p.second].size()) {
            if (dist[i][e[p.second][j].first] == p.first + e[p.second][j].second) {
                cnt[i][e[p.second][j].first] = (cnt[i][e[p.second][j].first]+cnt[i][p.second])%MOD;
            } else if (dist[i][e[p.second][j].first] > p.first + e[p.second][j].second) {
                cnt[i][e[p.second][j].first] = cnt[i][p.second];
                dist[i][e[p.second][j].first] = p.first + e[p.second][j].second;
                que.push(P(dist[i][e[p.second][j].first], e[p.second][j].first));
            }
        }
    }
}

void checker (ll v) {
    ali[v] = true;
    rep(i,e[v].size()) {
        if (ali[e[v][i].first]) continue;
        if (dist[0][e[v][i].first]+e[v][i].second == dist[0][v]) {
            checker(e[v][i].first);
        }
    }
}

int main(){
    cin >> n >> m;
    cin >> s >> t;
    s--; t--;
    rep(i,m) {
        ll u, v, d;
        cin >> u >> v >> d;
        u--; v--;
        e[u].push_back(P(v,d));
        e[v].push_back(P(u,d));
    }
    dijk(0, s);
    dijk(1, t);
    memset(ali, 0, sizeof(ali));
    checker(t);
    
    ll Mdis = dist[0][t];
    ll ans = 0;
    rep(i,n) {
        if (!ali[i]) continue;
        if (dist[0][i] == dist[1][i]) {
            ll tmp = cnt[0][i] * cnt[1][i] % MOD;
            tmp = tmp * tmp % MOD;
            ans = (ans+tmp)%MOD;
            continue;
        }
        rep(j,e[i].size()) {
            if (!ali[e[i][j].first]) continue;
            if (dist[0][i]*2 < Mdis && dist[1][e[i][j].first]*2 < Mdis && dist[0][i]+dist[1][e[i][j].first]+e[i][j].second == Mdis) {
                ll tmp = cnt[0][i] * cnt[1][e[i][j].first] % MOD;
                tmp = tmp * tmp % MOD;
                ans = (ans+tmp)%MOD;
            }
        }
    }
    ans = (cnt[0][t]*cnt[1][s]-ans+MOD)%MOD;
    cout << ans << endl;
}
































Measured memory_bytes: 20900
#include<stdio.h>
#include <string.h>

char CheckWeather(char* a_acWeather);

int main(void) {
	char acWeather[7];
	//天気を入力
	scanf("%s", acWeather);
	
	//明日の天気を出力
	switch (CheckWeather(acWeather)){
	case 1:
		printf("Cloudy\n");
		break;
	case 2:
		printf("Rainy\n");
		break;
	default:
		printf("Sunny\n");
		break;
	}
	return 0;
}

/*********
*	今日の天気に応じて明日の天気のフラグを返す関数
*	a_acWeather	入力された今日の天気
*/
char CheckWeather(char* a_acWeather) {
	char cWeatherFlag = 0;
	if (strcmp(a_acWeather, "Sunny") == 0) {
		cWeatherFlag = 1;
	}
	else if (strcmp(a_acWeather, "Cloudy") == 0) {
		cWeatherFlag = 2;
	}
	else {}
	return (cWeatherFlag);
}


Measured memory_bytes: 1600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
const int maxn = 100005;
int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
//        if(a[i] == 1)mins = i;
    }
    int ans = (n-k)/(k-1)+1;
    if((n-k)%(k-1) != 0)ans++;
    cout << ans << endl;

    return 0;
}


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

int main(){
	int N;
	cin>>N;
	int oddnum=0;
	int tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		if(tmp%2==1)oddnum++;
	}
	if(oddnum%2==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int isprime(int);

int main()
{
  int n,A[10000];
  int i,cnt=0;
  int judge=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    judge = isprime(A[i]);
    if(judge==1) cnt++;
    else continue;
  }
  printf("%d\n",cnt);
  return 0;
}

int isprime(int x){
  int i;
  if(x<=1) return 0;
  if(x%2==0 && x!=2) return 0;
  for(i=2;i<=sqrt(x);i++){
    if(x%i==0) return 0;
  }
  return 1;
}



Measured memory_bytes: 2060
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

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

    int sum = 0;
    for(int i = 0; i < n; i++){
        sum += a[i];
    }

    if(sum % 10 != 0){
        cout << sum << endl;
        return 0;
    }

    sort(a.begin(), a.end());
    int sub = -1;
    for(int i = 0; i < n; i++){
        if(a[i] % 10 != 0){
            sub = a[i];
            break;
        }
    }

    cout << (sub == -1 ? 0 : (sum - sub)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N;
  cin >> N;

  string s;
  cin >> s;

  int l = 0, r = N-1;
  int ans = 0;
  while(l < r){
    while(l < N && s[l] == 'R') l++;
    while(r >= 0 && s[r] == 'W') r--;
    if(r <= l) break;
    r--; l++;
    ans++;
  }

  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3752
import collections
S = str(input())
count = 1
s1 = []
#for i in range(len(S)):
#  s1.append(S[i])

#s2 = S[::-1]
#k = 0
#while s2[k] == s2[k+1]:
#  k += 1


i = 0
j = 1
add = 0

while i <= len(S)-1:
  if i == 0:
    s1.append(S[0])
    i += 1
  else:
    if S[i:i+j] == s1[-1]:
      j += 1
    else:
      s1.append(S[i:i+j])
      i = i + j
      j = 1
  if i + j > len(S):
    i = len(S)
    
count = len(s1)

print(count + add)
#print(s1)

Measured memory_bytes: 53600
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());

            int a = (n - k) > 0 ? k : n;
            int b = (n - k) > 0 ? (n - k) : 0;

            int rst = a * x + b * y;
            Console.WriteLine(rst);
        }
    }
}


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

int main(){

	int n, a[100];
	cin >> n;

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

	for(int i = n-1; i>=0; i--){		//今まだは、「i = 0」でスタートして来たが「0」からスタートで無くても良い。
		cout << a[i] << " \n"[i == 0];
	}


	return 0;
}



Measured memory_bytes: 3104
import itertools

a=input()
b=input()
c=input()

ab=[0]*100000
ac=[0]*100000
bc=[0]*100000

lena=len(a)
lenb=len(b)
lenc=len(c)

def match(c1,c2):
    return c1==c2 or c1=='?' or c2=='?'

for i in range(lena):
    for j in range(lenb):
        if match(a[i],b[j])==False:
            ab[i-j+50000]=1

for i in range(lena):
    for j in range(lenc):
        if match(a[i],c[j])==False:
            ac[i-j+50000]=1

for i in range(lenb):
    for j in range(lenc):
        if match(b[i],c[j])==False:
            bc[i-j+50000]=1
ans=10000
for i in range(-4000,4001):
    for j in range(-4000,4001):
        if ab[i+50000]==0 and ac[j+50000]==0 and bc[j-i+50000]==0:
            left=min(0,i,j)
            right=max(lena,i+lenb,j+lenc)
            ans=min(ans,right-left)

print(ans)

Measured memory_bytes: 55304
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v(m);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        v[i] = make_pair(a, b - 1);
    }
    sort(v.begin(), v.end());
    int ans = 1;
    int low = -1;
    int high = 1000000;
    for (int i = 0; i < m; i++) {
        if (v[i].first <= high) {
            low = max(low, v[i].first);
            high = min(high, v[i].second);
        } else {
            ans++;
            low = v[i].first;
            high = v[i].second;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
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 long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    // 答え
    cout << dp[N-1] << endl;
}

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

#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define mp make_pair

using namespace std;

using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;

const int INF = 1e9;
const int MOD = 1e9+7;

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

signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int D, G; cin >> D >> G;
    vi p(D), c(D); REP(i, D) cin >> p[i] >> c[i];
    int ans = INF;
    
    REP(i, 1 << D)
    {
        bitset<10> b(i);
        int count = 0, score = 0;
        REP(j, D) if(b[j]) score += p[j]*(j+1)*100+c[j], count += p[j];
        if(score < G)
        {
            for(int j = D-1; j >= 0; j--)
            {
                if(!b[j])
                {
                    count += min((G-score+(j+1)*100-1)/((j+1)*100), p[j]);
                    score += min((G-score+(j+1)*100-1)/((j+1)*100), p[j]) * (j+1)*100;
                    break;
                }
            }
        }
        if(score >= G) chmin(ans, count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256