akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
// 許容する誤差ε
#define EPS (1e-10)
// 2つのスカラーが等しいかどうか
#define EQ(a,b) (abs((a)-(b)) < EPS)
// 2つのベクトルが等しいかどうか
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void print(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void print(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
//typedef
typedef complex<double> Point;
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


int a[200000], b[200000];
signed main(){
  int n;
  scanf("%lld", &n);
  rep(i,n)scanf("%lld%lld", &a[i], &b[i]);
  int sum = 0, ans = 0;
  drep(i,n-1,0){
    int s = a[i]+sum;
    int d = b[i]-(s%b[i]);
    if(d == b[i])d = 0;
    ans += d;sum += d;
  }
  cout << ans << endl;
	return 0;
}










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

int main() {
  string s;
  cin >> s;
  int i, l, count;
  i = 0;
  l = s.size() - 1;
  count = 0;
  while (s.at(i) != 'A') {
    i++;
  }
  while (s.at(l) != 'Z') {
    l--;
    count++;
  }
  
  cout << s.size() - i - count << endl; 
  
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string S; cin >> S;
    ll K; cin >> K;

    ll onecnt = 0;
    rep(i, len(S)) {
        if (S[i] == '1') onecnt++;
        else break;
    }
    if (onecnt >= K) cout << 1 << endl;
    else cout << S[onecnt] << endl;
}

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

/* define const */

/* finish defineing const */

int n;

int sum(int x, int y)
{
  int sum = 0;
  while (x > 0) {
    sum += x%10;
    x /= 10;
  }
  while (y > 0) {
    sum += y%10;
    y/= 10;
  }
  return sum;
}

int main()
{
  cin >> n;

  int mn = 99999999;
  
  for (int i = 1; i < n; i++) {
    mn = min(mn, sum(i,n-i));
  }
  cout << mn << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll MOD = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 5000100;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[101010];

//union-find木について
ll par[101010];
ll rank2[101010];

void init(ll n) {
	rep(i, n) {
		par[i] = i;
		rank2[i] = 0;
	}
}

ll find(ll x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);
	}
}

void unite(ll x, ll y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rank2[x] < rank2[y]) {
		par[x] = y;
	}
	else {
		par[y] = x;
		if (rank2[x] == rank2[y]) {
			rank2[x]++;
		}
	}
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	vector<ll>a(n), b(n);
	ll total = 0;
	ll j = 1;
	ll total2 = 0;
	rep(i, n) {
		cin >> a[i];
		if (i != 0) {
			total += 2 * a[i] * j;
			j *= -1;
		}
	}
	cout << a[0] - total / 2 << " ";
	ll target = a[0] - total / 2;
	for (ll i = 0;i < n-1;++i) {
		ll ans = 2 * a[i] - target;
		if (i != n - 1)cout << ans << " ";
		else {
			cout << ans << endl;
		}
		target = ans;
	}
	return 0;
}


