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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const LL U = 1e9;

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

  int H, W, h, w;
  cin >> H >> W >> h >> w;
  if(h*w == 1){
	cout << "No" << endl;
	return 0;
  }
  LL C = h * w - 1;
  LL lb = 1, ub = 1e9+10;
  LL mn = h*w, mx = 1;
  while(ub-lb>1){
	LL d = (lb + ub) / 2;
	LL a = (U - d) / C;
	LL b = a * C + d;
	if(a <= U && b <= U){
	  ub = d;
	  mn = b;
	  mx = a;
	}
	else
	  lb = d;
  }
  
  VVL xs(H, VL(W, 0));
  LL S = 0;
  REP(y,H) REP(x,W){
	if(y % h == h-1 && x % w == w-1)
	  xs[y][x] = -mn;
	else
	  xs[y][x] = mx;
	S += xs[y][x];
  }

  if(S <= 0){
	cout << "No" << endl;
	return 0;
  }
  cout << "Yes" << endl;
  REP(y,H){
	REP(x,W) cout << (x?" ":"") << xs[y][x];
	cout << endl;
  }

  return 0;
}


Measured memory_bytes: 4864
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n', '', _, String).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
*/

main:-
    get_number(X),
    Y is X * X * X,
    writeln(Y).


Measured memory_bytes: 8184
/*
 _   ________   ___       __ ___   _           _  _
| | / /|  _  \ / _ \     / // _ \ | |         | |(_)
| |/ / | | | |/ /_\ \   / // /_\ \| | __ __ _ | | _
|    \ | | | ||  _  |  / / |  _  || |/ // _` || || |
| |\  \| |/ / | | | | / /  | | | ||   <| (_| || || |
\_| \_/|___/  \_| |_//_/   \_| |_/|_|\_\\__,_||_||_|
*/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
const int N = 1e6+50;
const int mod = 1e9+7;
const int in = 1e9+9;
typedef pair<int,int> ii;
int n, ans = 0;
int fact[N],inv[N];
#define fi first
#define se second
int binpow(int a,int n){
	if(n==1) return a%mod;
	if(n%2==1) return (binpow(a,n-1)*a)%mod;
	int res = binpow(a,n/2)%mod;
	return (res*res)%mod;
}
void Init(){
	fact[0] = 1;
	for (int i=1;i<=n;i++) fact[i] = fact[i - 1] * i % mod;
	inv[n] = binpow(fact[n],mod-2);
	for (int i=n;i>=1;i--) inv[i-1] = inv[i]*i % mod;
}
 
int C(int n,int k){
	return n<k?0:(fact[n]%mod*inv[k]%mod*inv[n-k]%mod)%mod;
}
signed main(){
	cin >> n;
	Init();
	int tmp = 0;
	for(int i=(n+1)/2;i<n;i++){
		int res = ((C(i-1,n-i-1)%mod*fact[i]%mod*fact[n-i-1]%mod)%mod-tmp+mod)%mod;
		(ans += res*i) %= mod;
		(tmp += res) %= mod;
	}
	cout << ans%mod;
}


Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i = 0; i< (n); ++i)
const long long INF = 1LL<<58;

// aを常に小さい値にする　大きい値にする
template<class T> bool chmin(T &a, T b){ if(a>b) a = b; }
template<class T> void chmax(T &a, T b){ if(a<b) a = b; }

// 二分探索 前方のindexを返すもの（自分自身を含む） 前方: -INF側のこと
template<class T> int former(const vector<T> &v, T x){
    return upper_bound(v.begin(), v.end(), x) - v.begin() -1; // upper_bound : keyより大きい要素の内の一番左側のイテレータを返す
}
// 二分探索 後方のindexを返すもの（自分自身を含む）後方: INF側のこと
template<class T> int latter(const vector<T> &v, T x){
    return lower_bound(v.begin(), v.end(), x) - v.begin(); // lower_bound : key以上の要素の内の一番左側のイテレータを返す
}

// 最大公約数を求める GCD
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


// 素因数分解 pair
vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) {
            ++num;
            n /= p;
        }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

const int MAX = 210000;
const int MOD = 1000000007;

//  二項係数の計算nCk セット
//  https://drken1215.hatenablog.com/entry/2018/06/08/210000
//  使い方としては、最初に一度前処理として COMinit() をしておけば、あとは COM(n, k) 関数を呼べばよい
//  前処理 COMinit(): O(n)
//　クエリ処理 COM(n, k): O(1)
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int vector_finder(std::vector<int> vec, int number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
    }
    else { // 発見できなかったとき
        return 0;
    }
}

/*
 * 二次元累積和　いもす法

 *
 * */

