akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    int N;
    cin >> N;
    int ans = 1;
    while(ans * 2 <= N) ans *= 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int A[3];
    cin >> A[0] >> A[1] >> A[2];
    int ans = INT_MAX / 2;
    for (int j = 0; j < 3; j++)
    {
        for (int i = 0; i < 3; i++)
        {
            int tmp = INT_MAX / 2;
            if (i == j)
                continue;

            if (A[j] % 2 == A[i] % 2)
            {
                tmp = 0;
                tmp += abs(A[i] - A[j]) / 2;
                if (max(A[j], A[i]) <= A[3 - i - j])
                {
                    tmp += A[3 - i - j] - max(A[j], A[i]);
                }
                else
                {
                    tmp += (-A[3 - i - j] + max(A[j], A[i]) + 1) / 2;
                    if (A[3 - i - j] % 2 != max(A[j], A[i]) % 2)
                    {
                        tmp++;
                    }
                }
            }
            chmin(ans, tmp);
        }
    }
    cout << ans;
    return 0;
}

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

//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
 
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define fo(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define foe(i,x) for(auto& i: x)
#define ar array
#define pb push_back
#define vt vector
#define F first
#define S second

template<class T> bool umin(T& a,const T& b){return b<a?a=b,1:0;}
template<class T> bool umax(T& a,const T& b){return b>a?a=b,1:0;}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {cin>>x;}
void read(double& d) {string t;read(t);	d=stod(t);}
void read(long double& d) {	string t;read(t);d=stold(t);}
template<class H, class... T> void read(H& h, T&... t) {read(h);read(t...);}
template<class A> void read(vt<A>& x) {	foe(a, x)read(a);}

// no change 
const ll MOD = 1e9+7;  
int n;
void Titan(){
	read(n);
	cout << n*n;;



}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T = 1;
	//cin >> T;		//cmt if one test case
    fo(T){
		//cout << "Case #" << i+1 << ": " ;
		Titan();
	}
}
/*///////////////////////////////////////////////////////////
Important Notes : 
* check long long 
* check base cases
* do not loose Hope
* if case fails on 2nd test case maybe some cases are missing check them
* do not sit idle
* try to do it using pen/paper.
*/


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

typedef long long ll;

int main() {
  ll N, C, K;
  cin >> N >> C >> K;
  vector<ll> T(N);
  for(ll i=0; i<N; i++) cin >> T[i];
  sort(T.begin(), T.end());

  ll ans=0, i=0;
  while(1){
    ll cnt=1, crt,st;
    st=T[i];
    ans++;
    bool F=false;
    while(cnt<=C){
      //cout << i <<"->"<< T[i] <<" "<< cnt <<" "<< ans << endl;
      if(i+1 == N){ F=true; break; }
      if(T[i+1] <= (st+K)){
        cnt++;
        i++;
      }
      else {
        i++;
        break;
      }
    }
    if(F) break;
  }

  cout << ans << endl;
}

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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int a[300000],b[300000];
int c1[300000],c2[300000];

struct st{
	int a,b,c;
};
bool operator<(st a,st b){
	return a.a+a.b<b.a+b.b;
}

int ans[300000];

int main(){
	int n;cin>>n;
	rep(i,n)scanf("%d",&a[i]),c1[a[i]]++;
	rep(i,n)scanf("%d",&b[i]),c2[b[i]]++;
	priority_queue<st>que;
	for(int i=1;i<=n;i++){
		if(c1[i]+c2[i]){
			que.push({c1[i],c2[i],i});
		}
	}
	int rest=n;
	multiset<int>A,B;
	vector<P>v;
	while(!que.empty()){
		st p=que.top();que.pop();
		int need=p.a+p.b-rest;
		if(need>0){
			int a1=min({p.a,(int)A.size(),need});p.a-=a1;need-=a1;
			rep(i,a1){
				int d=*A.begin();A.erase(A.begin());
				v.push_back(P(p.c,d));
			}
			int b1=min({p.b,(int)B.size(),need});p.b-=b1;need-=b1;
			rep(i,b1){
				int d=*B.begin();B.erase(B.begin());
				v.push_back(P(d,p.c));
			}
		}
		if(need>0){
			puts("No");return 0;
		}
		rest-=p.a+p.b;
		rep(i,p.b)A.insert(p.c);
		rep(i,p.a)B.insert(p.c);
	}
	puts("Yes");
	sort(v.begin(),v.end());
	for(auto p:v){
		cout<<p.second<<' ';
	}
	cout<<endl;
}

