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

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

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

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vll a(n); rep(i,n) cin>>a[i];
  
  vsort(a);
  ll cnt=0;
  rep(i,n-1){
    if(a[i]==a[i+1]) cnt++;
  }
  
  ll ans=n-(cnt+1)/2*2;
  cout<<ans<<endl;
  
}

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;
#if 0
  vvll g(n);
  rep(i, n - 1) {
    ll u, v;
    cin >> u >> v;
    u--;
    v--;
    if (u > v) {
      swap(u, v);
    }
    g[u].push_back(v);
    // g[v].push_back(u);
  }
#else
  vll u(n - 1), v(n - 1);
  rep(i, n - 1) {
    cin >> u[i] >> v[i];
    if (u[i] > v[i]) {
      swap(u[i], v[i]);
    }
  }
#endif
  vll s(n + 1);
  REP(i, n + 1) {
    s[i] = s[i] + i;
  }

  REP(i, n + 1) {
    s[i] += s[i - 1];
  }

  ll ans = 0;
  rep(i, n + 1) {
    ans += s[i];
  }

  rep(i, n - 1) {
    ll cnt = u[i] * (n - v[i] + 1);
    ans -= cnt;
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
	while(1) {
		vector<string> v;
		for(int i = 0; i < 3; i++) {
			string str;
			cin >> str;
			if(str == "0")
				goto EXIT;
			v.push_back(str);
		}

		for(int i = 0; i < 2; i++) {
			bool tate, yoko;
			bool naname0, naname1;
			char c;
			naname0 = naname1 = true;
			c = i ? 'b': 'w';
			for(int j = 0; j < 3; j++) {
				tate = yoko = true;
				for(int k = 0; k < 3; k++) {
					tate &= v[k][j] == c;
					yoko &= v[j][k] == c;
				}
				naname0 &= v[j][2-j] == c;
				naname1 &= v[j][j] == c;
				if(tate || yoko) {
					cout << c << endl;
					goto NEXT;
				}
			}
			if(naname0 || naname1) {
				cout << c << endl;
				goto NEXT;
			}
		}
		cout << "NA" << endl;
NEXT:;
	}
EXIT:;
}

Measured memory_bytes: 1188
#!/usr/bin/env python3
import sys
import collections

def solve(N: int):
    count = collections.defaultdict(int)
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                value = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if value > N:
                    break
                count[value] += 1

    for i in range(1, N+1):
        print(count[i])
    
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 10212
#include <bits/stdc++.h>
 
#define forn(i, n) for (llong i = 0ll; i < (llong) n; ++i)
#define fornn(i, l, r) for (llong i = (llong) l; i < (llong) r; ++i)
#define size(x) ((int) (x.size()))
 
using namespace std;
 
typedef long long llong;
const llong inf = (llong) 1e+9 + 7ll;
const llong linf = (llong) 1e+18 + 7ll;
const long double eps = (long double) 1e-9;
const long double pi = acosl((long double) -1.0);
const int alph = 26;

mt19937 mrand(random_device{} ()); 

template<typename T, typename U> inline llong umin(const T& a, const U& b) { return a < b ? a : b; }
template<typename T, typename U> inline llong umax(const T& a, const U& b) { return a > b ? a : b; }
 
static char buff[(int) 2e6 + 17]; // reads std::string
const int maxn = (int) 3e2 + 17;

llong k;

bool read()
{
	if (scanf("%lld", &k) != 1)
		return false;

	return true;
}

void solve()
{
	llong t = (k + 50ll * 49) / 50;
	vector<llong> ans(50, t);
	llong res = 50ll * t - 50 * 49;
	int j = 0;

	while (res < k)
	{
		++res;
		
		forn (i, 50)
			if (i == j)
				ans[i] += 50;
			else
				--ans[i];

		++j;
		j %= 50;
	}

	printf("50\n");

	forn (i, 50)
		printf("%lld ", ans[i]);

	printf("\n");
}

int main()
{
#if SEREZHKA
	freopen("file.in", "r", stdin);
#endif

	while (read())
		solve();

	return 0;
}


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

int a,b,c,d,s,w;
int main()
{
	scanf("%d %d %d",&a,&b,&c);
	
	s=a-c;
	d=0;
	w=s/(b+c);
		printf("%d\n",w);
	
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y){
  if(y == 0) return x;
  return gcd(y, x % y);
}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(all(ret));
  return (ret);
}

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

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

  ll gc = gcd(a,b);
  
  vector<ll> div = divisor(gc);
  ll n = div.size();
  ll ans = 1;
  rep(i,n){
    if(IsPrime(div[i])) ans++;
  }

  cout << ans << endl;
}


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