int main() {

    int N, M, Q;
    cin >> N >> M >> Q;
    int l, r;
    //区間[l,r]を走る列車について考える。これを二次元平面上の(y座標,x座標)=(l,r)
    //の点とみなすとこの列車を完全に含むような区間はy<=lかつr<=xの範囲全てになる
    int imos[550][550];//imos[y][x]でyからxまでの区間に含まれる列車の本数
    for (int i = 0; i < 550; ++i) {
        for (int j = 0; j < 550; ++j) {
            imos[i][j] = 0;
        }
    }
    for (int i = 0; i < M; ++i) {
        cin >> l >> r;
        imos[l][r]++;
    }
    for (int i = 510; i >0; --i) {
        for (int j = 0; j <510; ++j) {
            imos[i - 1][j] += imos[i][j];
        }
    }
    for (int i = 0; i < 510; ++i) {
        for (int j = 0; j < 510; ++j) {
            imos[i][j + 1] += imos[i][j];
        }
    }
    for (int i = 0; i < Q; ++i) {
        cin >> l >> r;
        cout << imos[l][r] << endl;
    }
}

Measured memory_bytes: 2048
#include<iostream>
using namespace std;
 
int a[200010];
int ans[200010];
 
int main(){
int n;
cin>>n;
  
for(int i=2;i<=n;i++)
{
	cin>>a[i];
}
for(int i=2;i<=n;i++)
  ans[a[i]]++;
for(int i=1;i<=n;i++)
 cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 5196
#include<iostream>
using namespace std;
long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N;
int A[10000];
main()
{
	cin>>N;
	long ans=0;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		(ans+=power(A[i],mod-2))%=mod;
	}
	for(int i=2;i*i<=1e6;i++)
	{
		int cnt=0;
		for(int j=0;j<N;j++)
		{
			int now=0;
			while(A[j]%i==0)
			{
				now++;
				A[j]/=i;
			}
			if(cnt<now)cnt=now;
		}
		(ans*=power(i,cnt))%=mod;
	}
	for(int i=0;i<N;i++)
	{
		if(A[i]>1)
		{
			for(int j=i+1;j<N;j++)
			{
				if(A[i]==A[j])
				{
					A[j]=1;
				}
			}
			(ans*=A[i])%=mod;
		}
	}
	cout<<ans<<endl;
}

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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair< int, int > pii;
typedef vector< int > vi;
ll gcd(ll a, ll b) { 
    if (a > b) swap(a,b);
    if (a == 0) return b;
    return gcd(b % a, a);
}

ll euclid(ll a, ll b, ll &x, ll &y) {
if (b) { ll d = euclid(b, a % b, y, x);
return y -= a/b * x, d; } return x = 1, y = 0, a;
}

const ll mod = 1000000007, LIM = 2000003;

ll invert(ll a) {
    ll x, y, g = euclid(a, mod, x, y);
    assert(g==1);
    return (x+mod) % mod;
}

ll fact[LIM+1];
ll binom(int a, int b) {
    ll ans = (fact[a] * invert(fact[b])) % mod;
    return (ans * invert(fact[a-b])) % mod;
}
ll solve(int r, int c) {
    if (r < 0 || c < 0) return 0;
    return binom(r+c+2, r+1)-1;
}

int main() {
    int r1, c1, r2, c2; cin >> r1 >> c1 >> r2 >> c2;

    fact[0] = 1;
    for (int i = 1; i <= LIM; i++) {
        fact[i] = (i * fact[i-1]) % mod;
    }

    ll ans = solve(r2, c2) - solve(r2, c1-1) - solve(r1-1,c2) + solve(r1-1, c1-1);
    ans = (ans % mod + mod) % mod;
    cout << ans << '\n';
}


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

int main(){
    int N;
    cin >> N;
    vi A(N+1);
    for(int i = 1; i <= N; i++){
        cin >> A[i];
    }

    map<int, int> people;
    for(int i = 1; i <= N; i++){
        people[A[i]] = i;
    }

    for(int i = 1; i <= N; i++){
        auto itr = people.find(i);
        cout << itr->second;
        if(i != N) cout << " ";
        else cout << endl;
    }

    return 0;
}

Measured memory_bytes: 8316
S=input()
Q=int(input())
L=list()
B=True
X=''
Y=''
for i in range(Q):
  L=list(input().split())
  if L[0]=='1':
    B=not(B)
  else:
    if ((L[1]=='1' and B) or (not(L[1]=='1' or B))):
      Y=Y+L[2]
    else:
      X=X+L[2]
S=S[::-1]
S=S+Y
S=S[::-1]
S=S+X
if not(B):
  S=S[::-1]
print(S)

Measured memory_bytes: 4460
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <cmath>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
const int inf = 1e9;
const ll linf = 1LL << 50;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  ll sum = 0;
  vector<int> t;
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    t.pb(x);
    sum += x;
  }
  int m;
  cin >> m;
  for(int i = 0; i < m; i++){
    int p, x;
    cin >> p >> x;
    cout << sum - t[p-1] + x << endl;
  }
	return 0;
}


Measured memory_bytes: 256
def main():
    N,Y = map(int, input().split())

    m_man = Y // 10000

    for x in range(m_man, -1, -1):
        m_gosen = (Y - 10000*x) // 5000
        
        for y in range(m_gosen, -1, -1):
            z = (Y - 10000*x - 5000*y) // 1000
            
            if x + y + z == N:
                print('{} {} {}'.format(x, y, z))
                quit()
    
    print('-1 -1 -1')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
