akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        while(s.hasNext()){
            String line=s.nextLine();
            for(int i=0;i<26;i++){
                String now="";
                for(int j=0;j<line.length();j++){
                    if(line.charAt(j)>='a'&&line.charAt(j)<='z'){
                        now+=(char)('a'+(line.charAt(j)-'a'+i)%26);
                    }else now+=line.charAt(j);
                }
                boolean ok=false;
                for(int j=0;j<now.length()-2;j++){
                    if(now.charAt(j)=='t'&&now.charAt(j+1)=='h'&&now.charAt(j+2)=='e')ok=true;
                }
                for(int j=0;j<now.length()-3;j++){
                    if(now.charAt(j)=='t'&&now.charAt(j+1)=='h'){
                        if(now.charAt(j+2)=='i'&&now.charAt(j+3)=='s')ok=true;
                        if(now.charAt(j+2)=='a'&&now.charAt(j+3)=='t')ok=true;
                    }
                }
                if(ok){
                    System.out.println(now);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 26608
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define sc(x) cin >> x
#define sc2(x, y) cin >> x >> y
#define sc3(x, y, z) cin >> x >> y >> z
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define debugn(i, n, a) rep(i, n)cout << " --- " << a[i] << "\n";
#define debugin(i, n, a) rep(i, n)printf(" --- %10d\n", a[i])
#define debugi2n(i, n, a, b) rep(i, n)printf(" --- %10d %10d\n", a[i], b[i])
#define debugiin(i, n, a) rep(i, n)printf(" --- %10d %10d\n", a[i].first, a[i].second)
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)


signed main(void){
  int i, j;
  for(int testcase = 0;;testcase++){
    int(n);
    ll a[n][n];
    rep(i, n)rep(j, n)sc(a[i][j]);
    ll res = 0;
    rep2d(i, j, n)res += min(a[i][j], a[j][i]);
    pri(res);

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 1320
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define ll int
#define bits_count __builtin_popcountll
#define endl '\n'
#define double double
#define ld double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
#define sz(x) (ll)x.size()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve(){

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

    FOR(i,1,30000){
        int x = i*0.08,y = i*0.1;
        if(x == a && y == b){
            cout<<i<<endl;
            return;
        }
    }

    cout<<-1<<endl;
}

signed main(){

   FastRead;    


    int t = 1; 
    // cin>>t; 
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int l[1000] = {}, r[1000] = {};

int main()
{
	int n;
	long ans = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d %d", &l[i], &r[i]);
	}
	for (int i = 0; i < n; i++)
	{
		ans = ans + r[i] - l[i] + 1;
	}
	printf("%ld", ans);
	return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(1000000000)
from itertools import count
from functools import lru_cache
from collections import defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    I = (ii(), ii())
    for i in (1,2,3):
        if i not in I:
            print(i)




main()


Measured memory_bytes: 4212
n = int(input())
a = list(map(int, input().split()))
t = 0

for i in range(n):
    minj = i
    for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
    a[i], a[minj] = a[minj], a[i]
    if i != minj:
        t += 1

print(' '.join(map(str, a)))
print(t)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int a,b,n,m,ans=0;cin>>a>>b;
    n=max(a,b);m=min(a,b);
    rep(i,n)
    ans+=m*pow(10,i);
    cout<<ans;
    
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100
#define WHITE 1
#define BLACK 2
#define INF 2000000

int n,array[N][N];
int prim(void);

int main(){
    int i,j,tmp;
    
    scanf("%d",&n);

    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            scanf("%d",&tmp);
            if(tmp != -1){
                array[i][j] = tmp;
            }
            else{
                array[i][j] = INF;
            }
        }
    }

    printf("%d\n",prim());

    return 0;
}
int prim(){
    int u,mincost,v,sum=0,i,j;
    int color[N],p[N],d[N];

    for(i=0;i<n;i++){
        color[i] = WHITE;
        d[i] = INF;
        p[i] = -1;
    }
    d[0] = 0;

    while(1){
        mincost = INF;
        for(i=0;i<n;i++){
            if(color[i] != BLACK && d[i] < mincost){
                mincost = d[i];
                u = i;
            }
        }

        if(mincost == INF) break;
        color[u] = BLACK;

        for(v=0;v<n;v++){
            if(color[v] != BLACK && array[u][v] < d[v]){
                p[v] = u;
                d[v] = array[u][v];
            }
        }
    }

    for(i=0;i<n;i++){
        sum += d[i];
    }

    return sum;
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MAX = 1000001;
const ll MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; 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;
    }
}

ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  int x, y; scanf("%d %d", &x, &y);
	ll ans = 0;
	if((x + y) % 3 == 0){
		COMinit();
		int p = (2*x - y)/3;
		int q = (2*y - x)/3;
		ans = COM(p + q, p);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 27156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

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

	int a = A+B;
	int b = A-B;
	int c = A*B;

	int d = max(a,b);
	int e = max(d,c);

	cout << e << endl;
	return 0;
}


Measured memory_bytes: 256
from collections import OrderedDict
if __name__ == "__main__":
    a, b, k = map(int, input().split())

    output = OrderedDict()

    for i in range(k):
        if a<= a+i <= b:
            output[a+i] = a+i
    
    for i in range(-k+1,1):
        if a<= b+i <= b:
            output[b+i] = b+i
    
    for o in output.keys():
        print(o)


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

int main() {
  int n;
  cin>>n;
  vector<char>vec(n);
  for(int i=0;i<n;i++){
    char c;
    cin>>c;
    vec.at(i)=c;
  }
  int count=0;
  for(int i=0;i<n-2;i++){
    if(vec.at(i)=='A'&&vec.at(i+1)=='B'&&vec.at(i+2)=='C')count++;
  }
  cout<<count<<endl;
}


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

typedef long long ll;

#define REP(i, N) for (int i = 0; i < (int)(N); i++)

// chmax, chmin
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; }

