akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(string, s);
    For(i, s.size()){
        if((i % 2 == 0 && !(s[i] == 'R' || s[i] == 'U' || s[i] == 'D')) || (i % 2 == 1 && !(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'))){
            Cout("No");
            return 0;
        }
    }
    Cout("Yes");
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	while(true){
		int n,x;
		cin>>n>>x;
		if(n==0 && x==0) break;;
		int ans=0;
		FOR(i,1,n+1)FOR(j,i+1,n+1)FOR(k,j+1,n+1){
			if(i+j+k==x){
				ans++;
			}
		}
		cout<<ans<<endl;
	}
}


Measured memory_bytes: 3212
#include <iostream>

using namespace std;

int data[3][3];

//縦の探索
int func0(int x){
	int tmp = data[0][x];
	int flag = 1;
	for(int i=1;i<3;i++){
		if(tmp != data[i][x]){
			flag = 0;
			break;
		}
	}
	if(flag == 0){
		return 0;
	}
	else{
		return tmp;
	}
}

//横の探索
int func1(int y){
	int tmp = data[y][0];
	int flag = 1;
	for(int i=1;i<3;i++){
		if(tmp != data[y][i]){
			flag = 0;
			break;
		}
	}
	if(flag == 0){
		return 0;
	}
	else{
		return tmp;
	}
}
int func2(){
	int tmp = data[0][0];
	int flag = 1;
	for(int i=1;i<3;i++){
		if(tmp != data[i][i]){
			flag = 0;
			break;
		}
	}
	if(flag == 0){
		return 0;
	}
	else{
		return tmp;
	}
}	

int func3(){
	int tmp = data[0][2];
	int flag = 1;
	for(int i=1;i<3;i++){
		if(tmp != data[i][2-i]){
			flag = 0;
			break;
		}
	}
	if(flag == 0){
		return 0;
	}
	else{
		return tmp;
	}
}


int main(){
	string str;
	while(cin>>str){
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(str[i*3+j] == 'o')     data[i][j] = 1;
				else if(str[i*3+j] == 'x')data[i][j] = -1;
				else                      data[i][j] = 0;
			}
		}

		int flag = 0;
		int state = 0;
		//ここから探索。
		for(int x=0;x<3;x++){
			if(func0(x)!=0){
				flag = 1;
				state = func0(x);
				break;
			}
		}
		for(int y=0;y<3;y++){
			if(func1(y)!=0){
				flag = 1;
				state = func1(y);
				break;
			}
		}
		//ここから斜めの探索。
		if(func2()!=0){
			flag = 1;
			state = func2();
		}
		if(func3()!=0){
			state = func3();
		}
		if(state == 1){
			cout<<"o"<<endl;
		}
		else if(state == -1){
			cout<<"x"<<endl;
		}
		else{
			cout<<"d"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1172
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>
#include <cmath>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

const double eps = 1e-8;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
	ll N, K;
	cin >> N >> K;
	if ((N + 1) / 2 >= K)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define maxn 100010
using namespace std;

int main(){
	int a, b, c = 0, d;
	cin >> b >> a;
	for(int i = 0; i < a; ++i){
		cin >> d;
		c = c + d;
	}
	if(c >= b){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
} 

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

int main() {
  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 ret = 3000;
  int range = pow(4,N);
  vector<int> length(N);
  vector<int> count(N);
  for (int i=0; i<range; ++i) {
    fill(length.begin(), length.end(), 0);
    fill(count.begin(), count.end(), 0);
    for (int j=0; j<N; ++j) {
      int idx = (i >> (2*j)) & 3;
      length[idx] += l[j];
      count[idx]++;
    }

    if (count[0] == 0 || count[1] == 0 || count[2] == 0) continue;

    ret = min(ret, abs(length[0] - A) + abs(length[1] - B) + abs(length[2] - C)
	      + 10 * (count[0] + count[1] + count[2] - 3));
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

// 奇数回反転するものだけカウントする
// n == 1 and m == 1の時
// 1
// n == 1 or m == 1の時
// max(n, m)-2;
// n == 2 or m == 2のとき
// 0
// n >= 3 and m >= 3の時
// 四隅: 偶数(4)
// 枠: 偶数(6)
// その他: 奇数(9)
int main() {
  ll n, m; in(n),in(m);
  if (n>m) swap(n, m);
  if (n == 1 and n == m) {
    print(1);
    return 0;
  }
  
  if (n == 1) {
    print(max(n, m)-2);
    return 0;
  }
  
  print((n-2)*(m-2));
  return 0;
}


Measured memory_bytes: 3636
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
b = inpl()
x = 0
y = 0
for i in range(n):
    if b[i] - a[i] > 0:
        x += (b[i] - a[i])//2
    else:
        y += a[i] - b[i]
if x >= y:
    print('Yes')
else:
    print('No')

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

using namespace std;

typedef long long LL;
#define N 105

LL n,m,p,mod,ans,f[N][4][N][N],fac[N],ifac[N];

void upd(LL &x,LL y){x=(x+y)%mod;}

LL inv(LL x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}

LL C(LL x,LL y){return fac[x]*ifac[y]%mod*ifac[x-y]%mod;}

int main(){
	scanf("%lld%lld%lld%lld",&n,&m,&p,&mod);
	if (n<m) swap(n,m);
	fac[0]=1; for (LL i=1;i<=n;++i) fac[i]=fac[i-1]*i%mod;
	ifac[n]=inv(fac[n]); for (LL i=n-1;~i;--i) ifac[i]=ifac[i+1]*(i+1)%mod;
	f[p+1][3][n][m]=1;
	for (LL i=p;i;--i){
		LL prd1,prd2;
		prd1=prd2=1;
		for (LL j=1;j<=n;++j) prd2=prd2*i%mod;
		for (LL j=0;j<=n;++j){
			LL tmp=1;
			for (LL l=0;l<=m;++l){
				for (LL k=l;k<=m;++k)
					upd(f[i][0][j][k-l],f[i+1][3][j][k]*tmp%mod*ifac[l]);
				tmp=tmp*prd1%mod*prd2%mod;
			}
			prd1=prd1*(p-i+1)%mod;
			prd2=prd2*inv(i)%mod;
		}
		prd1=prd2=1;
		for (LL k=1;k<=m;++k) prd2=prd2*i%mod;
		for (LL k=0;k<=m;++k){
			LL tmp=1;
			for (LL l=0;l<=n;++l){
				for (LL j=l;j<=n;++j)
					upd(f[i][1][j-l][k],f[i][0][j][k]*tmp%mod*ifac[l]);
				tmp=tmp*prd1%mod*prd2%mod;
			}
			prd1=prd1*(p-i+1)%mod;
			prd2=prd2*inv(i)%mod;
		}
		if (i>1){
			prd1=prd2=1;
			for (LL j=1;j<=n;++j) prd2=prd2*(i-1)%mod;
			for (LL j=0;j<=n;++j){
				LL tmp=1;
				for (LL l=0;l<=m;++l){
					for (LL k=l;k<=m;++k)
						upd(f[i][2][j][k-l],f[i][1][j][k]*tmp%mod*ifac[l]);
					tmp=-tmp*prd1%mod*prd2%mod;
				}
				prd1=prd1*(p-i+1)%mod;
				prd2=prd2*inv(i-1)%mod;
			}
			prd1=prd2=1;
			for (LL k=1;k<=m;++k) prd2=prd2*(i-1)%mod;
			for (LL k=0;k<=m;++k){
				LL tmp=1;
				for (LL l=0;l<=n;++l){
					for (LL j=l;j<=n;++j)
						upd(f[i][3][j-l][k],f[i][2][j][k]*tmp%mod*ifac[l]);
					tmp=-tmp*prd1%mod*prd2%mod;
				}
				prd1=prd1*(p-i+1)%mod;
				prd2=prd2*inv(i-1)%mod;
			}
		}
		else{
			memcpy(f[i][2],f[i][1],sizeof f[i][2]);
			memcpy(f[i][3],f[i][2],sizeof f[i][3]);
		}
	}
	ans=(f[1][3][0][0]*fac[n]%mod*fac[m]%mod+mod)%mod;
	printf("%lld\n",ans);
	
	return 0;
}
			

Measured memory_bytes: 34816
#include <cstdio>
#include <cstdint>
#include <climits>
#include <vector>
#include <algorithm>
#include <utility>

template <
  typename Monoid,
  typename Container = std::vector<typename Monoid::first_type>
>
class simple_segment_tree {
public:
  using first_type = typename Monoid::first_type;
  using second_type = typename Monoid::second_type;
  using value_type = first_type;
  using binary_operation = typename Monoid::binary_operation;
  using external_binary_operation = typename Monoid::external_binary_operation;
  using container = Container;

private:
  size_t M_base_size;
  binary_operation M_op1;
  external_binary_operation M_op2;
  container M_c;

public:
  simple_segment_tree() = default;
  simple_segment_tree(simple_segment_tree const&) = default;
  simple_segment_tree(simple_segment_tree&&) = default;

  simple_segment_tree(size_t n, first_type const& x = binary_operation().identity):
    M_base_size(n),
    M_op1(binary_operation()),
    M_op2(external_binary_operation()),
    M_c(n+n, x)
  {
    for (size_t i = n; i--;)
      M_c[i] = M_op1(M_c[i<<1|0], M_c[i<<1|1]);
  }

  template <typename InputIt>
  simple_segment_tree(InputIt first, InputIt last):
    M_base_size(std::distance(first, last)),
    M_op1(binary_operation()),
    M_op2(external_binary_operation()),
    M_c(M_base_size*2)
  {
    for (size_t i = M_base_size; first != last; ++i)
      M_c[i] = *first++;
    for (size_t i = M_base_size; i--;)
      M_c[i] = M_op1(M_c[i<<1|0], M_c[i<<1|1]);
  }

  simple_segment_tree& operator =(simple_segment_tree const&) = default;
  simple_segment_tree& operator =(simple_segment_tree&&) = default;

  void modify(size_t i, second_type const& x) {
    i += M_base_size;
    M_c[i] = M_op2(M_c[i], x);
    while (i > 1) {
      i >>= 1;
      M_c[i] = M_op1(M_c[i<<1|0], M_c[i<<1|1]);
    }
  }

  first_type accumulate(size_t l, size_t r) {
    first_type resl = M_op1.identity;
    first_type resr = resl;
    l += M_base_size;
    r += M_base_size;
    while (l < r) {
      if (l & 1) resl = M_op1(resl, M_c[l++]);
      if (r & 1) resr = M_op1(M_c[--r], resr);
      l >>= 1;
      r >>= 1;
    }
    return M_op1(resl, resr);
  }
};

template <typename Tp>
struct range_min_single_update {
  using first_type = Tp;
  using second_type = Tp;
  struct binary_operation {
    first_type identity = std::numeric_limits<Tp>::max();
    first_type operator ()(first_type const& x, first_type const& y) const {
      return std::min(x, y);
    }
  };
  struct external_binary_operation {
    first_type operator ()(first_type const&, second_type const& y) const {
      return y;
    }
  };
};

int main() {
  size_t n, q;
  scanf("%zu %zu", &n, &q);
  simple_segment_tree<range_min_single_update<int>> st(n);

  for (size_t i = 0; i < q; ++i) {
    int t;
    scanf("%d", &t);

    if (t == 0) {
      // update(j, x)
      size_t j;
      intmax_t x;
      scanf("%zu %jd", &j, &x);
      st.modify(j, x);
    } else if (t == 1) {
      // getSum(s, t)
      size_t s, t;
      scanf("%zu %zu", &s, &t);
      printf("%d\n", st.accumulate(s, t+1));
    }
  }
}



Measured memory_bytes: 3240
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    ll N,D,A;
    cin >> N >> D >> A;
    // pos,life
    vector<pair<ll,ll>> monster(N);
    // モンスターの座標表(二分探索用)
    vector<ll> poss(N);
    REP(i,N) {
        int x,h;
        cin >> x >> h;
        monster[i] = make_pair(x,h);
        poss[i] = x;
    }

    // 座標ソート
    sort(ALL(monster));
    sort(ALL(poss));

    if (N==1) {
        cout << (monster[0].second+A-1)/A << endl;
        return 0;
    }

    // N体目で重なりが終わる線のかず それを含む
    vector<ll> end(N,0);

    ll ans = 0;
    ll kasanari = 0;
    REP(i,N) {

        // endに入っていた場合重なりを解除
        if (end[i] != 0) {
            kasanari -= end[i];
            end[i] = 0;
        }
        // ダメージ足りないなら爆弾の追加
        if ( kasanari * A < monster[i].second ) {
            ll need = (monster[i].second - (kasanari * A)+A-1 )/ A;
            kasanari += need;
            ans += need;
            // 二分探索でどこまで影響があるかを調べる。
            ll key = poss[i] + (2 * D);
            auto itr = upper_bound(ALL(poss),key);
            ll index;
            // 最後まで影響ある場合は無視で良い
            if (itr == poss.end()) {
                continue;
            }
            end[ itr - poss.begin()] += need;

            // cout << index << endl;
        }


        if (kasanari < 0) {
            cout << "Error " << endl;
            exit(1);
        }
    }

    cout << ans << endl;

    return 0;
}


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

U = list(map(int, input().split()))
for i in range(1, N):
    U[i] += U[i-1]

D = list(map(int, input().split()))
for i in range(N-2, -1, -1):
    D[i] += D[i+1]

result = 0
for i in range(N):
    result = max(U[i]+D[i], result)

print(result)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input;
        try {
            while((input = reader.readLine()) != null){
                String[] inputArray = input.split(" ");
                int a = Integer.parseInt(inputArray[0]);
                int b = Integer.parseInt(inputArray[1]);
                int aa = a;
                int bb = b;
                if(bb>aa){
                    int tmp = aa;
                    aa = bb;
                    bb = tmp;
                }
                int mod = aa % bb;
                while(mod != 0){
                    aa = bb;
                    bb = mod;
                    mod = aa % bb;
                }
                System.out.println(bb+" "+(a/bb*b));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 15080
//ΔAGC026A
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111;
int n,a[N];
int main()
{
	int i,s=0;
	cin>>n;
	for(i=1;i<=n;i=i+1)
		cin>>a[i];
	for(i=2;i<=n;i=i+1)
		if(a[i]==a[i-1])
			a[i]=1e9,s++;
	cout<<s;
	return 0;
}

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

const long long mod = 1e9 + 7;
const long long N = 2e6 + 10;

long long fact[N];

template<typename T>
void add_self(T& a, T b)
{
	a += b;
	if(a > mod)
	{
		a -= mod;
	}
}

template<typename T>
void substract_self(T& a, T b)
{
	a -= b;
	if(a < 0)
	{
		a += mod;
	}
}

template<typename T>
long long mul(T a, T b)
{
	return (a * b) % mod;
}

long long power(long long a, long long b)
{
	long long res = 1ll;
	while(b)
	{
		if(b & 1)
		{
			res = (res * a) % mod;
		}
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}

long long modInverse(long long a)
{
	return power(a, (long long)(mod - 2));
}

long long nCr(long long n, long long r)
{
	long long val = mul(fact[n], mul(modInverse(fact[n - r]), modInverse(fact[r])));
	return val;
}

int main() {
	fact[0] = 1;
	for(int i = 1; i < N; i++)
	{
		fact[i] = (fact[i - 1] * i) % mod;
	}
	long long n, k;
	cin >> k;
	string s;
	cin >> s;
	n = s.length();
	long long sol = power(26ll, n + k);
	for(int i = 0; i < n; i++)
	{
		long long val = mul(nCr(n + k, i), power(25ll, n + k - i));
		substract_self(sol, val);
	}
	cout << sol;
	
	return 0;
}

Measured memory_bytes: 20884
#include <iostream>
using namespace std;
int main() {int h,w,y[15][15],a,s=0,i,j,k;cin>>h>>w;for(i=0;i<10;i++)for(j=0;j<10;j++)cin>>y[i][j];for(k=0;k<10;k++)for(i=0;i<10;i++)for(j=0;j<10;j++)y[i][j]=min(y[i][j],y[i][k]+y[k][j]);for(i=0;i<h;i++)for(j=0;j<w;j++){cin>>a;if(a!=-1)s+=y[a][1];}cout<<s;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    ll n;
    cin >> n;

    map<ll, ll> m;
    rep(i, n) {
        ll a; cin >> a;
        m[a]++;
    }
    bool ans = true;
    for( auto i = m.begin(); i != m.end() ; ++i ) {
        if(i->second>1) ans = false;
    }
    if (ans==true) cout << "YES" << endl;
    else cout << "NO" << endl;


}

Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


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


float a ,b;
cin>>a>>b;
cout<<round((a+b)/2)<<endl;
 return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int n, a, b;
    cin>>n>>a>>b;
    cout<<min(a,b)<<" "<<max(0, a + b - n)<<endl;

    return 0;
}


Measured memory_bytes: 256
def insertionSort(A, n, g):
    cnt = 0
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return cnt

def shellSort(A, n):
    cnt = 0
    nn = n
    G = []
    g = 1
    while g <= n:
        G.insert(0, g)
        g = g*3 + 1
    m = len(G)
    for g in G:
        cnt += insertionSort(A, n, g)
    return cnt, m, G

n = int(input())
A = [int(input()) for i in range(n)]
cnt, m, G = shellSort(A, n)
print(m)
print(" ".join(map(str, G)))
print(cnt)
for a in A:
    print(a)



Measured memory_bytes: 45516
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2019-12-06 04:32:09
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<class T> ostream& operator<<(ostream& os, vector<T>& _) { os << '{'; for (T& x : _) { os << x; if (&x != &_.back()) os << ','; } os << '}'; return os; }
template<class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

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

  int n, W; cin >> n >> W;
  vector<int> v(n), w(n);
  for (int i = 0; i < n; ++i) cin >> v[i] >> w[i];

  vector<vector<int>> dp(n + 5, vector<int>(W + 5, 0));

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= W; ++j) {
      if (j - w[i] < 0) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
      }
    }
  }

  int ans = 0;
  for (int i = 0; i <= W; ++i) {
    ans = max(ans, dp[n][i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7108
#include <iostream>
#include <iomanip>
#define pi 3.14159265358979323846
using namespace std;

int main()
{
	double r,l,s;
	cin>>r;
	l = 2*pi*r;
	s = pi*r*r;
	cout<<setprecision(9)<<fixed<<s<<" "<<l<<endl;
	return 0;
}
 


Measured memory_bytes: 3288
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	long long w, h, x, y;
	cin >> w >> h >> x >> y;

	cout << (double) w * h / 2 << " ";
	if (x + x == w && y + y == h) {
		cout << "1\n";
	} else {
		cout << "0\n";
	}

	return 0;

}

Measured memory_bytes: 256
from sys import stdin

(n, a, b) = stdin.readline().rstrip().split()
n = int(n)
a = int(a)
b = int(b)

total=0
POW_MAX=4

for i in range(1, n+1):
    sub_total=0
    num = i
    for j in range(0, POW_MAX+1):

        mod = num % 10
        sub_total = sub_total + mod
        sho = num // 10
        num = sho
        if sho == 0:
            break
    if a <= sub_total and sub_total <= b:
        total = total + i

print(total)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
	set<char> ss;
 	string s;
  	cin >> s;
  	if ((s[1] == s[0] && s[1] == s[2]) || (s[2]==s[1] && s[2]==s[3]))
    	cout << "Yes" << endl;
  	else
     	cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
DBG = true
n = gets.to_i
ab = []
for i in 0...n
  a,b = gets.split.map{|z| z.to_i}
  ab << [a,b]
end
ab.sort_by!{|z| -z[0]-z[1]}
pa = 0
pb = 0
for i in 0...n
  if i%2 == 0
    pa += ab[i][0]
  else
    pb += ab[i][1]
  end
end
puts "#{pa-pb}"


Measured memory_bytes: 12664
import java.io.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Main {
   public static void main(String[] args) throws IOException{
	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	   String s,ans;
	   s = br.readLine();
	   Matcher m = Pattern.compile("apple").matcher(s);
	   s = m.replaceAll("tmp");
	   Matcher ms = Pattern.compile("peach").matcher(s);
	   s = ms.replaceAll("apple");
	   Matcher mf = Pattern.compile("tmp").matcher(s);
	   s = mf.replaceAll("peach");
	   System.out.println(s);
   }
}

Measured memory_bytes: 16888
<?php
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
    public function nextString() {
        return (string)$this->next();
    }
}

$sc = new Scanner();
$n = $sc->nextInt();

for($i=1; $i<=$n; $i++){
  $x[$i] = $sc->nextDouble();
  $u[$i] = $sc->nextString();
}

$arr = array();

for($i=1; $i<=$n; $i++){
  if($u[$i] === "BTC"){
    $arr[] = $x[$i] * 380000;
  } else {
    $arr[] = $x[$i];
  }
}

echo array_sum($arr);


Measured memory_bytes: 3700
import copy
import itertools
import sys

if sys.version[0] == '2':
    range, input = xrange, raw_input

drc = [(-1, 0), (0, 1), (1, 0), (0, -1)]
C_NUM = 6

def dfs(r, c, now_c, next_c):
    tmp_board[r][c] = next_c
    for dr, dc in drc:
        nr, nc = r + dr, c + dc
        if 0 <= nr < H and 0 <= nc < W and tmp_board[nr][nc] == now_c:
            dfs(nr, nc, now_c, next_c)


while True:
    H, W, C = map(int, input().split())
    if not (H | W | C):
        break
    board = [[int(x) - 1 for x in input().split()] for _ in range(H)]
    ans = 0
    for ope in itertools.product(range(C_NUM), repeat=4):
        # print(ope)
        if ope[0] == board[0][0] or ope[-1] == C - 1 or any(ope[i] == ope[i + 1] for i in range(3)):
            continue
        tmp_board = copy.deepcopy(board)
        for color in itertools.chain(ope, (C - 1, )):
            dfs(0, 0, tmp_board[0][0], color)
        dfs(0, 0, tmp_board[0][0], -1)
        cand = sum(row.count(-1) for row in tmp_board)
        if cand > ans:
            ans = cand
    print(ans)

Measured memory_bytes: 6512
import java.util.*;
class Main {
	public static void main(String...args) {
		Scanner scan = new Scanner(System.in);
		String row = scan.nextLine();
		while( !row.equals("0")) {
			int rowTotal = 0;
			String[] str = row.split("");
			for(int i = 0; i < str.length; i++) {
			   rowTotal += Integer.valueOf(str[i]);
			}
			System.out.println(rowTotal);
			row = scan.nextLine();
		}
	}
}



Measured memory_bytes: 27376
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    Long sum = 1L;
    Long max = 0L;
    Long b = 1000000000000000000L;
    Long [] a = new Long[N];
    for(int i = 0; i<N ;i++){
      a[i] = sc.nextLong();
      if(a[i]==0){
        System.out.println(0);
        return;
      }
    }
    for(int i = 0; i<N ;i++){
      sum = sum * a[i];
      if(sum>=max && sum<=b){
        max = sum;
      }else{
        System.out.println(-1);
        return;
      }
    }  
    System.out.println(sum);
  }
}


Measured memory_bytes: 60812
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int num;
    int taro = 0, hana = 0;
    cin >> num;
    for(int i=0; i<num; i++){
        string str1, str2;
        cin >> str1 >> str2;
        if(str1 < str2){
            hana += 3;
        }else if(str1 > str2){
            taro += 3;
        }else{
            hana++;
            taro++;
        }
    }
    cout << taro << " " << hana << endl;
    return 0;
}

Measured memory_bytes: 3196
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;
ll MOD = 1000000007;

// a^p
// 2^3 = 2 * 2^2
// 2^2 = 2 * (2^1)
// 2^1 = 2
ll modpow(ll a, ll p, ll mod) {
  if (p == 0) return 1;

  if (p % 2 == 0) {
    ll half = modpow(a, p / 2, mod) % mod;
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1, mod) % mod;
  }
}