// C.

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>

using namespace std;

typedef pair<int, int> II;
typedef vector<II> IIVec;

int main(int argc, char *argv[])
{
	IIVec v;
	int N;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		v.push_back(II(a, i));
	}
	sort(v.begin(), v.end());
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		ans += (i % 2) != (v[i].second % 2);
	}
	cout << ans / 2 << endl;
	return 0;
}


Measured memory_bytes: 1400
import collections
n=int(input())
s=list(input())
cnte=s.count('E')
cntw=s.count('W')
#print(cnte,cntw)
ans=n
a=0
b=0
for i in range(n):
    if s[i]=='E':
        a+=1
    elif s[i]=='W':
        b+=1
    c=cnte-a
    d=cntw-b
    tmp=b+c
    if s[i]=='W':
        tmp-=1
    ans=min(ans,tmp)
#    print(i,tmp)
print(ans)


Measured memory_bytes: 11760
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,s=40,c;
  cin >> N;
  for (int i=0;i<N;i++){
    c = 0;
    cin >> A;
    for (int j=0;j<30;j++){
      if (A % 2 == 1){
        break;
      }else if (A % 2 == 0){
        c += 1;
        A /= 2;
      }
    }
    if (c < s){
      s = c;
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
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;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int n;cin>>n;
    vector<int> A(n);
    vector<int> B(n);
    int max=0;
    REP(i,n){
        cin>>A[i];
    }
    B=A;
    sort(all(B));
    if(B[n-1]==B[n-2]){
        REP(i,n)cout<<B[n-1]<<endl;
    }
    else{
        REP(i,n){
            if(A[i]!=B[n-1])cout<<B[n-1]<<endl;
            else cout<<B[n-2]<<endl;
        }
    }
}

Measured memory_bytes: 4736
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;

int y[100005];

int main() {
	

	int a, b;
	while (cin >> a >> b) {
		if (a > b)swap(a, b);
		for (int i = a; a >= 1; i--) {
			if (a%i == 0 && b%i == 0) {
				cout << i << endl; break;
			}
		}
	}

	return 0;

}

Measured memory_bytes: 3008
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
int s;
int sn=0;
  int coutn;
scanf("%d",&s);
  coutn=s;
for(;;){
sn=sn+(s%10);
s=s/10;
if(s==0){break;}
}
if(coutn%sn==0){printf("Yes");}
else{printf("No");}
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//nCrを返す関数.
long long int comb(long long int n, long long int r){
	if(n < r || n < 0)
		return 0;
	long long int x = 1, y = 1;
	if (n-r < r) r = n - r;
	for (long long int i = 0; i < r; i++)
	{
		x = x * (n - i);
		y = y * (i + 1);
	}
	return x / y;
}


int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << max(c - (a - b), 0) << endl;

	return 0;
}

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