Measured memory_bytes: 2944
/* 
 Author:N_o_o_B 
 Created:October 24 2019 00:24:43
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int n;
    cin >> n;
    vi l(2*n);
    fori(i,2*n) cin >> l[i];
    sort(all(l));
    ll ans=0;
    for(int i=0;i<2*n;i+=2){
        ans+=min(l[i],l[i+1]);
    }
    cout << ans << endl;




    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
int main(void) {
  int h, w;
  cin >> h >> w;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i, h) rep(j, w) cin >> a[i][j];

  vector<int> x, y, xp, yp;
  rep(i, h) rep(j, w) {
    int jj = j;
    int vec = 1;
    if(i % 2) {
      jj = w - j - 1;
      vec = -1;
    }
    if(j == w - 1) {
      if(i == h - 1) continue;
      if(a[i][jj] % 2) {
        a[i][jj]--;
        a[i + 1][jj]++;
        y.push_back(i + 1);
        x.push_back(jj + 1);
        yp.push_back(i + 2);
        xp.push_back(jj + 1);
      }
    } else if(a[i][jj] % 2) {
      a[i][jj]--;
      a[i][jj + vec]++;
      y.push_back(i + 1);
      x.push_back(jj + 1);
      yp.push_back(i + 1);
      xp.push_back(jj + vec + 1);
    }
  }
  int n = y.size();
  cout << n << endl;
  rep(i, n) {
    cout << y[i] << ' ';
    cout << x[i] << ' ';
    cout << yp[i] << ' ';
    cout << xp[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 5224
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 666666,mo=998244353;
void GG(){puts("0");exit(0);}
int n,d[N],res=1;
int main() {
	read(n);rep(i,1,n)read(d[i]);
	if(d[1]!=0)GG();
	rep(i,2,n)if(d[i]==0)GG();
	sort(d+1,d+n+1);int lst=1;
	rep(i,2,n){
		if(d[i]!=d[i-1]+1)GG();
		int j=i;while(j+1<=n&&d[j+1]==d[i])j++;
		rep(k,i,j)res=1LL*res*lst%mo;
		//[i,j]
		lst=j-i+1;i=j;
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string A, B; cin >> A >> B;

  string result;
  if (A.length()>B.length()) result = "GREATER";
  else if (A.length()<B.length()) result = "LESS";
  else {
    if (A>B) result = "GREATER";
    else if (A<B) result = "LESS";
    else result = "EQUAL";
  }

  cout << result << endl;
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int a[n],b[n],c[n];
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    /**/
    int dpa[MAX] = {0},dpb[MAX] = {0},dpc[MAX] = {0};
    dpa[0] = a[0];
    dpb[0] = b[0];
    dpc[0] = c[0];

    for(int i = 1;i < n;i++){
        dpa[i] = max(dpb[i - 1],dpc[i - 1]) + a[i];
        dpb[i] =  max(dpa[i - 1],dpc[i - 1]) + b[i];
        dpc[i] =  max(dpb[i - 1],dpa[i - 1]) + c[i];
        
    }

    cout << max(dpa[n - 1],max(dpb[n - 1],dpc[n - 1])) << endl;

    return 0;
}

Measured memory_bytes: 2560
import java.io.*;
import java.util.*;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[][] input = new int[n][3];
        for(int i = 0; i<n; i++){
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        input[i][0] = a;
        input[i][1] = b;
        input[i][2] = c;
        }
        int solve = dp(n, input);
        System.out.println(solve);
    }
    public static int dp(int n, int[][] input){
    int[][] arr = new int[n][3];
    int max = 0;
    for(int i = 0; i<3; i++){
    arr[0][i] = input[0][i];
    max = Math.max(arr[0][i], max);
    }
    if(n==1){return max;}
    for(int i = 1; i<n; i++){
    arr[i][0] = input[i][0] + Math.max(arr[i-1][1], arr[i-1][2]);
    arr[i][1] = input[i][1] + Math.max(arr[i-1][0], arr[i-1][2]);
    arr[i][2] = input[i][2] + Math.max(arr[i-1][0], arr[i-1][1]);
    }
    for(int i = 0; i<3; i++){
    max = Math.max(arr[n-1][i], max);
    }
    return max;
    }

}


Measured memory_bytes: 64564
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  long ans = 0;
  int N,M;
  cin >> N >> M;
  vector<int> A(N);
  vector<int> S(N+1);
  map<int, int> mod_map;
  mod_map[0] = 1;
  S[0] = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    S[i+1] = (A[i] + S[i]) % M;
    ans += mod_map[S[i+1]];
    mod_map[S[i+1]]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[202020];