int gcd(int a, int b){
    assert(a>=0 && b >=0);
    if(a < b){
        return gcd(b,a);
    }
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

int lcm(int a, int b){
    assert(a>=0 && b >=0);
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

int main(){
    int a,b;
    while(cin >> a >> b){
        int g =gcd(a,b);
        cout << g << " " << (a / g) * b << endl;
    }
}

Measured memory_bytes: 3048
#include <stdio.h>

int n;
int A[30];

int solve(int i, int m) 
{
    if ( m == 0)
        return 1;
    if ( i >= n)
        return 0;

    return solve(i + 1, m) || solve(i + 1, m - A[i]);
}

int main(void)
{
    int q, i;
    int m;

    scanf("%d", &n);
    for (i = 0; i < n; i++) 
        scanf("%d", &A[i]);

    scanf("%d", &q);
    for (i = 0; i < q; i++) {
        scanf("%d",&m);
        if (solve(0, m))
            printf("yes\n");
        else
            printf("no\n");
    }

    return 0;
}


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


using namespace std;

#define int long long
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define ff first 
#define ss second 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpii;
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}


signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a,b;
	cin >> a >> b;
	if(b == 1){
		cout << 0;
		return 0;
	}
	a--,b--;
	cout << ((b - 1)/a) + 1;
	
}

Measured memory_bytes: 256
n,m,l = (int(x) for x in input().split())
A = [input().split() for i in range(n)]
B = [input().split() for i in range(m)]

C = [[0] * l for i in range(n)]

for i in range(n):
    x = 0
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
    print(*C[i])


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

const int BIG_NUM = 1e9;

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

    int n, r, s;
    cin >> n >> r;
    if(n < 10) {
        s = 100 * (10 - n);
    } else {
        cout << r;
        return 0;
    } 
    cout << r + s;
    return 0;
}



Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
int n,m,Ans;

struct node {
	int l,r;
}a[N];

bool cmp(node a,node b) {
	return a.l<b.l;
}

int main() {
	scanf("%d%d",&n,&m);
	for (int i=1; i<=m; i++) 
		scanf("%d%d",&a[i].l,&a[i].r);
	sort(a+1,a+m+1,cmp);
	int Now=0;
	for (int i=1; i<=m; i++) {
		if (a[i].r<=Now) Now=a[i].r-1;
		if (a[i].r>Now) {
			if (a[i].l>Now) {
				Now=a[i].r-1;
				Ans++;
			}
		}
	}
	printf("%d",Ans);
}


Measured memory_bytes: 1024
N = int(input())
l = []
for i in range(N):
    A = int(input())
    tmp = []
    for j in range(A):
        x, y = input().split()
        x, y = int(x) - 1, int(y)
        tmp.append([x,y])
    l.append(tmp)

def res(n):
    t = []
    for i in range(15):
        if n%2 != 0:
            t.append(i)
        n = n // 2
    return t

def judge(t):
    r = [-1] * N
    while(len(t) > 0):
        c = t.pop(0)
        if r[c] == -1:
            r[c] = 1
        elif r[c] == 0:
            return False
        for x, y in l[c]:
            if r[x] > -1 and r[x] != y:
                return False
            elif r[x] == -1:
                r[x] = y
                if y == 1 and (x not in t):
                    t.append(x)
    return True

count = 0;
for num in range(2**N):
    o = res(num)
    if judge(o[:]):
        count = max(count, len(o))

print(count)


Measured memory_bytes: 3188
N = int(input())
A = list(map(int,input().split()))

C = [0] * (N + 1)
for i in A:
    C[i] += 1

ans = 0
for i in C:
    ans += i * (i - 1) // 2

for i in range(N):
    print(ans - C[A[i]] + 1)

Measured memory_bytes: 26140
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	string ans = "No";
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) ans = "Yes";
	cout << ans << '\n';

	return 0;
}


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

using namespace std;

class DisjointSet {
public:
	vector<int> rank, p;

	DisjointSet() {}
	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size);
		for (int i = 0; i < size; i++) {
			p[i] = i;
		}
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
			return;
		}
		if (rank[x] < rank[y]) {
			p[x] = y;
			return;
		}
		p[y] = x;
		rank[x]++;
	}

	int findSet(int x) {
		while (x != p[x]) {
			x = p[x];
		}
		return x;
	}
};

int main() {
	int n, q;
	int com;
	int x, y;

	cin >> n >> q;
	DisjointSet ds = DisjointSet(n);

	for (int i = 0; i < q; i++) {
		cin >> com >> x >> y;
		if (com == 0) {
			ds.unite(x, y);
			continue;
		}
		if (com == 1) {
			cout << (ds.same(x, y) ? 1 : 0) << endl;
			continue;
		}
	}

	return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
   int x,a,b;
   cin>>x>>a>>b;
   if(abs(x-a)<abs(x-b))cout<<'A'<<endl;
   else cout<<'B'<<endl;
   
   
}

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


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

    vector<long long> lucas;
    lucas.push_back(2);
    lucas.push_back(1);
    long long ans = 0;
    for (int i = 2; i <= N; i++) {
       ans = lucas.at(i - 1) + lucas.at(i - 2);
       lucas.push_back(ans);
    }

    cout << lucas.at(N) << endl;

}