int main()
{
  int n;
  while (cin >> n) {
    for (int dataset = 0; dataset < n; ++dataset) {
      string s;
      cin >> s;
      
      string ans = "";
      int index = 0;
      for (int i = 0; i < s.size(); i += 3) {
	if (index == (int)ans.size()) {
	  ans += s[i];
	} else if (index < 0) {
	  ans = s[i] + ans;
	  index = 0;
	}
	if (i+2 < s.size() && s[i+1] == '-' && s[i+2] == '>')
	  ++index;
	else if (i+2 < s.size())
	  --index;
      }
      cout << ans << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;

int main()
{
	int K;
	string acl="ACL";
    string ans=""; 
	cin >> K;
	for(int i=0;i<K;i++)
	{
		ans+=acl;
	}
	
	cout << ans<< endl;

}


Measured memory_bytes: 3556
#include<iostream>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
//1000000000000223
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
indexed_set st ;
ll n , a[200009] , k , ans;
int main()
{
    IO
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>a[i] , a[i]+=a[i-1];
    st.insert(0);
    for(int i=1;i<=n;i++)
    {
        ll cur=a[i]-k*i;
        ans+=st.order_of_key(cur+1);
        st.insert(cur);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 14336
import sys

N, T = map(int, sys.stdin.readline().split())

A = map(int, sys.stdin.readline().split())

cnt = 0
diff = 0
miniA = A[0]
for i in xrange(1, N):
    if A[i] < miniA:
        miniA = A[i]
    if A[i] - miniA > diff:
        diff = A[i] - miniA
        cnt = 1
    elif A[i] - miniA == diff:
        cnt += 1
print cnt


Measured memory_bytes: 11304
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
 
using namespace std;
using namespace __gnu_pbds;
 
 
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define ini ll_MAX
#define inl LLONG_MAX
#define MOD 1000000007
#define sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define F0R(i, a) for (ll i = 0; i < (a); i++)
#define FORR(i, a, b) for (ll i = a; i >= (b); i--)
#define F0RR(i, a) for (ll i = a; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define pbds tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
 
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
 
using pii = pair<ll, ll>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
 
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
 
ll mod(ll a,ll b)
{
    return (b+a%b)%b;
}
 
ll gcd(ll a,ll b)
{
    if(b==0)return a;
    else return gcd(b,a%b);
}
ll po(ll a,ll b)
{
    ll ans = 1;
    while(b--)
        ans*=a;
    return ans;
}
ll pom(ll a,ll b,ll mod)
{
    if(b==0)return 1;
    ll k = pom(a,b/2,mod);
    if(b%2==0)return (k*k)%mod;
    else return ((k*k)*mod*a)%mod;
}
 
ll sqdist(ll a,ll b,ll c,ll d)
{
    return (a-c)*(a-c)+(b-d)*(b-d);
}
ll fact(ll n)
{
    if(n==0)return 1;
    ll ans = 1;
    FOR(i,1,n+1)ans*=i;
    return ans;
}

 
void solve()
{
 int n,m;cin>>n>>m;
 if(n==m)cout<<"Yes";
 else cout<<"No";
}
 
 
main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif
    // ll t;
    //cout<<"Y"<<endl;
    //cin>>t;
    //while(t--)
        solve();
}

Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_C&lang=jp

#include <iostream>
#include <queue>
using namespace std;
static const int INFTY = (1<<21);

int N;
int E[100][100];
int d[100];

void bfs(int s){
  queue<int> q;
  q.push(s);
  for (int j = 0; j < N; j++)d[j]=INFTY;
  d[s] = 0;
  int u;
  while(!q.empty()){
    u = q.front();
    q.pop();
    for(int v = 0; v < N; v++){
      if(E[u][v] == 0) continue;
      if(d[v] != INFTY) continue;
      d[v] = d[u] + 1;
      q.push(v);
    }
  }
  for(int k = 0; k < N; k++){
    if(d[k] == INFTY){
      cout << k+1 << " " << -1 << endl;
    }else{
      cout << k+1 << " " << d[k] << endl;
    }
  }
}



int main(){
  //Eへのグラフ情報の代入
  cin >> N;
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      E[i][j] = 0;
    }
  }
  for ( int i = 0; i < N; i++){
    int dummy;
    cin >> dummy;
    int n;
    cin >> n;
    for (int c = 0; c < n; c++){
      int dest;
      cin >> dest;
      E[dummy-1][dest-1] = 1;
    }
  }

  bfs(0);

  return 0;


}



Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 1000000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
//typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
int n,k,ans,sum;
int a[211111];
signed main(){
	cin>>n;
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	sum%=MOD;
	rep(i,n){
		sum-=a[i];
		sum=(sum+MOD)%MOD;
		ans+=a[i]*sum;
		ans%=MOD;
	}
	cout<<ans<<endl;
	
}


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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
const ll MOD = 1e9+7;

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

    ll ans = 1;
    rep(i, N){
        ans = ans*(i+1) % MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

void solve();

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

struct Node{
    ll x;
    Node(ll x):x(x){}
    Node operator*(const Node &node)const{
        return Node(x+node.x);
    }
}e(0);

vector<vector<Node>> data;
ll sz=1;

void update(ll i,ll k,Node node){
    k+=sz;
    data[i][k]=node;
    while(k>1){
        k>>=1;
        data[i][k]=data[i][2*k]*data[i][2*k+1];
    }
}

Node query(ll i,ll a,ll b,ll k=1,ll l=0,ll r=sz){
    if(r<=a||b<=l)return e;
    if(a<=l&&r<=b)return data[i][k];
    return query(i,a,b,2*k,l,(l+r)/2)*query(i,a,b,2*k+1,(l+r)/2,r);
}

void solve(){
    ll n;cin>>n;
    string s;cin>>s;
    ll q;cin>>q;
    
    while(sz<n)sz<<=1;
    data.assign(26,vector<Node>(2*sz,e));

    rep(i,n)update(s[i]-'a',i,Node(1));

    while(q--){
        ll op;cin>>op;
        if(op==1){
            ll x;cin>>x;--x;
            char c;cin>>c;
            update(s[x]-'a',x,Node(0));
            s[x]=c;
            update(c-'a',x,Node(1));
        }else{
            ll l,r;cin>>l>>r;
            --l;--r;
            ll ans=0;
            rep(i,26)ans+=query(i,l,r+1).x>0;
            cout<<ans<<endl;
        }
    }
}

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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
vector<double> p;
double dp[3005][3005];
int main()
{
    int n;
    cin >> n;
    
    p.resize(n+1);
    for (int  i = 1; i <=n; i++)
    {
        cin >> p[i];
    }
    
    dp[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            dp[i + 1][j + 1] += dp[i][j] * p[i+1];
            dp[i + 1][j] += dp[i][j] * (1-p[i+1]);
        }
    }
    double ans = 0;
    for (int i = 0; i <=n; i++)
    {
        if(2*i > n)
        {
            ans += dp[n][i];
        }
    }

    cout << setprecision(11) << ans << endl;
}


Measured memory_bytes: 70656
#include <stdio.h>
#include <string.h>
#include <math.h>
int c[55][55];
int d[55][55];

void init(int w,int h){
	int i,j;
	for(i=0; i<w; i++){
		for(j=0; j<h; j++){
			c[i][j]=0;
			d[i][j]=0;
		}
	}
}

int serch(int x,int y,int w,int h){
	int i,j;
	if(c[x][y]==0||d[x][y]==1)return 0;
	d[x][y]=1;
	for(i=x-1; i<=x+1; i++){
		for(j=y-1; j<=y+1; j++){
			if(i>=0&&i<w&&j>=0&&j<h)serch(i,j,w,h);
		}
	}
	return 1;
}

int main(){
	int w,h;
	int i,j;
	int ans;
	while(1){
		scanf("%d %d",&w,&h);
		if(w==0&&h==0)break;
		ans=0;
		init(w,h);
		for(j=0; j<h; j++){
			for(i=0; i<w; i++){
				scanf("%d",&c[i][j]);
			}
		}
		for(j=0; j<h; j++){
			for(i=0; i<w; i++){
				if(serch(i,j,w,h))ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  bool flag = false;
  rep(i,3) {
    if (s[i] == '7') flag = true;
  }
  cout << (flag ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#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(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }


typedef long long ll;
using P = pair<ll, ll>;		//P.first, P.second
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

struct UnionFind{
    vector<int> Parent;
    vector<int> sizes;
    UnionFind(int n):Parent(n),sizes(n,1){ rep(i,n)Parent[i]=i; }
    //find the root of x
    int root(int x){
        if(x!=Parent[x]){
        Parent[x] = root(Parent[x]);
        }
        return Parent[x];
    }
    //merge x and y
    void unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(x>y) swap(x, y);
        Parent[y] = x;
        sizes[x] += sizes[y];
    }
    bool same(int x,int y){ return root(x) == root(y); }
    int size(int x){ return sizes[root(x)]; }
};

/*~使い方講座~
まず、main関数内で 
    UnionFind uni(N);
と呼び出します（これでUnionFind木のuniちゃんが呼び出されます）。
uniちゃんの中には、NodeがN個あり、
それぞれの親とそれが属する集合の数（size）が定義されています。
    ①二つのNode xとy が同じ集合に属するか確認するとき
    uni.same(x, y);
    とすることで、それらが同じかどうかをtrue/falseで返す
    ②あるNode x が含まれる集合の大きさを知りたいとき
    uni.size(x);
    ③二つのNode xとyを同じ集合に属させたいとき
    uni.unite(x, y);
    ④あるNode xの根を知りたいとき
    uni.root(x);
*/
/*~UnionFind木が出題された問題~
①D-Decayed Bridges
https://beta.atcoder.jp/contests/abc120
/Users/knaga/procon/Atcoder/abc120
UnionFind木は繋がりを断つことはできないが、
構成することはできるので、逆からやるやつ。
②D-Equals
https://beta.atcoder.jp/contests/abc097
/Users/knaga/procon/Atcoder/abc097
swapすればそれらは行き来可能になるので、実質パイプ。
③B-Union Find
https://beta.atcoder.jp/contests/atc001
/Users/knaga/procon/Atcoder/atc001
典型問題。uniteして、繋がってるか聞かれたら答えるだけ。
④B-道路工事
https://beta.atcoder.jp/contests/arc032/
/Users/knaga/procon/Atcoder/arc032
すべての点に対して根を考えることで、
グループが幾つに分かれているかを知ることができる
⑤D-連結
https://beta.atcoder.jp/contests/abc049
/Users/knaga/procon/Atcoder/abc049
二つのUnionFind木を管理して、
同時に繋がっていることを根のPairを持って
mapで管理すると良い
[解説]http://drken1215.hatenablog.com/entry/2019/06/29/182300
*/
ll a,b;
int main() {
	ll N,M;
	cin>>N>>M;
	vector<P> ba;
	rep(i,N){
		cin>>a>>b;
		ba.push_back({b,-a});
	}
	sort(all(ba),greater<P>());
	printpair(ba);
	UnionFind uni(M);
	vector<ll> ansv(M);
	rep(i,N){
		a = -ba[i].second;
		b = ba[i].first;
		cerr<<a<<" "<<b<<endl;
		cerr<<M-a<<endl;
		if(M-a<0){
			continue;
		}
		ll umeru = uni.root(M-a);
		if(ansv[umeru]==0){

			ansv[umeru] = b;

			if(umeru-1>=0){
				cerr<<umeru<<"の親: "<<uni.root(umeru)<<endl;
				cerr<<umeru-1<<"の親: "<<uni.root(umeru)<<endl;
				uni.unite(umeru,umeru-1);
				cerr<<"結合"<<endl;
				cerr<<M-a<<"の親: "<<uni.root(umeru)<<endl;
				cerr<<M-a-1<<"の親: "<<uni.root(umeru-1)<<endl;
			}

		}
		//print(ansv);
	}
	ll ans = 0;
	print(ansv);
	rep(i,M){
		ans+=ansv[i];
	}
	cout<<ans<<endl;
}

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

using namespace std;

int main()
{
	char a, b;
	cin >> a >> b;
	
	if (a == 'H') {
		if (b == 'H') {
			cout << "H";
		}
		else {
			cout << "D";
		}
	}
	else {
		if (b == 'H') {
			cout << "D";
		}
		else {
			cout << "H";
		}
	}
	
	return 0;
}


Measured memory_bytes: 256
n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
import itertools, math
l = 0
for perm in itertools.permutations(xy, n):
  for i in range(n-1):
    l += ((perm[i][0] - perm[i+1][0])**2 + (perm[i][1] - perm[i+1][1])**2)**0.5
    
print(l/math.factorial(n))

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    int N;
    while(cin >> N,N){
        vector<int> l(N); for(auto& in:l) cin >> in;
        
        tuple<int,int,int> ans;
        double minH = INF;
        
        for(int S = 0; S <= 15; S++){
            for(int A = 0; A <= 15; A++){
                for(int C = 0; C <= 15;C++){
                    
                    vector<int> R(N+1);
                    R[0] = S;
                    for(int i = 1; i <= N;i++) R[i] = (A*R[i-1] + C)%256;
                    
                    map<int,int> mp;
                    for(int i = 1; i <= N;i++) mp[(l[i-1]+R[i])%256]++;
                    
                    double H = 0;
                    for(auto p:mp){
                        H -= (p.second/(double)N)*(log(p.second/(double)N));
                    }
                    if(H + 1e-9 < minH){
                        minH = H;
                        ans = tuple<int,int,int>(S,A,C);
                    }
                }
            }
        }
        
        
        cout << get<0>(ans) << " " << get<1>(ans) << " " <<get<2>(ans) << endl;
    }
    return 0;
}



Measured memory_bytes: 3348
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;


int main() {
	int n; cin >> n;
	vector<ll> a(n + 1);
	for (int i = 1; i <= n; i++) cin >> a[i], a[i] -= i;
	sort(a.begin() + 1, a.end());
	ll b = a[n / 2 + (n & 1)];
	ll ans = 0;
	for (int i = 1; i <= n; i++) ans += abs(b - a[i]);
	cout << ans << endl;
	return 0;
}


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

int main()
{
    string ss;
    while(cin >> ss)
    {
        char winner = 'd';
        //o
        //c
        if(ss[0]=='o'&&ss[3]=='o'&&ss[6]=='o') winner ='o';
        if(ss[1]=='o'&&ss[4]=='o'&&ss[7]=='o') winner ='o';
        if(ss[2]=='o'&&ss[5]=='o'&&ss[8]=='o') winner ='o';
        //¡
        if(ss[0]=='o'&&ss[1]=='o'&&ss[2]=='o') winner ='o';
        if(ss[3]=='o'&&ss[4]=='o'&&ss[5]=='o') winner ='o';
        if(ss[6]=='o'&&ss[7]=='o'&&ss[8]=='o') winner ='o';
        //ÈÈß
        if(ss[0]=='o'&&ss[4]=='o'&&ss[8]=='o') winner ='o';
        if(ss[2]=='o'&&ss[4]=='o'&&ss[6]=='o') winner ='o';
        //x
        //c
        if(ss[0]=='x'&&ss[3]=='x'&&ss[6]=='x') winner ='x';
        if(ss[1]=='x'&&ss[4]=='x'&&ss[7]=='x') winner ='x';
        if(ss[2]=='x'&&ss[5]=='x'&&ss[8]=='x') winner ='x';
        //¡
        if(ss[0]=='x'&&ss[1]=='x'&&ss[2]=='x') winner ='x';
        if(ss[3]=='x'&&ss[4]=='x'&&ss[5]=='x') winner ='x';
        if(ss[6]=='x'&&ss[7]=='x'&&ss[8]=='x') winner ='x';
        //ÈÈß
        if(ss[0]=='x'&&ss[4]=='x'&&ss[8]=='x') winner ='x';
        if(ss[2]=='x'&&ss[4]=='x'&&ss[6]=='x') winner ='x';

        cout << winner << endl;
    }

    return 0;
}

Measured memory_bytes: 0
/*
Á·Ï°Ìâ£ºGCD and LCM_AOJ 0005
	´ËÌâÍØÕ¹ÁËLCM(the least common multiple)µÄÇó·¨¡£ 
*/ 

#include <cstdio>
#include <iostream>
using namespace std;

long long a, b;

long long gcd(long long a, long long b)
{
	if(b==0)
		return a;
	return gcd(b, a%b);
}

int main()
{
	while(scanf("%lld%lld", &a, &b)!=EOF)
	{
		long long g=gcd(a, b);
		printf("%lld ", g);
		printf("%lld\n", a/g*b);//×¢ÒâÕâÀïÏÈ×ö³ý·¨£¡ 
		
	}
	
	return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, i,j;
    double a[10],b[10];
    double c=0;
    scanf("%d",&n);
    for (i=0;i<n;i++)
        scanf("%lf%lf",&a[i],&b[i]);
    for (i=0;i<n-1;i++)
        for (j=i+1;j<n;j++)
            c=c+sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]))*2/n;
    printf("%.10f",c);
    return 0;
}

Measured memory_bytes: 3848
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		//????????£?????????????????????
		Scanner sc = new Scanner(System.in);
		
		//??°????????????
		int num = sc.nextInt();
		//??????????????°??????????????????
		int sum = num * num * num;
		//??¨?????????
		System.out.println(sum);
	}
}

