akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int isPrimeNum( int x )
{
    int i;

    for( i = 2; i <= sqrt((double)x); i++ )
        if( x % i == 0 ) return 0;
    return 1;
}

int main(){
  int num;
  int i,j;
  int *array;
  int count = 0;

  do{
  scanf("%d",&num);
  }while(num < 1 || num > 10000);

  array = (int *)malloc(sizeof(int)*num);

  for(i = 0;i < num;i++){
    do{
    scanf("%d",&array[i]);
    }while(array[i]<2 || array[i]>100000000);
  }

  for(i = 0;i < num;i++) {
        if( isPrimeNum( array[i] ) ) {
	  count++;
        }
    }

  printf("%d\n",count);
  
  free(array);
  
  return 0;
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+7;
int a[maxn],cnt[maxn]={0};
ll pre[maxn]={0},jie[maxn];
void init()
{
    jie[0]=0;
    jie[1]=1;
    for(int i=2;i<maxn;++i)
        jie[i]=i+jie[i-1];
}
int main()
{
    ios::sync_with_stdio(false);
    //freopen("in.txt","r",stdin);
    init();
    int n;
    cin>>n;
    ll ans=0;
    set<int> st;
    map<ll,int> mp;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        pre[i]=a[i]+pre[i-1];
        mp[pre[i]]++;
    }
    map<ll,int>::iterator it=mp.begin();
    for(;it!=mp.end();++it){
        if(it->first==0)
            ans+=jie[it->second];
        else
            ans+=jie[it->second-1];
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 17408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,d,c=0;;
    cin>>n>>d;
    ll u=d*d;
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        if(((x*x)+(y*y))<=u){c++;}
    }
    cout<<c;
}


Measured memory_bytes: 3564
data = input()
nums = [int(i) for i in data.split()]

max_idx = len(nums)
for i in range(1, max_idx):
    for j in range(max_idx-i):
        if nums[j] > nums[j+1]:
            nums[j], nums[j+1] = nums[j+1], nums[j]

print(' '.join([str(i) for i in nums]))

Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
   string A,Ans;cin>>A;
   ll B,C;
   B=A.size();
   C=A.size()-2;
   Ans=A[0]+to_string(C)+A[B-1];
   cout<<Ans<<endl;
   

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
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 set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N;
vector<ll> A;
set<ll> st;

