akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

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

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


 
int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
      int n;
      cin>>n;
      string s;
      cin>>s;
      if(n%2==0){
        string t1=s.substr(0,n/2);
        string t2=s.substr(n/2,n/2);
        if(t1==t2)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        }else cout<<"No"<<endl;
      }
}












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

#define MOD 1000000007
typedef unsigned long long ull;

int N = 0;

int main() {
  cin >> N;
  vector<int> A(N);

  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  sort(A.begin(), A.end());
  
  for(int i = 0; i < N - 1; i++) {
    if (A[i] == A[i + 1]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  double x1, y1, x2, y2,
         x3, y3, xp, yp;

  while ( scanf ( "%lf%lf%lf%lf%lf%lf%lf%lf",
            &x1, &y1, &x2, &y2,
            &x3, &y3, &xp, &yp ) == 8 )
  {
    double u, v;
    double det;

    x2 -= x1; y2 -= y1;
    x3 -= x1; y3 -= y1;
    xp -= x1; yp -= y1;

    det = x2 * y3 - x3 * y2;
    u   = ( xp * y3 - x3 * yp ) / det;
    v   = ( x2 * yp - xp * y2 ) / det;

    puts ( u > 0. && u < 1.
        && v > 0. && v < 1.
        && ( u + v ) > 0. && ( u + v ) < 1.
         ? "YES"
         : "NO" );
  }

  return ( 0 );
}

Measured memory_bytes: 0
import sys
import bisect
def input(): return sys.stdin.readline().rstrip()


def main():
    n = int(input())
    A=[0]*n
    for i in range(1,n+1):
        A[-i]=int(input())
    inf=10**10    
    dp=[inf]*(n+1)
    dp[0]=0
    for AA in A:
        bis=bisect.bisect_right(dp, AA)
        dp[bis]=AA #n以下の個数を数える
    print(bisect.bisect_right(dp, inf-100)-1)


if __name__ == '__main__':
    main()

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S1,S2,S3;
    cin >> S1>>S2>>S3;
    cout << S1[0]<<S2[0]<<S3[0]<<'\n';

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

template<class T>
void prime_factors(T n, map<T, int>&out) {
    if(n == 1) { // n=1 の素因数分解はなし
        return;
    }
    for(T i = 2, _n = n; i*i <= _n; ++i) {
        while(n % i == 0) {
            ++out[i]; // 素数i^{out[i]}
            n /= i;
        }
    }
    if(n != 1) out[n] = 1;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    cout<<setprecision(10);
    ll n;
    cin>>n;
    ll s=sqrt(n);

    for(ll i=s;i>0;--i){
        if(n%i==0){
            cout<<(n/i+i-2)<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <cassert>
#include <random>
#include <tuple>
#include <cstdint>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long ll;

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

int main() {
    int n, k; cin >> n >> k;
    vector<int> h(n); rep(i, n) cin >> h[i];
    vector<int> dp(n+110, INF); dp[0] = 0;
    rep(i, n) rep(j, k) {
        if (i+j+1 < n) dp[i+j+1] = min(dp[i+j+1], dp[i] + abs(h[i] - h[i+j+1]));
    }

    cout << dp[n-1] << endl;


    return 0;
}

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

int main(void) {
	int N;
	string S;
	cin >> N >> S;

	string ans = S;
	if (N > 0) {
		for (int i = 0; i < (int)S.length(); ++i) {
			int id = (int)(S[i] - 'A') + N;
			if (id >= 26)
				id -= 26;
			ans[i] = 'A' + (char)id;
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
import sys

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

ans = float("inf")

min_a = min(A)
max_a = max(A)
for i in range(min_a, max_a+1):
    cost = 0
    for a_j in A:
        cost += (a_j - i)**2
    ans = min(ans, cost)

print(ans)

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

int main(){
  int i,n,m,x,y,X,Y,xmax=-200,ymin=200,flag=0;
  cin>>n>>m>>X>>Y;
  for(i=0;i<n;i++){
	cin>>x;
    if(x>xmax){
		xmax=x;
    }
  }
   for(i=0;i<m;i++){
	cin>>y;
    if(y<ymin){
		ymin=y;
    }
   }

  	for(i=X+1;i<=Y;i++){
		if(i>xmax && i<=ymin){
			flag=1;
          	break;
        }
    }
	
  	if(flag==1){
		cout<<"No War"<<endl;
    }else{
		cout<<"War"<<endl;
    }
}
     
     
     
     
     
  

Measured memory_bytes: 256
n, x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in range(1, n):
    if a[i] + a[i-1] > x:
        b = a[i] + a[i-1] - x
        minab = min(a[i], b)
        a[i] -= minab
        cnt += minab
        
        b -= minab
        cnt += b
        a[i-1] -= b
print(cnt)

Measured memory_bytes: 14132
#include<stdio.h>
int main(){
  int n,m,i,j,cards[4][14];
  char a;

  for(i = 0;i < 4;i++){
    for(j = 0;j < 14;j++){
      cards[i][j] = 0;
    }
  }

  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%c%c %d",&a, &a,&m);
      if(a == 'S'){
        cards[0][m] = 1;
      }
      else if(a == 'H'){
	cards[1][m] = 1;
      }
      else if(a == 'C'){
	cards[2][m] = 1;
      }
      else if(a == 'D'){
	cards[3][m] = 1;
      }
  }
  for(i = 0;i < 4;i++){
    for(j = 1;j <= 13;j++){
      if(i == 0 && cards[0][j] == 0){
        printf("S %d\n",j);
      }
      else if(i == 1 && cards[1][j] == 0){
	printf("H %d\n",j);
      }
      else if(i == 2 && cards[2][j] == 0){
	printf("C %d\n",j);
      }
      else if(i == 3 && cards[3][j] == 0){
	printf("D %d\n",j);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 596
/**
 *    Author:   ElProfesor
 *	       
**/

#include<bits/stdc++.h>

using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
typedef vector <lli> vl;
typedef vector <string> vs;
typedef vector < pair <long, long> > vll;

// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(lli i=0; i<n; i++)
#define rep(i,k,n) for (lli i = k; i < n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)

// Printing Data :
#define pvec(v) forz(i,v.si) cout<<v[i]<<" "; cout<<endl;
#define parr(arr, n) forz(i,n) cout<<arr[i]<<" "; cout<<endl;
#define p1(i) cout<<i<<endl;
#define p2(i, j) cout<<i<<" "<<j<<endl;
#define p3(i, j, k) cout<<i<<" "<<j<<" "<<k<<endl;
#define p4(i, j, k, l) cout<<i<<" "<<j<<" "<<k<<" "<<l<<endl;

typedef pair <lli,lli> pll;
 
// CODE BEGINS :

int main()
{
    kira; 

    lli a, b, c, d; cin>>a>>b>>c>>d;

    lli i=0;
    while(a>0 && c>0)
    {
        if(i%2==0) c = c-b;
        else a = a-d;
        i++;
    }

    cout << (a>0 ? "Yes" : "No") <<endl;

    return 0;
}




















































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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;

/////////////////////////////////

int const MAX = 250;
int const INF = 1e9 + 41;

int a, b, c;
int d[MAX][MAX][MAX];

int rec(int a, int b, int c) {
	if (a == b && a == c) return 0;
	int m = max(a, max(b, c));
	if (m >= MAX) return INF;
	if (d[a][b][c] != -1) return d[a][b][c];
	int res = INF;

	res = min(res, 1 + rec(a + 1, b + 1, c));
	res = min(res, 1 + rec(a, b + 1, c + 1));
	res = min(res, 1 + rec(a + 1, b, c + 1));

	res = min(res, 1 + rec(a + 2, b, c));
	res = min(res, 1 + rec(a, b + 2, c));
	res = min(res, 1 + rec(a, b, c + 2));

	d[a][b][c] = res;
	return res;
}

void solve() {
	memset(d, 255, sizeof(d));
	int	ans = rec(a, b, c);
	printf("%d\n", ans);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	scanf("%d %d %d", &a, &b, &c);  
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 61312
#include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>

using namespace std;
int main()
{
	long long X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<long long> A(X, 0);
	vector<long long> B(Y, 0);
	vector<long long> C(Z, 0);

	for(int i = 0; i < X; i += 1) cin >> A[i];
	for(int i = 0; i < Y; i += 1) cin >> B[i];
	for(int i = 0; i < Z; i += 1) cin >> C[i];

	sort(A.begin(), A.end(), greater<long long>());
	sort(B.begin(), B.end(), greater<long long>());
	sort(C.begin(), C.end(), greater<long long>());

	K = min(K, X * Y * Z);
	vector<long long> res;

	for(int i = 0; i < X; i += 1)
	{
		for(int j = 0; j < Y; j += 1)
		{
			for(int k = 0; k < Z; k += 1)
			{
				if((i + 1) * (j + 1) * (k + 1) <= K)
					res.emplace_back(A[i] + B[j] + C[k]);	
				else
					break;
			}
		}
	}
	sort(res.begin(), res.end(), greater<long long>());
	for(int i = 0; i < K; i += 1)
	{
		cout << res[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << fixed << setprecision(10) << (double)w * h / 2 << " " << (x * 2 == w && y * 2 == h ? 1 : 0) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <limits>
#include <numeric>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <stack>

using namespace std;

#define INFint (1<<30)
#define BOUND 27182818284
#define MAT 2

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

ll MOD = 1000000007;
const ll INF = (1ll<<60);
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for(int i=int(a);i<int(b);++i)

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

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

// gcd
template<typename T>
T gcd(T a, T b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int findGCD(vector<int> arr) {
    int result = arr[0];
    for (auto a: arr) {
        result = gcd(a, result);
    }
    return result;
}

template<typename T>
T lcm(T m, T n) {
    // 引数に0がある場合は0を返す
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    fill((T *) array, (T *) (array + N), val);
}


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

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

int next_table[12][30010];
vector<int>num[11];

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

    for(int i=0; i<N; i++){
        num[S[i]-'0'].push_back(i);
    }
    int ans=0;
    for(int i=0; i<10; i++){
        if(num[i].empty())
            continue;

        int digit1 = num[i][0];
        for(int j=0; j<10; j++){
            auto a = lower_bound(num[j].begin(), num[j].end(), digit1+1);
            if(a != num[j].end()){
                int digit2 = *a;
                for(int k=0; k<10; k++){
                    auto b = lower_bound(num[k].begin(), num[k].end(), digit2+1);
                    if(b != num[k].end()){
                        ans++;
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n,m;
  cin>>n>>m;
  string a[n],b[m];
  rep(i,n) cin>>a[i];
  rep(i,m) cin>>b[i];
  rep(i,n - m + 1) {
    rep(j,n - m + 1) {
      bool flag = true;
      rep(k, m) {
        if(a[i + k].substr(j, m) != b[k]) {
          flag = false;
        }
      }
      if(flag) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(obj) (obj).begin(),(obj).end()
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

#define pb(a) push_back(a)
#define mp make_pair

#define dump(x)  cout << #x << " = " << (x) << "\n";
#define COUT(x) cout<<(x)<<"\n"

int main()
{
    int n = 0;
    cin >> n;
    vector<int> x(n * 2);
    REP(i, n * 2)
    {
        cin >> x[i];
    }
    sort(x.begin(), x.end(), greater<int>());
    int ct = 0;
    for(int i = 1; i < x.size(); i += 2)
    {
        ct += x[i];
    }

    COUT(ct);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int H, N;
    cin >> H >> N;
    REP(i, N) {
        int A;
        cin >> A;
        H -= A;
    }
    cout << (H > 0 ? "No" : "Yes") << endl;
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a: isize,
        b: isize,
    }

    let a1 =  a + b;
    let a2 =  a - b;
    let a3 =  a * b;

    let ans;
    if a1 < a2 {
        if a2 < a3 {
            ans = a3;
        } else {
            ans = a2;
        }
    } else {
        if a1 < a3 {
            ans = a3;
        } else {
            ans = a1;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int R;
    cin >> R;
    int ans = 3 * R * R;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3600
include Math
A, B, H, M = gets.split.map(&:to_i)

pi = Math::PI

ttm = 6*M
tth = 30*(H+M.to_f/60.to_f)

theta = ((ttm-tth).abs) * pi / 180.0


c = cos(theta)

# tm = 6*M.to_f*pi/180
# th = 30*H.to_f*pi/180
# c = cos((tm-th).abs)

r = A*A + B*B - 2*A*B*c

puts sqrt(r)

Measured memory_bytes: 14696
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring> 
#include<queue>
#include<stack> 
#include<string.h>
#include<set>
#define ll long long
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(c>=a&&c<=b)
	{
		printf("Yes\n");
	}
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 384
import java.util.*;
import java.io.*;
class Main {

    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String []s = br.readLine().split(" ");

        int N = Integer.parseInt(s[0]);
        int W = Integer.parseInt(s[1]);

        int []weigths = new int[N];
        int []values = new int[N];
        

        for(int i=0; i < N; ++i) {
            s = br.readLine().split(" ");
            weigths[i] = Integer.parseInt(s[0]);
            values[i] = Integer.parseInt(s[1]);
        }



        long [][]dp = new long[N+1][W+1];

        for(int i=0; i <= N; ++i)
            dp[i][0] = 0;

        for(int i=0; i <= W; ++i)
            dp[0][i] = 0;

        for(int i=1; i <= N; ++i)
            for(int j=1; j <= W; ++j) {
                if (j - weigths[i-1] >= 0)
                    dp[i][j] = Math.max(dp[i-1][j], values[i-1] + dp[i-1][j - weigths[i-1]]);
                else dp[i][j] = dp[i-1][j];
            }

        System.out.println(dp[N][W]);
    }
}

Measured memory_bytes: 132436
#include <bits/stdc++.h>
using namespace std;
int main() {
  int k,n,x;
  cin >> k >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  x=a[0]+k-a[n-1];
  for (int i = 0; i < n-1; i++) {
    x=max(x,a[i+1]-a[i]);
  }
  cout << k-x << endl;
}

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

typedef unsigned long long ull;
#define FOR(i, a, b) for (ull i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl

int gcm(ull a,ull b,ull c){
	ull m1,m2,d;
	if(a<b)	swap(a,b);
	if(a%b==0)	m1=b;
	else{
		ull e=a;
		while(e%b!=0){
		d=e%b;
		e=b;		b=d;	
	}
	m1=d;
	}
	
if(a<c)	swap(a,c);
	if(a%c==0)	m2=c;
	else{
		while(a%c!=0){
		d=a%c;
		a=c;		c=d;	
	}
	m2=d;	
	}
	
	if(m1<m2)	swap(m1,m2);
	if(m1%m2==0)		d=m2;
	else{
		while(m1%m2!=0){
		d=m1%m2;
		m1=m2;		m2=d;	
	}
	}
	
	return d;
	
}

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

	ull K,sum=0;	cin>>K;
	FOR(i,1,K+1){
		FOR(j,1,K+1){
			FOR(k,1,K+1){
				sum+=gcm(i,j,k);
			}
		}
	}
  
  cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 3664
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import sys


def h1(key):
    return key % m


def h2(key):
    return 1 + (key % (m - 1))


def h(key, i):
    return (h1(key) + i * h2(key)) % m


def insert(key):
    i = 0
    while True:
        j = h(key, i)
        if T[j] == 'NULL':
            T[j] = key
            return j
        else:
            i += 1


def search(key):
    i = 0
    while True:
        j = h(key, i)
        if T[j] == key:
            print('yes')
            return j
        elif T[j] == 'NULL' or i >= m:
            print('no')
            return 'NULL'
        else:
            i += 1


def str_to_key(_str):
    _length = len(_str)
    _sum, p = 0, 1
    for i in range(_length):
        _sum += p * (ord(_str[i]) - 64)
        # why choose p=5 ?
        p *= 5

    # key = sum([ord(each) - 64
    #            for each in _str])
    # print(key, _str)
    return _sum


def action(command, content):
    key = str_to_key(content)
    if command[0] == 'i':
        insert(key=key)
    elif command[0] == 'f':
        search(key=key)
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    m = 1046527
    length = int(_input[0])
    command_list = list(map(lambda x: x.split(), _input[1:]))
    T = ['NULL' for _ in range(m)]
    for command, content in command_list:
        action(command=command, content=content)

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

int main()
{
  int N, K, d;
  vector<int> ary;
  cin >> N >> K;

  for (int i = 0; i < K; i++)
  {
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      int res;
      cin >> res;
      ary.push_back(res);
    }
  }
  sort(ary.begin(), ary.end());
  ary.erase(unique(ary.begin(), ary.end()), ary.end());
  int ans = N - ary.size();
  cout << ans << endl;
}


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



int main() {
    int k;
    cin >> k;
    
    int re = 7 % k;
    int cnt = 1;
    rep(i,k) {
        if(re == 0)
            break;
        re = (re * 10 + 7) % k;
        cnt++;
    }
    
    if(cnt > k)
        cnt = -1;
    
    cout << cnt << endl;
    
    
    return 0;
}




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

using namespace std;
using ii  = pair<int, int>;
using vii = vector<ii>;

int const NMAX = 1e5 + 11;

int n, ncolors, color[NMAX];
vii g[NMAX];

void dfs(int u, int p = -1, int c = -1)
{
    int free_color = 1;
    for (auto [v, i] : g[u])
    {
        if (v == p)
            continue;

        if (free_color == c)
            ++free_color;
        color[i] = free_color;
        dfs(v, u, free_color);
        ++free_color;
    }
    ncolors = max(ncolors, free_color - 1);
}

int main(void)
{
    int u, v;
    cin >> n;
    for (int i = 0; i < n - 1; ++i)
    {
        cin >> u >> v, u--, v--;
        g[u].emplace_back(v, i);
        g[v].emplace_back(u, i);
    }

    dfs(1);
    cout << ncolors << endl;
    for (int i = 0; i < n - 1; ++i)
        cout << color[i] << endl;

    return 0;
}


Measured memory_bytes: 12564
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
    int h, n;

    cin >> h >> n;

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

    if (h <= 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

using namespace std;

int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    int z=0;
    while(n>0)
    {
        if(x<n)
        {
            z+=t;
            n=n-x;
        }
        else
        {
            z+=t;
            n=0;
        }
    }
cout<<z;
    return 0;
}


Measured memory_bytes: 3580
import sys


lines = 2
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())


n = int(inp[0].split()[0])
a_lst = [int(i) for i in inp[1].split()]

rest = n - sum(a_lst)

rest = rest if rest >= 0 else -1

print(rest)


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

using namespace std;


template <class T>
std::istream& operator>>(std::istream& in, std::vector<T>& data) {
    for (auto& item : data) {
        in >> item;
    }
    return in;
}

template <class T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& data) {
    bool first = true;
    for (const auto& item : data) {
        if (!first) {
            out << " ";
        }
        out << item;
        first = false;
    }
    return out;
}


vector<int> nums;
vector<char> symbols = {'0', '1', '3', '4', '5', '6', '7', '8', '9'};
int counter = 0;

void gen_numbers(int current) {
    if (current >= 1000000) {
        return;
    }
    if (current % 13 == 5) {
        nums.push_back(current);
        ++counter;
    }
    for (int c = 0; c <= 9; ++c) {
        if (c == 0 && current == 0) {
            continue;
        }
        gen_numbers(10 * current + c);
    }

}


int main() {
#ifdef LOCAL
    freopen("atcoder/2/input.txt", "r", stdin);
#endif

    gen_numbers(0);
    int real_count = counter;

    int mod = (int)1e9 + 7;
    string s;
    cin >> s;
    reverse(s.begin(), s.end());

    vector<vector<int64_t>> dp(s.size() + 1, vector<int64_t>(13, 0));
    dp[0][0] = 1;

    int64_t power = 1;

    for (int idx = 0; idx < s.size(); ++idx) {
        unordered_set<int> used;
        for (int rem = 0; rem < 13; ++rem) {
            if (s[idx] == '?') {
                for (int i = 0; i <= 9; ++i) {
                    int new_rem = (power * i + rem) % 13;
//                    if (new_rem == 3) {
//                        cout << "idx = " << idx << ", i = " << i << ", rem = " << rem << " new_rem = " << new_rem << "\n";
//                    }
                    if (new_rem >= 10 && idx < 1) {
                        continue;
                    }

                    dp[idx + 1][new_rem] += dp[idx][rem];
                    dp[idx + 1][new_rem] %= mod;
                }
            } else {
//                cout << power << endl;
                int new_rem = (rem + power * (s[idx] - '0')) % 13;
                if (new_rem >= 10 && idx < 1) {
                    continue;
                }
                dp[idx + 1][new_rem] += dp[idx][rem];
                dp[idx + 1][new_rem] %= mod;
            }
        }
        power *= 10;
        power %= 13;
    }

//    for (const auto& vec : dp) {
//        cout << vec << "\n";
//    }

//    cout << "real: " << real_count << "\n";
    cout << dp[s.size()][5] << "\n";


    return 0;
}











Measured memory_bytes: 13944
S = raw_input()
N = len(S)

ans = [0 for _ in xrange(N)]
for i in xrange(0,N-1):
    if S[i] == "R" and S[i+1] == "L":
        # Positon of "RL"
        ans[i] = 1
        ans[i+1] = 1
        # Search the Left wind
        j = 1
        while (i-j) >=0 and S[i-j] == "R":
            if j %2 == 1:
                ans[i+1] += 1
            else:
                ans[i] += 1
            j += 1
        # Search the right wind
        j = 2
        while (i+j) <N and S[i+j] == "L":
            if j %2 == 1:
                ans[i+1] += 1
            else:
                ans[i] += 1
            j += 1
        
print " ".join([str(i) for i in ans]) 


Measured memory_bytes: 4676
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int n,a,b,c,d,x;
  long long la,lb,lc,lx;
  double da,db,dc;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> n >> a;
  vector<int> va(n);
  //vector<int> vb(n);
  //vector<int> vc(n-1);
  rep(i,0,n) cin >> va.at(i);
  //rep(i,0,n) cin >> vb.at(i);
  //rep(i,0,n-1) cin >> vc.at(i);
  //int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  //int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------
int count = 0;
  while(ans<n){
  	ans += (a*2+1);
    count++;
  }

  cout << count << endl;
 // cout << fixed << setprecision(5) << ans << endl;

}

Measured memory_bytes: 256
n, m = map(int, input().split())

total_ac = 0
total_wa = 0
results = {}
for _ in range(m):
  pi, si = input().split()
  if results.get(pi) == None:
    results[pi] = {
      "AC": False,
      "CumWA": 0
    }
  if not results[pi]["AC"] and si == "AC":
    results[pi]["AC"] = True
    total_ac += 1
    total_wa += results[pi]["CumWA"] 
  elif not results[pi]["AC"] and si == "WA":
    results[pi]["CumWA"] += 1

print(total_ac , total_wa )  

  

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

using namespace std; 

int main() {
    // 入力部分
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W));
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            cin >> S[i][j];
        }
    }

    // 予め色々計算しておく
    // 横方向
    vector<vector<int>> Cw(H, vector<int>(W, 0));
    for (int i=0; i<H; i++) {
        int j = 0;
        int j_last = 0;
        int cnt = 0;
        while (j < W) {
            if (S[i][j] == '.') {
                cnt += 1;
                j += 1;
                if (j == W) {
                    fill(Cw[i].begin() + j_last, Cw[i].begin() + W, cnt);
                }
            } else {
                fill(Cw[i].begin() + j_last, Cw[i].begin() + j, cnt);
                cnt = 0;
                j += 1;
                j_last = j;
            }
        }
    }
    
    vector<vector<int>> Ch(W, vector<int>(H, 0));
    for (int j=0; j<W; j++) {
        int i = 0;
        int i_last = 0;
        int cnt = 0;
        while (i < H) {
            if (S[i][j] == '.') {
                cnt += 1;
                i += 1;
                if (i == H) {
                    fill(Ch[j].begin() + i_last, Ch[j].begin() + H, cnt);
                }
            } else {
                fill(Ch[j].begin() + i_last, Ch[j].begin() + i ,cnt);
                cnt = 0;
                i += 1;
                i_last = i;
            }
        }
    }

    int res = 0;
    for (int i=0; i<H; i++) {
        for (int j=0; j<W; j++) {
            res = max(res, Cw[i][j] + Ch[j][i] - 1);
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 35584
import itertools as it
n=[x for x in input()]
In=list(it.product(['+','-'],repeat=3))
for k in range(8):
   ans = eval(n[0]+In[k][0]+n[1]+In[k][1]+n[2]+In[k][2]+n[3])
   if ans==7:
    print(n[0]+In[k][0]+n[1]+In[k][1]+n[2]+In[k][2]+n[3]+"=7")
    exit()
    

Measured memory_bytes: 9048
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint n,i,ans=big,gen=0;cin>>n;
	vector<llint>x(n);
	vector<llint>y(n);
	vector<pair<llint,int>>num(n+n);
	for(i=0;i<n;i++){cin>>x[i]>>y[i];num[i]=mp(x[i],i);num[i+n]=mp(y[i],i+n);}
	gen=0;for(i=0;i<n;i++){gen+=x[i];}mineq(ans,gen);
	gen=0;for(i=0;i<n;i++){gen+=y[i];}mineq(ans,gen);
	SO(num);gen=0;
	vector<bool>used(n+n);
	for(i=0;i<n-2;i++){
		gen+=num[i].fir;
		used[num[i].sec]=1;
	}
	//for(i=0;i<n+n;i++){cerr<<num[i].fir<<endl;}
	for(i=0;i<n;i++){
		int u=0;llint aa=gen;
		if(used[i]){u++;aa-=x[i];}
		if(used[i+n]){u++;aa-=y[i];}
		if(u>0){aa+=num[n-2].fir;}
		if(u>1){aa+=num[n-1].fir;}
		if(u==1&&num[n-2].sec%n==i){aa-=num[n-2].fir;aa+=num[n-1].fir;}
		mineq(ans,aa+x[i]+y[i]);//cerr<<aa<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Linq;
using System.Text;
using static System.Math;

class MainClass
{

    public static void Main(string[] args)
    {
        var N = LnInt();
        var As = LnInts();
        var l = new long[N];
        var r = new long[N];
        for(int i = 0; i < N; i++)
        {
            if (As[i] + i < N)
            {
                l[As[i] + i]++;
            }
            if (i - As[i] >= 0)
            {
                r[i - As[i]]++;
            }
        }
        print(l.Zip(r, (left, right) => left * right).Sum());
    }

    public static void print(object obj) { Console.WriteLine(obj); }
    public static long Gcd(long a, long b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int Gcd(int a, int b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
    public static int[] LnInts() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new int[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]); return ins; }
    public static int LnInt() { var vs = Console.ReadLine().Trim(); return int.Parse(vs); }
    public static long[] LnLngs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new long[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = long.Parse(vs[i]); return ins; }
    public static long LnLng() { var vs = Console.ReadLine().Trim(); return long.Parse(vs); }
    public static string[] LnStrs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return vs; }
    public static string LnStr() { var vs = Console.ReadLine().Trim(); return vs; }
public static List<T[]> AllPermutation<T>(params T[] array) where T : IComparable{var a = new List<T>(array).ToArray();var res = new List<T[]>();res.Add(new List<T>(a).ToArray());var n = a.Length;var next = true;while (next){next = false;int i;for (i = n - 2; i >= 0; i--){if (a[i].CompareTo(a[i + 1]) < 0) break;}if (i < 0) break;var j = n;do{j--;} while (a[i].CompareTo(a[j]) > 0);if (a[i].CompareTo(a[j]) < 0){var tmp = a[i];a[i] = a[j];a[j] = tmp;Array.Reverse(a, i + 1, n - i - 1);res.Add(new List<T>(a).ToArray());next = true;}}return res;}}



Measured memory_bytes: 46372
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 0
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	for {
		n := getNextInt(scanner)
		x := getNextInt(scanner)
		if n == 0 && x == 0 {
			return
		}

		ans := 0
		for i := 1; i <= n; i++ {
			for j := 1; j < i; j++ {
				if x-(i+j) < 1 {
					continue
				}
				if x-(i+j) > n {
					continue
				}
				if x-(i+j) >= i {
					continue
				}
				if x-(i+j) >= j {
					continue
				}
				ans++
			}
		}
		fmt.Fprintln(writer, ans)
	}
}



Measured memory_bytes: 1168
#include <iostream>

using namespace std;

int main(){

	int a,b,c;
	int x;
	int cnt=0;
	int n;

	while(cin>>n>>a>>b>>c>>x){
		if(n==0&&a==0&&b==0&&c==0&&x==0)break;

		int *y;
		y = new int[n];
		for(int i=0;i<n;i++)cin>>y[i];

		int pos=0;
		cnt=0;

		while(1){
			if(y[pos] == x){
				pos++;
			}

			if(pos==n)break;

			cnt++;
			x = (a*x+b)%c;

			if(cnt>10000){
				break;
			}
		}
		if(cnt==10001){
			cout<<-1<<endl;
		}
		else{
			cout<<cnt<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i,a,n) for (ll i=a;i<n;i++)
#define per(i,a,n) for (ll i=n-1;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define pb push_back


///Input/Output macros!
#define gi(x) scanf("%d", &x)
#define gi2(x, y) scanf("%d%d", &x, &y)
#define gi3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define gill(x) scanf("%lld", &x)
#define gill2(x, y) scanf("%lld%lld", &x, &y)
#define gill3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define pi(x) printf("%d\n", x)
#define pill(x) printf("%lld\n", x)


///Basic Debugging macros!
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(ll __i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(ll __i__=0;__i__<r;__i__++){for(ll __j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}

using namespace std;

///Power of 2 till 2^31!
ll pow2[32] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648};

///Power function!
ll power(ll x,ll y)
{
        ll res = 1;
        while(y>0){
            if(y&1)
                res *= x;
            y>>=1;
            x*=x;
        }
        return res;
}
map<ll,ll> mp;
///Basic Sieve of Eratosthenes!
void Sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (ll p=2; p<=n; p++)
       if (prime[p])
        ++mp[p];
          //cout << p << " ";
}

ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

bool isPerfectSquare(ll x){ ll s = sqrt(x); return (s*s == x);}

bool isFibonacci(int n){return isPerfectSquare(5*n*n + 4) || isPerfectSquare(5*n*n - 4);}

bool isPrime(int n){if (n <= 1)return false;if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0)return false;
    return true;
}

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;


const int MOD = 1000000007;
const long double PI = 4*atan((long double)1);
const ll INF = 1e18;

int main()
{
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    cout<<((a*b)/gcd(a,b))<<'\n';
    return 0;
}


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int dp[100000] = {};
int main() {
	int n;
	cin >> n;
	vector<int> a;
	REP(i, n) {
		int hoge;
		cin >> hoge;
		a.push_back(hoge);
	}
	dp[0] = 1;
	for (int i = 0;i < a.size();++i) {
		for (int q = 50000;q >=0;--q) {
			if (dp[q] == true) {
				dp[q + a[i]] = true;
			}
		}
	}
	for (int i = 50000;i >= 0;--i) {
		if (i % 10 != 0 && dp[i] == true) {
			cout << i << endl;
			return 0;
		}
	}
	cout << "0" << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;

int mod=1000000007;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int Gcd(int x,int y)
{
  int large = max(x,y);
  int small = min(x,y);

  while(true){
      int amari =large%small;
      
      large = small;

      small = amari;

      if(small == 0){
          break;
      }
  }
  return large;
}


int main(){

int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
        for(int k=1;k<=n;k++){

       ans+=Gcd(i,Gcd(j,k));
        }
    }

}
cout<<ans<<endl;


}


Measured memory_bytes: 3648