Measured memory_bytes: 25964
// https://atcoder.jp/contests/abc134/tasks/abc134_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    bitset<200001> bs;
    FOR(i, 1, N + 1) {
        int t;
        cin >> t;
        if (t) {
            bs.set(i);
        }
    }
    bitset<200001> ans;
    int cnt = 0;
    for (int i = N; i >= 1; i--) {
        int sum = 0;
        for (int j = i * 2; j <= N; j += i) {
            sum += ans[j];
        }
        if (sum % 2 != bs[i]) {
            ans.set(i);
            cnt++;
        }
    }
    cout << cnt << "\n";
    for (int i = 1; i <= N; i++) {
        if (ans[i]) {
            cout << i << (--cnt ? " " : "\n");
        }
    }

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

const ll MOD = 1000000007;
const ll INF = 1e18; //1*10^18

ll powll(ll a, ll n)
{ //O(log n)
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a;
    }
    a = a * a;
    n >>= 1; //(n & 1)=(n % 2 !=0)
  }
  return res;
}

ll modpow(ll a, ll n, ll mod) //O(log n)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1) //(n & 1)=(n % 2 !=0)
    {
      res = res * a % mod;
    }
    a = a * a % mod;
    n >>= 1; //(n>>=1)=(n/2)
  }
  return res;
}