int main(){
    cin >> N;
    rep(i,N){
        ll a;cin>>a;
        if(st.count(a)) st.erase(a);
        else st.insert(a);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b;
	cin>>a>>b;
	int sockets = 1;
	int cnt = 0;
	while(sockets < b)
	{
		sockets+=a;
		sockets--;
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
 
int main() {
    
    int N,K;
    cin >> N >>K;
    int sum=0;
    
    for (int i=0 ; i<N ; i++){
        int x=0 ;
        cin >> x;
        if ( K-x<x ){
            sum += 2*(K-x);
        }
        else {
            sum += 2*x;
        }
    }
   
    
    cout << sum <<endl;
    
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> inline void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> inline void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }
TPL<TNM T> inline void UNIQUE(vector<T>& vec) { sort(ALL(vec)); vec.erase(unique(ALL(vec)), vec.end()); }
inline bool range2d(int x, int y, int W, int H) { return (x >= 0) && (y >= 0) && (W > x) && (H > y); }

int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	int mx = max(max(A, B), C);
	OUT(mx * 10 + A + B + C - mx);
	return 0;
}


Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 10桁出力 cout << setprecision(10) << double;
#include <queue>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	string a, b;
	cin >> a >> b;
	string ans = "EQUAL";

	if (a.length() > b.length()) {
		ans = "GREATER";
	}
	else if (a.length() < b.length()) {
		ans = "LESS";
	}
	else {


		for (int i = 0; i < min(a.length(), b.length()); i++) {
			if (a[i] == b[i]) {
				continue;
			}
			else if (a[i] > b[i]) {
				ans = "GREATER";
				break;
			}
			else {
				ans = "LESS";
				break;
			}
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define add accumulate
  #define ll long long int
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define vll vector<ll>
  #define lb lower_bound
  #define ub upper_bound
  #define pll pair<ll,ll>
  #define vpll vector<pll>
  #define all(v) v.begin(), v.end()
  #define rep(i,k,n) for(int i=k;i<n;i++)
  #define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
  const ll mod=1e9+7;
  const ll MAX=1e5+10;
  ll lcm(ll x,ll y){return (x*y)/__gcd(x,y);}
  //
  //    
    ll solve(){
        ll n,k;
        cin>>n>>k;
        ll arr[n];
        rep(i,0,n)
            cin>>arr[i];
        sort(arr,arr+n);
        vpll vec;
        rep(i,0,k){
            ll x,y;
            cin>>x>>y;
            vec.pb(mp(y,x));
        }
        sort(vec.rbegin(),vec.rend());
        auto itr=vec.begin();
        rep(i,0,n){
            if(arr[i]<itr->ff){
                itr->ss-=1;
                arr[i]=itr->ff;
                if(itr->ss==0)
                    ++itr;
                // cout<<arr[i]<<" ";
            }
            if(itr==vec.end())
                break;
        }
        cout<<add(arr,arr+n,0ll);
    }
    int main(){ 
        hs;
        ll t;
        // cin>>t;
        t=1;
        while(t--)
            solve();
    return 0; 
} 

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

using namespace std;

int main(){
int n,k;
cin >> n >> k;

vector<int> v(n);

for (int i = 0; i < n; ++i)
{
	cin >> v[i];
}


sort(v.begin(),v.end());
int p = 0;
int ans = 0;
while(p < k){
ans += v[p];
p++;
}

cout << ans <<endl;
}


Measured memory_bytes: 3600
#include <cstdio>
using namespace std;
int k;
namespace jzp1 {
	inline void sol() {
		printf("%d\n", k);
		for (int i = 1; i <= k; ++i) {
			for (int j = 1, st = i; j <= k; ++j, st = st % k + 1)
				printf("%d ", st);
			puts("");
		}
	}
}
namespace jzp2 {
	int mp[1111];
	inline void sol() {
		int n = (k + 3) / 4 * 2;
		printf("%d\n", n);
		for (int i = 1; i <= k; ++i)	mp[i] = i;
		for (int i = k + 1; i <= n + n; ++i)	mp[i] = (i - n) % n + 1;
		for (int i = 1; i <= n; ++i) {
			for (int j = 1, st = i, lst = i - 1; j <= n; ++j, lst = st, st = st % n + 1) {
				if (i & 1)	printf("%d ", mp[st]);
				else	printf("%d ", mp[lst + n]);
			}
			puts("");
		}
	}
}
int main() {
	scanf("%d", &k);
	if (k <= 500) jzp1::sol();
	else
		jzp2::sol();
	return 0;
}


Measured memory_bytes: 1736
def main():
    length = int(input())
    sequence = list(map(int, input().split()))
    answer = 0
    index = 0
    while index < length:
        while index + 1 < length and sequence[index] == sequence[index + 1]:
            index += 1
        if index + 1 < length and sequence[index] < sequence[index + 1]:
            while index + 1 < length and sequence[index] <= sequence[index + 1]:
                index += 1
        elif index + 1 < length and sequence[index + 1] < sequence[index]:
            while index + 1 < length and sequence[index + 1] <= sequence[index]:
                index += 1
        answer += 1
        index += 1
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 14436
#include<bits/stdc++.h>
using namespace std;
int serch(int go,int now)
{
    int direction[6][2]={{1,2},{-1,3},{1,-1},{4,5},{5,2},{2,1}};
    if(now==-1)return -1;
    return direction[now][go];
}
int main()
{
    string str;
    while(cin>>str&&str!="#"){
        int now=0;
        for(int i=0;i<str.size();i++)now=serch(str[i]-'0',now);
        if(now==5)cout<<"Yes\n";
        else cout<<"No\n";
    }
}

Measured memory_bytes: 1172
#include<iostream>
using namespace std;
int main(){
  int N;
  int flg = 0;
  cin >> N;
  int *a = new int[N];
  for (int i =0 ; i < N; i++){
    cin >> a[i];
  }
  for(int i = 0; i < N; i++){
    if(a[i] == flg + 1){
      flg++;
    }
  }
  if(flg == 0){
    cout << -1;
  }else{
    cout << N - flg;
  }
  delete [] a;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#define ll long long
using namespace std;

int main(void){
    ll n, m;
    cin >> n >> m;
    ll ans = 0;
    ans = n*(n-1)/2+m*(m-1)/2;
    cout << ans << endl;
    return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

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

  int N;
  cin >> N;
  ll M;
  cin >> M;
  int total = 0;
  vl A(N);
  rep(i, 0, N) {
    cin >> A[i];
    total += A[i];
  }

  ll cnt = 0ll;

  rep(i, 0, N) {
    ll a = A[i];
    if (a * 4ll * M < total) continue;
    cnt++;
  }

  if (cnt >= M) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }




  return 0;
};


Measured memory_bytes: 256
#include<stdio.h>

char jinkoki[32][4]={
  "",
  "Man",
  "Oku",
  "Cho",
  "Kei",
  "Gai",
  "Jo",
  "Jou",
  "Ko",
  "Kan",
  "Sei",
  "Sai",
  "Gok",
  "Ggs",
  "Asg",
  "Nyt",
  "Fks",
  "Mts"
};

int main(){
  int i,j,m,n,arr[32]={0};
  while(scanf("%d%d",&m,&n),m!=0){
    for(i=0;i<32;i++){arr[i]=0;}
    arr[0]=1;
    for(i=0;i<n;i++){
      for(j=0;j<32;j++){arr[j]*=m;}
      for(j=0;j<31;j++){
        arr[j+1]+=(arr[j]/10000);
        arr[j]%=10000;
      }
    }
    for(i=17;i>=0;i--){
      if(arr[i]!=0){
        printf("%d%s",arr[i],jinkoki[i]);
      }
    }printf("\n");
  }
}



Measured memory_bytes: 2080
#define z 1000000
a[z],b[z],n,i=2,x,c;main(){for(;i<z;i++)a[i]=i;for(i=0;i<z;i++)if(a[i]!=0){b[x++]=i;for(c=i;c<z;c+=i)a[c]=0;}while(scanf("%d",&n)!=-1){c=0;while(b[c]<=n && b[c]!=0){c++;}printf("%d\n",c);}exit(0);}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    if(n == 1) {
        cout << 1 << endl;
        return 0;
    }

    vector<string> board1(n), board2(n);
    rep(i, n) {
        cin >> board1[i];
    }

    int cnt = 0;
    rep(a, n) {

        rep(i, n) {
            board2[i] = board1[(i+a)%n];
        }

        int flag = 0;
        rep(i, n-1) {
            for(int j = i+1; j < n; j++) {

                if(board2[i][j] != board2[j][i]) {
                    flag = 1;
                    break;
                }
            }
            if(flag) {
                break;
            }
        }

        if(!flag) {
            cnt++;
        }
    }

    cout <<n*cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 998244353;
constexpr int  mod = mo;
constexpr ll inf = 1ll<<62;

int main(){
    ll s;
    cin>>s;
    constexpr ll m = 1000000000;
    vector<pair<ll,ll>> ans;
    ans.emplace_back(0,0);
    ans.emplace_back(m,1);
    ll x = (m - s%m)%m;
    ll y = (s + x)/m;
    ans.emplace_back(x,y);
    for(int i=0;i<3;++i){
        if(i != 0)cout << " ";
        cout << ans[i].first << " " << ans[i].second;
    }
    cout << endl;
    
    return 0;
}



Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n = int(input())
p = list(map(int, input().split()))

ans = 1
minVal = p[0]

for i in range(1, n):
    if minVal > p[i]:
        ans += 1
        minVal = p[i]
print(ans)






Measured memory_bytes: 32284
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <climits>
using namespace std;

bool comp(pair<int, string> a, pair<int, string> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}


 
int main(){
    int a,b,c;
    cin >> a >> b >> c;

    if(a == b){
        if(b == c)
            cout << 1 << endl;
        else
            cout << 2 << endl;
    }
    else if(b == c)
        cout << 2 << endl;
    else if(a == c)
        cout << 2 << endl;
    else
        cout << 3 << endl;
    


}

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

int main() {
  std::string s1, s2, s3;
  std::cin >> s1 >> s2 >> s3;
  std::transform(s1.begin(), s1.end(), s1.begin(), toupper);
  std::transform(s2.begin(), s2.end(), s2.begin(), toupper);
  std::transform(s3.begin(), s3.end(), s3.begin(), toupper);
  std::cout << s1[0] << s2[0] << s3[0] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

    
int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  
  string s;
  cin>>s;
  string t = "CODEFESTIVAL2016";
  int ans = 0;
  REP (i, 16) {
    ans += (s[i] != t[i]);
  }
  cout<<ans<<endl;

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    private static int[] calcMondaySaturdayPrimes(int n) {
        boolean[] table = new boolean[n + 1];
        table[0] = table[1] = true;
        for (int i = 0; ; i++) {
            int x = 7 * i + 1;
            if (x > Math.sqrt(n)) {
                break;
            } else if (!table[x]) {
                for (int j = x + x; j <= n; j += x) {
                    table[j] = true;
                }
            }
            x = 7 * i + 6;
            if (x > Math.sqrt(n)) {
                break;
            } else if (!table[x]) {
                for (int j = x + x; j <= n; j += x) {
                    table[j] = true;
                }
            }
        }

        int counter = 0;
        for (int i = 0; ; i++) {
            int x = 7 * i + 1;
            if (x > n) {
                break;
            } else if (!table[x]) {
                counter++;
            }
            x = 7 * i + 6;
            if (x > n) {
                break;
            } else if (!table[x]) {
                counter++;
            }
        }

        int[] result = new int[counter];
        int index = 0;
        for (int i = 0; ; i++) {
            int x = 7 * i + 1;
            if (x > n) {
                break;
            } else if (!table[x]) {
                result[index++] = x;
            }
            x = 7 * i + 6;
            if (x > n) {
                break;
            } else if (!table[x]) {
                result[index++] = x;
            }
        }
        return result;
    }

    private static void solve() {
        Scanner scanner = new Scanner(System.in);
        int[] primes = calcMondaySaturdayPrimes(300000);

        while (true) {
            int n = scanner.nextInt();
            if (n == 1) {
               break;
            }

            System.out.print(n + ":");
            for (int i = 0; i < primes.length && primes[i] <= n; i++) {
                if (n % primes[i] == 0) {
                    System.out.print(" " + primes[i]);
                }
            }
            System.out.println();
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 13000
package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
)

type Score struct {
	S string
	P int
	i int
}

type Scores []Score

func (s Scores) Len() int      { return len(s) }
func (s Scores) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s Scores) Less(i, j int) bool {
	if s[i].S == s[j].S {
		return s[i].P > s[j].P
	}
	return s[i].S < s[j].S
}

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N := nextInt()

	scores := make([]Score, 0, N)
	for i := 1; i <= N; i++ {
		S := nextStr()
		P := nextInt()
		scores = append(scores, Score{S, P, i})
	}
	sort.Sort(Scores(scores))

	for _, s := range scores {
		fmt.Println(s.i)
	}
}


Measured memory_bytes: 640
"use strict"
function main(arg) {
    var data = arg.split("\n")[1].split(" ").map(Number)
    var min_i = 0
    var min_v = data[0]
    var count = 1
    for (var i = 1; i < data.length; i++) {
        // console.log(i)
        if (min_v >= data[i]) {
            // ok
            count++
            min_v = data[i]
        }
    }
    console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main()
{
    int n;
    cin >> n;
    vector<int> p(n), q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    vector<int> a(n);
    rep(i,n) a[i] = i+1;

    map<vector<int>, int> mp;
    do {
        mp[a] = mp.size();
    } while (next_permutation(a.begin(), a.end()));
    
    int ans = abs(mp[p] - mp[q]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5248
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main implements Runnable {
    public static void main(String[] args) {
        new Thread(null,new Main(), "" ,Runtime.getRuntime().maxMemory()).start();
    }

    public void run() {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        int one = n % 10;
        
        String ans = "";
        if(one == 2 || one == 4 || one == 5 || one == 7 || one == 9) ans = "hon";
        else if(one == 0 || one == 1 || one == 6 || one == 8) ans = "pon";
        else ans = "bon";
        
        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 32688
#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 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 sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<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 vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("TBD");}else{puts("Heisei");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int y,m,d;
    char a,b;
    cin >> y >> a >> m >> b >> d;
    if(m>4)yn;
    return 0;
}
 
 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int N;
	cin >> N;
	bool can = true;
	int t[100100];
	int x[100100];
	int y[100100];
	t[0] = 0; x[0] = 0; y[0] = 0;
	for (int i = 1; i <= N; ++i) {
		cin >> t[i] >> x[i] >> y[i];
		if (t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) {
			can = false;
		}
		if ((t[i] - t[i - 1]) % 2 != (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])) % 2) {
			can = false;
		}
	}
	if (can)cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1408
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	static public void main(String args[]) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		
		ArrayList<Integer> list = new ArrayList<>();
		for(int i=0; i<n; i++) {
			list.add(scan.nextInt());
		}

		int m = scan.nextInt();

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

			int query = scan.nextInt();

			int lowerResult = ~Collections.binarySearch(list, query, (x, y) -> x.compareTo(y) >= 0 ? 1 : -1);			
				System.out.println(lowerResult);
//				System.out.println("debug");
		}
	}
}



Measured memory_bytes: 115144
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	var (
		min = +math.MaxInt32
		max = -math.MaxInt32
	)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		if tmp < min {
			min = tmp
		}
		if tmp > max {
			max = tmp
		}
	}
	fmt.Printf("%d\n", max-min)
}


Measured memory_bytes: 512
#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;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=200005;
ll pre[N],a[N];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n;
  cin>>n;
  rep(i,1,n+1) cin>>a[i],pre[i]=pre[i-1]+a[i];
  ll ans=LLONG_MAX;
  rep(i,1,n) ans=min(ans,abs(pre[n]-pre[i]-pre[i]));
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 3328
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define dump(o) { cerr << #o; for (auto e : (o)) cerr << " " << e; cerr << endl; }
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

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

//??§?¨???§???
//v: ??§???????????§?¨??????? ????????????
template<typename T>
void compress(vector<T> &v) {
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
}

//??§?¨???§???(map)
//v: ??§???????????§?¨??????? ????????????
//?????????: zip[??§???????????§?¨?]:??§???????????§?¨? (zip.size()<=10^5?????????????????????)
template<typename T>
map<T, T> compressMap(vector<T> &v) {
	map<T, T> zip;
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	for (T i = 0; i < v.size(); i++) zip[v[i]] = i;
	return zip;
}

//??§???????????§?¨?
//index(??§???????????§?¨?, ??§???????????§?¨??????????(??????) )
template<typename T>
int index(vector<T> v, T i) { return lower_bound(v.begin(), v.end(), i) - v.begin(); }

//2?¬????imos???
class Imos {
public:
	using vvi = vector<vector<int> >;
	int X, Y;
	vvi s; //?´???????
	//f:field
	Imos(vvi &f) {
		X = f.size();
		Y = f[0].size();
		//one-based
		//(x,y)?????§????´??????????(x+1,y+1)
		s = vvi(X + 1, vector<int>(Y + 1));
		for (int y = 0; y < Y; y++)
			for (int x = 0; x < X; x++)
				s[x + 1][y + 1] += s[x + 1][y] + s[x][y + 1] - s[x][y] + f[x][y];
	}
	//[x1,x2)??????[y1,y2)???field??????????±???????
	//one-based????????????????§?
	int sum(int x1, int y1, int x2, int y2) { return s[x2][y2] - s[x2][y1] - s[x1][y2] + s[x1][y1]; }
};

int main() {
	int n, m; cin >> n >> m;
	vector<int> xs(n), ys(n);
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &xs[i], &ys[i]);
		x[i] = xs[i]; y[i] = ys[i];
	}
	compress(x);
	compress(y);

	//map<int, int> zipx(compressMap(x));
	//map<int, int> zipy(compressMap(y));
	//dump(x);
	//dump(zipx);
	//dump(y);
	//dump(zipy);

	vector<vector<int> > f(x.size(), vector<int>(y.size()));

	for (int i = 0; i < n; i++) {
		int vx = index(x, xs[i]);
		int vy = index(y, ys[i]);
		f[vx][vy]++;
	}

	//for (int vx = 0; vx < x.size(); vx++) dump(f[vx]);

	Imos imos(f);

	for (int i = 0; i < m; i++) {
		int x1, y1, x2, y2;
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		x1 = index(x, x1);
		y1 = index(y, y1);
		x2 = index(x, x2 + 1); //Imos???sum???one-based?????????+1
		y2 = index(y, y2 + 1);
		cout << imos.sum(x1, y1, x2, y2) << endl;
	}
	return 0;
}