int main() {
    string S;
    cin >> S;
    
    int A = S[0] - '0', B = S[1] - '0', C = S[2] - '0', D = S[3] - '0';
    
    if ( A + B + C + D == 7 ){
        cout << A << "+" << B << "+" << C << "+" << D << "=" << 7 << endl;
        return 0;
    } else if ( A + B + C - D == 7 ) {
        cout << A << "+" << B << "+" << C << "-" << D << "=" << 7 << endl;
        return 0;
    } else if ( A + B - C + D == 7 ) {
        cout << A << "+" << B << "-" << C << "+" << D << "=" << 7 << endl;
        return 0;
    } else if ( A - B + C + D == 7 ) {
        cout << A << "-" << B << "+" << C << "+" << D << "=" << 7 << endl;
        return 0;
    } else if ( A + B - C - D == 7 ) {
        cout << A << "+" << B << "-" << C << "-" << D << "=" << 7 << endl;
        return 0;
    } else if ( A - B + C - D == 7 ) {
        cout << A << "-" << B << "+" << C << "-" << D << "=" << 7 << endl;
        return 0;
    } else if ( A - B - C + D == 7 ) {
        cout << A << "-" << B << "-" << C << "+" << D << "=" << 7 << endl;
        return 0;
    } else if ( A - B - C - D == 7 ) {
        cout << A << "-" << B << "-" << C << "-" << D << "=" << 7 << endl;
        return 0;
    }
    
    return 0;
}

Measured memory_bytes: 3604
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<utility>
#include<functional>
#include<cassert>
#include<cmath>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<vint> vvint;
#define PI 3.1415926535;
#define MOD 1000000007;