int ReturnDigit(ll num)
{
  string number = to_string(num);
  return number.length();
}

const ll MAX = 1e4;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
  // srand((unsigned int)time(NULL));//--> rand()
  ll i, j, k, l, ans = 0;
  ll n;
  cin >> n;
  ans = (0 + (n - 1)) * (n) / 2;
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n;
	cin >> n;
	vector<int>arr(n);
	rep(i, n)cin >> arr[i];
	sort(all(arr));
	cout << arr[n - 1] - arr[0] << endl;
	return 0;
}



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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    ll n,k,c;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    ll dpl[n+1],dph[n+1];
    dpl[0]=0;
    dph[0]=0;
    ll last=-INF;
    repA(i,1,n)
    {
        if(s[i-1]=='x') dpl[i]=dpl[i-1];
        else if(last +c < i)
        {
            last=i;
            dpl[i]=1+dpl[i-1];
        }
        else dpl[i]=dpl[i-1];
    }
    last=-INF;
    repA(i,1,n)
    {
        if(s[n-i]=='x') dph[i]=dph[i-1];
        else if(last +c <i)
        {
            last=i;
            dph[i]=1+dph[i-1];
        }
        else dph[i]=dph[i-1];
    }
    rep(i,n)
    {
        ll left=i;
        ll right=n-i-1;
        if(s[i]=='o'  && dpl[left] + dph[right] <k  && dpl[left] +1 + dph[right] == k)
        {
            cout<<i+1<<'\n';
            // break;
        }
    }
    return 0;
}