//Sample2
//https://gyazo.com/39c67d1abe7a6a686acb52285f8a0bc9

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

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

	vector<pair<int, int>> A( N );
	for( int i = 0; i < N; ++i ) {
		cin >> A.at( i ).first;
		A.at( i ).second = i;
	}

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

	for( int i = 0; i < N; ++i ) {
		cout << A.at( A.at( 0 ).second == i ).first << endl;
	}
}


Measured memory_bytes: 3200
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n, count = 1;
  int maybe = 0, ans = 0;
  char s[110];
  scanf("%d%s", &n, s);
  while (count < n)
  {
    for (int k = 'a'; k <= 'z'; k++)
    {
      int left = 0, right = 0;
      for (int j = 0; j < count; j++)
      {
        if (s[j] == k)
        {
          left = 1;
          break;
        }
      }
      for (int j = count; j < n; j++)
      {
        if (s[j] == k)
        {
          right = 1;
          break;
        }
      }
      if (left && right)
      {
        maybe++;
      }
    }
    ans = MAX(ans, maybe);
    maybe = 0;
    count++;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]

full = 0
for i in range(N + 1):
    full += abs(A[i+1] - A[i])

# iは使わなくなるAの添字
for i in range(1, N+1):
    minus = abs(A[i] - A[i-1]) + abs(A[i+1] - A[i])
    plus = abs(A[i+1] - A[i-1])
    x = full - minus + plus
    print(x)