int main(void) {
	int n;
	string s;
	cin >> n >> s;
	int cnt = 0, ans = 0;
	for (int i = 0; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < 10; k++) {
				cnt = 0;
				for (int l = 0; l < s.size(); l++) {
					if (cnt == 0) {
						if (s[l] == (char)(i + 48)) {
							cnt++;
						}
					}
					else if (cnt == 1) {
						if (s[l] == (char)(j + 48)) {
							cnt++;
						}
					}
					else if (cnt == 2) {
						if (s[l] == (char)(k + 48)) {
							cnt++;
						}
					}
					if (cnt == 3) {
						ans++;
						goto NEXT;
					}
				}
			NEXT:;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	if(s.size()==2) cout << s << endl;
	else{
		rep(i,s.size()){
			cout << s[s.size()-i-1];
		}
		cout << endl;
	}
}

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

ll res(ll x){
	if(x == 1) return 1;
  	
  	ll ans = 1;
  	ans += res(x/2) * 2;

  	return ans;
}

int main(){
	ll h;
  	cin >> h;
  
  	cout << res(h) << endl;; 
}

Measured memory_bytes: 3552
#include<iostream>

int main(void)
{
	 uint64_t R, L;

	std::cin >> L;
	std::cin >> R;

	int min_mod = 2019;
	if (R - L < 2020) {
		for (uint64_t i = L; i < R; i++) {
			for (uint64_t j = i + 1; j <= R; j++) {
				//std::cout << "i : " << i << std::endl;
				//std::cout << "j : " << j << std::endl;

				int val = i * j % 2019;
				//std::cout << val << std::endl;
				if (min_mod > val) {
					min_mod = val;
					if (min_mod == 0) {
						break;
					}
				}
			}
		}
	}
	else {
		min_mod = 0;
	}
	std::cout << min_mod << std::endl;
	

}

Measured memory_bytes: 256
import sys
import math

N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
C = list(map(int, input().split(' ')))

A.sort()
B.sort()
C.sort()

array1 = list()
count = 0
f = 0
for j in range(N):
    for i in range(f, N):
        if B[N-1-j] < C[N-1-i]:
            count += 1
            if i == N-1:
                f = N
        else:
            f = i
            break
    array1.append(count)
ans = 0
f = 0
count = 0
for i in range(N):
    for j in range(f, N):
        if B[i] > A[j]:
            count += 1
            if j == N-1:
                f = N
        else:
            f = j
            break
    ans += count * array1[N-1-i]
print(ans)


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

int main() {
  set<int> S ;
  rep(i,1000) S.insert(i*i) ;
  int N , D ;
  int ans = 0 ;
  cin >> N >> D ;
  int A[N][D] ;
  int count = 0 ;
  rep(i,N) rep(j,D) cin >> A[i][j] ;
  for(int i = 0 ; i < N ; i++ ){
    for(int j = i+1 ; j < N ;j++ ){
		rep(k,D) ans += ( A[i][k] - A[j][k] )*( A[i][k] - A[j][k] ) ;
        if( S.count(ans) ) count++ ;
        ans = 0 ;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a*b*c==5*5*7)cout << "YES" << "\n";
  else cout << "NO" << "\n";
  return 0;
}


Measured memory_bytes: 256
//                _                                      
//  ___ _ __ ___ (_) __ ___      ___   _ _ __ ___  _ __  
// / __| '_ ` _ \| |/ _` \ \ /\ / / | | | '_ ` _ \| '_ \ 
// \__ \ | | | | | | (_| |\ V  V /| |_| | | | | | | |_) |
// |___/_| |_| |_|_|\__, | \_/\_/  \__,_|_| |_| |_| .__/ 
//                  |___/                         |_|  
//code by smigwump
//https://codeforces.com/blog/entry/62393 hashing hack protection
//https://codeforces.com/blog/entry/61587 rand() alternatives
//https://codeforces.com/blog/entry/61675 randomized hack protection
#include <bits/stdc++.h>
typedef long long ll;
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define REP(i,a,b) for(ll i = a; i <= b; i++)
#define PER(i,a,b) for(ll i = a; i >= b; i--)

using namespace std;

int main() {
	// #ifndef ONLINE_JUDGE
	//     freopen("input.txt", "r", stdin);
	//     freopen("output.txt", "w", stdout);
	// #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    while(t--) {
    	int h,w,k;
        cin>>h>>w>>k;
        char arr[h][w];
        REP(i,0,h-1) REP(j,0,w-1) cin>>arr[i][j];
        int ans = 0;
        REP(x,0,(1<<h)-1) {
            REP(y,0,(1<<w)-1) {
                int sum = 0;
                REP(i,0,h-1) {
                    REP(j,0,w-1) {
                        if(arr[i][j]=='#' && (!(x&(1<<i)) && !(y&(1<<j)))) {
                            sum++;
                        }
                    }
                }
                if(sum==k) {
                    ans++;
                }
            }
        }
        cout<<ans<<"\n";
    }
	return 0;
}

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

int N, a[40010], b[40010], T[40010];

int main(){
	while( cin >> N , N ){
		for(int i=1 ; i <= N ; i++ ) cin >> a[i];
		for(int i=1 ; i <= N ; i++ ) cin >> b[i];
		
		sort(a + 1, a + N + 1, greater<int>());
		sort(b + 1, b + N + 1, greater<int>());
		fill(T, T + N + 1, 0);
		
		int s = 1, t = 1;
		while( s <= N && t <= N ){
			while( a[t] > b[s] && t <= N ) t++;
			if( t <= N && b[s] >= a[t] ){
				T[t]++;
				t++, s++;
			}
		}
		
		for(int i=1 ; i <= N ; i++ ) T[i] += T[i-1];
		
		int k = -1;
		for(int i = 1 ; i <= N ; i++ ){
			if( (i - T[i]) >= (i + 2) / 2 ){
				k = i;
				break;
			}
		}
		if( k == -1 || k == N ){
			cout << "NA" << endl;
		}else{
			cout << k << endl;
		}
	}
}

Measured memory_bytes: 1648
#include <stdio.h> 

int main(){
  int N,i,j;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);

  trace(A,N);
  insertionSort(A,N);

  return 0;
}

void trace(int a[],int n){
  int i;
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    printf("%d",a[i]);
  }
  printf("\n");
}