deque<int> Q;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		if(i%2==0) Q.push_back(x);
		else Q.push_front(x);
	}
	if(N%2==1) {
		reverse(ALL(Q));
	}
	x=0;
	FORR(r,Q) {
		_P("%d",r);
		x++;
		if(x==N) _P("\n");
		else _P(" ");
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
int main(void)
{
    int n, m;
    cin >> n >> m;
    bool flag[m][n];
    fill(flag[0], flag[0] + m * n, false);
    int pi[m];

    REP(i, m)
    {
        int k;
        cin >> k;
        REP(j, k)
        {
            int s;
            cin >> s;
            flag[i][s - 1] = true;
        }
    }
    REP(i, m)
    {
        int p;
        cin >> p;
        pi[i] = p;
    }
    int ans = 0;
    for (int x = 0; x < (1 << n); x++)
    {
        bool lightup = true;
        REP(i, m)
        {
            int cnt = 0;
            REP(j, n)
            {
                int y = (x >> j) & 1;
                if (y == 0)
                    continue;
                if (flag[i][j])
                    cnt++;
            }
            if (cnt % 2 != pi[i])
            {
                lightup = false;
                break;
            }
        }
        if (lightup)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int n;
	int d, min, max;
	long long sum;

	scanf("%d%d", &n, &d);
	sum = min = max = d;
	while (--n > 0) {
		scanf("%d", &d);
		if (d < min) min = d;
		if (d > max) max = d;
		sum += d;
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}


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

using namespace std;

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

  int H,W,K; cin>>H>>W>>K;
  std::string map[H];
  for (int i = 0; i < H; i++)
    cin >> map[i];

  int idmap[H][W];
  int id = 1;
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++)
      idmap[i][j] = (map[i][j] == '#' ? id++ : 0);

  for (int i = 0; i < H; i++) {
    int cur_id = 0;
    int initial_id = 0;
    int initial_pos = 0;
    for (int j = 0; j < W; j++) {
      if (idmap[i][j] == 0)
        idmap[i][j] = cur_id;
      else {
        cur_id = idmap[i][j];
        if (initial_id == 0) {
          initial_id = cur_id;
          initial_pos = j;
        }
      }
    }
    for (int j = 0; j < initial_pos; j++)
      idmap[i][j] = initial_id;
  }

  for (int j = 0; j < W; j++) {
    int cur_id = 0;
    int initial_id = 0;
    int initial_pos = 0;
    for (int i = 0; i < H; i++) {
      if (idmap[i][j] == 0)
        idmap[i][j] = cur_id;
      else {
        cur_id = idmap[i][j];
        if (initial_id == 0) {
          initial_id = cur_id;
          initial_pos = i;
        }
      }
    }
    for (int i = 0; i < initial_pos; i++)
      idmap[i][j] = initial_id;
  }

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++)
      cout << idmap[i][j] << " ";
    cout << endl;
  }

  return 0;
}


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

using namespace std;

bool Check(const int n, const int s, vector<vector<bool>> &adj) {
    for (int i = n; 1 <= i; --i) {
        int tmp = 0;
        for (int j = 1; j <= n; ++j)
            if (adj[i - 1][j - 1]) tmp += j;

        if (tmp < s) return false;
        for (int j = i - 1; 1 <= j; --j) {
            if (i != j && adj[i - 1][j - 1] && j <= tmp && s <= tmp - j) {
                adj[i - 1][j - 1] = adj[j - 1][i - 1] = false;
                tmp -= j;
            }
        }
        if (tmp != s) return false;
    }

    for (int i = 0; i < n; ++i) {
        int tmp = 0;
        for (int j = 0; j < n; ++j)
            if (adj[i][j]) tmp += (j + 1);
        if (tmp != s) return false;
    }
    return true;
}

void Solve() {
    int n;
    cin >> n;

    for (int s = n * (n - 1) / 2; n <= s; --s) {
        vector<vector<bool>> adj(n, vector<bool>(n, true));
        for (int i = 0; i < n; ++i) adj[i][i] = false;
        if (Check(n, s, adj)) {
            int m = 0;
            for (int i = 0; i < n; ++i)
                for (int j = i + 1; j < n; ++j)
                    if (adj[i][j]) ++m;
            cout << m << endl;
            for (int i = 0; i < n; ++i)
                for (int j = i + 1; j < n; ++j)
                    if (adj[i][j]) cout << i + 1 << " " << j + 1 << "\n";
            return ;
        }
    }
}

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

    Solve();

    return 0;
}


