akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = Read().ToArray();
            if (N[0] == N[1] && N[0] == N[2] && N[1] == N[2] ||
                N[1] == N[2] && N[1] == N[3] && N[2] == N[3] ||
                N.All(x => x == N[0]))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
        
        public static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0)
                throw new Exception("0未満");

            if (start > stop || (start == 0 && stop == 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        public static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        public static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        public static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static IList<int> ReadIntInputs()
        {
            return Read().Split(' ').Select(int.Parse).ToList();
        }

        public static int ReadInt()
        {
            return int.Parse(Read());
        }

        public static IList<string> ReadInputs()
        {
            return Read().Split(' ').ToList();
        }
    }
}

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

int main(){
  int a, b;
  cin >> a >> b;
  int sum = 0;
  if(a > b){
    sum += a;
    a--;
  }else{
    sum += b;
    b--;
  }
  if(a > b){
    sum += a;
    a--;
  }else{
    sum += b;
    b--;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3640
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
a.sort()
ans=[]
for i in xrange(3):
    for j in xrange(i+1,n):
        ans.append(int(str(a[i])+str(a[j])))
        ans.append(int(str(a[j])+str(a[i])))
ans.sort()
print(ans[2])

Measured memory_bytes: 8144
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int N;
    cin >> N;
    vector<int> A(N);
    REP (i, N) cin >> A[i];
    int sum = 0;
    REP (i, N - 1) {
        if (i % 2 == 0) sum += 2 * A[i];
        else sum -= 2 * A[i];
    }
    vector<int> x(N);
    x[0] = (sum + 2 * A[N - 1]) / 2;
    REP (i, N - 1) x[i + 1] = 2 * A[i] - x[i];
    REP (i, N) cout << x[i] << " \n"[i + 1 == N];
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
int main(void)
{
  int a,b,d,r;
  double f;
  scanf("%d",&a);
  scanf("%d",&b);
  d=a/b;
  r=a%b;
  f=(double)a/(double)b;
  printf("%d %d %f\n",d,r,f);
    return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;
const ll mod = 1e9+7;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

const int MAX_N = 1000010;
ll fact[MAX_N],fact_inv[MAX_N],inv[MAX_N];

ll pow_mod(ll a,ll b) {
    ll ret;
    if (b < 0) ret = pow_mod(a,mod+b-1);
    else if (b == 0) ret = 1;
    else if (b == 1) ret = a;
    else {
        ll c = pow_mod(a,b/2);
        if (b%2) ret = (c*c)%mod*a%mod;
        else ret = c*c%mod;
    }
    return ret;
}

void create_table(int n) {
    fact[0] = 1;fact[1] = 1;
    for (int i = 2;i <= n;++i) fact[i] = fact[i-1]*i%mod;
    fact_inv[n] = pow_mod(fact[n],-1);
    for (int i = n;i > 0;--i) fact_inv[i-1] = fact_inv[i]*i%mod;
    for (int i = 1;i <= n;++i) inv[i] = fact_inv[i]*fact[i-1]%mod;
}

ll combi(ll a, ll b) {
    return fact[a]*fact_inv[b]%mod*fact_inv[a-b]%mod;
}

int main() {
    int n,h,d;
    cin >> n >> h >> d;
    vector<ll> dp(h+1,0);
    create_table(n);
    dp[0] = fact[n];
    ll sum = 0,a = 0;
    for (int i = 1;i < n+1;++i) (a += fact[i]) %= mod;
    for (int i = 0;i < h;++i) {
        (sum += dp[i]) %= mod;
        if (i >= d) (sum -= dp[i-d]) %= mod;
        dp[i+1] = sum*a%mod;
    }
    cout << (sum+mod)%mod << endl;
    return 0;
}

Measured memory_bytes: 31616
package main

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

var (
	b string
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	b = scanner.Text()

	if b == "A" {
		fmt.Println("T")
	}
	if b == "C" {
		fmt.Println("G")
	}
	if b == "G" {
		fmt.Println("C")
	}
	if b == "T" {
		fmt.Println("A")
	}
}


Measured memory_bytes: 640
#include<stdio.h>
#include<math.h>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#define N 100
#define M 300
#define K 600
using namespace std;
typedef pair<double,int> P;
int x[N];
int y[N];
vector<P> e[N];
int a[M];
int b[M];
int id[M][N];
bool used[M][N];
vector<int> adj[M];
int out_i,out_v;
int out;
vector<int> e2[K];
int dist[K];
 
int rev(int i,int v){
    if(a[i]==v)return b[i];
    else return a[i];
}
 
void solve(int i,int v,int k){
    vector<int> res;
    int s=i;
    used[s][v]=true;
    res.push_back(s);
    if(i==out_i&&v==out_v)out=k;
    while(1){
        i=e[v][(id[i][v]+1)%e[v].size()].second;
        v=rev(i,v);
        if(i==s)break;
        used[i][v]=true;
        res.push_back(i);
        if(i==out_i&&v==out_v)out=k;
    }
    for(i=0;i<res.size();i++)adj[res[i]].push_back(k);
}
 
int max(int a,int b){return a>b?a:b;}
 
void bfs(int n,int s){
    int i;
    for(i=0;i<n;i++)dist[i]=-1;
    dist[s]=0;
    queue<int> que;
    que.push(s);
    while(!que.empty()){
        int v=que.front();
        que.pop();
        for(i=0;i<e2[v].size();i++){
            int u=e2[v][i];
            if(dist[u]==-1){
                dist[u]=dist[v]+1;
                que.push(u);
            }
        }
    }
}
 
int main(){
    while(1){
        int n,m,i,j;
        scanf("%d %d",&n,&m);
        if(n==0&&m==0)break;
        for(i=0;i<n;i++)e[i].clear();
        for(i=0;i<m;i++)adj[i].clear();
        int lf=0;
        for(i=0;i<n;i++){
            scanf("%d %d",&x[i],&y[i]);
            if(x[i]<x[lf])lf=i;
        }
        for(i=0;i<m;i++){
            scanf("%d %d",&a[i],&b[i]);
            a[i]--;b[i]--;
            double dx=(double)(x[b[i]]-x[a[i]]);
            double dy=(double)(y[b[i]]-y[a[i]]);
            e[a[i]].push_back(P(atan2(dy,dx),i));
            e[b[i]].push_back(P(atan2(-dy,-dx),i));
        }
        for(i=0;i<n;i++)sort(e[i].begin(),e[i].end());
        int bt=0;
        for(i=0;i<n;i++){
            for(j=0;j<e[i].size();j++){
                id[e[i][j].second][i]=j;
                if(i==lf){
                    int u=rev(e[i][j].second,i);
                    int v=rev(e[i][bt].second,i);
                    double t1=atan2((double)(y[u]-y[i]),(double)(x[u]-x[i]));
                    double t2=atan2((double)(y[v]-y[i]),(double)(x[v]-x[i]));
                    if(t1>t2)bt=j;
                }
            }
        }
        out_i=e[lf][bt].second;
        out_v=lf;
        for(i=0;i<m;i++)for(j=0;j<n;j++)used[i][j]=false;
        int k=0;
        for(i=0;i<m;i++){
            if(!used[i][a[i]]){
                solve(i,a[i],k);
                k++;
            }
            if(!used[i][b[i]]){
                solve(i,b[i],k);
                k++;
            }
        }
        for(i=0;i<k;i++)e2[i].clear();
        for(i=0;i<m;i++){
            e2[adj[i][0]].push_back(adj[i][1]);
            e2[adj[i][1]].push_back(adj[i][0]);
        }
        bfs(k,out);
        int ans=0;
        for(i=0;i<k;i++)ans=max(ans,dist[i]);
        printf("%d\n",ans);
    }
    return 0;
} 

Measured memory_bytes: 1272
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1005;
const int mod = 1000000007;



int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  ll a,b,v,w,t;
  cin>>a>>v;
  cin>>b>>w;
  cin>>t;
  if(v*t>=w*t+abs(a-b))cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> buttons;
  vector<bool> buttons_flag;
  for(int i=0; i<N; i++){
    int tmp;
    cin >> tmp;
    buttons.push_back(tmp);
    buttons_flag.push_back(false);
  }
  buttons_flag[0] = true;
  int next_button = buttons[0]-1;
  int count = 0;
  while(true){
    count += 1;
    if(buttons_flag[next_button] == true || next_button == 1)
      break;
    buttons_flag[next_button] = true;
    next_button = buttons[next_button]-1;
  }
  if (next_button == 1){
    cout << count << endl;
  } else {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;

int main(){
    int h,w;
    
    while(true){
        cin>>h>>w;
        if(h==0 && w==0)break;
        rep(i,h){
            rep(j,w){
                cout<<'#';
            }
            cout << endl;
        }
        cout << endl;
    }
    
}




Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

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

    int n, a[100009][3];
    cin >> n;
    rep(i, n) rep(j, 3) cin >> a[i][j];

    int dp[100009][3] = {};
    rep(i, n) rep(j, 3) rep(k, 3) {
        if(j == k) continue;
        chmax(dp[i + 1][j], dp[i][k] + a[i][j]);
    }

    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 2560
n, m = map(int, input().split())
# print(n, m)
ans = 0
if n == 1 and m == 1:
    ans = 1
elif n == 1 and m > 1:
    ans = m - 2
elif n > 1 and m == 1:
    ans = n - 2
else:
    ans = (n - 2) * (m - 2)

print(ans)


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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}

int main(){
  string s;
  cin>>s;
  if(s=="SUN")cout<<7<<endl;
  else if(s=="MON")cout<<6<<endl;
  else if(s=="TUE")cout<<5<<endl;
  else if(s=="WED")cout<<4<<endl;
  else if(s=="THU")cout<<3<<endl;
  else if(s=="FRI")cout<<2<<endl;
  else cout<<1<<endl;
  
  
  
return 0;
}

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

#define all(a) begin(a),end(a)
#define F first
#define S second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

const int mod=998244353;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int mul(int a,int b){
  return ((a)*1ll*(b))%mod;
}

void add(int &a,int b){
  a+=b;
  if(a>=mod)a-=mod;
}

int sub(int a,int b){
  a-=b;
  if(a<0){
    a+=mod;
  }
  return a;
}

int powz(int a,int b){
  int res=1;
  while(b){
    if(b&1){
      res=mul(res,a);
    }
    b/=2;
    a=mul(a,a);
  }
  return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
  input>>x.F>>x.S;
  return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}


const int N=200005;

void solve(){ 
	int n;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			int gc=__gcd(i,j);
			for(int k=1;k<=n;k++){
				ans+=__gcd(gc,k);
			}
		}
	}
	cout<<ans;
	
}

signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc=1;
  //~cin>>tc;
  for(int _=0;_<tc;_++){
    //~cout<<"Case #"<<_+1<<": \n";
    solve();
    if(_!=tc-1){
      cout<<'\n';
    }
  }
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll k,a,b;
    cin>>k>>a>>b;
    if(b <= a+2){
        cout<<k+1; return 0;
    }
    int r=k-a+1;
    if(r < 0){
        cout<<k+1; return 0;
    }
    else{
        cout<<a+(b-a)*(r/2)+r%2;
    }
}

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    vector<int> t(N+1), x(N+1), y(N+1);
    for(int i=1; i<=N; i++) {
        cin >> t[i] >> x[i] >> y[i];
    }

    adjacent_difference(t.begin(), t.end(), t.begin());
    adjacent_difference(x.begin(), x.end(), x.begin());
    adjacent_difference(y.begin(), y.end(), y.begin());

    for(int i=1; i<=N; i++) {
        int d = abs(x[i]) + abs(y[i]);
        if(t[i] < d || (t[i] - d)%2) {
            cout << "No" << endl;
            return 0;
        }
    }

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


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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

	int a, b;
	cin >> a >> b;

	if(a >= 13){
		cout << b;
	} else if(a < 13 && a >= 6){
		cout << b/2;
	} else {
		cout << 0;
	}

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 16 21:10:50 2020