void insertionSort(int a[],int n){
  int j,i,v;
  for(i=1;i<n;i++){
    v=a[i];
    j=i-1;
    while(j>=0 && a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    trace(a,n);
  }
}    

Measured memory_bytes: 604
#include<stdio.h>
int main(){
	int n,i,j,k,a[100],b[100],c[100],d[100],e[100][100],s=0,max=0;
	while(scanf("%d",&n),n){
		for(i=s=0;i<=n;i++)d[i]=0;
		for(i=0;i<n-1;i++){
			scanf("%d %d %d",&a[i],&b[i],&c[i]);
			d[a[i]]++;
			d[b[i]]++;
		}
		d[1]++;
		for(i=0;i<n-1;i++){
			if(d[a[i]]==1||d[b[i]]==1)c[i]=0;
		}
		//for(i=0;i<n-1;i++)printf("%d %d %d\n",a[i],b[i],c[i]);
		for(i=0;i<n-1;i++)s+=c[i];
		for(i=0;i<n*n;i++)e[i/n][i%n]=1e9;
		for(i=0;i<n;i++)e[i][i]=0;
		for(i=0;i<n-1;i++)e[a[i]-1][b[i]-1]=e[b[i]-1][a[i]-1]=c[i];
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				for(k=0;k<n;k++){
					if(e[j][k]>e[j][i]+e[i][k])e[j][k]=e[j][i]+e[i][k];
				}
			}
		}
		for(i=max=0;i<n-1;i++){//printf("%d ",e[0][i]);printf("\n");
			if(max<e[0][i])max=e[0][i];
		}//printf("%d\n",max);
		printf("%d\n",s*2-max);
	}
	return 0;
}

Measured memory_bytes: 612
#include<stdio.h>
#define N 100
int main(){
    int A[N];
    int i,j,n,m,w,v,a;
    scanf("%d",&w);
    for(n=0;n<w;n++){
        if(scanf("%d",&a)==EOF){
            break;
        }
        A[n]=a;
    }
    for(i=1;i<w;i++){
        v=A[i];
        j=i-1;
	for(m=0;m<w-1;m++){
            printf("%d ",A[m]);
        }
	printf("%d\n",A[m]);
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
    }
    for(m=0;m<w-1;m++){
            printf("%d ",A[m]);
        }
    printf("%d\n",A[m]);
    return 0;
}


Measured memory_bytes: 2084
#include<iostream>
using namespace std;
int main(){
  int money,bell;
  while(1){
    cin >> money;
    if(money==0){
      break;
    }
    money=1000-money;
    bell=0;
    while(money!=0){
      if(money>=500){
	bell++;
	money-=500;
      }
      else if(money>=100){
	bell++;
	money-=100;
      }
      else if(money>=50){
	bell++;
	money-=50;
      }
      else if(money>=10){
	bell++;
	money-=10;
      }
      else if(money>=5){
	bell++;
	money-=5;
      }
      else if(money>=1){
	bell++;
	money-=1;
      }
    }
    cout << bell << endl;
  }
}

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

#define dbg(x) cerr<<#x": "<<x<<"\n"
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define DMAX 100001

using namespace std;

long long v[DMAX], c, k, n;

int main()
{
	ios_base::sync_with_stdio(0);
	cin >> n >> c >> k;

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

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

	long long last=0, cap = 0, ans = 0;
	for(long long i=1;i<=n;i++)
	{
		if(cap == c)
		{
			last = v[i]+k;
			cap = 1;
			ans++;
			continue;
		}
		if(v[i] <= last)
		{
			cap++;
		}
		else {
			ans++;
			cap = 1;
			last = v[i]+k;
		}
	}
	cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int)N;i++)
