akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

const int MOD = 1000000007;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void initComb() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}
long long comb(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main(){
  initComb();
  ll N, M, K;
  cin >> N >> M >> K;
  int sum = 0;
  rep(i, N)
    sum = (sum+i*(N-i)*M%MOD*M%MOD)%MOD; //2点間の縦方向の距離がiになる組合せの和(他の点は無視)
  rep(i, M)
    sum = (sum+i*(M-i)*N%MOD*N%MOD)%MOD; //2点間の横方向の距離がiになる組合せの和(他の点は無視)
  ll ans = sum*comb(N*M-2, K-2); //2点を固定する組合せは他の点のパターン分存在する
  ans %= MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12160
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = list(map(int, input().split()))
lb, ub = 0, 10**9
while ub - lb > 1:
    m = (lb + ub) // 2
    cnt = 0
    for i in range(N):
        cnt += (A[i] + m - 1) // m - 1
    if cnt <= K:
        ub = m
    else:
        lb = m
print(ub)

Measured memory_bytes: 91864
#include<iostream>

using namespace std;



int main(){
    int k;
    int data[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
    cin >> k; 
    cout << data[k-1] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
vector<vec> G(N,vec());
bool ans=false;
int dfs(int x,int p){
    int count=0;
    for(auto e:G[x]){
        if(e==p)continue;
        if(dfs(e,x)==0){
            count++;
        }
    }
    if(count>=2)ans=true;
    //cout<<x<<" "<<count<<endl;
    return count;
}
main(){
    int n=in();
    rep(i,n-1){
        int a=in(),b=in();
        G[a].pb(b);G[b].pb(a);
    }
    rep(i,100){
        int a=rand()%n+1;
        dfs(a,0);
    }
    cout<<(ans?"First":"Second");
    return 0;
}



Measured memory_bytes: 15232
import java.util.*;
public class Main {
	public static void main(String args[] ){
		Scanner sc =new Scanner(System.in);
		int n =sc.nextInt();
		int d =sc.nextInt();
		int count =0;
		int ans = 0;
		int aaa =n*d;
		int data[] =new int[aaa];
		for(int i=0;i<n*d;i++) {
			data[i] =sc.nextInt();
		}
		
			for(int i=0;i<n*d;i+=d) {
				
				for(int j=i+d;j<n*d;j+=d) {
					if(i==j)continue;
					//System.out.println("i"+i+"j"+j);
				int ccount =0;
				int tt =0;
				while(ccount<d) {
					for(int t=0;t<d;t++) {
					 tt += Math.pow(data[i+t]-data[j+t],2);
					 //System.out.println(data[i+t]);
					 //System.out.println(data[j+t]);
					//System.out.println(t+"t");
							ccount++;
					}
					double ttt =Math.sqrt(tt);
				    int intint = (int)ttt;
					if((ttt-intint)==0.0) {
								ans++;
					  }
				}
		
			}
			
			
						
		
	  }
			System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
using namespace std;
void sgs(string s);
long long int n;
int ans=0;
int main(){
  cin >> n;
  sgs("");
  cout<<ans<<endl;
}
void sgs(string s){
     int t=0;int f=0;int se=0;
     for(int i=0;i<s.size();i++){
       if(s[i]=='3') t++;
       if(s[i]=='5') f++;
       if(s[i]=='7') se++;
     }
     if(t>0&&f>0&&se>0&&stoll(s)<=n) ans++;//3,5,7でないものはないかつ数字の範囲もクリア
     if(s.size()==9) return;//範囲
     sgs('3'+s);
     sgs('5'+s);
     sgs('7'+s);
}


Measured memory_bytes: 256
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors
N = int(input())
a = make_divisors(N)
b = []
for i in range(len(a)):
  k = a[i]
  if k > N**0.5:
    if N//(k-1) == N%(k-1):
      b.append(k)
#print(a)
print(sum(b)-len(b))



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

int main() { 
    char c;
    cin >> c;

    if (c == 'a' || c== 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    }
    else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;cin>>N;
  vector<long>P(N),Q(N);
  for(int i=0;i<N;i++)cin>>P[i];
  for(int i=0;i<N;i++)cin>>Q[i];
  vector<long>v(N);
  for(int i=0;i<N;i++)v[i]=i+1;
  long X=-1,Y=-1;
  int c=1;
  do {
    bool a=true,b=true;
    for(int i=0;i<N;i++)if(P[i]!=v[i])a=false;
    for(int i=0;i<N;i++)if(Q[i]!=v[i])b=false;
    if(a)X=c;if(b)Y=c;
    c++;
  } while (std::next_permutation(v.begin(), v.end()));
  cout<<abs(Y-X);
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args){
		try {
			BufferedReader stdReader = new BufferedReader(new InputStreamReader(System.in));
			String line;
			while ((line = stdReader.readLine()) != null){
				int hour = Integer.parseInt(line)/(60*60);
				int minutes = (Integer.parseInt(line)%(60*60))/60;
				int second = (Integer.parseInt(line)%(60*60))%60;
				System.out.println(hour+":"+minutes+":"+second);
			}
		} catch (Exception e) {
			e.getStackTrace();
			System.exit(0);
		}
	}
}

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

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

    string s;
    cin >> s;

    int poj = -1;

    for(int i = 0; i < n; i++){
        if(s[i] == 'W'){
            poj = i;
            break;
        }
    }

    if(poj == -1){
        cout << 0 << endl;
    }else{
        int poj_2 = poj;
        for(int i = poj + 1; i < n; i++){
            if(s[i] == 'R'){
                poj_2 = i;
                break;
            }
        }

        if(poj == poj_2){
            cout << 0 << endl;
        }else{
            int k = n - 1;
            int ans = 0;
            while(1){
                if(k <= poj){
                    break;
                }

                if(s[k] == 'R'){
                    ans++;
                    poj++;
                    while(1){
                        if(poj >= k){
                            break;
                        }

                        if(s[poj] == 'W'){
                            break;
                        }

                        poj++;
                    }
                }
                k--;
            }

            cout << ans << endl;
        }
    }
    
}

Measured memory_bytes: 3720
#128_B
n=int(input())
sp=[]
for i in range(1,n+1):
    s,p=input().split()
    p=int(p)
    sp.append((s,p,i))
sp.sort(key=lambda x:(x[0],-x[1]))

for i in range(n):
    print(sp[i][2])

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main() {
    set<ll> s;
    ll q,x;
    ll n;
    cin>>n;
    rep(i,n){
        scanf("%lld %lld",&q,&x);
        if(q==1){
            fin(s.count(x));
        } else if(q==0){
            s.insert(x);
            fin(s.size());
        }
        else{
            s.erase((x));
        }
        
    }
    
}




Measured memory_bytes: 12516
#include<iostream> 
#include<string>
#include<algorithm>
using namespace std;
int A[100];
void output(int a[],int N) {
	cout << a[0];
	for (int i = 1; i < N; i++) {
		cout << " " << a[i];
	}
	cout << endl;
}
int main()
{
	int N,v,a;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	output(A, N);
	for (int i = 1; i < N; i++) {
		v = A[i];
		a = i - 1;
		while (a >= 0 && A[a] > v) {
			A[a+1] = A[a];
			a--;
		}
		A[a + 1] = v;
		output(A, N);
	}
	
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vvi a(2, vi(n, 0));
    vvi dp(2, vi(n, 0));

    rep(i, 2) rep(j, n){
        cin >> a[i][j];
        if(i == 0){
            if(j == 0) dp[i][j] = a[i][j];
            else dp[i][j] = a[i][j] + dp[i][j-1];
        }
        else{
            if(j == 0) dp[i][j] = a[i][j] + dp[i-1][j];
            else dp[i][j] = a[i][j] + max(dp[i-1][j], dp[i][j-1]);
        }
    }
    cout << dp[1][n-1] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define bang_bang ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define cases int t;cin>>t;while(t--)
#define pb push_back
#define ppb pop_back
#define mem(x,a) memset(x,a,sizeof(x));
#define ld long double
#define mp make_pair
#define limit 200005
#define inf 1e18
const int md = 998244353;

int movesx[3]={-1,0,1};
int movesy[3]={-1,0,1};

int moves[4][2]={{1,0},{-1,0},{0,1},{0,-1}};


bool cmp(int a,int b)
{
	return a>b;
}

int gcd(int a, int b){return b?gcd(b,a%b):a;}
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}
int power(int base,int exponent,int mod=inf)
{
    if(exponent==0)
        return 1;
    int temp=power(base,exponent/2,mod);
    temp=(temp*temp)%mod;
    if(exponent%2!=0)
    {
        temp=(temp*base)%mod;
        return temp;
    }
    return temp;
}

int ncr(int a,int b)
{
    int dp[b+1];
    mem(dp,0)
    dp[0]=1;
    for(int i=1;i<=a;i++)
        for(int j=min(i,b);j>0;j--)
            dp[j]=(dp[j]+dp[j-1])%md;
            //C(n,r)=C(n-1,r-1)+C(n-1,r)
    return dp[b];
}
int n,t;
int numLen(int K) 
{
    if (K % 2 == 0 || K % 5 == 0) 
        return -1; 
    int number = 0; 
    int len = 1; 
    for (len = 1; len <= K; len++) { 
        number = (number * 10 + 7) % K; 
        if (number == 0) 
            return len; 
    } 
  
    return -1; 
} 

signed main(){
    bang_bang
    //cases
    {
        int k;
        cin>>k;
        cout<<numLen(k)<<endl;
    }
    return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 100000
using namespace std;

struct place{
	int x,y;
};

int main(){
	int N;
	while(1){
		cin>>N;
		if(N==0)break;
		int n[N],p[N];
		loop(i,1,N)cin>>n[i]>>p[i];
		bool dt[401][401];
		rep(i,401)rep(j,401)dt[i][j]=false;
		dt[200][200]=true;
		place basyo[N];
		basyo[0].x=200;
		basyo[0].y=200;
		loop(i,1,N){
			int dirx,diry;
			if(p[i]==0){
				dirx=-1;
				diry=0;
			}else if(p[i]==1){
				dirx=0;
				diry=1;
			}else if(p[i]==2){
				dirx=1;
				diry=0;
			}else{
				dirx=0;
				diry=-1;
			}
			int nx=basyo[n[i]].x+dirx;
			int ny=basyo[n[i]].y+diry;
			dt[ny][nx]=true;
			basyo[i].x=nx;
			basyo[i].y=ny;
		}
		int minix,miniy,maxx,maxy;
		minix=miniy=maxx=maxy=INF;
		rep(i,401){
			rep(j,401){
				if(dt[i][j]){
					miniy=i;
					break;
				}
			}
			if(miniy!=INF)break;
		}
		rep(i,401){
			rep(j,401){
				if(dt[j][i]){
					minix=i;
					break;
				}
			}
			if(minix!=INF)break;
		}
		for(int i=400;i>=0;i--){
			for(int j=400;j>=0;j--){
				if(dt[i][j]){
					maxy=i;
					break;
				}
			}
			if(maxy!=INF)break;
		}
		for(int i=400;i>=0;i--){
			for(int j=400;j>=0;j--){
				if(dt[j][i]){
					maxx=i;
					break;
				}
			}
			if(maxx!=INF)break;
		}
		int ansx=maxx-minix+1;
		int ansy=maxy-miniy+1;
		cout<<ansx<<" "<<ansy<<endl;
	}
	return 0;
}

Measured memory_bytes: 1320
n = gets.chomp.to_i
d = gets.chomp.split(" ").map(&:to_i)
m = gets.chomp.to_i
t = gets.chomp.split(" ").map(&:to_i)
count = 1
hash = Hash.new(0)
d.each do |i| 
    hash[i] += 1
end
t.each do |j|
    hash[j] -= 1
    count -= 1 if hash[j] < 0
end

puts count == 1 ? "YES" : "NO"

Measured memory_bytes: 54816
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

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

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	long long  n, m; cin >> n >> m;
	long long  s = 0;

	for (long long  i = 1; i <= m; i++) {
		long long  a; cin >> a;
		s += a;
	}

	cout << max(-1ll, n - s);

	return 0;
}

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		String[] flds = readFlds();
		String x = flds[0];
		String y = flds[1];
		if (x.equals(y))
			pln("=");
		else if (x.compareTo(y) < 0)
			pln("<");
		else
			pln(">");
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 22740
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();
		char[] sArray = s.toCharArray();
		int[] L = new int[26];
		int[] R = new int[26];

		int countMax = 0;

		//LR配列の初期化
		L[sArray[0]-'a']=1;
		for(int i=1;i<n;i++) {
			R[sArray[i]-'a']=R[sArray[i]-'a']+1;
		}

		for(int i=1;i<n;i++) {
			//LR配列の更新
			L[sArray[i]-'a']=L[sArray[i]-'a']+1;
			R[sArray[i]-'a']=R[sArray[i]-'a']-1;

			//種類数カウント,更新
			int count=0;
			for(int j=0;j<L.length;j++) {
				if(L[j] !=0 && R[j] !=0) count++;
			}
			if (countMax < count) {
				countMax = count;
			}
		}
		System.out.println(countMax);
	}
}


Measured memory_bytes: 23636
<?php

$point_tarou = 0;
$point_hanako = 0;

$num_cords = trim(fgets(STDIN));
do {
  $input = trim(fgets(STDIN));
  List($tarou, $hanako) = explode(" ", $input);

  $cmp = strcmp($tarou, $hanako);
  if ($cmp === 0) {
    $point_tarou++;
    $point_hanako++;
  } elseif ($cmp < 0 ) {
    $point_hanako += 3;
  } else {
    $point_tarou += 3;
  }

  $num_cords--;
} while ($num_cords > 0);

echo "${point_tarou} ${point_hanako}" . PHP_EOL;

Measured memory_bytes: 15392
#include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>

using namespace std;

//#define DEB

#ifdef DEB
ifstream ifs("input.txt");
ofstream ofs("output.txt");
#define cin ifs
#define cout ofs
#endif

int main(){

	int n,m,k;
	while(cin>>n>>k>>m&&!(n==0&&m==0&&k==0)){
		vector<int> stones(n);
		for(int i = 0; i < n; i++)
			stones[i]=(i+1);
		// ÅÉÁ·
		int cur=(m-1)%n;
		stones.erase(stones.begin()+cur);
		// ±±©çÍkÂ¨«É»êéàÌðÁµÄ­
		cur=cur%stones.size();
		while(1){
			if(stones.size()==1)
				break;
			cur+=(k-1);
			cur%=stones.size();
			stones.erase(stones.begin()+cur);
		}
		cout<<stones[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ull = unsigned long long;

int main() {
	ull N, K;
	cin >> N >> K;
	
	vector<uint> p(N);
	
	for(uint i=0; i<N; i++) {
		cin >> p[i];
	}
	
	uint tsum = accumulate(p.begin(), p.begin() + K, uint(0));
	uint maxc = tsum;
	uint maxi = 0;
	
	for(uint i=1; i<=N-K; i++) {
		tsum = tsum - p[i-1] + p[i+K-1];
		if(tsum > maxc) {
			maxc = tsum;
			maxi = i;
		}
	}

	//cout << maxi << " " << maxc << endl;
	
	double ans = 0;
	for(uint i=0; i<K; i++) {
		ans += (double)(p[i + maxi] + 1) / 2;
	}

	cout << setprecision(9) << ans;
	
	return 0;
}


Measured memory_bytes: 1024
import bisect

N = int(input())
A = list(map(int,input().split()))
A.sort()
if N == 2:
  print(A[1]-A[0])
  print(A[1],A[0])
  exit()
i0 = bisect.bisect_left(A,0)
if i0 >= N-1:
  print(-sum(A[:N-1])+A[N-1])
  a = A[N-1]
  for i in range(N-1):
    print(a,A[i])
    a = a-A[i]
elif i0 <= 1:
  print(-A[0]+sum(A[1:]))
  a = A[0]
  for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
else:
  print(-sum(A[:i0])+sum(A[i0:]))
  a = A[i0-1]
  for i in range(i0,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
  a = A[N-1]-a
  for i in range(i0-1):
    print(a,A[i])
    a = a-A[i]


Measured memory_bytes: 61196
#include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> G;
vector<int> du, dv;
void dfsu(int s, int d){
    du[s] = d;
    for(int i: G[s]){
        if(du[i] == -1) dfsu(i, d + 1);
    }
}
void dfsv(int s, int d){
    dv[s] = d;
    for(int i: G[s]){
        if(dv[i] == -1) dfsv(i, d + 1);
    }
}
int main(){
    int N, u, v;
    cin >> N >> u >> v;
    u--;
    v--;
    G.resize(N);
    du.resize(N, -1);
    dv.resize(N, -1);
    for(int i = 0; i < N - 1; i++){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfsu(u, 0);
    dfsv(v, 0);
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(du[i] < dv[i]) {
            ans = max(ans, dv[i] - 1);
        }
    }
    cout << ans << endl;
}

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

int main(){
    int64_t a, b, k;
    string ans ="NG";
  
    cin >> k >> a >> b;

    if( a % k == 0 || b % k == 0) ans = "OK";
    if( a / k != b / k) ans = "OK";
    cout <<  ans  << endl;
}

Measured memory_bytes: 3636
local a,v=io.read("n","n")
local b,w=io.read("n","n")
local t=io.read("n")

if a<b then
    if a+v*t>=b+w*t then
        print("YES")
    else
        print("NO")
    end
else
    if a-v*t<=b-w*t then
        print("YES")
    else
        print("NO")
    end
end

Measured memory_bytes: 2680
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://atcoder.jp/contests/caddi2018b/tasks/caddi2018b_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    res = count(S.begin(),S.end(),'2');
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
int main(){
    int n;
    cin >> n;
    int a=1;
    int t,q;
    cin >> t;
    int ans=0;
    rep(i,n-1){
        cin >> q;
        if (t==q) a++;
        else {
            ans+=a/2;
            a=1;
        }
        t=q;
    }
    ans+=a/2;
            a=0;
            cout << ans << endl;
}

Measured memory_bytes: 256
use strict;
use warnings;

my ($a, $b);
{
  my $in = <STDIN>;
  ($a, $b) = split(" ", $in);
}
my $ans = -1;
for (my $i=0; $i<1001; $i++) {
  if (int($i * 0.08) == $a && int($i * 0.1) == $b) {
    $ans = $i;
    last;
  }
}

print "$ans\n";

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

  vector<pair<int, int>> P(n);
  for (int i = 0; i < n; i++) {
    P.at(i) = make_pair(i, A.at(i));
  }

  sort(P.begin(), P.end(),
       [](auto x, auto y) -> bool { return x.second < y.second; });

  for (int i = 0; i < n; i++) {
    if (i == n - 1) {
      cout << P.at(i).first + 1 << endl;
    } else {
      cout << P.at(i).first + 1 << " ";
    }
  }
}


Measured memory_bytes: 2048
r=lambda x:x*(u[x]<0)or r(u[x])
n,m,*t=map(int,open(0).read().split())
u=[-1]*-~n
for x,y in zip(t[::3],t[1::3]):
 x,y=sorted((r(x),r(y)))
 if x!=y:u[x]+=u[y];u[y]=x
print(sum(i<0for i in u)-1)

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

int main()
{
	double a, b;
	int i;
	vector<int> v1(4), v2(4);
	while (cin>>a>>b) {
		v1[(a>=1.1)+(a>=0.6)+(a>=0.2)]++;
		v2[(b>=1.1)+(b>=0.6)+(b>=0.2)]++;
	}
	for (i = 3; i >= 0; i--) cout<<v1[i]<<" "<<v2[i]<<endl;

	return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <memory.h>
#include <set>
#include <ctime>
#include <map>
#include <cstring>
#include <iterator>
#include <queue>
#include <assert.h>
#include <bitset>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <functional>

//#pragma comment(linker, "/STACK:512000000")

using namespace std;

#define pb emplace_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define forab(i, a, b) for (int i = (a); i < (b); ++i)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int infi = 1e9 + 7;
const ll infl = (ll)1e18 + (ll)7;

int cnt[30];

int32_t main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    //srand(time(NULL));
   // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    //freopen("customs.in", "r", stdin); freopen("customs.out", "w", stdout);
    int n, a, b;
    cin >> n >> a >> b;
    --a, --b;
    int qq = 0;
    int ww = 0;
    int ee = 0;

    forn(i, n) {
        int q;
        cin >> q;
        --q;
        cnt[q]++;
        if (q > b)
            ++qq;
        else if (q > a)
            ++ww;
        else
            ++ee;
    }
    int ans = min(qq, min(ww, ee));
    cout << ans << '\n';
    

    return 0;
}

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

using namespace std;

#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}

#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define int long long

int n;
int a[100005];

signed main()
{
	IOS;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	bool yes = true;
	for (int i = 0; i < n-1; i++) {
		if (a[i] > a[i+1]) a[i+1]++;
		if (a[i] > a[i+1]) yes = false;
	}
	(yes)?cout << "Yes\n":cout << "No\n";
	return 0;
}



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

int partition(vector<int> &A, int p, int r) {
    int x = A.at(r);
    int i = p - 1;
    for (int j = p; j < r; ++j) {
        if (A.at(j) <= x) {
            ++i;
            swap(A.at(i), A.at(j));
        }
    }
    swap(A.at(i + 1), A.at(r));
    return i + 1;
}

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

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A.at(i);
    }
    int q = partition(A, 0, n - 1);
    for (int i = 0; i < n; ++i) {
        if (i) cout << ' ';
        if (i == q) cout << '[';
        cout << A.at(i);
        if (i == q) cout << ']';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

	ll h, w;
	cin >> h >> w;

	vvll a(h, vll(w));
	REP(i, h){
		REP(j, w) cin >> a[i][j];
	}
	vector<P> cur, dst;
	REP(i, h){
		REP(j, w - 1){
			if(a[i][j] % 2){
				cur.push_back(P{i + 1, j + 1});
				dst.push_back(P{i + 1, j + 2});
				a[i][j + 1]++;
			}
		}
	}
	REP(i, h - 1){
		if(a[i][w - 1] % 2){
			cur.push_back(P{i + 1, w});
			dst.push_back(P{i + 2, w});
			a[i + 1][w - 1]++;
		}
	}
	ll n = cur.size();
	cout << n << endl;
	REP(i, n){
		cout << cur[i].first << " " << cur[i].second << " ";
		cout << dst[i].first << " " << dst[i].second << endl;
	}
    return 0;
}

Measured memory_bytes: 9784
#include <bits/stdc++.h>
#define ll long long
#define file(s) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
using namespace std;
const int N = 3e3 + 7, mod = 1e9 + 7;

#define inc(i, x, y) for (int i = x; i <= y; ++i)
#define dec(i, x, y) for (int i = x; i >= y; --i)
#define gc getchar

bool chkmin(int &x, int y) { return x > y ? x = y, 1 : 0; }
bool chkmax(int &x, int y) { return x < y ? x = y, 1 : 0; }

int rd() {
	int ret = 0; bool fl = 0; char ch = 0;
	while (!isdigit(ch)) fl |= (ch == '-'), ch = gc();
	while (isdigit(ch)) ret = (ret << 1) + (ret << 3) + (ch ^ 48), ch = gc();
	return fl ? -ret : ret;
}

int a[N];
ll ans, dp[N][N];

ll add(ll x, ll y) { return x + y > mod ? x - mod + y : x + y; }

ll qpow(ll x, int y) {
	ll ret = 1ll;
	for (; y; y >>= 1, x = 1ll * x * x % mod) if (y & 1) ret = 1ll * ret * x % mod;
	return ret;
}

int main() {
	int n = rd(), q = rd();
	ll sum = qpow(2, q), inv2 = qpow(2, mod - 2);
	inc(i, 1, n) a[i] = rd();
	inc(i, 1, n) inc(j, 1, n) dp[i][j] = (a[i] < a[j] ? sum : 0);
	while (q--) {
		int x = rd(), y = rd();
		dp[x][y] = dp[y][x] = 1ll * add(dp[x][y], dp[y][x]) * inv2 % mod;
		inc(j, 1, n) {
			if ((j == x) || (j == y)) continue;
			dp[x][j] = dp[y][j] = 1ll * add(dp[x][j], dp[y][j]) * inv2 % mod;
			dp[j][y] = dp[j][x] = 1ll * add(dp[j][y], dp[j][x]) * inv2 % mod;
		}
	}
	inc(i, 2, n) dec(j, i - 1, 1) ans = add(ans, dp[i][j]);
	printf("%lld\n", ans);
}

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

int main(){
    int n;
    cin >> n;
    int a[100];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    bool flag=1;
    int count=0;
    while(flag){
        flag=0;
        for(int j=n-1;j>0;j--){
            if(a[j]<a[j-1]){
               swap(a[j],a[j-1]);
            flag=1;
            count++;
            }
        }
    }
    for(int i=0;i<n;i++){
        if(i!=n-1)cout<<a[i]<<" ";
        else cout<<a[i];
    }
    cout<<endl;
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define data_type long long

int main()
{
    string str;
    int ch=1;
    int q,x,a;
    char b;
    cin>>str;
    list<char> str1;
    for(auto i:str)
        str1.push_back(i);
    cin>>q;
       while(q--)
        {
            cin>>x;
            if(x==1)
                ch^=1;
            else
                {
                    cin>>a>>b;
                    if(ch==1 && a==1)
                        str1.push_front(b);
                    else if(ch==0 && a==1)
                        str1.push_back(b);
                    else if(ch==1 && a==2)
                        str1.push_back(b);
                    else
                        str1.push_front(b);
                }

        }
    if(ch==0)
      reverse(str1.begin(),str1.end());
    for(auto i:str1)
        cout<<i;



    return 0;
}



Measured memory_bytes: 9984
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

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


	vector<int> c, d;
	rep(i, m) {
		rep(j, b[i]) {
			if(i & 1) {
				c.push_back(1);
				d.push_back(0);
			} else {
				c.push_back(0);
				d.push_back(1);
			}
		}
	}

	int ans = INF, res = 0;
	vector<int> t(a.begin(), a.end());
	rep(i, n) {
		if(t[i] == c[i]) continue;

		REP(j, i+1, n) {
			if(c[i] == t[j]) {
				for(int k = j; k-1 >= i; k--) {
					swap(t[k], t[k-1]);
					res++;
				}
				break;
			}
		}
	}

	bool flag = true;
	rep(i, n) {
		if(t[i] == c[i]) continue;
		flag = false;
	}

	if(flag) {
		ans = min(ans, res);
	}

	res = 0;
	rep(i, n) t[i] = a[i];

	rep(i, n) {
		if(t[i] == d[i]) continue;

		REP(j, i+1, n) {
			if(d[i] == t[j]) {
				for(int k = j; k-1 >= i; k--) {
					swap(t[k], t[k-1]);
					res++;
				}
				break;
			}

		}
	}

	flag = true;
	rep(i, n) {
		if(t[i] == d[i]) continue;
		flag = false;
	}

	if(flag) {
		ans = min(ans, res);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1220
from collections import deque


N, M = map(int, input().split())
to = [[] for _ in range(N)]
bridge = []

for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    to[a].append(b)
    to[b].append(a)
    bridge.append(set([a, b]))


def main():
    ans = 0

    for b in bridge:
        seen = [0] * N
        seen[0] = 1
        
        # BFS
        que = deque([0])
        while que:
            v = que.popleft()
            for nv in to[v]:
                if set([v, nv]) == b:
                    continue
                if not seen[nv]:
                    seen[nv] = 1
                    que.append(nv)

        if seen != [1] * N:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 68032
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
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(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<string> s(n);
	rep(i,n) cin >> s[i];
	int ans = 0;
	rep(k,n){
		bool ok = true;
		rep(i,n){
			for(int j = i+1; j < n; ++j){
				if(s[i][(j+k)%n] != s[j][(i+k)%n]) ok = false;
			}
		}
		if(ok) ans += n;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3692
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
cost = abs(a[0]) + abs(a[-1])
for i in range(n-1):
    cost += abs(a[i] - a[i+1])
a = [0] + a + [0]

for i in range(n+2):
    if i == 0 or i == n+1: continue
    if a[i-1] < a[i] < a[i+1] or a[i-1] > a[i] > a[i+1]:
        print(cost)
    else:
        m = abs(a[i-1] - a[i]) + abs(a[i] - a[i+1])
        p = abs(a[i-1] - a[i+1])
        print(cost - m + p)


Measured memory_bytes: 92136
import math

N = int(input())
x = [None]*N
y = [None]*N
for i in range(N):
    x[i], y[i] = [int(j) for j in input().split(' ')]

def distance(x1, y1, x2, y2):
    return math.sqrt((x1-x2)**2+(y1-y2)**2)


def a(j, N):
    s = 0
    if len(j)==N:
        for i in range(len(j)-1):
            s+=distance(x[j[i]], y[j[i]], x[j[i+1]], y[j[i+1]])
        return s
    for i in range(N):
        j2 = j[:]
        if i in j2:
            continue
        j2.append(i)
        s += a(j2, N)
    return s

print(a([], N)/math.factorial(N))

Measured memory_bytes: 3064
/*
    AUTHOR:shivam51
    IIESTS
*/
  #include<bits/stdc++.h>
  using namespace std;
  //
  #define MAX 10000
  #define md 1000000007
  #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);
  //
  //
  int dx[]={0,0,1,-1};
  int dy[]={1,-1,0,0};
	    int main(){
	    	hs
	  		ll h,w;	cin>>h>>w;;;;
	  		char arr[h][w];
	  		int store[h][w];
	  		queue<pair<int,int>> q;
	  		rep(i,0,h)
	  			rep(j,0,w){
	  				cin>>arr[i][j];
	  				store[i][j]=-1;
	  				if(arr[i][j]=='#'){
	  					store[i][j]=0;
	  					q.push(mp(i,j));
	  				}
	  			}
	  		ll ans=0;
	  		while(!q.empty()){
	  			ll x=q.front().ff;
	  			ll y=q.front().ss;
	  			q.pop();
	  			// ans=store[x][y];

	  			rep(i,0,4){
	  				ll xx=x+dx[i];
	  				ll yy=y+dy[i];
	  				if(store[xx][yy]!=-1||xx<0||xx>=h||yy<0||yy>=w)
	  					continue;
	  				store[xx][yy]=store[x][y]+1;
	  				ans=store[x][y]+1;
	  				q.push(mp(xx,yy));
	  			}
	  		}	/*
	  		rep(i,0,h){
	  			rep(j,0,w)
	  				cout<<store[i][j];
	  			cout<<'\n';
	  		}*/
	  		cout<<ans;
	  		return 0;
	  }

Measured memory_bytes: 13328
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    int num[100005]={};
    REP(i,n){
        int keep=i+1;
        while(keep<k){
            keep*=2;
            num[i]++;
        }
    }
    int rui[20]={};
    REP(i,n)rui[num[i]]++;
    double ans=0;
    REP(i,20){
        ans+=pow(0.5,i)*rui[i];
    }
    ans/=n;
    printf("%.10lf\n",ans);
    return 0;
}

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

vector<pair<string, bool> > Parse_String(string &S) {
    vector<pair<string, bool> > res;
    bool flg = false;
    for(int i = 0; i < S.size(); ) {
        int j = i;                  // [i, j)
        while(j < S.size() && S[j] != '"') ++j;
        res.push_back(pair<string, bool>(S.substr(i,j-i), flg));
        flg = !flg;
        i = j + 1;
    }
    return res;
}

bool solve() {
    string S1;
    cin >> S1;
    if(S1 == ".") return false;
    string S2;
    cin >> S2;

    vector<pair<string, bool> > List1, List2;
    List1 = Parse_String(S1);
    List2 = Parse_String(S2);
    /*
    cout << "S1: "<< endl;
    for(int i = 0; i < List1.size(); ++i) {
        cout << List1[i].first << " " << List1[i].second << endl;;
    }

    cout<< "S2: " << endl;
    for(int i = 0; i < List2.size(); ++i) {
        cout << List2[i].first << " " << List2[i].second << endl;;
    }
    */

    if(List1.size() != List2.size()) {
        cout << "DIFFERENT" << endl;
        return true;
    }

    int N = List1.size();
    int res = 0;
    for(int i = 0; i < N; ++i) {
        auto &p1 = List1[i];
        auto &p2 = List2[i];
        if(p1.second) 
        {
            if(p1.first != p2.first) ++res;
        }
        else 
        {
            if(p1.first != p2.first) {
                cout << "DIFFERENT" << endl;
                return true;
            }
        }
    }
    if(res <= 0) { cout << "IDENTICAL" << endl; }
    else if(res == 1) { cout << "CLOSE" << endl; }
    else { cout << "DIFFERENT" << endl; }
    return true;
}

int main() {
    while(solve());
    return 0;
}


Measured memory_bytes: 3224
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S =sc.nextLine();
        
        String spt[]=S.split(",");
        
        for(int i=0;i<spt.length;i++){
            System.out.print(spt[i]+" ");
        }
        
   }
}


Measured memory_bytes: 38468
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;
int main(){
	int i,j,W,H,count=0;
	char c;
	cin>>W>>H>>c;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(i==0||i==H-1){
				if(j==0||j==W-1){
					cout<<'+';
					count++;
				}else{
					cout<<'-';
					count++;
				}
			}else{
				if(j==0||j==W-1){
					cout<<'|';
					count++;
				}else{
					if(count==(W*H)/2){
						cout<<c;
						count++;
					}else{
						cout<<'.';
						count++;
					}
				}
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>


ll powmod(ll a, ll b) {
	a %= MOD;
	ll res = 1;
	while (b > 0) {
		if (b % 2 == 1)res = res * a % MOD;
		a = a * a % MOD;
		b /= 2;
	}
	return res;
}

ll f[210000];
void cominit() {
	f[0] = 1;
	REP(i, 200000)f[i + 1] = f[i] * (i + 1) % MOD;
}

ll com(ll n, ll r) {
	if (n < r)return 0;
	return f[n] * powmod(f[r] * f[n - r], MOD - 2) % MOD;
}

ll perm(ll n, ll r) {
	return f[n] * powmod(f[n - r], MOD - 2) % MOD;
}

ll n, s[110000], cnt[110000], m, l = -1, r;
int main() {
	cominit();
	cin >> n;
	REP(i, n + 1) {
		cin >> s[i];
		cnt[s[i]]++;
		if (cnt[s[i]] == 2)m = s[i];
	}
	REP(i, n + 1) {
		if (s[i] == m) {
			if (l == -1)l = i;
			else r = i;
		}
	}
	REPO(i, n + 1) {
		ll ans = com(n + 1, i);
		ans -= com(l + n - r, i - 1);
		ans = (ans + MOD * 10) % MOD;
		cout << ans << endl;
	}
}
	


Measured memory_bytes: 4352
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    string s, t; cin >> s >> t;
    char s_min = '{'; char s_max = '`';
    char t_min = '{'; char t_max = '`';
    for(auto c:s){if(c < s_min){s_min = c;}; if(c > s_max){s_max = c;}}
    for(auto c:t){if(c < t_min){t_min = c;}; if(c > t_max){t_max = c;}}

    if (s_min < t_max) {
        cout << "Yes" << endl;
    } else if ((s_min == t_min) && (s_max == t_max)) {
        if (s.size() < t.size()) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256