Measured memory_bytes: 256
# coding=utf-8
import math

root_three = math.sqrt(3)


def divide_segment(left, right):
    """divide segment

    Args:
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        divided points
    """
    delta_x_quarter = (right[0] - left[0]) / 3.0
    delta_y_quarter = (right[1] - left[1]) / 3.0

    delta_x_quarter_rotated = (delta_x_quarter - root_three * delta_y_quarter) / 2.0
    delta_y_quarter_rotated = (root_three * delta_x_quarter + delta_y_quarter) / 2.0

    s = [left[0] + delta_x_quarter, left[1] + delta_y_quarter]
    t = [left[0] + delta_x_quarter * 2.0, left[1] + delta_y_quarter * 2.0]
    u = [s[0] + delta_x_quarter_rotated, s[1] + delta_y_quarter_rotated]

    return s, t, u


def make_coch_curve(depth, left, right):
    """make coch curve with depth iteration_number between point left, right
    each vertices positions are printed

    Args:
        depth: depth
        left: left edge point
        right: right edge point

    Returns:
        None
    """
    print("{0:2.8f} {1:2.8f}".format(left[0], left[1]))
    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth - 1, left, right)


def make_coch_curve_recursively(depth, left, right):
    """recursion part of coch curve

    Args:
        depth: depth
        left: left edge coordinate
        right: right edge coordinate

    Returns:
        None
    """
    # get coordinate of divided points
    s, t, u = divide_segment(left, right)

    if depth == 0:
        print("{0:2.8f} {1:2.8f}".format(s[0], s[1]))
        print("{0:2.8f} {1:2.8f}".format(u[0], u[1]))
        print("{0:2.8f} {1:2.8f}".format(t[0], t[1]))
        print("{0:2.8f} {1:2.8f}".format(right[0], right[1]))
    else:
        make_coch_curve_recursively(depth - 1, left, s)
        make_coch_curve_recursively(depth - 1, s, u)
        make_coch_curve_recursively(depth - 1, u, t)
        make_coch_curve_recursively(depth - 1, t, right)


def main():
    depth = int(input().strip())
    make_coch_curve(depth, left=[0.0, 0.0], right=[100.0, 0.0])


if __name__ == '__main__':
    main()

Measured memory_bytes: 7872
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#define FOR(i,a,b) for(int (i)=(a);(i)<int(b);(i)++)
using namespace std;

const int MAX_V = 100; // ????????°????????§???
const int INF = INT_MAX;

int v; // ????????°
int g[MAX_V][MAX_V]; // ??£??\??????
int d[MAX_V][MAX_V]; // ????????????

bool warshallfloyd()
{
  copy(g[0],g[MAX_V],d[0]);
  FOR(i,0,v) d[i][i] = 0;

  FOR(k,0,v){
    FOR(i,0,v){
      FOR(j,0,v){
        if(d[i][k] != INF && d[k][j] != INF)
          d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }

  // ?????????????????????
  FOR(i,0,v) if(d[i][i] < 0) return false;

  return true; // ????????????????????¨?????????
}

int main()
{
  int gv, ge; // gv???????????°???ge???????????°
  cin >> gv >> ge;
  v = gv;
  fill(g[0],g[MAX_V],INF);
  FOR(i,0,ge){
    int gs, gt, gd;
    cin >> gs >> gt >> gd; // ge??????????§???????gt??????????????????gd???????????????
    g[gs][gt] = gd;
  }

  if(warshallfloyd()) // ???????????????????????´???
    FOR(i,0,v){
      FOR(j,0,v){
        if(d[i][j] != INF)
          cout << d[i][j];
        else // ??????j?????????????????´???
          cout << "INF";
        if(j != v-1)
          cout << " ";
        else
          cout << endl;
      }
    }
  else
    cout << "NEGATIVE CYCLE" << endl;
}

Measured memory_bytes: 3228
#include <iostream>

using namespace std;

using lli = long long int;

int main() {
    lli k, sum, temp;

    ios::sync_with_stdio(false);

    while (cin >> k, k) {
        sum = 0L;
        for (lli i = 0L; i < k * (k - 1L) / 2L; i++) {
            cin >> temp;
            sum += temp;
        }

        cout << sum / (k - 1L) << endl;
    }
}

Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template < typename T > string tost( const T& n ) { ostringstream stm; stm << n; return stm.str();}
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;}
int const INF = 1001001001;

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

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

int H,W;
cin >> H >> W;
vector<string> fi(H);
rep(h,H) cin >> fi[h];

vvi dist(H,vi(W, -1));
queue<pii> que;

dist[0][0] = 0;
que.push(make_pair(0, 0));

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

    rep(i,4) {
        int nph =  p.first + dx[i];
        int npw = p.second + dy[i];
        if(nph < 0 || nph >= H || npw <0 || npw >= W) continue;
        if(dist[nph][npw] != -1 || fi[nph][npw] == '#') continue;
        dist[nph][npw] = dist[p.first][p.second] + 1;
        que.push(make_pair(nph, npw));
    }
}