Measured memory_bytes: 14048
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define vi vct<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define vb vct<bool>
#define vs vector<string>
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define ft cout<<"for test"<<endl;
#define read(v,a,n) for(int i=a; i<n; i++)cin>>v[i];
#define print(v) for(auto it:v)cout<<it<<' ';cout<<endl;
#define PI 2*acos(0.0)
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test,cs=1;cin>>test;while(test--)
///................function.....................///
#define siz(s) (int)(s.size())
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mod 999999937
int main()
{
    FIO;
    ///freopen("in.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    int n,i,c=0;
    cin>>n;
    vi v(n+1);
    read(v,1,n+1);
    for(i=1; i<=n; i++)
        if((i&1)&&(v[i]&1))c++;
    cout<<c<<endl;
}


Measured memory_bytes: 3612
#include<stdio.h>

int main(void){
  int i = 0;
  int a = 0;
  int b = 0;
  int c = 0;
  int flag = 0;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  if (a==b){
    flag++;
  }
  if (a==c){
    flag++;
  }
  if (b==c){
    flag++;
  }
  if (flag == 1){
    printf("Yes");
  }else{
    printf("No");
  }
}

Measured memory_bytes: 128
'use strict'

const main = (INPUT) => {
  const input = INPUT.split('\n')[0].split(' ').map(n => Number(n))
  const N = input[0]
  const L = input[1]
  let ans = 0
  let i
  let flg
  if (L >= 0) {
    i = 1
    flg = false
  } else {
    i = 0
    flg = true
  }
  for (; i < N; i++) {
    if (L + i == 0) {
      flg = false
    } else {
      ans += L + i
    }
  }
  if (flg) {
    ans -= L + N - 1
  }
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9+5
#define ll long long int


int main(){
   ll N,W;
   cin>>N>> W;
   vector<ll> weights(N+1,0);
   vector<ll> values(N+1,0);
   
   for(ll i=1;i<=N;i++){
       cin>>weights[i]>>values[i];
   }
   
  ll dp[N+1][100001];
  
  for(ll i=1;i<=N;i++){
      for(ll j=1;j<=W;j++){
          if(j<weights[i]){
              dp[i][j] = dp[i-1][j];
              
          }
          else
          {
              dp[i][j] = max(values[i] + dp[i-1][j-weights[i]],dp[i-1][j]);
          }
      }
  }
  cout<<dp[N][W];
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X;cin>>X;
  int ans=8;
  if(600<=X&&X<=799)ans=7;
  if(800<=X&&X<=999)ans=6;
  if(1000<=X&&X<=1199)ans=5;
  if(1200<=X&&X<=1399)ans=4;
  if(1400<=X&&X<=1599)ans=3;
  if(1600<=X&&X<=1799)ans=2;
  if(1800<=X&&X<=1999)ans=1;
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
import Control.Applicative

import Control.Monad
    (replicateM)
 
type Dice
    = [Int]
 
type Problem
    = [Dice]
 
type Result
    = Bool
 
roll :: Dice -> String -> Dice
 
roll dice []
    = dice
 
roll [s1, s2, s3, s4, s5, s6] (x:xs)
    = case x of
        'N' -> roll [s2, s6, s3, s4, s1, s5] xs
        'S' -> roll [s5, s1, s3, s4, s6, s2] xs
        'E' -> roll [s4, s2, s1, s6, s5, s3] xs
        'W' -> roll [s3, s2, s6, s1, s5, s4] xs
        'C' -> roll [s1, s3, s5, s2, s4, s6] xs
         
rollTo :: Int -> Dice -> [Dice]
 
rollTo top dice@[s1, s2, s3, s4, s5, s6]
    = [rolled | (cond, rolled) <- [c1, c2, c3, c4, c5, c6], top == cond] where
        c1 = (s1, dice)
        c2 = (s2, roll dice "N")
        c3 = (s3, roll dice "W")
        c4 = (s4, roll dice "E")
        c5 = (s5, roll dice "S")
        c6 = (s6, roll dice "NN")
         
spinTo :: Int -> Dice -> [Dice]
 
spinTo front dice@[_, s2, s3, s4, s5, _]
    = [spun | (cond, spun) <- [c2, c3, c4, c5], front == cond] where
        c2 = (s2, dice)
        c3 = (s3, roll dice "C")
        c4 = (s4, roll dice "CCC")
        c5 = (s5, roll dice "CC")

findDuplication :: [Dice] -> Bool

findDuplication []
    = False

findDuplication (dice@(top:front:_):dices)
    = if elem dice $ concatMap (spinTo front) $ concatMap (rollTo top) dices
        then True
        else findDuplication dices

solve :: Problem -> Result
 
solve
    = findDuplication
 
output :: Result -> String
 
output bool
    = if not bool then "Yes" else "No"
     
input :: IO Problem
 
input
    = do
        n <- read <$> getLine
        dices <- replicateM n $ map read <$> words <$> getLine
        return dices
 
main :: IO ()
 
main
    = putStrLn <$> output =<< solve <$> input

Measured memory_bytes: 4148
n,k = map(int,input().split())
a = list(map(int,input().split()))

l=0
r=10**9

def check(x):
    now = 0
    for i in range(n):
        now += (a[i] - 1 )// x
    return now <= k

while r-l > 1:
    x = (l+r) //2
    if check(x):
        r = x
    else:
        l = x

print(r)



Measured memory_bytes: 30784
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 500005;
int a[maxn];
int n,sum1,sum2;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]%4==0)sum1++;
        else if(a[i]%4==2)sum2++;
    }
    if(sum2>1)
    {
        int ans=sum2+sum1*2;
        if(ans>=n)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else
    {
        int ans = sum1*2;
        if(sum1)ans++;
        if(ans>=n)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640