// nCa を求める
ll modCombination(ll n, ll a, ll mod) {
  if (n - a < a) {
    return modCombination(n, n - a, mod);
  }

  ll denominator = 1;  // 分母
  ll numerator = 1;    // 分子

  for (ll i = 0; i < a; i++) {
    denominator *= a - i;
    numerator *= n - i;
    denominator %= mod;
    numerator %= mod;
  }

  return numerator * modpow(denominator, mod - 2, mod) % mod;
}

class UnionFind {
 private:
  vector<ll> parents;

 public:
  UnionFind(ll n) : parents(n, -1) {}

  bool issame(ll x, ll y) { return root(x) == root(y); }

  bool merge(ll x, ll y) {
    if (issame(x, y)) return false;

    ll rx = root(x);
    ll ry = root(y);
    if (parents[rx] > parents[ry]) swap(rx, ry);
    // サイズ情報を更新
    parents[rx] += parents[ry];
    // yの親を更新
    parents[ry] = rx;

    return true;
  }

  ll size(ll x) { return -parents[root(x)]; }

 private:
  ll root(ll x) {
    if (parents[x] < 0) return x;
    // 根の親の値に木の(-)サイズの情報を入れる
    return parents[x] = root(parents[x]);
  }
};

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

  ll a;
  ll b;
  ll c;

  cin >> a >> b >> c;

  cout << c << " " << a << " " << b;

  return 0;
}