Measured memory_bytes: 5012
input()
number_list = list(map(int, input().split()))
count = 0
for i in range(len(number_list)):
    max_height = 0
    for j in range(i):
        max_height = max(max_height, number_list[j])
    if(max_height <= number_list[i]):
        count += 1
print(count)

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

int main() {
  int n;
  scanf("%d", &n);
  ll ans = 0;
  for (int i = 1; i<=n; i++) {
    if(i%3!=0 && i%5!=0) ans+=i;
  }

  printf("%lld\n", ans);
};

Measured memory_bytes: 3844
n = gets.chomp.split.map(&:to_i)

hp = gets.chomp.split.map(&:to_i)
hp.delete(0)

while hp[1] != nil
    hp.sort!

    pivot = hp[0]
    hp.delete_at(0)
    hp.length.times do |i|
        hp[i] = hp[i] % pivot
    end
    hp.push(pivot)

    hp.delete(0)
end

puts hp[0]


Measured memory_bytes: 10240
def solve():
  ans = 0
  X = int(input())
  lis = [False]*(X+1)
  lis[1] = True
  for b in range(2,X+1):
    p = 2
    while b**p<=X:
      lis[b**p] = True
      p += 1
  for i in range(X,-1,-1):
    if lis[i]==True:
      return i
print(solve())

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	std::vector<int> dish(n);
	std::vector<int> satisfaction(n);
	std::vector<int> extra_satisfaction(n-1);

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

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

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


	// Now, we will first add all the satisfaction value we got by eating the lunch.
	// Remember that we ate in a random order.

	int ans = 0;
	for(int i=0; i < n; i++){
		ans += satisfaction[dish[i] - 1];
	}
    
    // Now we shall add the extra satisfaction.

    // if two consecutibve elements occur  in the dishes list, then we add the value from extra_satisfaction vector,
    // if we have 1 after 2. we need to pull; extra_satis[0] whic is i-1.

    for(int i=0; i<n-1; i++){
    	if(dish[i+1] == dish[i]+1){
            // now we add 
            ans += extra_satisfaction[dish[i]-1];
    	}
    }

	cout << ans;
}