Measured memory_bytes: 256
/*
    Life Before Death, Strength Before Weakness, Journey Before Destination
    ------------------------------------------------------------------------
    You don't become great by trying to be great.
    You become great by wanting to do something,
    and then doing it so hard that you become great in the process.
    */

    //#pragma comment(linker, ack:200000000")
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #include <bits/stdc++.h>
    using namespace std;
    #define rep(i, n)    for(ll i = 0; i < (n); ++i)
    #define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
    #define fst first
    #define snd second
    //#define mp make_pair
    #define pb push_back
    #define PI           3.141592653589793238462643383279502884197169399  /* pi */
    // #define te
    typedef long double ld;
    typedef long long ll;
    typedef pair<ll, ll> pii;
    typedef vector<ll> vi;
    const int maxN = 200100;
    typedef pair<pii, ll> piii;

    void solve() {
        ll n;
        cin >> n;
        ll a[n];
        for(int i=0; i<n; i++) cin >> a[i];
        ll cnt = 1;
        for(int i=0; i<n; i++){
            if(a[i] == cnt) cnt++;
        }
        if(cnt == 1) cout << -1 << endl;
        else if(cnt == n + 1 ) cout << 0 << endl;
        else cout << n - cnt + 1 << endl;
    }

    int main() {
      cin.sync_with_stdio(0); cin.tie(0);
      cin.exceptions(cin.failbit);
      //ll ti;   cin >> ti;  while(ti--)
      solve();
      return 0;
    }


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<iomanip>
#include<algorithm>
#define lint long long int
#define FOR(x, to) for(x=0; x<(to); x++) // for簡略表記
#define DUMP(ar) for(int i=0; i<ar.size(); i++) cout << "[" << i << "]:" << ar[i] << endl // 配列一覧表示
#define COUT(x) cout << x << endl // 単要素出力
#define ALL(ar) ar.begin(), ar.end() // コンテナの全要素
#define ADD 1000001
#define SUB 1000002
#define MUL 1000003
using namespace std;
// cout << fixed << setprecision(4) で小数点以下4桁の桁そろえ
// goto ANSWER; で最後へ飛ぶ

int main(){
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    
    vector<int> data;
    string s;
    while(cin >> s){
        if(s == "+"){
            data.push_back(ADD);
        }else if(s == "-"){
            data.push_back(SUB);
        }else if(s == "*"){
            data.push_back(MUL);
        }else if(s == "stop"){
            break;
        }else{
            data.push_back(stoi(s));
        }
    }
    
    vector<int> stack;
    for(unsigned int i=0; i<data.size(); i++){
        if(data[i] < ADD){
            stack.push_back(data[i]);
            continue;
        }

        int v1, v2;
        v1 = stack.back(); stack.pop_back();
        v2 = stack.back(); stack.pop_back();

        switch(data[i]){
        case ADD:
            stack.push_back(v2 + v1);
            break;
        case SUB:
            stack.push_back(v2 - v1);
            break;
        case MUL:
            stack.push_back(v2 * v1);
            break;
        }
    }

    // cout << "終了" << endl;

ANSWER:
    cout << stack.front() << endl;
    return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int i,j,n,a[300000],mid,min,o,ans,mid2;
void qt(int l,int r)
{
    int i,j,m,p;
    i=l; j=r;
    m=a[(l+r)/2];
    while (i<=j)
    {
        while (a[i]<m) i++;
        while (a[j]>m) j--;
        if (i<=j)
        {
            p=a[i];a[i]=a[j]; a[j]=p;
            i++; j--;
        }
    }
if (i<r) qt(i,r);
if (l<j) qt(l,j);
}

int main()
{
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    scanf("%d",&a[i]);
    qt(1,n);
    mid=a[n]/2;
    if (a[n]%2==1)
    {
        mid2=a[n]/2+1;
        min=1000000010;
        for (i=1;i<=n;i++)
        {
          o=a[i]-mid;
          if (o<0) o=-o;
          if (o<min) {min=o; ans=a[i];}
        }
        min=1000000010;
        for (i=1;i<=n;i++)
        {
          o=a[i]-mid2;
          if (o<0) o=-o;
          if (o<min) {min=o; ans=a[i];}
        }
        printf("%d %d",a[n],ans);
    } else
   {
     min=1000000010;
      for (i=1;i<=n;i++)
      {
         o=a[i]-mid;
         if (o<0) o=-o;
         if (o<min) {min=o; ans=a[i];}
      }
      printf("%d %d",a[n],ans);
   }
    return(0);
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#define int long long 
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int a[114], cnt[114];
signed main() {
	int n;
	cin >> n;
	rep(i, n)cin >> a[i];
	if (n == 1)cout << a[0] << endl;
	else {
		cnt[0] = lcm(a[0], a[1]);
		for (int i = 1; i < n - 1; i++)cnt[i] = lcm(cnt[i - 1], a[i + 1]);
		cout << cnt[n - 2] << endl;
	}
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;
int main(){
  int x;
  cin>>x;
  if(x>=30) cout<<"Yes";
  else cout<<"No";
return 0;
}

Measured memory_bytes: 3632
import java.util.*;
public class Main {
    public static void main(String args []){
        Scanner sc = new Scanner(System.in);
        int N  = sc.nextInt();
        String S = sc.next();
        if(N%2!=0) System.out.println("No");
        else{
            boolean check = true;
            for(int i=0;i<N/2;i++){
                if(S.charAt(i)!=S.charAt(i+N/2)){
                    check = false;
                    break;
                }
            }
            if(check) System.out.println("Yes");
            else System.out.println("No");
        }

    }
}


Measured memory_bytes: 23636
#include<stdio.h>
#include<string.h>

#define M 1046527
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return key%(M-1)+1; }

int find(char str[]){
/* your task */
  long long key,i,x;
  key = getKey(str);
  for(i=0; ;i++){
    x = (h1(key)+i*h2(key))%M;
    if(strcmp(H[x],str)==0)return 1;
    else if(strlen(H[x])==0)return 0;
                }
  return 0;
}

int insert(char str[]){
 /* your task */
   long long key,i,x;
  key = getKey(str);
  for(i=0; ;i++){
    x=(h1(key)+i*h2(key))%M;
    if(strcmp(H[x],str)==0)return 1;
    else if(strlen(H[x])==0){
      strcpy(H[x],str);
      return 0;             }
                }
  return 0;

}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Measured memory_bytes: 16052
#include<stdio.h>

unsigned long long ki(unsigned long long x){
    if(x>1)
    return 2*ki(x/2)+1;
    else if(x=1)
    return x;
}


int main(void){
    unsigned long long h;
    scanf("%llu",&h);
    printf("%llu",ki(h));
    return 0;
}

Measured memory_bytes: 256
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)


bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    string s;

    cin>>s;

    l = s.size();

    k = 0;

    For(i,0,l-1)
    {
        if(s[i]=='o')
            k++;
    }

    k+=15-l;

    if(k>=8)
        cout<<"YES\n";
    else
        cout<<"NO\n";

   // main();

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b, k;
  scanf("%d%d%d", &a, &b, &k);
  if (b-a+1 > 2*k) {
    for (int i=0; i<k; i++) printf("%d\n", a+i);
    for (int i=k-1; i>=0; i--) printf("%d\n", b-i);
  } else {
    for (int i=a; i<=b; i++) printf("%d\n", i);
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
double p;
double h = 100, l = 0;

double f(double x) { return x + p / pow(2, x / 1.5); }

int main() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];

  for (int i = 0; i < n - m + 1; ++i) {
    for (int j = 0; j < n - m + 1; ++j) {
      bool flg = true;
      for (int k = 0; k < m; ++k) {
        for (int l = 0; l < m; ++l) {
          if (a[i + k][j + l] != b[k][l]) flg = false;
        }
      }
      if (flg) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }

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

Measured memory_bytes: 256
c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))