if(dist[H-1][W-1] == -1) {
    cout << -1 << endl;
    return 0;
}

int cnt = 0;
rep(h,H) rep(w,W) {
    if(fi[h][w] == '#') cnt++;
}
int ans = H * W- (dist[H-1][W-1] + 1) - cnt;
cout << ans << endl;
return 0;
}

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

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

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

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



signed main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<int> ans(n, 0);
    
    vector<tuple<int,int,int>> v;
    int p = 0, center = 0;
    REP(i, n-1){
        if(s[i] == 'R' && s[i+1] == 'L'){
            center = i;
        }else if(s[i] == 'L' && s[i+1] == 'R'){
            v.push_back(make_tuple(p, center, i));
            p = i + 1;
        }
    }
    v.push_back(make_tuple(p, center, n-1));

    for(auto tp : v){
        int num = get<2>(tp) - get<0>(tp) + 1;
        int even = num / 2 + ((get<0>(tp)%2 == 0 && get<2>(tp)%2 == 0) ? 1 : 0);
        int odd = num / 2 + ((get<0>(tp)%2 == 1 && get<2>(tp)%2 == 1) ? 1 : 0);
        int c = get<1>(tp);
        ans[c] = (c%2 == 0 ? even : odd);
        ans[c+1] = ((c+1)%2 == 0 ? even : odd); 
    }

    for(auto i : ans) cout << i << " ";
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 1724
A, B, C, D = gets.chomp.split(' ').map(&:to_i)
all = B-A+1
c = (B/C) - (A-1)/C
d = (B/D) - (A-1)/D
cd = B/(C.lcm(D)) - (A-1)/(C.lcm(D))
puts all - c - d + cd

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll INF = numeric_limits<ll>::max()/2;

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

    int n,m;cin>>n>>m;
    vector<P> v(m);
    for(int i=0;i<m;i++){
        int a,b;cin>>a>>b;a--;b--;
        v[i]=P(b,a);
    }
    sort(v.begin(),v.end());
    int res=0,last=-1;
    for(int i=0;i<m;i++){
        int a=v[i].second,b=v[i].first;
        if(a<=last && last<=b-1) continue;
        last=b-1;
        res++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll 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(ll n, ll 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() {
    int n;
    cin>>n;
    cout<<3*n*n<<endl;
}


Measured memory_bytes: 3608
'''
 Author: fuad Ashraful Mehmet
 University of Asia Pacific
 created :30 Aug 2019 7.33 PM
 Category :   from Atcoder
 Problem:https: 
'''
import math



m,d=map(int,input().split())



mySet=list()



for i in range(22,d+1):
	res=int(i/10)*(i%10)
	x=int(i/10)

	 
	if res<=m and x>1 and (i%10)>1:
		mySet.append(res)

		# print('{} {}'.format(int(i/10),i%10))




print(len(mySet))

Measured memory_bytes: 3060
(n,),a,*z=$<.map{_1.split.map &:to_i}
g=(d=0,*[2e9]*n).map{[]}
z.map{g[_1]<<_2;g[_2]<<_1}
f=->u,r{x=d[k=d.bsearch_index{_1>=a[u-1]}]
d[k]=a[u-1]
$*[u]=r=[r,k].max
g[u].map{$*[_1]||f[_1,r]}
d[k]=x}
f[1,0]
puts$*

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

int main() {
  string w;
  cin >> w;

  int count[26] = {};
  for (int i = 0; i < w.size(); i++) {
    count[w[i] - 'a']++;
  }

  for (int i = 0; i < 26; i++) {
    if (count[i] % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 3e3 + 10;
double dp[N][N];

int n;
double p[N];

double DP(int pos,int head)
{
    if(!pos)
        return head == 0;
    if(head < 0)
        return 0;
    double &r = dp[pos][head];
    if(r > -0.5)
        return r;

    r = p[pos] * DP(pos-1,head-1)  + (1-p[pos]) *
        DP(pos-1,head);
    return r;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //memset(dp,-1,sizeof dp);
    for(int i =0 ; i < N; i++)
        for(int j = 0; j < N; j++)
            dp[i][j] = -1;

    cin >> n;

    for(int i = 1; i <= n; i++)
        cin >> p[i] ;

    double ans = 0;

    for(int i = (n+1)/2; i <= n; i++)
        ans += DP(n,i);
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}




Measured memory_bytes: 71296
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7

# Strongly connected component
# derived from https://atcoder.jp/contests/practice2/submissions/16645774


def get_strongly_connected_components(edges, num_vertex):
    """
    edges: [(v1, v2)]
    """
    from collections import defaultdict

    reverse_edges = defaultdict(list)
    for v1 in edges:
        for v2 in edges[v1]:
            reverse_edges[v2].append(v1)

    terminate_order = []
    done = [0] * num_vertex  # 0 -> 1 -> 2
    count = 0
    for i0 in range(num_vertex):
        if done[i0]:
            continue
        queue = [~i0, i0]
        while queue:
            i = queue.pop()
            if i < 0:
                if done[~i] == 2:
                    continue
                done[~i] = 2
                terminate_order.append(~i)
                count += 1
                continue
            if i >= 0:
                if done[i]:
                    continue
                done[i] = 1
            for j in edges[i]:
                if done[j]:
                    continue
                queue.append(~j)
                queue.append(j)

    done = [0] * num_vertex
    result = []
    for i0 in terminate_order[::-1]:
        if done[i0]:
            continue
        component = []
        queue = [~i0, i0]
        while queue:
            i = queue.pop()
            if i < 0:
                if done[~i] == 2:
                    continue
                done[~i] = 2
                component.append(~i)
                continue
            if i >= 0:
                if done[i]:
                    continue
                done[i] = 1
            for j in reverse_edges[i]:
                if done[j]:
                    continue
                queue.append(~j)
                queue.append(j)
        result.append(component)
    return result


def debug(*x):
    print(*x, file=sys.stderr)


def solve(N, M, edges):
    scc = get_strongly_connected_components(edges, N)
    print(len(scc))
    for s in scc:
        print(*[len(s)] + s)


def main():
    # parse input
    N, M = map(int, input().split())
    from collections import defaultdict
    edges = defaultdict(list)
    for i in range(M):
        a, b = map(int, input().split())
        edges[a].append(b)
    solve(N, M, edges)


# tests
T1 = """
6 7
1 4
5 2
3 0
5 5
4 1
0 3
4 2
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
4
1 5
2 4 1
1 2
2 3 0
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


Measured memory_bytes: 288960
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Point {
    int x;
    int y;

    public Point(final int x, final int y) {
        this.x = x;
        this.y = y;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        solve(in);
    }

    private static void build(final Scanner in, List<Point> coordinates, int n) {
        int x, y;
        for (int i = 0; i < n; i++) {
            x = in.nextInt();
            y = in.nextInt();
            coordinates.add(new Point(x, y));
        }
    }

    private static void solve(final Scanner in) {
        int n = in.nextInt();
        int m = in.nextInt();
        List<Point> start = new ArrayList<>();
        List<Point> end = new ArrayList<>();
        build(in, start, n);
        build(in, end, m);
        checkPoint(start, end);
    }

    private static void checkPoint(final List<Point> start, final List<Point> end) {
        for (final Point point : start) {
            findMinimum(point, end);
        }
    }

    private static int getDis(Point p1, Point p2) {
        return Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y);
    }

    private static void findMinimum(final Point point, final List<Point> end) {
        int minDis = Integer.MAX_VALUE, currDis, idx = 0;
        for (int i = 0; i < end.size(); i++) {
            Point currPoint = end.get(i);
            currDis = getDis(point, currPoint);
            if (currDis < minDis) {
                minDis = currDis;
                idx = i;
            }
        }
        System.out.println(idx + 1);
    }
}


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

#define ll long long int

string str;
ll len;
ll dp[110][10][4][2];
ll cholo(ll id,ll last,ll ct,bool mark)
{
    if(id>=len){
        if(ct) return 0ll;
        else return 1ll;
    }
    ll &ret=dp[id][last][ct][mark];
    if(~ret) return ret;

    ll big=(mark) ? str[id]-'0' : 9;

    if(ct==0) big=0;

    ll sum=0;
    for(ll i=0;i<=big;i++){
        if(i==big) {
            if(i>0ll) sum+=cholo(id+1,i,ct-1,mark);
            else sum+=cholo(id+1,i,ct,mark);
        }
        else{
            if(i>0ll) sum+=cholo(id+1,i,ct-1,false);
            else sum+=cholo(id+1,i,ct,false);
        }
    }
    return (ret= sum);

}

int main()
{
    ll x,p,i,j,k;
    cin>>str>>k;
    len=str.length();
    memset(dp,-1,sizeof dp);
    ll ans=cholo(0,0,k,true);
    cout<<ans<<'\n';
}



Measured memory_bytes: 3700
#include <algorithm>

namespace rika
{
  template <typename T>
  class edge
  {
  public:
    int to;
    T cost;
    
    edge() = default;
    edge(const edge<T>&) = default;
    edge(edge<T>&&) = default;
    edge& operator =(const edge<T>&) = default;
    edge& operator =(edge<T>&&) = default;

    ~edge() = default;

    edge(int _to, T _cost) : to(_to), cost(_cost) {}
  };
}
  int N;

#include<bits/stdc++.h>
using namespace std;
using namespace rika;
namespace rika
{
  namespace internal
  {
    template <typename TValue, typename TGraph>
    std::pair<TValue, int> visit(int from, int v, const TGraph &g)
    {
      if(v >= N)
        throw "test";
      auto r = std::make_pair(TValue(), v);
      try{
      for(auto it = g[v].begin(); it != g[v].end(); ++it)
      {
        if(it->to == from)
          continue;
        auto r2 = visit<TValue>(v, it->to, g);
        if(r2.first + it->cost >= r.first)
          r = std::make_pair(r2.first + it->cost, r2.second);
      }
      }
      catch (int x) {}
      return r;
    }
  }

  template <typename TValue, typename TGraph>
  TValue tree_diameter(const TGraph &g)
  {
    using namespace internal;
    auto r1 = visit<TValue>(-1, 0, g);
    auto r2 = visit<TValue>(-1, r1.second, g);
    return r2.first;
  }
}

#include<bits/stdc++.h>
using namespace std;
using namespace rika;
int main()
{
  cin >> N;
  vector<vector<edge<int>>> g(N * 10);
  for(int i = 0; i < N - 1; i++)
  {
    int s, t, w;
    cin >> s >> t >> w;
    g[s].push_back(edge<int>(t, w));
    g[t].push_back(edge<int>(s, w));
  }
  cout << tree_diameter<int>(g) << endl;
}

Measured memory_bytes: 35424
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

int main(){
    fastcin();
    string s;
    cin >> s;
    rep(i, s.size()) cout << 'x';
    cout << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int M = 103;
char a[M],b[M],c[M];
int lena, lenb, lenc;
int va, vb, vc;
char now;

int main(){
	scanf("%s%s%s",a,b,c);
	va = vb = vc = 0;
	lena = strlen(a); lenb = strlen(b); lenc = strlen(c);

	now = a[va]; va++;
	for(int i = 0; i < lena+lenb+lenc; i++){
		if(now == 'a'){
			if(va == lena){printf("A"); break;}
			else{
				now = a[va];
				va++;
			}
		}
		if(now == 'b'){
			if(vb == lenb){printf("B"); break;}
			else{
				now = b[vb];
				vb++;
			}
		}
		if(now == 'c'){
			if(vc == lenc){printf("C"); break;}
			else{
				now = c[vc];
				vc++;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 1e6 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

vector<ll> D[N];
ll cnt[N], a[N], n;
int main () {
	ios::sync_with_stdio(0), cin.tie(0);
	for (int i = 1; i < N; i ++)
		for (int j = i * 2; j < N; j += i)
			D[j].pb(i);
	cin >> n;
	for (int i = 1; i <= n; i ++)	
		cin >> a[i], cnt[a[i]] ++;
	ll ans = 0;
	for (int i = 1; i <= n; i ++) {
		if (cnt[a[i]] > 1) continue;
		ll f = 1;
		for (auto d : D[a[i]]) {
			if (cnt[d]) {
				f = 0;
				break;
			}
		}
		ans += f;
	}
	cout << ans;
}

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

int main(){
 
  int n,a,b,ans=0;
  cin>>n; 
  vector<int> card(n);
  REP(i,n) cin>>card.at(i);
  
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
  
  REP(i,n){
    if(2*i<n){a+=card.at(2*i);}
    if(2*i+1<n){b+=card.at(2*i+1);cout<<"";}
  }
  
  cout<<a-b<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define P pair<int,int>
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int a[114514],b[114514];
int bin[9];
string ss[114514];
signed main(){
	rep(0,i,9)cin>>bin[i];
	ic(n)
	rep(0,i,n)cin>>a[i];
	rep(0,i,n){
		rep(0,j,9){
			if(a[i]==bin[j])bin[j]=0;
		}
	}
	if(bin[0]==0&&bin[3]==0&&bin[6]==0||bin[1]==0&&bin[4]==0&&bin[7]==0||bin[2]==0&&bin[5]==0&&bin[8]==0||bin[0]==0&&bin[1]==0&&bin[2]==0||bin[3]==0&&bin[4]==0&&bin[5]==0||bin[6]==0&&bin[7]==0&&bin[8]==0||bin[0]==0&&bin[4]==0&&bin[8]==0||bin[2]==0&&bin[4]==0&&bin[6]==0)c("Yes")
	else c("No")
}	

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

#define MOD 1000000007

int n, m;
int memo[310][310][310];

long long dp(int i, int ma, int all){
    if(i == m){
        if(ma == n){
            return 1;
        }else{
            return 0;
        }
    }

    if(memo[i][ma][all] != -1){
        return memo[i][ma][all];
    }

    long long ans = 0;
    ans = dp(i+1, all, all) * ma;
    ans %= MOD;
    ans += dp(i+1, ma, all) * (all-ma);
    ans %= MOD;
    ans += dp(i+1, ma, all+1) * (n-all);
    ans %= MOD;

    return memo[i][ma][all] = ans;
}

signed main(){
    cin >> n >> m;
    memset(memo, -1, sizeof(memo));
    cout << dp(0, 1, 1) << endl;
    return 0;
}

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

using namespace std;

int main(){
  int n,m,X,Y,xmax=-100,ymin=100;
  
  cin>>n>>m>>X>>Y;
  
  xmax=max(xmax,X);
  ymin=min(ymin,Y);
  
  int x,y;
  for(int i=0; i<n; i++){
    cin>>x;
    if(x>xmax)xmax=x;
  }
  for(int i=0; i<m; i++){
    cin>>y;
    if(y<ymin)ymin=y;
  }
  
  int z=xmax+1;
  
  if(z>ymin)cout<<"War"<<endl;
  else cout<<"No War"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else:
  count = K - (A + 1)
  if count % 2 == 0:
    ans = count // 2 * (B - A) + B
  else:
    ans = count//2 * (B - A) + B + 1
  print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define C 26
using namespace std;

int main(){
  int n;
  char c;
  while(1){
    cin>>n;
    if(!n)break;
    int cnt[C]={},idx,ans1,ans2=0;
    for(int i=0;i<n;i++){
      cin>>c;
      idx=c-'A';
      cnt[idx]++;
      int maxcnt=0,maxidx;
      for(int j=0;j<C;j++)
	if(maxcnt<cnt[j]){
	  maxcnt=cnt[j];
	  maxidx=j;
	}
      int maxcnt2=0,maxidx2;
      for(int j=0;j<C;j++)
	if(maxidx!=j&&maxcnt2<cnt[j]){
	  maxcnt2=cnt[j];
	  maxidx2=j;
	}
      if(!ans2&&maxcnt>maxcnt2+n-i-1)ans1=maxidx,ans2=i+1;
    }
    if(ans2)cout<<(char)(ans1+'A')<<' '<<ans2<<endl;
    else cout<<"TIE"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3040
var
  s:string;
  i,p:longint;
  ok:boolean;
begin
  readln(s);
  for i:=1 to length(s) do
  if s[i]='C' then
  begin
    ok:=true;
    p:=i;
    break;
  end;
  if not ok then 
  begin
    writeln('No');
    exit;
  end;
  ok:=false;
  for i:=p+1 to length(s) do
  if s[i]='F' then ok:=true;
  if ok then writeln('Yes')
        else writeln('No');
end.

Measured memory_bytes: 128
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#define ll long long
using namespace std;
const int maxn=((1<<17)+10);
const int mod=1e9+7;
int n,m,a[18];
ll dp[maxn],inv[maxn],jc[maxn],tw[maxn],cnt[maxn],ans;
ll kuai(ll x,int y)
{
	ll ans=1;
	while(y)
	{
		if(y&1)(ans*=x)%=mod;
		(x*=x)%=mod;y>>=1;
	}
	return ans%mod;
}
void pre()
{
	jc[0]=jc[1]=1;tw[0]=1;inv[0]=1; 
	for(int i=1;i<=n;i++)
		tw[i]=tw[i-1]*2%mod;
	for(int i=1;i<=tw[n];i++)
		jc[i]=jc[i-1]%mod*i%mod;
	inv[tw[n]]=kuai(jc[tw[n]],mod-2);
	for(int i=tw[n];i>=1;i--)
		inv[i-1]=inv[i]*i%mod;
	cnt[0]=0;
	for(int i=1;i<=tw[n];i++)
		cnt[i]=cnt[i>>1]+(i&1);
}

ll C(ll n,ll m)
{
	if(n<m||n<0||m<0)return 0;
	return jc[n]%mod*inv[m]%mod*inv[n-m]%mod;
}

int main()
{
	scanf("%d%d",&n,&m);
	pre();//cout<<C(2,1)<<endl;
	for(int i=1;i<=m;i++)scanf("%d",&a[i]);
	dp[0]=1;sort(a+1,a+m+1);
	for(int i=m;i>=1;i--)
		for(int sta=tw[n]-1;sta>=0;sta--)
			for(int k=0;k<=n;k++)//Ã¶¾Ù 
			if(sta&tw[k])
				(dp[sta]+=dp[sta^tw[k]]%mod*C(tw[n]-a[i]-sta+tw[k],tw[k]-1)%mod*jc[tw[k]]%mod)%=mod;
	for(int i=0;i<=tw[n];i++)
	{
		dp[i]=dp[i]*jc[tw[n]-i-1]%mod;//¿ÕÎ»ÖÃËæ±ã 
		if(cnt[i]&1)ans=(ans-dp[i]+mod)%mod;
		else ans=(ans+dp[i])%mod;//cout<<ans<<endl;
	}
	printf("%lld",(ans*tw[n]%mod));
}


Measured memory_bytes: 3456
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >> n;
    int h[n];
    rep(i,n) cin >> h[i];

    int ans = 0;
    int mx = 0;
    
    rep(i,n){
        if(mx <= h[i]){
            mx = h[i];
            ans++;
        }
    }
    
    cout << ans << ln;
    return 0;
}

Measured memory_bytes: 256
import math

k = int(input())
result = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        p = math.gcd(a, b)
        for c in range(1, k + 1):
            q = math.gcd(p, c)
            result += q
print(result)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin>>vec.at(i);
    }

    bool check=false;
    int tmp=0;
    for(int i=0;i<n;i++){
        if(tmp+1==vec.at(i)){
            tmp++;
            check = true;
        }
    }
    if(check)cout<<n-tmp<<endl;
    if(!check)cout<<"-1"<<endl;
}

 

Measured memory_bytes: 1024
#include <cstdio>
#include <vector>
#include <algorithm>
#define pb push_back
using namespace std;

int Pow(int a){
	int ret = 1;
	for(int i = 0; i < a; i++) ret *= 10;
	return ret;
}

int main(){
	int a, l;
	while(scanf("%d%d", &a, &l),a||l){
		vector<int> num;
		num.pb(a);
		while(true){
			int Min = 0, Max = 0;
			int rank[6];
			bool ok = false;
			for(int i = 0; i < l; i++){
				rank[i] = (a%Pow(i+1))/Pow(i);
				//printf("%d ", rank[i]);
			}
			//printf("\n");
			sort(rank,rank+l);
			for(int i = 0; i < l; i++){
				Min += Pow(i)*rank[l-1-i];
				Max += Pow(i)*rank[i];
			}
			a = Max - Min;
			//printf("%d %d %d\n", Min, Max, a);
			for(int i = 0; i < num.size(); i++){
				if(a == num[i]){
					printf("%d %d %d\n", i, a, num.size()-i);
					ok = true;
					break;
				}
			}
			if(ok) break;
			num.pb(a);
		}
	}
}

Measured memory_bytes: 1056
import sys

a = 998244353
n = int(input())
D = list(map(int,input().split()))
if n==1 and D[0]==0:
    print(1)
    sys.exit()
elif D[0]!=0:
    print(0)
    sys.exit()
else:
    D.sort()
    if D[1]!=1:
        print(0)
        sys.exit()
    else:
        cnt = 1
        precnt = 1
        ans = 1
        for i in range(n-2):
            if D[i+2]-D[i+1]>=2:
                print(0)
                sys.exit()
            elif i+2 == n-1:
                if D[i+2]==D[i+1]:
                    cnt += 1
                    ans *= precnt**cnt
                else:
                    ans *= precnt**cnt
                    precnt = cnt
                    ans *= precnt
            elif D[i+2] == D[i+1]:
                cnt += 1
            else:
                ans *= precnt**cnt
                precnt = cnt
                cnt = 1
    print(ans%a)


Measured memory_bytes: 14396
N = int(input())
A = list(map(int, input().split(" ")))

A_m = list()
A_p = list()
for a in A:
    if a >= 0: A_p.append(a)
    else: A_m.append(a)
M = 0
M += sum(A_p)
M -= sum(A_m)
if len(A_m)%2:
    A_abs = list(map(abs, A))
    M = sum(A_abs)
    M -= 2*min(A_abs)
print(M)

Measured memory_bytes: 14224
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;


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

	cout << 100 << " " << 100 << endl;
	char grid[100][100];
	for (int i = 0; i < 50; i++){
		for (int j = 0; j < 100; j++){
			grid[i][j] = '.';
		}
	}
	for (int i = 50; i < 100; i++){
		for (int j = 0; j < 100; j++){
			grid[i][j] = '#';
		}
	}
	for (int i = 1; i < 49; i++){
		for (int j = 0; j < 100; j++){
			if (b != 1){
				if (j % 3 == i % 3){
					grid[i][j] = '#';
					b--;
				}
			}else{
				i = MOD, j = MOD;
			}
		}
	}
	for (int i = 51; i < 100; i++){
		for (int j = 0; j < 100; j++){
			if (a != 1){
				if (j % 3 == i % 3){
					grid[i][j] = '.';
					a--;
				}
			}else{
				i = MOD, j = MOD;
			}
		}
	}
	for (int i = 0; i < 100; i++){
		for (int j = 0; j < 100; j++){
			cout << grid[i][j];
		}
		cout << endl;
	}
}



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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<int> L(N);
    for (int i = 0; i < N; i++) {
        cin >> L[i];
    }
    int ans = 1 << 29;
    for(int i = 0; i < 1 << N; i++) {
        for(int j = 0; j < 1 << N; j++) {
            int sumA = 0, sumB = 0, sumC = 0;
            int cost = -30;
            for (int k = 0; k < N; k++) {
                if ((i >> k & 1) && (j >> k & 1)) {
                    sumA += L[k];
                    cost += 10;
                } else if (!(i >> k & 1) && (j >> k & 1)) {
                    sumB += L[k];
                    cost += 10;
                } else if ((i >> k & 1) && !(j >> k & 1)) {
                    sumC += L[k];
                    cost += 10;
                }
            }
            if (sumA == 0 || sumB == 0 || sumC == 0) continue;
            ans = min(ans, cost + abs(sumA - A) + abs(sumB - B) + abs(sumC - C));

        }
    }
    cout << ans << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

Measured memory_bytes: 256