Measured memory_bytes: 256
var arr=readLine()!.characters.split{$0==" "}.map{(String($0))}

var win : Int = 0
for character in arr[0].characters {
	if( character == "o" ) {
      win += 1
    }
}

( ( 15 - arr[0].characters.count + win ) >= 8 ) ? print( "YES" ) : print( "NO" ) 

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

//#include <unordered_map>

//#include <iostream>//POJ
//#include <vector>
//#include <string>
//#include <iomanip>
//#include <math.h>
//#include <algorithm>
//#include <cstring>
using namespace std;
#define setc cin.tie(0);ios::sync_with_stdio(0)
#define dd(n) cout<<fixed<<setprecision(n)
#define repi(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)
#define rep(i,n) repi(i,0,n)
#define repi_(i,a,b) for(int i=(a), i##_len=(b); i<=i##_len; ++i)
#define rep_(i,n) repi_(i,0,n)
#define repir(i,a,b) for(int i=(a)-1, i##_first=(b); i>=i##_first; --i)
#define repr(i,n) repir(i,n,0)
#define repir_(i,a,b) for(int i=(a), i##_first=(b); i>=i##_first; --i)
#define repr_(i,n) repir_(i,n,0)
#define all(x) (x).begin(),(x).end()
#define vsort(v) sort((v).begin(), (v).end())
#define gsort(v) tsort(v); reverse((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())
//template<typename T> T vpop(vector<T> *v) {
//	T res = v->back();
//	v->pop_back();
//	return res;
//}
//char vpop(string *v) {
//	char res = v->back();
//	v->pop_back();
//	return res;
//}
#define siz(v) ((int)(v).size())
#define ers(v, n) (v).erase((v).begin() + n)
#define cnt(v, n) count(all(v), n)
#define vmin(v) *min_element(v.begin(), v.end())
#define vmax(v) *max_element(v.begin(), v.end())
#define contain(q) !q.empty()
#define cont(q) !q.empty()
//#define qpop(q, a, b) a=q.back().first;b=q.back().second;q.pop()
//#define pqpop(p, a, b) a=q.top().first;b=q.top().second;q.pop()
#define el "\n"
#define sp " "
#define pi 3.14159265358979
#define co(x) cout<<x<<el
#define coc(c, a, b) if(c)co((a));else co((b))
#define cosp(x) cout<<(x)<<' '
#define YES(c) coc(c,"YES", "NO")
#define Yes(c) coc(c,"Yes", "No")
#define yes(c) coc(c,"yes", "no")
#define POSSIBLE(c) coc(c, "POSSIBLE", "IMPOSSIBLE")
#define Possible(c) coc(c, "Possible", "Impossible")
#define possible(c) coc(c, "possible", "impossible")
#define inf INT_MAX
#define wildcard(T) numeric_limits<T>::min()

#define pb push_back
#define pq priority_queue
#define np next_permutation

#ifdef tqktmp_2
#define gc() getchar(); getchar()
#else
#define gc() 1
#endif
const unsigned int bf0 = (1 << 0);
const unsigned int bf1 = (1 << 1);
const unsigned int bf2 = (1 << 2);
const unsigned int bf3 = (1 << 3);
const unsigned int bf4 = (1 << 4);
const unsigned int bf5 = (1 << 5);
const unsigned int bf6 = (1 << 6);
const unsigned int bf7 = (1 << 7);

typedef long long lint;
typedef vector<int> ivec; typedef vector<string> svec;
typedef vector<lint> lvec;
typedef vector<vector<int>> ivvec;
typedef pair<int, int> P;

const int
dx8[8] ={ 0,1,1,1,0,-1,-1,-1 },
dy8[8] ={ 1,1,0,-1,-1,-1,0,1 },
dx4[4] ={ 0,1,0,-1 },
dy4[4] ={ 1,0,-1,0 };

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

int main(){
	setc;

	string s;cin>>s;
	s[5]=' ';s[13]=' ';
	co(s);
	gc();
}


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

ll lcm(ll a, ll b){
  ll g = gcd(a,b);
  return a/g*b;
}

int main(){
  int n; cin >>n;
  ll ans = 1LL;
  rep(i,n){
    ll t; cin >>t;
    ans = lcm(ans,t);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int A,B;
  cin>>A>>B;
  if((A+B)%2){
    cout<<"IMPOSSIBLE"<<endl;
  }else{
    cout<<(A+B)/2<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int n, k;
    cin >> n >> k;

    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());

    int s = 0;
    for (int i = 0; i < k; i++) {
        s += p[i];
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3632