Measured memory_bytes: 256
// Template begins
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue> 
#include <string.h>
#include <string>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(v) (v).begin(),(v).end()
#define sort0(v) sort(all(v))
#define lbb(a,b,arr,x) lower_bound(arr+a,arr+b+1,x)-arr
#define ubb(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-arr
#define freq(a,b,arr,x) upper_bound(arr+a,arr+b+1,x)-lower_bound(arr+a,arr+b+1,x)
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define d0(x) cout<<(x)<<" "
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define d5(a,b,c,d,e) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<endl
#define d6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<endl
#define max3(a,b,c) max(max((a),(b)),(c))
#define max4(a,b,c,d) max(max((a),(b)),max((c),(d)))
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
#define printp(x) cout << x.ff << " " << x.ss << endl
 
const ll mod=998244353;
#define inf 9999999999999
#define MAXN   100001 
  
// stores smallest prime factor for every number 
 
 
ll inv(ll i){if(i==1) return 1;return (mod-((mod/i)*inv(mod%i))%mod)%mod;}
 
ll gcd(ll a,ll b){if(a==0) return b;return gcd(b,b%a);}
inline void fastio(){ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
// Template ends
const int MN = 2e5+7;
struct comp{
    bool operator() (pii a, pii b){
        return min(a.ff,a.ss) < min(b.ff, b.ss) ;
    }
};
void solve(){
    int n; cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    multiset <pii, comp> ms;
    sort(arr,arr+n,greater<int>());
    ll sum=arr[0];
    ms.insert(mp(arr[0],arr[1]));
    ms.insert(mp(arr[0],arr[1]));
    for(int i=2;i<n;i++){
        auto it=ms.end();
        it--;
        //cout<<min(it->first,it->second)<<endl;
        sum+=min(it->first,it->second);
        int a=it->first; int b=it->second;
        ms.erase(it);
        ms.insert(mp(arr[i],a));
        ms.insert(mp(arr[i],b));
    }
    cout<<sum<<endl;
}
int main(){
    fastio();
    //write code
    int t; t=1;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 13312
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

LL n, k;
LL a[101010];
LL cnt[101];

LL dp[101][2];

int main(){
    cin >> n >> k;
    REP(i, n)cin >> a[i];
    REP(i, 45){
        REP(j, n){
            if((1LL << i) & a[j])cnt[i]++;
        }
    }
    REP(i, 101)REP(j, 2)dp[i][j] = -1;
    dp[45][0] = 0;
    for(LL i = 44;i >= 0;i--){
        LL mask = 1LL << i;

        LL num = 0;
        REP(j, n){
            if(a[j] & mask)num++;
        }

        LL s0 = mask*num;
        LL s1 = mask*(n - num);

        if(dp[i + 1][1]  >= 0){
            dp[i][1] = max(dp[i][1], max(dp[i + 1][1] + s0, dp[i + 1][1] + s1));
        }

        if(dp[i + 1][0] >= 0){
            if(k & mask){
                dp[i][1] = max(dp[i][1], dp[i + 1][0] + s0);
            }
        }

        if(dp[i + 1][0] >= 0){
            if(k & mask){
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + s1);
            }else{
                dp[i][0] = max(dp[i][0], dp[i + 1][0] + s0);
            }
        }
    }
    cout << max(dp[0][1], dp[0][0]) << endl;
}

Measured memory_bytes: 1024
/* ex 7_1
   offNaria */

#include <stdio.h>

typedef struct point
{
    int x_elem;
    int y_elem;
} point;

//b-aベクトルをaを中心として反時計まわりに90度回転し，始点をbにしたものの終点を計算する関数
point rotate(point a, point b);

int main(void)
{
    point p_1, p_2, p_3, p_4;
    scanf("%d %d %d %d", &p_1.x_elem, &p_1.y_elem, &p_2.x_elem, &p_2.y_elem);
    p_3 = rotate(p_1, p_2); //p_2-p_1ベクトルをp_1を中心として反時計回りに90度回転し，始点をp_2としたベクトルの終点がp_3
    p_4 = rotate(p_2, p_3); //p_3-p_2ベクトルをp_2を中心として反時計回りに90度回転し，始点をp_3としたベクトルの終点がp_4
    printf("%d %d %d %d\n", p_3.x_elem, p_3.y_elem, p_4.x_elem, p_4.y_elem);
    return 0;
}

point rotate(point a, point b)
{
    point rotatedVec = {b.x_elem + (a.y_elem - b.y_elem), b.y_elem + (b.x_elem - a.x_elem)};
    return rotatedVec;
}

Measured memory_bytes: 1724
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	int n, d; cin >> n >> d;
	vector<vector<int> >x(n);
	for(int i=0; i<n; i++){
		x[i].resize(d);
		for(int j=0; j<d; j++){
			cin >> x[i][j];
		}
	}

	int ans = 0;
	for(int i=0; i<n-1; i++){
		for(int j=i+1; j<n; j++){
			double tmp = 0;
			for(int k=0; k<d; k++){
				tmp += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
			}
			double sq = sqrt(tmp);
			if(sq == (int)sq) ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
    int a,b,c;
scanf("%d%d%d",&a,&b,&c);
if((a<b) && (b<c)){
    printf("Yes\n");
}else{
    printf("No\n");
}
    // your code goes here
    return 0;
}

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

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

    std::string s;
    std::cin >> s;

    std::string left, right;
    int count;
    std::vector<int> vec(n - 1);
    for(int i = 1; i < n; ++i){
        left = s.substr(0, i);
        right = s.substr(i, n - i);
        std::sort(left.begin(), left.end());
        left.erase(std::unique(left.begin(), left.end()), left.end());
        std::sort(right.begin(), right.end());
        right.erase(std::unique(right.begin(), right.end()), right.end());

        count = 0;

        for(int j = 0; j < left.size(); ++j){
            for(int k = 0; k < right.size(); ++k){
                if(left.at(j) == right.at(k)){
                    ++count;
                }
            }
        }

        vec.push_back(count);
    }

    std::cout << *max_element(vec.begin(), vec.end()) << std::endl;

    return 0;
}

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

unsigned long long int gcd(unsigned long long int a, unsigned long long int b) {
    if(a > b) swap(a, b);
    if(a == 0) return b;
    else return gcd(a, b%a);
}
unsigned long long int lcm(unsigned long long int a, unsigned long long int b) {
    return  a / gcd(a, b) * b;
}

int main() {
    int i, N;
    cin >> N;
    unsigned long long int T[N], tmp;

    for(i=0; i<N; ++i) {
        cin >> T[i];
    }

    if(N == 1) {
        cout << T[0] << endl;
        return 0;
    }

    tmp = lcm(T[0], T[1]);
    for(i=2; i<N; ++i) {
        tmp = lcm(tmp, T[i]);
    }
    cout << tmp << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <vector> 
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main() {
    long long K,a,b;
    cin >> K;
    cin >> a;
    cin >> b;
    for (int x = a; x <= b; x++) {
        if (x % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3624
R, G, B, N = map(int, input().split())

ok = 0
for r in range(N // R + 1):
    for g in range((N - r * R) // G + 1):
        last_num = N - (r * R) - (g * G)
        if last_num >= 0 and last_num % B == 0:
            ok += 1

print(ok)

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

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(M), b(M), c(M);
	vector<vector<int>> dp(N, vector<int>(N, 100000000));
	for (int i = 0; i < N; i++) {
		dp[i][i] = 0;
	}
	for (int i = 0; i < M; i++) {
		cin >> a[i] >> b[i] >> c[i];
		dp[a[i] - 1][b[i] - 1] = dp[b[i] - 1][a[i] - 1] = c[i];
	}
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}
	int res = 0;
	for (int i = 0; i < M; i++) {
		if (dp[a[i] - 1][b[i] - 1] < c[i]) {
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;


string s;
void solve(){
    cin>>s;
    rep(i,s.size()){
        cout<<'x';
    }



}

int main(){

    solve();

    return 0;

}
/*


*/


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		Integer []s = new Integer [n];
		int all = 0;
		int min = 101;
		
		for(int i = 0; i < n;i++) {
			s[i] = sc.nextInt();
			all += s[i];
			if(s[i] % 10 != 0) {
				min = Math.min(min, s[i]);
			}
		}
		
		
		if(all % 10 == 0 && min != 101) {
			all = all - min;
			System.out.println(all);
		}
		else if(all % 10 == 0 && min == 101) {
			System.out.println(0);
		}
		else {
			System.out.println(all);
		}
			
		
	}

}


Measured memory_bytes: 23764
#include <stdio.h>
#include <bitset>
using namespace std;

const int Z = 1 << 19;
bitset<26> IT[Z * 2];
int N, Q; char S[500500];

void in(int x, char c)
{
	x += Z;
	IT[x] = bitset<26>();
	IT[x][c - 'a'] = 1;
	x /= 2;
	while (x){
		IT[x] = IT[x * 2] | IT[x * 2 + 1];
		x /= 2;
	}
}

bitset<26> out(int l, int r)
{
	bitset<26> ret;
	l += Z; r += Z;
	while (l < r){
		if (l & 1) ret |= IT[l++];
		if (r & 1) ret |= IT[--r];
		l /= 2; r /= 2;
	}
	return ret;
}

int main()
{
	scanf ("%d", &N);
	scanf ("%s", S + 1);
	for (int i = 1; i <= N; i++) IT[i + Z][S[i] - 'a'] = 1;
	for (int i = Z - 1; i >= 1; i--) IT[i] = IT[i * 2] | IT[i * 2 + 1];

	scanf ("%d", &Q); while (Q--){
		int o; scanf ("%d", &o);
		if (o == 1){
			int x; char c; scanf ("%d %c", &x, &c);
			in(x, c);
		}
		if (o == 2){
			int l, r; scanf ("%d %d", &l, &r);
			printf ("%d\n", out(l, r + 1).count());
		}
	}
	return 0;
}

Measured memory_bytes: 11708
N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
p = Hash.new 0
A.each do |i|
  p[i] += 1
end
ans = 0
r = [p.size - K, 0].max
if r > 0
  p.sort_by{|_, v|v}.each.with_index do |(_, v), i|
    ans += v
    break if i + 1 >= r
  end
end
puts ans

Measured memory_bytes: 42368
/*input
10 4
*/

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

void odd(int N, int M) {
    rep(i, M) {
        cout << 1+i << " " << N-i << "\n";
    }
    cout << endl;
}

void even(int N, int M) {
    rep(i, M) {
        if (2*(i+1) > N/2) cout << 2+i << " " << N-i << "\n";
        else cout << 1+i << " " << N-i << "\n";
    }
    cout << endl;
}

int main() {
    int N, M;
    cin >> N >> M;
    if (N%2 == 1) odd(N, M);
    else even(N, M);
}


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

using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = ((int)s.size() - 1) / 2; i >= 0; --i) {
        if (s.substr(0, i) == s.substr(i, i)) {
            cout << 2 * i << endl;
            return 0;
        }
    }
    return 0;
}


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

typedef pair<int, int> pii;
const long long int MOD = 1000000007;
long long int dp[60][2];

pii calc(int a, int b, int c, bool x, bool y, bool z, int p, map<pair<pii, int>, int> &mp) {
    if(mp.count(make_pair(make_pair(a, b), c))) return make_pair(0, 0);
    mp[make_pair(make_pair(a, b), c)]++;

    pii ret(0, 0);
    if(((a+b+p)%10) == c) {
        if((a+b+p)>=10) ret.first++;
        else ret.second++;
    }

    if(a < 9 && !x) {
        pii tmp = calc(a+1, b, c, x, y, z, p, mp);
        ret.first += tmp.first;
        ret.second += tmp.second;
    }
    if(b < 9 && !y) {
        pii tmp = calc(a, b+1, c, x, y, z, p, mp);
        ret.first += tmp.first;
        ret.second += tmp.second;
    }
    if(c < 9 && !z) {
        pii tmp = calc(a, b, c+1, x, y, z, p, mp);
        ret.first += tmp.first;
        ret.second += tmp.second;
    }
    return ret;
}

int main() {
    string a, b, c;
    while(cin >> a) {
        if(a == "0") break;
        cin >> b >> c;
        int N = a.length();
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        reverse(c.begin(), c.end());

        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;
        for(int i=0; i<N; i++) {
            for(int j=0; j<2; j++) {
                int cnt[2] = {};
                int p = isdigit(a[i]) ? a[i] - '0' : (i==N-1);
                int q = isdigit(b[i]) ? b[i] - '0' : (i==N-1);
                int r = isdigit(c[i]) ? c[i] - '0' : (i==N-1);
                map<pair<pii, int>, int> mp;
                pii tmp = calc(p, q, r, isdigit(a[i]), isdigit(b[i]), isdigit(c[i]), j, mp);
                cnt[0] = tmp.second;
                cnt[1] = tmp.first;

                for(int k=0; k<2; k++) {
                    (dp[i+1][k] += dp[i][j] * cnt[k]) %= MOD;
                }
            }
        }

        printf("%lld\n", dp[N][0]);
    }
    return 0;
}


Measured memory_bytes: 3220
N = int(input())
MM = input().split()
count = 0
list1 =[]
for i in MM:
  a = int(i)
  list1.append(a)
list2 = sorted(list1)
for i,j in zip(list1,list2):
  
  if i != j:
    
    count +=1
if count >2:
  print('NO')
else:
  print('YES')

Measured memory_bytes: 9096
const main = (input) => {
  const [, n] = input.trim().split('\n')
  const nums = n.split(' ').map(v => Number(v)).sort((a, b) => a - b)

  const max = nums[nums.length - 1]
  const arr = new Array(max+1).fill(0)

  for (let v of nums) {
    for (let i=v; i<=max; i+=v) arr[i]++
  }

  let ans = 0
  for (let v of nums) {
    if (arr[v] === 1) ans++
  }
  console.log(ans)
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 67184
#include <string>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,h[100005];
ll dp[100005];
/*
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a. != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
*/
int main(){
	int K;
    std::cin >> K;
    printf("%d",(K/2)*((K+1)/2));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;

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

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


int main(){
  int n;
  cin>>n;
  ll a,ans=1;
  rep(i,n){
    cin>>a;
    if(ans%a!=0){
      ans=lcm(ans,a);
    }
  }
  cout<<ans<<endl;
  return 0;
}





Measured memory_bytes: 384