int main()
{
  int A,B,C,D;
  string x,op1,op2,op3;
  cin>>x;
  A=x.at(0)-'0',B=x.at(1)-'0';
  C=x.at(2)-'0',D=x.at(3)-'0';
  rep(i,2){rep(j,2){rep(k,2){
    if(i==1){op1="-";}else{op1="+";}
    if(j==1){op2="-";}else{op2="+";}
    if(k==1){op3="-";}else{op3="+";}
    if(A+pow(-1.0,(float)i)*B+pow(-1.0,(float)j)*C+pow(-1.0,(float)k)*D==7.0)
    {
      cout<<A<<op1<<B<<op2
        <<C<<op3<<D<<"=7"<<endl;
     return 0;
    }
  }}}
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  print $ f n - 3 * f (n `div` 3) - 5 * f (n `div` 5) + 15 * f (n `div` 15)

f :: Int -> Int
f k = k * (succ k) `div` 2

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 3752
#include <cstdio>

int c[3]={1000,500,100};
int cnt[3];
int main(void){
	while(1){
		int a,b;
		scanf("%d %d",&a,&b);
		if(a+b==0)break;
		int rest=b-a;
		for(int i=0;i<3;i++){
			cnt[i]=0;
			while(rest>=c[i]){
				cnt[i]++;
				rest-=c[i];
			}
		}
		printf("%d %d %d\n",cnt[2],cnt[1],cnt[0]);
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdlib.h>

using namespace std;

int main() {
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a1+a2+a3 >= 22) {
        cout << "bust";
    }else {
        cout << "win";
    }
    return 0;
}


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    int N;
    string S;
    
    cin >> N;
    cin >> S;
    
    int stack=0;
    int left=0;
    REP(i,N){
        if(S[i]=='(') stack++;
        if(S[i]==')'){
            if(stack>0) stack--;
            else left++;
        }
    }

    string res;
    REP(i,left){
        res+="(";
    }
    res+=S;
    REP(i,stack){
        res+=")";
    }
    cout<<res<<endl;
    
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

int gcd(int a, int b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s;
	cin >> s;
	int ans = 0;
	int cur = 0;
	rep(i, s.size()){
		if(s[i] == 'A' || s[i] == 'C' || s[i] == 'T' || s[i] == 'G'){
		cur++;
		}
		else{
			ans = max(ans, cur);
			cur = 0;
		}
	}
	ans = max(ans, cur);
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = getIntList()
    val B = getIntList()
    val C = getIntList()
    var satisfaction: Int = 0
    var before = 99
    for (a in A) {
        satisfaction += B[a-1]
        if (a - before == 1) {
            satisfaction += C[a-2]
        }
        before = a 
        //println("B: ${B[a-1]} sa: $satisfaction")
    }
    println(satisfaction)
 }
fun getIntList(): List<Int> {
    return readLine()!!.split(" ").map(String::toInt)
}


Measured memory_bytes: 37616
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

Node treeMaximum(Node x)
{
  while( x->right != NIL )
    x = x->right;
  return x;
}

Node treeMinimum(Node x)
{
  while( x->left != NIL )
    x = x->left;
  return x;
}

Node treeSuccessor(Node x)
{
  if ( x->right != NIL )
    return treeMinimum(x->right);
  Node y = x->parent;
  while( y != NIL && x == y->right )
  {
    x = y;
    y = y->parent;
  }
  return y;
}

Node treeSearch(Node u, int k)
{
  while( u != NIL && k != u->key )
  {
    if ( k < u->key )
      u = u->left;
    else
      u = u->right;
  }
  return u;
}
void treeDelete(Node z)
{
  Node y;
  Node x; 

  if ( z->left == NIL || z->right == NIL )
    y = z;
  else
    y = treeSuccessor(z);
  if ( y->left != NIL )
    x = y->left;
  else
    x = y->right;

  if ( x != NIL )
    x->parent = y->parent;

  if ( y->parent == NIL )
    root = x;
  else
  {
    if (y == y->parent->left)
      y->parent->left = x;
    else
      y->parent->right = x;
  }

  if ( y != z )
    z->key = y->key;
  free(y);
}

void insert(int k)
{
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL )
  {
    y = x;
    if ( z->key < x->key )
      x = x->left;
    else
      x = x->right;
  }

  z->parent = y;
  if ( y == NIL )
    root = z;
  else
  {
    if (z->key < y->key)
      y->left = z;
    else
      y->right = z;
  }
}

void inorder(Node u)
{
  if ( u == NIL )
    return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node u)
{
  if ( u == NIL )
    return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main()
{
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ )
  {
    scanf("%s", com);
    if ( strcmp(com, "find") == 0 )
    {
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( strcmp(com, "findMin") == 0 )
      {
	      Node minn = treeMinimum(t);
	      printf("%d\n", minn->key);
      }
      else if ( strcmp(com, "findMax") == 0 )
      {
	      Node maxn = treeMaximum(t);
	      printf("%d\n", maxn->key);
      }
      else
      {
	      if ( t != NIL )
          printf("yes\n");
	      else
          printf("no\n");
      }
    }
    else if ( com[0] == 'i' )
    {
      scanf("%d", &x);
      insert(x);
    }
    else if ( strcmp(com, "print") == 0 )
    {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( strcmp(com, "delete") == 0 )
    {
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20436
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int n, root, ans;
char dat[100005];
vector<int> G[100005];
int sz[100005], dep[100005];
bool del[100005];

int del_unn(int v, int par)
{
	int ret = 0;
	sz[v] = dat[v] == 'W';
	rep(i, G[v].size()) {
		int u = G[v][i];
		if(u == par) continue;
		ret += del_unn(u, v);
		sz[v] += sz[u];
	}
	if(sz[v] == 0) {
		del[v] = true;
		ret ++;
	}
	return ret;
}

int pre_calc()
{
	root = -1;
	rep1(i, n) if(dat[i] == 'W') root = i;
	if(root == -1) {
		printf("0\n");
		exit(0);
	}
	int ret = del_unn(root, -1);
	if(ret == n - 1) {
		printf("1\n");
		exit(0);
	}
	return n - 1 - ret;
}

int calc_ext(int v, int par)
{
	int retc = dep[v] = 0, retd = 0;
	int cd = (par != -1) ^ (dat[v] == 'W');
	rep(i, G[v].size()) {
		int u = G[v][i];
		if(u == par || del[u]) continue;
		cd ^= 1;
		retd = max(retd, calc_ext(u, v));
		retc = max(retc, dep[v] + dep[u]);
		dep[v] = max(dep[v], dep[u]);
	}
	dep[v] += cd;
	ans += cd;
	return max(retc + cd, retd);
}

int main()
{
	scanf("%d", &n);
	rep(i, n - 1) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	scanf("%s", dat + 1);
	ans += pre_calc() * 2;
	ans -= calc_ext(root, -1) * 2;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 16000
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl
using lint=long long;
int MOD=1000000007;

signed main(){
    int n;cin>>n;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    vector<lint> sm(n+1,0);
    rep1(i,n){
        sm[i]=sm[i-1]+a[i-1];
        sm[i]%=MOD;
    }
    lint res=0;
    for(int i=1;i<n;++i){
        res+=sm[i]*a[i];
        res%=MOD;
    }
    cout<<res<<"\n";
    return 0;
}

Measured memory_bytes: 5508
open System

[<EntryPoint>]
let main _ =
(*
  I'm always watching you...
 _________
/ ___ ___ \
| <●> <●> |
\    |   /
 |  MMM  |
 \  WWW  /
  \_____/
*)
  let s = System.Console.ReadLine()
  let ans =
    match s with
    | "Sunny"  -> "Cloudy"
    | "Cloudy" -> "Rainy"
    | "Rainy"  -> "Sunny"
    | _        -> failwith "error."
  System.Console.WriteLine(ans)
  0

Measured memory_bytes: 11092
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int p, q, r;
	final int DIV = 1000000;
	double s, t;
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			p = sc.nextInt();
			q = sc.nextInt();
			r = sc.nextInt();
			if( (p|q|r) == 0 ) break;
			s = p - q;
			t = (double)( q-p ) / q; 
			if( r == 0 ) System.out.println((double)2 * ( p - q ) * PI );
			else {
				double sum = 0;
				int loop = q / lcm(q, p-q);
				double theta = 2 * PI * loop;
				
				for(int i=0;i<DIV;i++) {
					double t1 = theta / DIV * i;
					double t2 = theta / DIV * ( i + 1 );
					P p = hypotroid( (t1+t2) / 2 ) ;
					sum += sqrt(p.x * p.x + p.y * p.y) * (t2-t1);
				}
				System.out.println(sum);
			}
		}
	}
	
	int lcm( int a, int b ) {
		if( b == 0 ) return a;
		else return lcm(b, a%b);
	}
	
	P hypotroid( double theta ) {
		double x = - s * sin(theta) - (double) t * r * sin( theta * t );
		double y = s * cos(theta) + (double) t * r * cos( theta * t );
		return new P(x, y);
	}
	
	class P {
		double x, y;
		P(double x, double y) {
			this.x = x;
			this.y = y;
		}
	}

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

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
diff (a:b:as) = (b - a):diff (b:as)
diff _ = []

main = do
    [k, n] <- map read . words <$> getLine :: IO [Int]
    a <- map read . words <$> getLine :: IO [Int]
    print $ k - max (k - last a + head a) (maximum (diff a))


Measured memory_bytes: 106876
using System;
class Program
{
  static void Main (string[] args)
  {
    int N = int.Parse(Console.ReadLine());
    string[] input = Console.ReadLine().Split(' ');
    double[] values = new double[N];
    for (int i = 0; i < N; i++) {
      values[i] = double.Parse(input[i]);
    }
    Array.Sort(values);
    
    for (int i = 0; i < N-1; i++) {
      values[i+1] = (values[i] + values[i+1]) / 2;
    }
    Console.WriteLine(values[N-1]);
  }
}

Measured memory_bytes: 11348
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T> bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T> ostream &operator<<(ostream &os, vector<T> v) {
    for (int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for (auto &e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int m, d;
    cin >> m >> d;
    int ans=0;
    for (int i = 1; i <= m; i++) {
        for (int j = 20; j <= d; j++) {
            if(j%10<2){
                continue;
            }
            if((j/10)*(j%10)==i){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
N,M = gets.split.map(&:to_i)
cards = Array.new(N+1,0)

M.times do
  l, r = gets.split.map(&:to_i)
  l -= 1
  cards[l] += 1
  cards[r] -= 1
end

s = Array.new(N, 0)
s[0] = cards[0]
(1..N).each do |i|
  s[i] = s[i-1] + cards[i]
end
ans = 0
s.each do |x|
  ans += 1 if x == M
end
p ans

Measured memory_bytes: 3324
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node{
	char s[20];
	int temp;
}a[1000010];
int t=1,n,tt;
char ss[20];
void getans(int len,int l){
	if(len==n){
		return ;
	}
	int ll=l;
	l=t+1; 
	for(int i=ll;i<=l-1;i++){
		strcpy(ss,a[i].s);
		for(int j=1;j<=a[i].temp+1;j++){
			strcpy(a[t+1].s,ss);
			a[t+1].s[len]='a'+j-1;
			a[t+1].s[len+1]='\0';
			a[t+1].temp=a[i].temp;
			if(a[t+1].s[len]-'a'+1>a[t+1].temp){
				a[t+1].temp=a[t+1].s[len]-'a'+1;
			}
			t++;
		}
	}
	tt=l;
	getans(len+1,l); 
	return ;
}
int main(){
	scanf("%d",&n);
	a[1].s[0]='a';
	a[1].s[1]='\0';
	a[1].temp=1;
	getans(1,1);
	for(int i=tt;i<=t;i++){
		printf("%s\n",a[i].s);
	}
	return 0;
} 

Measured memory_bytes: 5632
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next(), T = scan.next();


        HashMap<Character, Character> table = new HashMap<Character, Character>();
        HashMap<Character, Character> r_table = new HashMap<Character, Character>();

        char s_ch, t_ch;
        for (int i=0; i<S.length(); i++) {
            s_ch = S.charAt(i);
            t_ch = T.charAt(i);

            if (table.get(s_ch) == null) {
                table.put(s_ch, t_ch);
            }
            if (r_table.get(t_ch) == null) {
                r_table.put(t_ch, s_ch);
            }

            if (table.get(s_ch) != t_ch || r_table.get(t_ch) != s_ch) {
                System.out.println("No");
                System.exit(0);
            }
        }

        System.out.println("Yes");
    }
}

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

int D;

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

	cin >> D;

	if (D == 25) {
		cout << "Christmas" << endl;
	}
	else if (D == 24) {
		cout << "Christmas Eve" << endl;
	}
	else if (D == 23) {
		cout << "Christmas Eve Eve" << endl;
	}
	else if (D == 22) {
		cout << "Christmas Eve Eve Eve" << endl;
	}
	return 0;

}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	int N;
	cin >> N;
	REP(_, N) {
		int p, q;
		cin >> p >> q;
		bool ok = true;
		for(int m = -4000; m <= 4000; m++) {
			for(int n = -4000; n <= 4000; n++) {
				int a = m*m+n*n;
				if(a <= 1 || 20000 <= a) {
					continue;
				}
				int b = m*p+n*q;
				int c = m*q-n*p;
				if(b%a == 0 && c%a == 0) {
					if((m == p && n == q) || (-n == p && m == q) || (-m == p && -n == q) || (n == p && -m == q)) {
						continue;
					}
					ok = false;
					goto show;
				}
			}
		}
		show:
		cout << (ok ? 'P' : 'C') << endl;
	}
	return 0;
}

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

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
    StringBuffer sb = new StringBuffer(s);
    String rs = sb.reverse().toString();
    boolean b = true;
    int n = s.length();
    if(!rs.equals(s))
      b = false;
      String s1 = s.substring(0 , (n - 1) / 2);
      String s2 = rs.substring((n + 1) / 2 , n);
    if(!s1.equals(s2))
      b = false;
      String s3 = rs.substring(0 , (n - 1) / 2 );
      String s4 = s.substring((n + 1) / 2 , n);
    if(!s3.equals(s4))
      b = false;
	System.out.println(b ? "Yes" : "No");
	}
}

Measured memory_bytes: 23252
//
//  main.cpp
//
// g++ -std=c++14 main.cpp
//

//#include "main.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;
typedef long long ll;

int main(void){
    ll n, a[200020], s[200020];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i == 0) s[i] = a[i];
        else s[i] = s[i - 1] + a[i];
    }
    
    ll ans = 1e18;
    for (int i = 1; i < n - 2; i++) {
        int l_l = 0, l_r = i;
        while (l_r - l_l > 1) {
            int l_mid = (l_l + l_r) / 2;
            ll ll_sum = s[l_mid], lr_sum = s[i] - s[l_mid];
            if (ll_sum <= lr_sum) l_l = l_mid;
            else l_r = l_mid;
        }
        
        //cout << l_l << endl;
        
        ll p, q;
        ll ll_sum = s[l_l], lr_sum = s[i] - s[l_l];
        //cout << ll_sum << " " << lr_sum << endl;
        if (l_r != i && abs(lr_sum - ll_sum) > abs(s[i] - s[l_l + 1] - s[l_l + 1])) {
            q = s[i] - s[l_l + 1];
            p = s[l_l + 1];
        }
        else {
            p = ll_sum;  q = lr_sum;
        }
        
        int r_l = i + 1, r_r = n - 1;
        while (r_r - r_l > 1) {
            int r_mid = (r_l + r_r) / 2;
            ll rl_sum = s[r_mid] - s[i], rr_sum = s[n - 1] - s[r_mid];
            if (rl_sum <= rr_sum) r_l = r_mid;
            else r_r = r_mid;
        }
        
        ll r, ss;
        ll rl_sum = s[r_l] - s[i], rr_sum = s[n - 1] - s[r_l];
        if (r_r != n - 1 && abs(rr_sum - rl_sum) > abs(s[n - 1] - s[r_l + 1] - (s[r_l + 1] - s[i]))) {
            ss = s[n - 1] - s[r_l + 1];
            r = s[r_l + 1] - s[i];
        }
        else {
            r = rl_sum;  ss = rr_sum;
        }
        
        ans = min(ans, max({p, q, r, ss}) - min({p, q, r, ss}));
        
        //cout << p << " " << q << " " << r << " " << ss << endl;
    }
    
    cout << ans << endl;
    
}

/*
g++ -std=c++14 main.cpp
*/


Measured memory_bytes: 3328
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;

	getline(cin, s, '/');
	int year = stoi(s);

	getline(cin, s, '/');
	int month = stoi(s);

	getline(cin, s);
	int day = stoi(s);

	if(year > 2019) cout << "TBD\n";
	else if(year < 2019) cout << "Heisei\n";
	else
	{
		if(month > 4) cout << "TBD\n";
		else if(month < 4) cout << "Heisei\n";
		else
		{
			if(day > 30) cout << "TBD\n";
			else cout << "Heisei\n";
		}
	}
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right

def solve():
    N = int(input())
    Ls = list(map(int, input().split()))

    Ls.sort()

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            k = bisect_left(Ls, Ls[i]+Ls[j]) - 1
            ans += k-j

    print(ans)


solve()


Measured memory_bytes: 3188
def c_build_stairs(N, H):
    for i in range(N - 1, 0, -1):
        if H[i - 1] - H[i] >= 2:
            return 'No'
        elif H[i - 1] - H[i] == 1:
            H[i - 1] -= 1
    return 'Yes'

N = int(input())
H = [int(i) for i in input().split()]
print(c_build_stairs(N, H))

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


int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

int *convlist(int *o, int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) 
    {
        int count = 0;
        for( int j = 0; j < i; j++ )
        {
            if( o[j] < o[i] ) count++;
        }
        ans[i] = o[i] - count;
    }
    return ans;
}


long long getp(int i)
{
    long long ans = 1;
    for( int k = i; k > 1; k--) ans *= k;
    return ans;    
}

long long getNumber(int *a,int i)
{
    if( i == 0 ) return 0;
    return (*a - 1) * getp( i - 1 ) + getNumber( a + 1, i - 1);    
}

void showlist(int *a, int i)
{
    for( int k = 0; k < i; k++ ) cout << a[k] << ",";
    cout << endl;
}

int main()
{
    int n;
    int *oa, *ob;
    int *a, *b;
    cin >> n;
    oa = inputint(n);
    ob = inputint(n);

    a = convlist(oa, n);
    b = convlist(ob, n);

//    showlist(a, n);
//    showlist(b, n);

    long long numa = getNumber(a, n);
    long long numb = getNumber(b, n);
//    cout << numa << " " << numb << endl;

    cout << abs(numa - numb);
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    map<int,int> a;
    ll ans = 0;
    rep(i,n){
        int num; cin >> num;
        a[num]++;
    }
    debug(a[1],a[2],a[3]);
    for(P p : a){
        if(p.first <= p.second) ans+=p.second-p.first;
        else ans+=p.second;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
 #define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>PII;
typedef vector<PII>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= 1e19;
void solve(){
 string str;
 sl(str);
 if(str[2]==str[3] && str[4]==str[5]){
	 cout<<"Yes"<<endl;
	 return;
 }
 cout<<"No"<<endl;

		
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 256