if (c21 - c11 == c22 - c12) and (c21 - c11 == c23 - c13) and (c31 - c11 == c32 - c12) and (c31 - c11 == c33 - c13) and (c12 - c11 == c22 - c21) and (c12 - c11 == c32 - c31) and (c13 - c11 == c23 - c21) and (c13 - c11 == c33 - c31):
    print('Yes')
else:
     print('No')


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct T {
  int x, y, c;
};

signed main() {
  int a[3], b[3], c[3];
  rep(i, 0, 3) cin >> a[i];
  rep(i, 0, 3) cin >> b[i];
  rep(i, 0, 3) cin >> c[i];

  rep(i, 0, 101) {
    rep(j, 0, 101) {
      rep(k, 0, 101) {
        int a1 = i, a2 = j, a3 = k;
        if(a[0] - a1 != b[0] - a2 || a[0] - a1 != c[0] - a3) continue;
        if(a[1] - a1 != b[1] - a2 || a[1] - a1 != c[1] - a3) continue;
        if(a[2] - a1 != b[2] - a2 || a[2] - a1 != c[2] - a3) continue;
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


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

int main(){
  int n,m;
  cin>>n;
  vector<int> kushi(2*n);
  for(int i=0;i<2*n;i++){
    cin>>kushi[i];
  }
  sort(kushi.begin(),kushi.end());
  int ans=0;
  for(int j=0;j<n;j++){
    ans+=kushi[2*j];
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;
int main(){
  int N,sum = 0;
  cin >> N;
  int X = N;
  while(N > 0){
    sum += N%10;
    N /= 10;
  }
  if(X%sum == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc103/tasks/abc103_a
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << max({a, b, c}) - min({a, b, c}) << "\n";

    return 0;
}

Measured memory_bytes: 256
from sys import stdin

input = stdin.readline


def p_a():
    n = int(input())
    print(((n + 1) // 2) / n)


def p_b():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))

    print(sum(map(lambda x: x >= k, h)))


def p_c():
    n = int(input())
    k = list(map(int, input().split()))

    print(*[i[0] for i in sorted(enumerate(k, start=1), key=lambda x: x[1])])


if __name__ == '__main__':
    p_c()


Measured memory_bytes: 68060
#include<bits/stdc++.h>
#define pb push_back
#define p2(x) (x)*(x)
#define len(x) (int)(x).size()
using namespace std;
typedef long double ld;
typedef long long ll;
const int N = 81;
bool dp[N][N][8*N*N];
int a[N][N] ,b[N][N] , cons = 4*N*N;
bool chek(int x , int h){
    if(x >= h || x < 0)return false;
    return true;
}
signed main(){
    ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    int h , w;
    cin >> h >> w;
    for(int i = 0 ; i < h; ++i){
        for(int j = 0 ; j < w; ++j)
            cin >> a[i][j];
    }
    for(int i = 0 ; i < h; ++i){
        for(int j = 0 ; j < w; ++j)
            cin >> b[i][j];
    }

    dp[0][0][cons+a[0][0]-b[0][0]] = 1;
    dp[0][0][cons+b[0][0]-a[0][0]] = 1;

    vector < array < int , 2 > > poss = {
        {
            0 , -1
        },
        {
            -1 , 0
        }
    };
//    cout << poss[0][0] << ' ' << poss[0][1] << '\n';
//    cout << poss[1][0] << ' ' << poss[1][1] << '\n';
//    cout << endl;
    for(int i = 0 ; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(i == 0 && j == 0)continue;
            for(int prev = 0;prev<8*N*N;++prev){
                for(int state = 0; state < len(poss);++state){
                    if(!chek(poss[state][0] + i , h) || !chek(poss[state][1] + j , w))continue;
                    if(!dp[poss[state][0]+i][poss[state][1]+j][prev])continue;
                    assert(prev+a[i][j]-b[i][j]<8*N*N);
                    assert(prev+a[i][j]-b[i][j] >= 0);
                    dp[i][j][prev+a[i][j]-b[i][j]] = 1;
                    dp[i][j][prev+b[i][j]-a[i][j]] = 1;

                }
            }
        }
    }
//    cerr << " DEBUG \n";
//    for(int i = 0 ; i < h; ++i){
//        for(int j = 0 ; j < w; ++j){
//            cout << " POS " << i << ' ' << j << '\n';
//            for(int prev = 0 ; prev < 8*N*N;++prev)
//                if(dp[i][j][prev])
//                    cout<<prev-cons<<' ';
//            cout<<'\n';
//        }
//    }
//    cout << "\nENDL\n";
    int answer = 1e9;
    for(int i = 0;  i < 8*N*N;++i)
        if(dp[h - 1][w - 1][i])answer = min(answer , abs(i - cons));
    cout << answer;
    return 0;
}


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

using namespace std;

int main() {
    std::string s;
    int K;
    cin >> s >> K;

    std::vector<std::string> sub;

    for (int left = 0; left < s.size(); ++left) {
        for (int n = 1; n <= K; ++n) {
            sub.emplace_back(s.substr(left, n));
        }
    }

    std::sort(sub.begin(), sub.end());

    std::unique(sub.begin(), sub.end());

    cout << sub[K - 1] << endl;

    return 0;
}


Measured memory_bytes: 1660
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#include<queue>
#include<cstdio>
#include<vector>
#include <algorithm>
#include<string>
#define rep(i,n) for (int i=0;i<(n);++i)
using ll = long long;
using namespace std;
using P = pair<int,int>;

int main(){
    string s,t;
    cin>>s>>t;
    int ans = t.size();

    for(int start = 0;start<=s.size()-t.size();start++){
        int diff=0;
        rep(i,t.size()){
            if(t[i]!=s[start+i]){
                diff++;
            }
        }
        ans = min(ans,diff);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		String str = sc.next();
		int length = str.length();
		int p = str.replace("g", "").length();
		int g = length - p;
		int max = 0;
		if (g >= p) {
			max = (int)Math.floor((g - p)/2);
		} else {
			max = (int)Math.ceil((g -p)/2);
		}
		System.out.println(max);
	}

}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

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

int main() {
  string dw[7] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  string s;

  cin >> s;

  auto iter = find(begin(dw), end(dw), s);
  size_t index = distance(begin(dw), iter);
  cout << 7 - index << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,b,c,d,x,y;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	x=a*b;
	y=c*d;
	if(x>=y){
		printf("%d\n",x);
	}
	if(x<y){
		printf("%d\n",y);
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
 using namespace std;
 typedef long long ll;
 const int maxn=1e5+10;
 int gcd(int a,int b){return b>0?gcd(b,a%b):a;}
 int main()
 {
 	ll sum=0,n;
 	cin>>n;
 	for(int i=1;i<=n;i++){
 		for(int j=1;j<=n;j++){
 			for(int k=1;k<=n;k++)
 				sum+=gcd(i,gcd(j,k));
		 }
	 }
	cout<<sum;
 	return 0;
 }

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

const int maxn = 300010;
int n, pre[maxn], suf[maxn];
char s[maxn];

int main() {
    scanf("%d %s", &n, s + 1);
    for (int i = 1; i <= n; i++) {
        pre[i] = pre[i - 1] + (s[i] == 'W');
    }
    for (int i = n; i; i--) {
        suf[i] = suf[i + 1] + (s[i] == 'E');
    }
    int mn = INT_MAX;
    for (int i = 1; i <= n; i++) {
        mn = min(mn, pre[i - 1] + suf[i + 1]);
    }
    printf("%d\n", mn);
    return 0;
}

Measured memory_bytes: 2944
#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()
#define INF 1e9
typedef long long ll;

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

int a;
string c;
void solve(){
  if(a >= 3200){
    cout << c << endl;
  }else{
    cout << "red" << endl;
  }
}

int main(){
  cin >> a >> c;
  solve();
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm> 
using namespace std;
long long a[100050],n,ans,i,j,k;
int main()
{
    cin>>n;
	for(i=1;i<=n;i++)
	 cin>>a[i];
	sort(a+1,a+1+n);
	for(i=1;i<=n-2;i++)
	 for(j=i+1;j<=n-1;j++)
	  for(k=j+1;k<=n;k++)
	   if(a[i]+a[k]>a[j]&&a[j]+a[i]>a[k])
	    ans++;
	cout<<ans;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

int n, digit;
vector<string> ans;

void dfs(string a) {
  if (a.size() == digit + 1) return;
  int seven, five,  three;
  five = 0; seven = 0; three = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == '7') seven++;
    if (a[i] == '5') five++;
    if (a[i] == '3') three++;
  }
  if (seven != 0 && five != 0 && three != 0 && atoi(a.c_str()) <= n) {
    ans.push_back(a);
  }

  dfs(a + "7");
  dfs(a + "5");
  dfs(a + "3");
}

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  cin >> n;
  digit = to_string(n).size();
  dfs("");

  cout << ans.size() << endl;

  //for (auto v : ans) {
  //  cout << v << endl;
  //}
  
  return 0;
}


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

int main()
{
    long long int n;
    scanf("%lld", &n);
    n = n - 1;

    vector<char> result;
    char temp;

    while (1) {
        temp = (char)(((int)(n % 26)) + 97);
        result.push_back(temp);
        if (n < 26)
            break;
        n = n / 26;
        n = n - 1;
    }
    
    for (int i = result.size() - 1; i>=0; i--)
        printf("%c", result[i]);
    printf("\n");

    return 0;
}

Measured memory_bytes: 3588
module WeightedDirectedGraph
  (Weight : sig
    type t
    val inf : t (* オーバーフローの恐れはないので，max_intとか突っ込んでも良い *)
    val zero : t
    val neg_inf : t (* オーバーフローの恐れはないので，min_intとか突っ込んでも良い *)
    val ( + ) : t -> t -> t
    val compare : t -> t -> int
  end) :
sig
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  val bellman_ford :
    (* 頂点数n *)
    int ->
    (* 辺のリスト
       頂点は0からn-1までの整数でなくてはならない
       2n回呼び出されるので，リストを作るのに時間がかかるならメモ化すること *)
    (int * int * Weight.t) church_list ->
    (* 始点 *)
    int ->
    (* 頂点を受け取り，そこまでの距離を返す関数
       頂点に到達するパスが無ければinfを返し，
       そこに到達するまでに負閉路があればneg_infを返す *)
    (int -> Weight.t)
end =
struct
  type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

  let bellman_ford n es s =
    (* 距離を覚えるやつ *)
    let d = Array.make n Weight.inf in
    (* 経路に負閉路が含まれる頂点を覚えるやつ *)
    let neg = Array.make n false in
    (* 始点より終点のインデックスが大きくなる辺を集めた隣接リスト *)
    let inc = Array.make n [] in
    (* 始点より終点のインデックスが小さくなる辺を集めた隣接リスト *)
    let dec = Array.make n [] in
    es.fold (fun ((u, v, c) as e) () ->
      if u <= v
      then inc.(u) <- e :: inc.(u)
      else dec.(u) <- e :: dec.(u)) ();
    d.(s) <- Weight.zero;
    (* 残りの反復回数 *)
    let i = ref n in
    (* 更新が行われたか *)
    let is_modified = ref true in
    (* 各辺の処理 *)
    let f (u, v, c) = 
      let open Weight in
      if neg.(u) then neg.(v) <- true;
      if
        (* 原点から到達できない頂点は更新しない *)
        0 < Weight.compare inf d.(u)
        (* c は u から v への辺の重さ
           d.(u) + c < d.(v) *)
        && 0 < Weight.compare d.(v) (d.(u) + c)
      then begin
        d.(v) <- d.(u) + c;
        is_modified := true;
        if !i <= succ n lsr 1 then neg.(v) <- true
      end in
    while 0 < !i && !is_modified do
      is_modified := false;
      (* インデックスが増加する辺の処理 *)
      for u = 0 to n - 1 do
        List.iter f inc.(u)
      done;
      (* インデックスが減少する辺の処理 *)
      for u = n - 1 downto 0 do
        List.iter f dec.(u)
      done;
      decr i
    done;
    fun v -> if neg.(v) then Weight.neg_inf else d.(v)
end

module G = WeightedDirectedGraph (struct
  type t = int
  let zero = 0
  let inf = min_int
  let neg_inf = max_int
  let ( + ) = ( + )
  let compare x y = compare y x
end)

let () = Scanf.scanf "%d %d %d\n" @@ fun n m p ->
  let abc = Array.init m @@ fun _ ->
    Scanf.scanf "%d %d %d\n" @@ fun a b c -> a - 1, b - 1, c - p in
  let d = G.bellman_ford n { G.fold = fun f -> Array.fold_right f abc } 0 (n - 1) in
  if max_int <= d
  then print_endline "-1"
  else Printf.printf "%d\n" @@ max 0 d


Measured memory_bytes: 4864
#include<stdio.h>

int main(){
  int a,b; scanf("%d%d",&a,&b);
  if(a*b>0 && a!=1 && b!=1) printf("%d\n",a*b);
  else if(a<0 && b==0) printf("0\n");
  else{
    if (a+b>a-b) printf("%d\n",a+b);
    else printf("%d\n",a-b);
  }
  return 0;
}

Measured memory_bytes: 128
/*input
4 4
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=1000005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int arr[3]={300000, 200000, 100000};
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int a,b;
    cin>>a>>b;
    int ans=0;
    if(a<=3) ans+=arr[a-1];
    if(b<=3) ans+=arr[b-1];
    if(a==1 and b==1) ans+=400000;
    cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  for (int i = n - 2; i >= 0; --i) {
    if (a[i] > a[i + 1]) a[i]--;
  }
  bool ok = true;
  for (int i = 0; i < n - 1; ++i){
    if (!(a[i] <= a[i + 1])) ok = false;
  }
  
  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
//在 POJ 和小白菜中，该库禁用！
//在 USACO中请用文件。
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	cout<<((a-b)*100+b*1900)*(pow(2,b))<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import *

N, K = map(int, input().split())
ans = 0

for i in range(1, N+1):
    now = i
    p = 1
    
    while now<K:
        p *= 1/2
        now *= 2
    
    ans += p/N

print(ans)

Measured memory_bytes: 39152