Measured memory_bytes: 20456
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int>A(N);
    for(int i=0;i<N;i++)cin>>A[i];
    set<int>B;
    for(int i=0;i<N;i++)B.insert(A[i]);
    if(B.size()==N)cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 10368
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n + 2];
		for (int i = 1; i <= n; i++) {
			arr[i] = sc.nextInt();
		}
		int total = 0;
		int[] costs = new int[n + 1];
		for (int i = 1; i <= n + 1; i++) {
			costs[i - 1] = Math.abs(arr[i - 1] - arr[i]);
			total += costs[i - 1];
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 1; i <= n; i++) {
			int x = total - costs[i - 1] - costs[i] + Math.abs(arr[i - 1] - arr[i + 1]);
			sb.append(x).append("\n");
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 52736
import java.util.Scanner;

public class Main {

    private static long calcRec(long shorter, long longer) {
        long leftover = longer % shorter;
        long len = (longer / shorter) * 2 * shorter;

        if (leftover == 0) {
            return len - shorter;

        } else {
            return len + calcRec(leftover, shorter);
        }
    }

    private static long calcLen(long n, long x) {

        long len = n; // first two bounces == x + (n - x)

        if (2 * x == n) {
            return len + x;

        } else if (2 * x < n) {
            return len + calcRec(x, n - x);

        } else {
            return len + calcRec(n - x, x);
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long x = sc.nextLong();

        System.out.println(calcLen(n, x));
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <tuple>
#include <cmath>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n,m) for(int i=n;i<m;i++)
int main()
{
    int N, A, B; cin >> N >> A >> B;
    int result = 0;
    FOR(i, 1, N+1) {
        int sum = 0;
        int n = i;
        while (n) { sum += n % 10; n /= 10; }
        if (A <= sum && sum <= B) result += i;
    }
    cout << result << endl;
    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<lli> a(n);
    each (i, a) cin >> i;


    int idx = 0;
    for (int i = 0; i < a.size(); ++i) {
      if (abs(a[idx]) < abs(a[i])) {
        idx = i;
      }
    }

    vector<pair<int, int>> v;
    if (0 == a[idx]) {
    } else if (0 < a[idx]) {
      for (int i = 0; i < a.size(); ++i) {
        if (a[i] < 0) {
          a[i] += a[idx];
          v.push_back(make_pair(idx, i));
        }
      }
      for (int i = 0; i + 1 < a.size(); ++i) {
        v.push_back(make_pair(i, i + 1));
      }
    } else {
      for (int i = 0; i < a.size(); ++i) {
        if (0 < a[i]) {
          a[i] += a[idx];
          v.push_back(make_pair(idx, i));
        }
      }
      for (int i = a.size() - 1; 0 <= i - 1; --i) {
        v.push_back(make_pair(i, i - 1));
      }      
    }

    cout << v.size() << endl;
    each (i, v) cout << i.first + 1 << ' ' << i.second + 1 << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;

int a[101010],b[101010];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n, t; cin >> n >> t;
    for(int i=0;i<n;++i) cin >> a[i];
    for(int i=n-1;i>=1;--i) b[i-1] = max(b[i], a[i]);

    vector<ll> cnt;
    for(int i=0; i < n; ++i) cnt.emplace_back(b[i] - a[i]);
    sort(cnt.rbegin(), cnt.rend());

    int ans = 1;
    while(cnt[ans-1]==cnt[ans] && ans < n) ++ans;
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 2168
n = int(input())
L = list(map(int,input().split()))
S = 0
ans1 = 0
for i in range(n):
  S += L[i]
  if i%2 == 0:
    if S <= 0:
      ans1 += abs(S)+1
      S = 1
  else:
    if S >= 0:
      ans1 += S+1
      S = -1
T = 0
ans2 = 0
for i in range(n):
  T += L[i]
  if i%2 == 0:
    if T >= 0:
      ans2 += T+1
      T = -1
  else:
    if T <= 0:
      ans2 += abs(T)+1
      T = 1
print(min(ans1,ans2))

Measured memory_bytes: 14464
#累積和による解法
#計算量 O(N+Q)

N,Q = map(int, input().split())
S = input()
A = [0]*N

cnt = 0
for i in range(1,N):
    if S[i-1]=="A" and S[i]=="C":
        cnt += 1
    A[i] = cnt

for j in range(Q):
    x,y = map(int, input().split())
    print(A[y-1]-A[x-1])

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

int main()
{
	ll a,b;
	cin>>a>>b;
	double p=a/0.08;
	ll f=(ll)p;
	for(ll i=f-5;i<=f+5;i++)
	{
		ll p=floor(i*0.08);
		ll q=floor(i*0.1);
		if(p==a && q==b)
		{
			cout<<i;
			return 0;
		}
	}
	double r=b/0.1;
	f=(ll)r;
	for(ll i=f-5;i<=f+5;i++)
	{
		ll w=floor(i*0.08);
		ll q=floor(i*0.1);
		if(w==a && q==b)
		{
			cout<<i;
			return 0;
		}
	}
	cout<<-1<<"\n";
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var len int
	var err error
	bc := bufio.NewScanner(os.Stdin)

	bc.Scan()
	len, err = strconv.Atoi(bc.Text())
	if err != nil {
		fmt.Println("err:", err)
		os.Exit(1)
	}

	bc.Scan()
	arrayStr := strings.Fields(bc.Text())
	var arrayInt []int
	for _, elem := range arrayStr {
		newElem, err := strconv.Atoi(elem)
		if err != nil {
			fmt.Println("err:", err)
		}
		arrayInt = append(arrayInt, newElem)
	}
	change := SelectSort(arrayInt)
	for i, elem := range arrayInt {
		if i != len-1 {
			fmt.Printf("%d ", elem)
		} else {
			fmt.Printf("%d\n", elem)
		}
	}
	fmt.Println(change)
}

func SelectSort(elems []int) int {
	var len = len(elems)
	var change, count int
	for i := 0; i < len-1; i++ {
		min := i
		for j := i + 1; j < len; j++ {
			if elems[j] < elems[min] {
				min = j
				change = 1
			}
		}
		if change == 1 {
			tmp := elems[i]
			elems[i] = elems[min]
			elems[min] = tmp
			count++
			change = 0
		}
	}
	return count
}


Measured memory_bytes: 1156
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        int count = 0;

        scanner.close();

        for (int i = 0; i < 3; i++){
            if (S.charAt(i) == 'R'){
                count++;
            }
        }
        if (S.equals("RSR")){
            count = 1;
        }
        
        System.out.println(count);
    }
}



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

typedef long long ll;

int main()
{
    int n;
    int h[128], dis[128];
    int tmp;

    cin >> n;

    while (n != 0) {
        for (int i = 0; i <= n; ++i) {
            cin >> h[i];
            if (i) dis[i] = h [i] - h[i - 1];
        }

        if (dis[1] != dis[2] && dis[2] == dis[n]) {
            cout << h[0];
        } else if (dis[n] != dis[n - 1] && dis[1] == dis[n - 1]) {
            cout << h[n];
        } else {
            for (int i = 0; i < n; ++i) {
                tmp = (h[n] - h[0]) / (n - 1);

                if (h[i] + tmp != h[i + 1]) {
                    cout << h[i + 1]; break;
                }
            }
        }
        cout << endl;

        cin >> n;
    }

    return 0;
}




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

int main()
{
  int N ;
  cin>>N ;
  int d[N] ;
  for(int i=0;i<N;i++) cin>>d[i] ;
  
  int sum=0 ;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      sum+=d[i]*d[j] ;
    }
  }
  cout<<sum<<endl ;
  
  return 0 ;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    P(n >= 1000 ? "ABD" : "ABC");
}

int main() {
    solve();
    return 0;
}


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

// #define fi first
// #define se second
#define rep(i, n) for (ll i=0;i<(n); i++)
#define ALL(v) (v).begin(), (v).end()
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;

const ll M=1000000007ll;
const ll MOD=1000000007ll;
const ll MAX=100000001ll;
//const ll M = 1000000000+7;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
   return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(ll n){
  if(n==0) return 1;
  mint ans = f(n/2);
  ans *= ans;
  if(n%2==1) ans*= 2;
  return ans;
}

mint choose(ll n, ll k){
  mint x=1, y=1;
  rep(i,k){
    x *= (n-i);
    y *= (i+1);
  }
  return x / y;
}

struct BIT {
  private:
   vector<ll> bit;
   ll N;
 
  public:
   BIT(ll size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(ll a, ll w) {
     for (ll x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(ll a) {
     ll ret = 0;
     for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };
 
ll fff(ll n, vector<ll>& v, ll i, ll j, ll rl){
  ll can = 0;
  ll can_i = 0;

  cout << v[0]<<endl;
  
  // right
  if(rl == 0){
    rep(k, n){
      if(v[k]*(j-k)>can){
	can = v[k]*(j-k);
	can_i = k;
      }
      //cout << can<<endl;
    }
    v[can_i] = 0;
    return can;
  }
  // left
  else{
    rep(k, n){
      if(v[k]*(k-i)>can){
	can = v[k]*(k-i);
	can_i = k;
      }
      //cout << can<<endl;

    }
    v[can_i] = 0;
    return can;
  }
  
}

ll ff(ll x){
  return x * (x+1) / 2;
}

int main(){
  ll n, k,x,y;
  cin>>n>>y;

  x=2000;
  rep(i, n+1){
    if((10000*i)>y ) break;
    rep(j, n+1){
      if((10000*i+5000*j)>y || (i+j)>n) break;
      
      if((10000*i+5000*j+1000*(n-(i+j))) ==y ){
	  cout << i << " "<< j << " "<< n-i-j << endl;
	  return 0;
      }
    }
  }
  
  
  cout<<"-1 -1 -1"<<endl;
}


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

int main(){
  int l, r; cin >> l >> r;
  int a[1000];
  a[1] = 1;
  for(int i = 2; i < 1000; i++) a[i] = a[i - 1] + i;
  for(int i = 0; i < 1000000000; i++){
    int L = l + i;
    int R = r + i;
    if(L > R) swap(L, R);
    for(int j = 2; j < 1000; j++){
      if(L == a[j - 1] && R == a[j]){
        cout << i << endl;
        return 0;
      }
    }
  }
  
 return 0; 
}

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

class Program {
    static string ReadLine() { return Console.ReadLine(); }
    static int ReadInt() { return int.Parse(ReadLine()); }
    static int[] ReadInts() { return ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return ReadLine().Split(); }

    static int Calc(int n, int[] xs) {
        var ban = new bool[10];
        foreach (var x in xs)
            ban[x] = true;

        var ds = n.ToString().Select(c => c - '0').ToArray();

        int min = ban.Select((e, i) => new { e, i }).First(e => !e.e).i;
        var ans = new List<int>();
        bool ok = false;
        // 桁数同じ
        foreach (var d in ds) {
            if (ok) {
                ans.Add(min);
            }
            else {
                if (ban[d]) {
                    bool found = false;
                    for (int i = d+1; i < 10; i++) {
                        if (!ban[i]) {
                            found = true;
                            ans.Add(i);
                            ok = true;
                            break;
                        }
                    }

                    if (!found) {
                        break;
                    }
                }
                else {
                    ans.Add(d);
                }
            }
        }

        if (ans.Count == ds.Length) return ans.Aggregate((a, b) => 10 * a + b);

        ans.Clear();
        if (min == 0) {
            int min2 = ban.Select((e, i) => new { e, i }).First(e => e.i > min && !e.e).i;
            ans.Add(min2);
            for (int i = 0; i < ds.Length; i++) ans.Add(min);
        }
        else {
            for (int i = 0; i < ds.Length + 1; i++) ans.Add(min);
        }
        return ans.Aggregate((a, b) => 10 * a + b);
    }

    static void Main() {
        var nk = ReadInts();
        int n = nk[0];
        var xs = ReadInts();
        Console.WriteLine(Calc(n, xs));
    }
}

Measured memory_bytes: 3160
n,m = map(int,input().split())
a = [-1]
flag = True
 
if m>0:
  for i in range(m):
    a.append(int(input()))
    if a[i+1]==a[i]+1:
      flag = False
      break
  if not flag:
    print(0)
  else:
    a.append(n+1)
    step = [a[i+1]-a[i]-1 for i in range(m+1)]
    onestep = [1,1]
    if max(step)>=3:
      for i in range(3,max(step)+1):
        onestep.append(onestep[-2]+onestep[-1])
  
    ans = 1
    for i in range(m+1):
      ans *= onestep[step[i]-1]
    print(ans%1000000007)
else:
  onestep=[1,1]
  if n==1:
    print(1)
  else:
    for i in range(2,n+1):
      onestep.append(onestep[-2]+onestep[-1])
    print(onestep[-1]%1000000007)

Measured memory_bytes: 460020
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int a[10000], b[10000], cnt; char c;
string S[10000];
vector<int>A;
vector<string>B;
int n, m;
int main() {
	cin >> n >> m;
	for (int i = 0; i < n * 2; i++) {
		cin >> a[i] >> c >> b[i] >> S[i];
		if (i >= 1 && i % 2 == 0) {
			if ((a[i] * 60 + b[i]) - (a[i - 1] * 60 + b[i - 1]) >= m) {
				B.push_back(S[i]); A.push_back((a[i] * 60 + b[i]) - (a[i - 1] * 60 + b[i - 1]));
			}
		}
	}
	cout << A.size() << endl;
	for (int i = 0; i < A.size(); i++) {
		cout << B[i] << ' ' << A[i] << endl;
	}
}

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

int n;
int dat[100100];
int ans = 0;

int main(){
	scanf("%d",&n);
	for( int i = 1 ; i <= n ; i++ )
		scanf("%d",&dat[i]);

	sort( dat+1 , dat+n+1 );

	int ptr = 1;
	while( ptr <= n ){
		bool cnt = 1;
		while( ptr < n  &&  dat[ptr] == dat[ptr+1] ){
			ptr++;
			cnt ^= 1;
		}
		ans += cnt;
		ptr++;
	}

	printf("%d",ans);

	return 0;
}


Measured memory_bytes: 640
def resolve():
    S = str(input())
    if S[0] != 'A':
        print('WA')
        return

    if S[2:-1].count('C') != 1:
        print('WA')
        return

    if S.replace('A', 'a').replace('C', 'c') != S.lower():
        print('WA')
        return

    print('AC')

    return
resolve()

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

#define ll long long
#define vi vector<int>
#define vc vector<char>
#define vt vector<string>
#define si set<int>
#define sc set<char>
#define st set<string>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back;

using namespace std;
map<string,ll>mp;

int main()
{
    ll  n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll ans=0;
    for(auto e:mp)
        if(e.se>1)ans+=(e.se*(e.se-1))/2;
        cout<<ans;
    return 0;
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int mi,ma,n,a[100005];
long long sum;

int main()
{
    scanf("%d",&n);
    mi=10000000;ma=-10000000;
    sum=0;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        mi=min(mi,a[i]);
        ma=max(ma,a[i]);
        sum+=a[i];
    }
    printf("%d %d %lld\n",mi,ma,sum);
}



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

int n,nw[510],pn,N,p[510],cnt;
long long ans[510][510],h[510],l[510];
map<long long,int> ma;

long long gcd(long long a,long long b) {return (!b)?a:gcd(b,a%b);}
long long lcm(long long a,long long b) {return a/gcd(a,b)*b;}

bool bo[10010];

int main()
{
	for (int i=2,cnt=0; i<=10000; i++) if (!bo[i])
	{
		if (i>=250) p[++pn]=i; 
		if (pn==251) break;
		for (int j=i; j<=10000; j+=i) bo[j]=1;
	}
	srand(12019687),scanf("%d",&N),cnt=0,n=501;
	for (int i=1; i<=n; i+=2) cnt++;
	for (int i=1; i<=cnt; i++) nw[i]=(i+1==251?254:i+1);
	random_shuffle(nw+1,nw+1+cnt);
	while (1)
	{
		ma.clear(); bool bo=0;
		for (int i=1; i<=cnt; i++) h[2*i-1]=nw[i],ma[nw[i]]=1;
		for (int i=2; i<=n; i+=2) 
		{
			h[i]=h[i-1]*h[i+1];
			if (ma[h[i]]) {bo=1; break;}
			ma[h[i]]=1;
		}
		if (!bo) break;
		random_shuffle(nw+1,nw+1+cnt);
	}
	for (int i=1; i<=cnt; i++) if (i&1) l[2*i-1]=p[i+1>>1]; else l[2*i-1]=p[pn-(i>>1)+1];
	for (int i=2; i<=n; i+=2) l[i]=l[i-1]*l[i+1];
	for (int i=0; i<=n+1; i++) ans[i][0]=ans[i][n+1]=ans[0][i]=ans[n+1][i]=1;
	ma.clear();
	for (int i=1; i<=n; i++)
		for (int j=2-(i&1); j<=n; j+=2) 
			ans[i][j]=h[i]*l[j],ma[ans[i][j]]=1;
	for (int i=1; i<=n; i++)
		for (int j=(i&1)+1; j<=n; j+=2) 
		{
			long long nw=lcm(lcm(lcm(ans[i-1][j],ans[i+1][j]),ans[i][j-1]),ans[i][j+1]);
			ans[i][j]=nw+1;
			while (ma[ans[i][j]]) ans[i][j]+=nw;
			ma[ans[i][j]]=1;
		}
	for (int i=1; i<=N; i++,puts(""))
		for (int j=1; j<=N; j++) printf("%lld ",ans[i][j]);
	return 0;
}

Measured memory_bytes: 20736
#include<iostream>
#include<algorithm>
#include<vector>
#define pb push_back
using namespace std;
const int N=2e5+10,mod=924844033;
int n,siz[N],num[N],inv[N],jc[N],ans;
int r[N<<2],l,tt,A[N<<2],B[N<<2],w[N<<2];
vector<int> S[N];
int ksm(int x,int k)
{
	int s=1;for(;k;k>>=1,x=1ll*x*x%mod)
				if(k&1) s=1ll*s*x%mod;return s;
}
int C(int n,int k) {return 1ll*jc[n]*inv[k]%mod*inv[n-k]%mod;}
void NTT(int *P,int op)
{
	for(int i=1;i<l;i++) if(r[i]>i) swap(P[i],P[r[i]]);
	for(int i=1;i<l;i<<=1)
	{
		int W=ksm(5,(mod-1)/(i<<1));
		if(op<0) W=ksm(W,mod-2);w[0]=1;
		for(int j=1;j<i;j++) w[j]=1ll*w[j-1]*W%mod;
		for(int j=0,p=i<<1;j<l;j+=p)
			for(int k=0;k<i;k++)
			{
				int X=P[j+k],Y=1ll*P[j+k+i]*w[k]%mod;
				P[j+k]=(X+Y)%mod;P[j+k+i]=(mod+(X-Y)%mod)%mod;
			}
	}
}
void dfs1(int x,int fr)
{
	siz[x]=1;
	for(auto R:S[x]) if(R!=fr) dfs1(R,x),siz[x]+=siz[R];
}
void dfs2(int x,int fr)
{
	siz[x]+=siz[fr];
	for(auto R:S[x]) num[siz[R]]++;
	for(auto R:S[x]) if(R!=fr) siz[x]-=siz[R],dfs2(R,x),siz[x]+=siz[R];
	siz[x]-=siz[fr];
}
int main()
{
	cin>>n;
	for(int i=1,x,y;i<n;i++)
		cin>>x>>y,S[x].pb(y),S[y].pb(x);
	dfs1(1,0);dfs2(1,0);
	jc[0]=inv[0]=1;
	for(int i=1;i<=n;i++) jc[i]=1ll*jc[i-1]*i%mod;
	inv[n]=ksm(jc[n],mod-2);
	for(int i=n-1;i>=1;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod;
	for(l=1;l<=n*2;l<<=1) tt++;tt--;
	for(int i=0;i<l;i++) r[i]=(r[i>>1]>>1)|((i&1)<<tt);
	for(int i=0;i<=n;i++) A[i]=1ll*jc[i]*num[i]%mod,B[i]=inv[i];
	reverse(B+0,B+n+1);NTT(A,1);NTT(B,1);
	for(int i=0;i<l;i++) A[i]=1ll*A[i]*B[i]%mod;NTT(A,-1);
	for(int i=0,inv=ksm(l,mod-2);i<l;i++) A[i]=1ll*A[i]*inv%mod;
	for(int i=1;i<=n;i++) printf("%lld\n",(mod+1ll*n*C(n,i)%mod-1ll*inv[i]*A[n+i]%mod)%mod);
}


Measured memory_bytes: 41984
S=input()
if len(S)==1:
  print(S)
else:
  def bfs(i,j,k):
    if i==len(S)-1:
      return k+int(S[j:])
    return bfs(i+1,i+1,k+int(S[j:i+1]))+bfs(i+1,j,k)
  bns=bfs(0,0,0)
  print(bns)

Measured memory_bytes: 9120
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	long long		a,b,c,h,i,j,k,l,m,n,x,y;
	long long		ans = 1;
	double aa,aans=1.0;
	string	s;
	cin >> n;
	//vector<ll>	aa(n);
	bool flag = true , zero = false;
	for(i=0;i<n;i++) {
		cin >> a;
		if (ans != 0) {
			c = 1000000000000000000ull / ans;
			if (c < a) flag = false;
		}
		ans *=a;
		aa = a;
		//aans *= aa;
		//if (aans > 1000000000000000000.0) flag = false;
		//if (ans > 1000000000000000000ull) flag = false;
		if (a == 0) {
			zero = true;
		}	
	}
	
	if (flag == false && zero == false) ans = -1;
	
	//vector<ll>	dp(n+1,INFL);
	//vector<vector<ll>>	dp2(x , vector<ll>(y,INFL));

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


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int a, v, b, w;
        a = scn.nextInt();
        v = scn.nextInt();
        b = scn.nextInt();
        w = scn.nextInt();
        long t = scn.nextLong();

        long dis = Math.abs(b - a);
        long ch = v - w;
        if (ch <= 0) {
            System.out.println("NO");
        } else {
            if (dis <= (ch * t)) {
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }

        scn.close();

    }

}

Measured memory_bytes: 27040
#include<algorithm>
#include<cstdio>
#include<stack>
#include<vector>
using namespace std;

int main() {
  stack<int> S1;
  stack< pair<int, int> > S2;

  char ch;
  int i = 1, j, sum = 0, a;
  while (scanf("%c", &ch) != EOF) {
    if (ch == '\\') S1.push(i);
    else if (ch == '/' && 0 < S1.size()) {
      j = S1.top(); S1.pop();
      sum += i - j;
      a = i - j;
      while (0 < S2.size() && j < S2.top().first) {
        a += S2.top().second;
        S2.pop();
      }
      S2.push(make_pair(j, a));
    }
    i++;
  }

  printf("%d\n", sum);
  printf("%d", S2.size());

  vector<int> ans;
  while (0 < S2.size()) {
    ans.push_back(S2.top().second);
    S2.pop();
  }
  reverse(ans.begin(), ans.end());

  for (int idx = 0; idx < ans.size(); idx++)
    printf(" %d", ans[idx]);

  printf("\n");

  return 0;
}



Measured memory_bytes: 2844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    static boolean isPalindrome(String str)
    {
        int i = 0, j = str.length() - 1;

        while (i < j)
        {
            if (str.charAt(i) != str.charAt(j))
                return false;
            i++;
            j--;
        }
        return true;
    }

    public static void main(String args[])
    {
        FastReader obj = new FastReader();
        StringBuffer str = new StringBuffer(obj.next());
        int left = (str.length()-1)/2,right = (str.length()+3)/2;
        if(isPalindrome(str.toString()))
        {
            if(isPalindrome(str.substring(0,left)))
            {
                if(isPalindrome(str.substring(right-1,str.length())))
                {
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 21332
#include<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
int n,num,p[35],c[35],ans;
inline void R(int&x,int y){(x+=y)>=mod?x-=mod:0;}
inline int pow(int x,int k)
{
	int sum=1;
	for(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;
	return sum;
}
void dfs(int x,int v)
{
	if(x>num)
	{
		int num=9LL*pow(10,v-1)%mod;
		if(v<=9&&num<n/v); else R(ans,((num-(n/v)+1)%mod+mod)%mod);
		return;
	}	
	for(int i=0;i<=c[x];++i) dfs(x+1,v),v*=p[x];
}
int exgcd(int a,int b,int&x,int&y)
{
	if(!b){x=1;y=0;return a;}
	int c=exgcd(b,a%b,y,x);
	y-=a/b*x;return c;
}
inline int D(int x,int y){return (x+1000000000LL*y)/y-1000000000;}
inline int U(int x,int y){return (x+1000000000LL*y+y-1)/y-1000000000;}
int Solve(int a,int b,int c,int ux,int uy)
{
	int x,y,g=exgcd(a,b,x,y);
	if(c%g) return 0;
	x*=c/g;y*=c/g;a/=g;b/=g;
	int t=x/b;x-=t*b;y+=t*a;
	if(x<=0)
	{
		int t=(-x)/b+1;
		x+=t*b;y-=t*a;	
	}
	int l=max(0,U(y-uy,a)),r=min((ux-x)/b,D(y-1,a));
	if(l<=r) return r-l+1; else return 0;
}
int main()
{
	scanf("%d",&n);int t=n;
	for(int i=2;i<=10000;++i) if(t%i==0)
	{
		p[++num]=i;
		while(t%i==0) t/=i,++c[num];
	}
	if(t>1) p[++num]=t,c[num]=1;dfs(1,1);
	for(int l=1;l<10;++l)
		for(int r=l+1,mid=0;r<10&&mid+l+r<=n;mid=min(mid+9LL*r*pow(10,r-1),(long long)1e9),++r)
			R(ans,Solve(l,r,n-mid,9*pow(10,l-1),9*pow(10,r-1)));
	for(int i=9,last;i<=n;i=last+1)
	{
		last=n/(n/i);
		if(1LL*i*i<=n)
		{
			int A=n/i,B=n%i,l=0,r=n,mid,res=0;
			while(l<=r)
			{
				mid=l+r>>1;
				if(A-mid>B+1LL*mid*i) res=mid,l=mid+1;
				else r=mid-1;
			}
			R(ans,res-(B==0)+1);
		}
		else if(n%(n/i)) R(ans,1);
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def dig(X, n):
    if (int(X / n)):
        return dig(int(X / n), n) + str(X % n)
    return str(X % n)


def main():
    N, K = map(int, input().split())
    print(len(dig(N, K)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
  int N;
  cin >> N;
  int A[N], B[N], C[N];

  for(int i=0; i<N; i++)
    cin >> A[i];
  for(int i=0; i<N; i++)
    cin >> B[i];
  for(int i=0; i<N-1; i++)
    cin >> C[i];

  int sum=0;
  for(int i=0; i<N; i++)
    {
      sum += B[A[i]-1];
      if(i<N-1 && A[i]+1==A[i+1])
	sum+=C[A[i]-1];
      //      cout << sum <<endl;
    }
  
  cout << sum << endl;

  

  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int K, T; 
	cin >> K >> T; 
	int saidai = 0; 
	for(int i = 0; i < T; i++){
		int a; 
		cin >> a; 
		saidai = max(saidai, a); 
	}
	cout << max(2 * saidai - 1 - K, 0) << endl; 
}

Measured memory_bytes: 256
l =[]
for i in range(5):
    a = int(input())
    l.append(a)

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

if len(x) == 0:
    print(sum(j))
else:
    print(sum(j)-10+min(x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18+5
#define mod 1000000007
#define MAXN 100005
#define ll long long
#define pb push_back
#define sortv(v) sort(v.begin(),v.end())
#define tc(t) int t;cin>>t;while(t--)
#define copy copy_n
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define frr(i,a,b) for(long long i=a;i>=b;i--)
#define frn(i,a,b,n) for(long long i=a;i<=b;i=i+n)
#define gcd(x,y) __gcd(x,y)
#define ld long double
#define um unordered_map
#define mkp make_pair
#define b_s binary_search
#define nob __builtin_popcount
#define des greater<ll>()
#define fi first
#define se second
ll mul(ll a, ll b, ll p = mod) {return ((a % p) * (b % p)) % p;}
ll add(ll a, ll b, ll p = mod) {return (a % p + b % p) % p;}
void input(ll a[], ll sz) {fr(i, 0, sz) cin >> a[i];}
void print(ll a[], ll sz) {fr(i, 0, sz) {if (i == sz - 1) cout << a[i] << "\n"; else cout << a[i] << " ";}}
ll maxr(ll a[], ll sz) {ll ma; fr(i, 0, sz) {if (i == 0) ma = a[i]; else if (a[i] > ma) ma = a[i];} return ma;}
ll minr(ll a[], ll sz) {ll mi; fr(i, 0, sz) {if (i == 0) mi = a[i]; else if (a[i] < mi) mi = a[i];} return mi;}
ll isprm(ll n) {
    if (n <= 1)  return 0;
    if (n <= 3)  return 1;
    if (n % 2 == 0 || n % 3 == 0) return 0;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return 0;
    return 1;
}
/*ll spf[MAXN];
void sieve()
{
    spf[1]=1;
    for (ll i=2; i<MAXN; i++)
        spf[i] = i;
    for (ll i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for(ll i=3;i*i<MAXN;i+=2)
    {
        if (spf[i]==i)
        {
            for (int j=i*i;j<MAXN;j+=i)
                if (spf[j]==j)
                    spf[j]=i;
        }
    }
}*/
ll power(ll x, ll y, ll p = mod)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p = mod)
{
    return power(n, p - 2, p);
}
ll ncrMod(ll n, ll r, ll p = mod)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    for (ll i = 1 ; i <= n; i++)
        fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p *
            modInverse(fac[n - r], p) % p) % p;
}
//a+b=xor(a,b)+2*(a&b)//
struct comp
{
    bool operator()(const pair<ll, ll> &a,
                    const pair<ll, ll> &b)const
    {
        if (a.fi == b.fi)
        {
            return (a.se > b.se); //second elem in descending
        }
        return (a.first < b.first);//first elem in ascending
    }
};




int main()
{
    fio;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=max(a*c,b*d);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    cout<<ans<<"\n";
    return 0;
}


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

#define DB if(0)

inline void no(){
	cout << "No";
	exit(0);
}

int main(){
	int n;	cin >> n;
	vector<int> a (n+1);
	for(int i = 0; i < n; i++) cin >> a[i];
	a[n] = INT_MAX;
	//-----------------------------
	for( int i = n-1 ; i > 0; i-- ){
		if(a[i-1] - 1 > a[i]) no();
		if(a[i-1] > a[i]){
			a[i-1]--;
		}
	}
	if(a[0] - 1 > a[1]) no();
	//
	cout << "Yes";
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n;


void init(){
	cin>>n;
}

int main(void){
	init();
	cout<<n*(n-1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    String s = "";
    for(int i = 0; i < W + 2; i++) {
      s += "#";
    }
    System.out.println(s);
    for(int i = 0; i < H; i++) {
      String str = sc.next();
      str = "#" + str;
      str = str + "#";
      System.out.println(str);
    }
    System.out.println(s);
  }
}

Measured memory_bytes: 24148
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

//
#include <iostream>
#include <vector>
#include <tuple>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

void debug_out() {};
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

struct C1 {
    vector<ll> v_{};
    explicit C1(vector<ll> v) : v_(move(v)){}
    explicit C1(ll N, vector<ll> r, vector<tuple<ll, ll, ll>> v) {}
    ll resolve() {
        return 0;
    }
};

int main() {
    ll N;
    cin >> N ;
    cout << N * N * N << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=998244353;
int a[2005][2005],b[2005];
int gcd(int a,int b){
	return a%b==0?b:gcd(b,a%b);
}
int main()
{
	ll n,cou=0;
	scl(n);
	rep(i,1,n){
		rep(j,1,n){
			rep(k,1,n){
				cou+=gcd(gcd(i,j),k);
			}
		}
	}pf("%lld\n",cou);
}


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	string S;
	cin >>S;
	int D=0;
	int N=0;
	for (int i=0; i<S.size(); i++) {
		int n=S.at(i)-'0';
		D +=n;
		N = N*10+n;
	}
	if (0==N%D)
		cout <<"Yes" <<endl;
	else
		cout <<"No" <<endl;
	return 0;
}



Measured memory_bytes: 256
L,M=map(int,input().split())
a=[0]*L
x=[]
y=[]
for i in range(M):
    b,c=map(int,input().split())
    x.append(b)
    y.append(c)
if max(x)<=min(y):
    print(-max(x)+min(y)+1)
else:
    print(0)

Measured memory_bytes: 17544
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))

using namespace std;

/*
N M
x1 y1
...
xM yM
 */

int N, M;
vector<vector<int>> edge(100001, vector<int>());
vector<int> len(100001, -1);

int dfs(int node){
  if(len[node] != -1)
    return len[node];
  
  int ret=0;
  for(auto i : edge[node]){
    ret = max(ret, dfs(i) + 1);
  }
  len[node] = ret;
  return ret;
}

int main(){
  cin >> N >> M;
  REP(i,M){
    int x,y;
    cin >> x >> y;
    edge[x].push_back(y);
  }

  int ans = 0;
  FOR_IN(i,1,N+1){
    ans = max(ans, dfs(i));
  }

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


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	if(n%2==1){
		printf("No");
		return 0;
	}
	string s,s1="",s2="";
	cin>>s;
	for(int i=0;i<n/2;i++) s1+=s[i];
	for(int i=n/2;i<n;i++) s2+=s[i];
	if(s1==s2) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007
//作者:中国江苏南京丁天行
using namespace std;
//数组不要开小了
//数组不要开反了
int n,c[2],k;
ll a[110][110];
ll ans;
int main()
{
    a[0][0]=1;
    for(int i=1;i<=100;i++){
            a[i][0]=a[i][i]=1;
            for(int j=1;j<i;j++)a[i][j]=a[i-1][j-1]+a[i-1][j];
    }
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
            int x;
            scanf("%d",&x);
            c[x&1]++;
    }
    for(int i=k;i<=n;i+=2)ans+=a[c[1]][i];
    for(int i=1;i<=c[0];i++)ans*=2ll;
    cout<<ans<<endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int n, b, sp;
	while (scanf("%d", &n)>0) {
		sp = 0;
		for (b = 1; b < 1024; b <<= 1) {
			if (n & b) {
				if (sp)
					putchar(' ');
				printf ("%d", b);
				sp = 1;
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#!/usr/bin/env python3

import math

def is_sqrt(n):
    s = int(math.sqrt(n))
    return s*s == n


def d2(d, pi, pj, xss):
    return sum([(xss[pi][i] - xss[pj][i])**2 for i in range(d)])


def solv(n, d, xss):
    count = 0
    for pi in range(n):
        for pj in range(pi):
            dd = d2(d, pi, pj, xss)
            if is_sqrt(dd):
                count += 1
    return count

if __name__ == '__main__':

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

    xss = []

    for _ in range(n):
        xss.append([int(x) for x in input().split()])

    ans = solv(n, d, xss)
    print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.endl(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  // cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int n;
  cin >> n;
  int ans = n;
  REP(i, n + 1) {
    int a = i;
    int b = n - i;
    int x, y;
    x = y = 0;
    while (a > 0) {
      x += a % 9;
      a /= 9;
    }
    while (b > 0) {
      y += b % 6;
      b /= 6;
    }
    ans = min(ans, x + y);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  vector<vector<int>> abc(n);
  for(int i=0; i<n; i++){
    int a, b, c; cin >> a >> b >> c;
    abc[i].push_back(a);
    abc[i].push_back(b);
    abc[i].push_back(c);
  }
  vector<vector<int>> dp(n, vector<int>(3, 0));
  dp[0][0]=abc[0][0];
  dp[0][1]=abc[0][1];
  dp[0][2]=abc[0][2];
  for(int i=1; i<n; i++){
    for(int j=0; j<3; j++){ // j is yesterday's activity
      for(int k=0; k<3; k++){ // k is today's activity
        if(j==k) continue;
        if(dp[i][k]<dp[i-1][j]+abc[i][k]) dp[i][k]=dp[i-1][j]+abc[i][k];
      }
    }
  }
  cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
  return 0;
}

Measured memory_bytes: 11136