@author: H_Hoshigi
"""


N = int(input())
S_dict = {}
for i in range(N):
    S_i = input()
    try:
        S_dict[S_i]
    except KeyError:
        S_dict[S_i] = 1
    else:
        S_dict[S_i] += 1

S_soretd_list = sorted(S_dict.keys())
answer_list = []
max_frequency = 0
for i in S_soretd_list:
    if S_dict[i] > max_frequency:
        max_frequency = S_dict[i]
        answer_list = [i]
    elif S_dict[i] == max_frequency:
        answer_list.append(i)
    else:
        pass
for i in answer_list:
    print(i)



Measured memory_bytes: 32476
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

template<ll M = 1000000007>
struct modint{
    ll val;
    modint(): val(0){}
    template<typename T>
    explicit modint(T t){val = t%M; if(val < 0) val += M;}

    modint pow(ll k){
        modint res(1), x(val);
        while(k){
            if(k&1) res *= x;
            x *= x;
            k >>= 1;
        }
        return res;
    }
    template<typename T>
    modint& operator=(T a){ val = a%M; if(val < 0) val += M; return *this; }
    modint inv() {return pow(M-2);}
    modint& operator+=(modint a){ val += a.val; if(val >= M) val -= M; return *this;}
    modint& operator-=(modint a){ val += M-a.val; if(val >= M) val -= M; return *this;}
    modint& operator*=(modint a){ val = 1LL*val*a.val%M; return *this;}
    modint& operator/=(modint a){ return (*this) *= a.inv();}
    modint operator+(modint a) const {return modint(val) +=a;}
    modint operator-(modint a) const {return modint(val) -=a;}
    modint operator*(modint a) const {return modint(val) *=a;}
    modint operator/(modint a) const {return modint(val) /=a;}
    modint operator-(){ return modint(-val);}
    bool operator==(const modint a) const {return val == a.val;}
    bool operator!=(const modint a) const {return val != a.val;}
    bool operator<(const modint a) const {return val < a.val;}
};

using mint = modint<MOD>;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    vector<int> cnt(n+1);
    mint ans(1);
    cnt[0] = 3;
    for (int i = 0; i < n; ++i) {
        if(!cnt[v[i]]){
            puts("0");
            return 0;
        }
        ans *= mint(cnt[v[i]]);
        cnt[v[i]]--; cnt[v[i]+1]++;
    }
    cout << ans.val << "\n";
    return 0;
}

Measured memory_bytes: 1024
//                        Bismillahir Rahmanir Rahim
//ALGO:
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define FILL(a, x) memset(a, x, sizeof(a))
#define ll long long
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define INF INT_MAX
#define MX 1000010
#define mod 1000000007
#define dout if(debug) cout
#define FR(i, n) for(int i=0; i<n; i++)
#define FOR(i, n) for(int i=1; i<=n; i++)
const double Pi=acos(-1);
using namespace std;
int debug=01;
void solve(){
   string s;
   cin>>s;
   cout<<s<<(s[s.size()-1]=='s'?"es":"s");
}
int main() {
    Fast
    int tst=1;
    //cin>>tst;
    for(int T=1; T<=tst; T++){
        //cout<<"Case "<<T<<": ";
        solve();
    }
}


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

int main(){
  int n;
  cin >> n;
  vector <long long> b(n);
  int count = 0;
  int flag = 1;
  for (int i = 0; i < n; i++){
    cin >> b.at(i);
    if (b.at(i) < 0){
      count ++;
    }
    else if (b.at(i) == 0){
      flag = 0;
    }
    b.at(i) = labs(b.at(i));
  }
  flag = count % 2 * flag;
  long long ans = 0;
  for (int i = 0;i<n;i++){
    ans += b.at(i);
  }
  if (flag == 1){
    int min =  *min_element(b.begin(), b.end());
    ans -= 2*min;
  }
  cout << ans << endl;
}


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

void judge(int x){
    
    if(x == 1){
        printf("Yes\n");
    }else if(x == 0){
        printf("No\n");
    }
}

int main(void) {
	
	int candy[3];
	int candyTMP;
	int i=0;
	scanf("%d %d %d\n",&candy[0], &candy[1], &candy[2]);
	
    if(candy[0] <= candy[1] && candy[1] <= candy[2]){
        if(candy[0]+candy[1]==candy[2]){
            judge(1);
            exit(0);
        }else{
            judge(0);
            exit(0);
        }
    }
    
    if(candy[0]>candy[1]){
        candyTMP=candy[0];
        candy[0]=candy[1];
        candy[1]=candyTMP;
    }
    if(candy[1]>candy[2]){
        candyTMP=candy[1];
        candy[1]=candy[2];
        candy[2]=candyTMP;
    }
    
    if(candy[0]>candy[1]){
        candyTMP=candy[0];
        candy[0]=candy[1];
        candy[1]=candyTMP;
    }
    if(candy[1]>candy[2]){
        candyTMP=candy[1];
        candy[1]=candy[2];
        candy[2]=candyTMP;
    }
    
    if(candy[0] <= candy[1] && candy[1] <= candy[2]){
        if(candy[0]+candy[1]==candy[2]){
            judge(1);
        }else{
            judge(0);
        }
    }
	
	return 0;
}


Measured memory_bytes: 128
n = int(input())
x0 = 0
y0 = 0
x1 = 1
y1 = 10 ** 9
x2 = (n - 1) // y1 + 1
y2 = (y1 - n) % y1
print(x0, y0, x1, y1, x2, y2)

Measured memory_bytes: 9172
#include <stdio.h>
#include <stdint.h>

int64_t bsrch(int64_t ary[], size_t sz, int64_t v)
{
  size_t low = 0;
  size_t high = sz - 1;

  while (low < high) {
    size_t mid = low + (high - low) / 2;
    if (ary[mid] < v) {
      low = mid + 1;
    } else {
      high = mid;
    }
  }

  return low;
}

int main(void)
{
  const int64_t inf = 100000000000;
  int a, b, q;
  scanf("%d %d %d", &a, &b, &q);
  int64_t s[a + 2], t[b + 2], x[q];
  for (int i = 1; i <= a; i++) scanf("%lld", &s[i]);
  for (int i = 1; i <= b; i++) scanf("%lld", &t[i]);
  for (int i = 0; i < q; i++) scanf("%lld", &x[i]);
  s[0] = t[0] = -inf;
  s[a + 1] = t[b + 1] = inf;
  for (int i = 0; i < q; i++) {
    int64_t ans = inf;
    int64_t d[4];
    size_t si = bsrch(s, a + 2, x[i]);
    size_t ti = bsrch(t, b + 2, x[i]);
    int64_t s_east = s[si] - x[i];
    int64_t s_west = x[i] - s[si - 1];
    int64_t t_east = t[ti] - x[i];
    int64_t t_west = x[i] - t[ti - 1];
    d[0] = s_east > t_east ? s_east : t_east;
    d[1] = s_west > t_west ? s_west : t_west;
    d[2] = s_west > t_east ? s_west + t_east * 2 : s_west * 2 + t_east;
    d[3] = t_west > s_east ? t_west + s_east * 2 : t_west * 2 + s_east;
    for (int j = 0; j < 4; j++) {
      if (ans > d[j]) ans = d[j];
    }
    printf("%lld\n", ans);
  }
}


Measured memory_bytes: 3584
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h, n = map(int, input().split())
a = list(map(int, input().split()))

if sum(a)>=h:
    print("Yes")
else:
    print("No")

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 2000000000
typedef long long ll;

int main(){
    int N,K;
    cin >> N;
    cin >> K;
    vector<int> h(N);
    vector<int> dp(N);
    rep(i,N) {cin >> h[i];}
    rep(i,N) {dp[i] = INF;}
    dp[0] = 0;

    rep(i,N){
        rep2(k,min(K,N-i-1))
            dp[i+k] = min(dp[i+k],dp[i] + abs(h[i]-h[i+k]));
    }




    
    cout << dp[N-1]<<endl;
    return 0;
    

}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

class J
{
public:
    int p;
    J(int p) : p(p){}
    bool operator () (int x)
    { return p < x; }
};

int main()
{
    map<int, int> team;
    vint          points;
    
    int n, p; char k;
    while(cin >> n >> k >> p && (n || p))
    {
        points.push_back(p);
        team.insert(pair<int, int>(n, p));
    }
    
    sort(ALL(points));
    points.erase(unique(ALL(points)), points.end());
    
    while(cin >> n)
    {
        J j(team[n]);
    
        cout << count_if(ALL(points), j) + 1 << endl;
    }
}

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s; cin >> s;
	if (s == "MON") cout << 6 << endl;
	if (s == "TUE") cout << 5 << endl;
	if (s == "WED") cout << 4 << endl;
	if (s == "THU") cout << 3 << endl;
	if (s == "FRI") cout << 2 << endl;
	if (s == "SAT") cout << 1 << endl;
	if (s == "SUN") cout << 7 << endl;


}



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

using i64 = int64_t;
i64 INF = 1ll << 60;

void chmin(i64 &a, i64 b){
  if(a > b)
    a = b;
}

int main(){
  int n;
  cin >> n;
  vector<int> ex6(8), ex9(8);
  ex6[0] = 1;
  ex9[0] = 1;
  for(int i = 1; i < 8; i++){
    ex6[i] = 6*ex6[i-1];
    ex9[i] = 9*ex9[i-1];
  }
  
  vector<i64> sum(100010, INF);
  sum[0] = 0;
  
  for(int i = 0; i <= n; i++){
    chmin(sum[i+1], sum[i]+1);
    for(int j = 1; j < 8; j++){
      if(i+ex6[j] <= n)
        chmin(sum[i+ex6[j]], sum[i]+1);
      if(i+ex9[j] <= n)
        chmin(sum[i+ex9[j]], sum[i]+1);
    }
  }
  
  cout << sum[n] << endl;
  
  return 0;
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    int N,a;
    vector<int> A;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&a);
        for(int j=0;j<50;j++){
            if(a%2==0){a=a/2;}
            else{A.push_back(j);break;}
        }
    }
    int ans=100;
    for(int i=0;i<N;i++){
        if(A[i]<ans){ans=A[i];}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
// AOJ 3052 Milk
// 2018.3.17 bal4u

#include <stdio.h>
#include <stdlib.h>

#define M 1000000007

int main()
{
	long long a, b, x, c, ans;

	scanf("%lld%lld%lld", &a, &b, &x);
	ans = x;
	if (x > b) {
		c = (x - b) / (a - b);
		ans += ((b%M) * (c%M)) % M;
	}
	printf("%d\n", (int)(ans % M));
	return 0;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <iostream>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <fstream>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <ctime>
#include <stack>
#include <map>
#include <set>
#if __cplusplus > 199711L
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
//	tree<key, mapped = null_type, cmp = less<key>, rb_tree_tag, tree_order_statistics_node_update> name;
//	order_of_key
//	find_by_order
#endif

using namespace std;

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fs first
#define sc second
#define abs(a) ((a) < 0 ? -(a) : (a))
#define sqr(a) ((a) * (a))

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

const double eps = 1e-9;
const int mod = (int) 1e+9 + 7;
const double pi = acos(-1.);
const int maxn = 100100;



int main() {

	#ifdef SOL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	#else
	srand(time(0));
	const string file = "";
	if (!file.empty()) {
		freopen((file + ".in").c_str(), "r", stdin);
		freopen((file + ".out").c_str(), "w", stdout);
	}
	#endif

	string s;
	cin >> s;
	for(int i = 0; i < 4; i++) {
		cout << s[i];
	}
	cout << " ";
	for(int i = 4; i < s.length(); i++) {
		cout << s[i];
	}
	cout << endl;

	#ifdef SOL
	fflush(stdout);
	fprintf(stderr, "%.3lf ms\n", 1000. * clock() / CLOCKS_PER_SEC);
	fflush(stderr);
	#endif
	return (0);
}

// by Andrey Kim


Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;

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

		for(int i = 1; i > 0; i++){

	      	String X,Y;
	  		int x,y;
	
			X = in.next();
	  		Y = in.next();
			x = Integer.parseInt(X);
	  		y = Integer.parseInt(Y);
	
	      	if(x == 0 && y == 0){
	        	break;
	      	}else{
		  		if(x >= y){
		  			System.out.println(y + " " + x);
		  		}else{
		  			System.out.println(x + " " + y);
		  		}
      		}
    	}
	}
}

Measured memory_bytes: 25200
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int k = scan.nextInt();
		int h[] = new int[n];
		for(int i=0;i<n;i++) {
			h[i] = scan.nextInt();
		}
		long ans = 0;
		
		Arrays.sort(h);
		for(int i=n-k-1;i>=0;i--) {
			ans += h[i];
		}
		
		System.out.println(ans);
		
		
	}
}


Measured memory_bytes: 64356
def main():
    
    n = int(input())

    B = input().split()

    for i in range(0,n):
            B[i]=int(B[i])

    prints=[]

    while len(B)>0:

        ##print(B)

        for i in range(len(B)-1, -1, -1):

            if B[i]-i == 1:

                prints.append(B[i])
                B = B[:i] + B[i+1:]
                break
        
        else:

            print(-1)
            return

    for i in range(n-1,-1,-1):

        print(prints[i])

    return

main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;





int main(){

	int N;
	scanf("%d",&N);

	double ans = 0,tmp;

	for(int i = 0; i < N; i++){

		scanf("%lf",&tmp);

		ans += 1.0/tmp;
	}

	printf("%.10lf\n",1.0/ans);

	return 0;
}


Measured memory_bytes: 256
program main
    implicit none
    INTEGER :: n, a, b, x, count = 0, ans = 0, i
    READ(*, *) n, a, b
    do i = 1, n
        x = i
        do while(x > 0)
            count = count + mod(x, 10)
            x = x / 10
        enddo
        if(count >= a .and. count <= b) then
            ans = ans + i
        endif
        count = 0
    enddo
    WRITE(*, *) ans
end program main

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int a = Integer.parseInt(lines[0]);
        int b = Integer.parseInt(lines[1]);
        int c = Integer.parseInt(lines[2]);
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 24216
import java.util.*;

public class Main {
	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();

		long[] A = new long[N];

		for (int i = 0; i < N; i++) {
			long ai = sc.nextLong();
			A[i] = ai;
		}
		long cntA, cntB;
		long sumA, sumB;
		sumA = sumB = 0;
		cntA = cntB = 0;

		//
		for (int i = 0; i < N; i++) {
			sumA += A[i];
			sumB += A[i];
			if (i % 2 == 0) {
				if (sumA <= 0) {
					cntA += (Math.abs(sumA) + 1);
					sumA = 1;
				}
				if (sumB >= 0) {
					cntB += (Math.abs(sumB) + 1);
					sumB = -1;
				}
			} else {
				if (sumA >= 0) {
					cntA += (Math.abs(sumA) + 1);
					sumA = -1;
				}
				if (sumB <= 0) {
					cntB += (Math.abs(sumB) + 1);
					sumB = 1;
				}
			}
		}
		System.out.println(Math.min(cntA, cntB));
		sc.close();
	}

}


Measured memory_bytes: 62560
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,k;
ll ar[200001];
ll bin(ll x)
{
    ll cnt=0;
    for(ll i=0;i<n;i++)
    {
        if(ar[i]>0)
        {
            ll c1=0;
            ll l=0;
            ll r=n-1;
            while(l<=r)
            {
                ll mid=(l+r)/2;
                if(ar[mid]*ar[i]<x)
                {
                    c1=mid+1;
                    l=mid+1;
                }
                else 
                    r=mid-1;
            }
            cnt+=c1;
            //if(x==6)
             //   cout<<c1<<" c1 6\n";
        }
        else if(ar[i]==0)
        {
            if(x>0)
                cnt+=n;
        }
        else
        {
            ll c1=0;
            ll l=0;
            ll r=n-1;
            while(l<=r)
            {
                ll mid=(l+r)/2;
                if(ar[mid]*ar[i]<x)
                {
                    c1=n-mid;
                    r=mid-1;
                }
                else
                {
                    l=mid+1;
                }
            }
            //if(x==6)
             //   cout<<c1<<" c2 6\n";
            cnt+=c1;
        }
    }
    for(ll i=0;i<n;i++)
    {
        if(ar[i]*ar[i]<x)
            cnt--;
    }
    //cout<<cnt<<endl;
    cnt/=2;
    return cnt<k;
}
int main() {
    cin>>n>>k;
    for(ll i=0;i<n;i++)
        cin>>ar[i];
    sort(ar,ar+n);
    ll l=-1e18;
    ll r=1e18;
    ll ans=0;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        //cout<<mid<<endl;
        ll chk=bin(mid);
        if(chk==1)
        {
            l=mid+1;
            ans=mid;
        }
        else
        {
            r=mid-1;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 1792
/*
* @Author: Kabid
* @Date:   2020-04-26 18:01:07
* @Last Modified by:   Kabid
* @Last Modified time: 2020-04-26 18:04:04
*/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>

#define ll long long
#define  in(x) scanf("%d",&x);
#define out(x) printf("%d",x);
#define  ins(x)  scanf("%s",x);
#define outs(x) printf("%s",x);
#define lin puts("");
#define _ putchar(' ');

int t;       //test cases
int i,j;	 //iterators
int n,k,p;   //variables
int w,s;
int main(){
	in(s) in(w)
	if(w>=s)puts("unsafe");
	else puts("safe");
	
	return 0;
}

Measured memory_bytes: 3764
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c && c <= b) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 256
aa = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(',').map(&:to_i)
k = gets.to_i
puts aa[k-1]


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

int h,w,a[99][99],b[99][99];
bool dp[99][99][40000];

signed main(){
    cin>>h>>w;
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h)rep(j,w){
        cin>>b[i][j];
        a[i][j]-=b[i][j];
    }
    dp[0][0][20000+a[0][0]]=dp[0][0][20000-a[0][0]]=1;
    rep(i,h)rep(j,w){
        if(j){
            rep(k,40000){
                if(dp[i][j-1][k])dp[i][j][k+a[i][j]]=dp[i][j][k-a[i][j]]=1;
            }
        }if(i){
            rep(k,40000){
                if(dp[i-1][j][k])dp[i][j][k+a[i][j]]=dp[i][j][k-a[i][j]]=1;
            }
        }
    }
    int ans=1e9;
    rep(i,40000)if(dp[h-1][w-1][i])ans=min(ans,abs(20000-i));
    cout<<ans<<endl;
}

Measured memory_bytes: 309888
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

#define NMAX 1000000

signed main(){
    int N;
    multiset<int> A;
    int cnt[200000]={0};
    int Q;
    int ans=0;

    cin>>N;
    for(int i=0;i<N;i++){
        int Ain;
        cin>>Ain;
        ans+=Ain;
        A.insert(Ain);
        cnt[Ain]++;
    }

    cin>>Q;


    for(int i=0;i<Q;i++){
        int a,b;
        cin>>a>>b;
        ans-=cnt[a]*a;
        ans+=cnt[a]*b;
        cnt[b]+=cnt[a];
        cnt[a]=0;
        cout<<ans<<endl;
    }

}


Measured memory_bytes: 9424
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  map<char,int> mp;
  string s;
  cin>>s;
  rep(i,sz(s))mp[s[i]]++;
  int cnt =0;
  for(auto it:mp)cnt++;
  string ans = (cnt==3)?"Yes":"No";
  cout<<ans<<endl;
  return 0;
}

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

int N, T, A[200005];

int main() {
	scanf("%d%d", &N, &T);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		if (i == N - 1) ans += T;
		else ans += min(A[i + 1] - A[i], T);
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 1024
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(input())

b = 10 ** 3
F5 = defaultdict(int)
for i in range(1, 10 ** 3):
    k = pow(i, 5)
    if X <= k:
        b = min(b, i)
    F5[k] = i

b -= 1
while True:
    x = X - pow(b, 5)
    if F5[x]:
        ans = (F5[x], -b)
        break

    b -= 1

print(ans[0], ans[1])


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

using namespace std;

#define int long long
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;

typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

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

int N, d[300000];

signed main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> d[i];
   	int maxi = d[0] - 10;
    for(int i = 1; i < N; ++i) {
    	if(maxi < 0) {
    		cout << "no" << "\n";
    		return 0;
    	}
    	if(maxi < d[i]) maxi = d[i] - 10;
        else maxi -= 10;
    }
    reverse(d, d + N);
    maxi = d[0] - 10;
    for(int i = 1; i < N; ++i) {
    	if(maxi < 0) {
    		cout << "no" << "\n";
    		return 0;
    	}
    	if(maxi < d[i]) maxi = d[i] - 10;
        else maxi -= 10;
    }
    cout << "yes" << "\n";
	return 0;
}



Measured memory_bytes: 5536
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1010

int n, m, a[SIZE], b[SIZE];
int pos[SIZE*SIZE][2];

int main(){

  scanf("%d%d", &n, &m);

  for(int i=0;i<n*m;i++)
    pos[i][0] = pos[i][1] = -1;

  for(int i=0;i<n;i++) {
    scanf("%d", a+i);
    a[i]--;
    if (pos[a[i]][0] != -1){
      puts("0");
      return 0;
    }
    pos[a[i]][0] = i;
  }

  for(int i=0;i<m;i++) {
    scanf("%d", b+i);
    b[i]--;
    if (pos[b[i]][1] != -1){
      puts("0");
      return 0;
    }
    pos[b[i]][1] = i;
  }

  ll ok = 0, fillA = 0, fillB = 0;
  ll ans = 1;

  for(int i=n*m-1;i>=0;i--) {
    if(pos[i][0] != -1 && pos[i][1] != -1) {
      ok += fillA + fillB;
      fillA++; fillB++;
    } else if (pos[i][0] != -1) {
      ans = (ans * fillB) % mod;
      ok += fillB - 1;
      fillA++;
    } else if (pos[i][1] != -1){
      ans = (ans * fillA) % mod;
      ok += fillA - 1;
      fillB++;
    } else {
      ans = (ans * ok) % mod;
      ok--;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    cin>>n;
    vector<ll> v(n);
    rep(i, n) {
        ll a;
        cin>>a;
        v[i] = a-i-1;
    }
    sort(v.begin(), v.end());
    if(n%2 == 1) {
        ll s = v[n/2]; 
        ll ans = 0;
        rep(i, n) ans += abs(v[i]-s);
        cout<<ans<<endl;
    }
    else{
        ll s1, s2;
        s1 = (v[n/2-1] + v[n/2])/2;
        s2 = (v[n/2-1] + v[n/2]+2-1)/2;
        ll ans1 = 0;
        rep(i, n) ans1 += abs(v[i]-s1);
        ll ans2 = 0;
        rep(i, n) ans2 += abs(v[i]-s2);
        cout<<min(ans1, ans2)<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll k;
  cin >> k;
  ll n = 50, r = k % 50;
  vl a(n, k / 50);
  rep(i, n) {
    if(i < r)
      a[i] += 100 - r;
    else
      a[i] += 49 - r;
  }
  cout << n << endl;
  rep(i, n) cout << a[i] << ' ';
  cout << endl;
}

Measured memory_bytes: 3640
M,*a=10**9+7;*I=r=j=x=1;n,*z=`dd`.split.map &:to_i;(n+1).times{|i|a[k=z[i]]&&x=a[k]+n-i;a[k]=i};(0..n).map{|i|p ((r=r*(n+1-i)*I[i]%M)-j)%M;j=j*(x-i)*I[i]%M;I<<(M-M/(i+2))*I[M%(i+2)-1]%M}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin >> s;
    int n=s.size();
    int ans[n]={};
    vector<int> sw;

    sw.emplace_back(-1);
    for(int i = 0; i < n-1; i++) {
        if(s[i]!=s[i+1]) sw.emplace_back(i);
    }
    sw.emplace_back(n-1);

//    for(int i = 0; i < sw.size(); i++) {
//        cout << sw[i] << " ";
//    }
//    cout << "\n";

    for(int i = 1; i < sw.size(); i+=2) {
        int left=sw[i]-sw[i-1];
        int right=sw[i+1]-sw[i];
        ans[sw[i]]  = (left+1)/2+right/2;
        ans[sw[i]+1]= left/2+(right+1)/2;
    }

    for(int i = 0; i < n; i++) {
        cout << ans[i] << " ";
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 1480
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>

using namespace std;

int main()
{
	int a, b, c, d;

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

	val = (c + b - 1) / b - (a + d - 1) / d;

	if (val <= 0)
	{
		printf("Yes\n");
	}

	else
	{
		printf("No\n");
	}

	return 0;
}

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

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> A(N);
  for(int i = 0; i < N; i++)
    cin >> A.at(i);
  int l = 0;
  for(int i = 0; i < N-1; i++) 
    l = max(l, A.at(i+1) - A.at(i));
  cout << min(K - l, A.at(N-1) - A.at(0)) << endl;
}

Measured memory_bytes: 1152
// 標準入力から一行を読み取り、指定の型に変換する
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let nq: Vec<usize> = read_vec();
    let n = nq[0];
    let q = nq[1];
    let s: String = read();

    // i + 1文字目までに現れた'AC'の数を事前に数える
    let mut appear_count = vec![0; n];
    let svec: Vec<char> = s.chars().collect();
    for i in 1..n
    {
        if svec[i - 1] == 'A' && svec[i] == 'C' { appear_count[i] += 1; }
        appear_count[i] += appear_count[i - 1];
    }

    // 各問題を作ったappear_count配列を使って解く。
    for _ in 0..q
    {
        let lr: Vec<usize> = read_vec();
        let l = lr[0];
        let r = lr[1];
        println!("{}", appear_count[r - 1] - appear_count[l - 1]);
    }
}


Measured memory_bytes: 4860
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    long long n, a, b;
    long long ans = 0;
    vector<int> x;
    cin >> n >> a >> b;
    x.assign(n, 0);
    for(int i=0;i<n;i++){
        cin >> x[i];
    }
    for(int i=1;i<n;i++){
        ans += min(a * (x[i] - x[i-1]), b);
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
def resolve():
    N,=pin()
    A=lispin()

    cnt=0
    for i in range(1,N+1):
        j=i-1
        if A[j]%2 and i%2:cnt+=1
    print(cnt)
#%%submit!
resolve()


Measured memory_bytes: 61876