akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

string s;

bool isvalid(string t) {
    bool used[30] = {};
    rep(i,0,t.length()) {
        int v = t[i] - 'a';
        if(used[v]) continue;
        used[v] = true;
        if(v != 0) t[i]--;
    }
    return s == t;
}

void solve(int p, string &cur, set<string> &st) {
    if(p == s.length()) {
        if(isvalid(cur)) st.insert(cur);
    }
    else {
        cur += s[p];
        solve(p+1, cur, st);
        cur.pop_back();
        if(s[p] != 'z') {
            cur += (char)(s[p] + 1);
            solve(p+1, cur, st);
            cur.pop_back();
        }
    }
}

signed main() {
    while(cin >> s) {
        if(s == "#") break;
        set<string> st;
        string cur = "";
        solve(0, cur, st);
        auto it = st.begin();
        int n = st.size();
        cout << n << endl;
        if(n <= 10) for(auto x : st) cout << x << endl;
        else {
            rep(i,0,5) cout << *it << endl, it++;
            it = st.end();
            rep(i,0,5) it--;
            rep(i,0,5) cout << *it << endl, it++;
        }
    }
    return 0;
}

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

int N,n;
P p[300000],dat[1200000];
void init(int n){
	N=1;while(N<n)N<<=1;
	fill(dat,dat+2*N-1,P(0,0));
}
void update(int k,int x){
	k+=N-1;dat[k]={x,k-N+1};
	while(k>0){
		k=(k-1)/2;
		dat[k]=max(dat[k*2+1],dat[k*2+2]);
	}
}
bool ok(int t){
	init(t);
	ll s=0,sum=0;
	for(int i=n-1;i>=n-t+1;i--)update(s++,p[i].second),sum+=p[i].second;
	if(p[n-t].first*(ll)t>=(ll)sum+p[n-t].second)return 1;
	for(int i=n-t;i>0;i--){
		if(dat[0].first>p[i].second)sum-=dat[0].first-p[i].second,update(dat[0].second,p[i].second);
		if(p[i-1].first*(ll)t>=(ll)sum+p[i-1].second)return 1;
	}
	return 0;
}
int main() {
	scanf("%d",&n);
	rep(i,n){
		int a,b;scanf("%d%d",&a,&b);
		p[i]={b,a};
	}
	sort(p,p+n);
	int a=0,b=n;
	while(a!=b){
		int t=(a+b)/2;
		if(b-a==1)t=b;
		if(ok(t))a=t;
		else b=t-1;
	}
	printf("%d\n",a);
}

Measured memory_bytes: 13736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
string s;cin>>s;
bool t=true;
sort(s.begin(),s.end());
for(int i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1])t=false;
}
if(t)cout<<"yes"<<endl;
else cout<<"no"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main() {

    int cnt = 0, i, n;
    scanf("%d", &n);
    int ar[n];
    for(i=0; i<n; i++) {
        scanf("%d", &ar[i]);
    }
    for(i=0; i<n; i++) {
        if(ar[i] != (i+1)) cnt++;
    }
    printf(cnt == 0 || cnt == 2 ? "YES" : "NO");
}




Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(){
 
  int n,m,x;
  int a[100];
  cin>>n>>m>>x;
  for(int i=0;i<m;++i){
    cin>>a[i];
  }
  int l=0,r=0;
  for(int i=0;i<m;++i){
	if(a[i]<x)++l;
	else ++r;
  }
  if(l<r)cout<<l<<endl;
  else cout<<r<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n = int(read())
ans = 0
if n % 2 == 1:
    pass
else:
    cnt = 0
    acc = 5
    while acc <= n:
        cnt += (n // acc) // 2
        acc *= 5
    ans = cnt

print(ans)


Measured memory_bytes: 2940
mod = (10 ** 9 + 7)

def comb(n, r):
    p, q = 1, 1

    for i in range(r):
        p = p *(n-i)%mod
        q = q *(i+1)%mod
    
    return p * pow(q, mod-2, mod) % mod


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

s = pow(2, n, mod) - 1

print((s - comb(n, a) - comb(n, b)) % mod)

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

int main()
{
    string str;
    string target = "keyence";
    cin >> str;
    if(str == target) {
        cout << "YES" << endl;
        return 0;
    }
    int n = str.size();
    for(int i = 0; i < n; ++i) {
        for(int j = i; j < n; ++j) {
            //delete[i, j]
            string S = "";
            for(int k = 0; k < n; ++k) {
                if(i <= k && k <= j) continue;
                else S.push_back(str[k]);
            }
            if(S == target) {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx,avx2")
#pragma GCC optimize ("trapv")
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,a,b) for(lli i = (lli)(a); i < (lli)(b);i++)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define wis cout<<endl<<"I already speak english, bitch"<<endl;
 
typedef long long int lli;
typedef vector<lli> vi;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef pair<ii,lli> iii;
typedef long double C;
 
#define trace(args...) { string  _s =#args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
 
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args){
    cerr <<  *it  << " : " << a << endl;
    err(++it, args...);
}


int main(){
	fastio;
	string s; int n, k; cin>>n>>k>>s;
	map<char,char> m;
	for(char i='a',j='A';i<='z';i++,j++) m[i]=i,m[j]=i;
	rep(i,0,sz(s)){
		if(i==k-1) cout<<m[s[i]];
		else cout<<s[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll  INFL = 1e18;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N; cin >> N;
    vector<vs> s(11);
    s[1].push_back("a");
    s[2].push_back("aa");
    s[2].push_back("ab");
    for(int i = 3; i <= 10; i++)
    {
        REP(j, s[i-1].size())
        {
            vb used(10, false);
            REP(k, i-1) used[s[i-1][j][k]-'a'] = true;
            int c = 1;
            REP(k, 10) if(used[k]) c++;
            REP(k, c)
            {
                s[i].push_back(s[i-1][j]+char('a'+k));
            }
        }
    }
    sort(ALL(s[N]));
    REP(i, s[N].size()) cout << s[N][i] << endl;
}

Measured memory_bytes: 11508
#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) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#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 lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T 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 num = 0;
	int ans = 0;
	rep(i, 3){
		if(s[i] == 'R') num++;
		else{
			ans = max(ans, num);
			num = 0;
		}
	}
	ans = max(ans, num);
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define int long long
#define N 100010
#define M 1010
using namespace std;
int a[M][M],vis[N],p[N],ptot;
void init(){
	vis[1]=1;
	int i=2;
	while (true){
		if (!vis[i]) p[++ptot]=i;
		if (ptot==1000) break;
		for (int j=1;j<=ptot && (i*p[j]<=10000);++j){
			vis[i*p[j]]=1;
			if (!(i%p[j])) break;
		}
		i++;
	}
}
int lcm(int x,int y){
	if (x==0 || y==0) return x+y;
	return x/__gcd(x,y)*y;
}
signed main(){
	init();
	int n;cin>>n;
	if (n==2){
		printf("4 7\n23 10\n");return 0;
	}
	for (int i=1;i<=n;++i){
		for (int j=1;j<=n;++j){
			if (!((i+j)&1)) a[i][j]=p[(i+j)/2]*p[n+(i-j)/2+(n+1)/2];
		}
	}
	for (int i=1;i<=n;++i){
		for (int j=1;j<=n;++j){
			if (!a[i][j]) a[i][j]=lcm(lcm(a[i-1][j],a[i][j-1]),lcm(a[i][j+1],a[i+1][j]))+1;
		}
	}
	for (int i=1;i<=n;++i){
		for (int j=1;j<=n;++j){
			printf("%lld ",a[i][j]);
		} 
		putchar('\n');
	}
	return 0;
}

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

using namespace std;

int n, w, tot, ans;
const int N = 109, V = 1e5 + 9;
long long a[N][2], dp[N][V];

long long sol(int i, int v){ // returns the tot_weight
    if(!v) return 0;
    if(v<0 || i==n) return 1E9;

    long long &ret = dp[i][v];
    if(~ret) return ret;

    return ret = min(a[i][0]+sol(i+1, v-a[i][1]), sol(i+1, v));
}

int main(){
    cin >> n >> w;
    for(int i=0; i<n; i++)
        cin >> a[i][0] >> a[i][1], tot += a[i][1];

    memset(dp, -1, sizeof dp);
    for(int i=0; i<=tot; i++)
        if(sol(0, i) <= w) ans = i;

    cout << ans;
}


Measured memory_bytes: 85504
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main() {
	int R[MAX], n;
	
	cin>>n;
	for (int i = 0; i < n; i++) cin>>R[i];
	
	int maxv = 	-999999999;
	int minv = R[0];
	
	for (int i = 1; i < n; i++){
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}	
	
	cout<<maxv<<endl;
	
	return 0;
}

Measured memory_bytes: 3868
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<set>
#include<cstdlib>
#include<deque>
#include<queue>
#include<bitset>
#include<functional>
#include<utility>
#include<list>
#include<iomanip>
#include<ctime>
#include<cassert>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
const int INF=1e9+1;
int cnt[10005],t=1,a[105][105],ans[10005];
int main()
{
	int n,m;
	cin>>n>>m;
	int k;
	cin>>k;
	for(int i=1;i<=k;i++) cin>>cnt[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(i%2==0) a[i][j]=i*m+j+1;
			else a[i][j]=(i+1)*m-j;
			//cout<<a[i][j]<<" ";
		}
		//cout<<endl;
	}
	for(int i=1;i<=n*m;i++)
	{
		ans[i]=t;
		cnt[t]--;
		if(cnt[t]==0) t++;
	}
	//for(int i=1;i<=n*m;i++) cout<<ans[i]<<" ";
	//cout<<endl;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cout<<ans[a[i][j]]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
int d,n;
int main()
{
    while (scanf("%d%d",&d,&n)!=EOF)
    {
        int t=1;
        for (int i=0;i<d;i++) t=t*100;
        if (d==0 && n==100) puts("101");
        else if (d==1 && n==100) puts("10100");
        else if (d==2 && n==100) puts("1010000");
        else printf("%d\n",t*n);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

int main() {
    int64_t N, K, now = 0, ans = 0;
    cin >> N >> K;
    vector<int64_t> A(N);
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
        A.at(i)++;
    }
    for (int i = 0; i < K; i++){
        now += A.at(i);
    }
    ans = now;
    for (int i = K; i < N; i++){
        now += A.at(i);
        now -= A.at(i - K);
        ans = max(ans, now);
    }
    cout << setprecision(10) << fixed << (double(ans) / 2) << endl;
}


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


int main() {
  int x;
  cin >> x;
  if (x == 7 || x == 5 || x == 3) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
// 入力
fscanf(STDIN,"%s",$str_t);

$len       = strlen($str_t);
$last_char = "";
$str_new   = "";

for($i=0; $i < $len; $i++){
    // 処理文字取得
    $wk_char = substr($str_t,$i,1);
    if($wk_char == "?"){

        // 一文字後の文字を取得
        $next_char = "";
        if( ($i+1) < $len){
            $next_char = substr($str_t,($i+1),1);
        }
        $wk_char = set_q($last_char,$next_char);
    }
    
    // 生成文字列
    $str_new .= $wk_char;
    
    // 1文字前の文字として記録
    $last_char = $wk_char;
}

echo $str_new;

function set_q($str_pre,$str_sur){
    // 前の文字がPであれば「D」をセット
    if($str_pre == "P"){
        return "D";
    }
    // 前の文字がDか無
    else{
        // 後の文字がPであれば「D」をセット
        if($str_sur == "P"){
            return "D";
        }else
        // 後の文字がDであれば「P」をセット
        if($str_sur == "D"){
            return "P";
        }else
        // 後の文字が?であれば「D」をセット
        if($str_sur == "?"){
            return "D";
        }
        // 後の文字が空であれば「D」をセット
        else{
            return "D";
        }
    }
}


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

vector<vector<bool> > used,edge;

void bfs(int at){
    for(int i=0;i<26;i++){
        if(edge[at][i]&&!used[at][i]){
            used[at][i]=true;
            bfs(i);
        }
    }
}

int main(){
    int n;
    for(;;){
        cin>>n;
        if(n==0) break;
        vector<int> ins(26,0),outs(26,0);
        string in;
        edge=vector<vector<bool> >(26,vector<bool>(26,false));
        used=vector<vector<bool> >(26,vector<bool>(26,false));
        int fr;
        for(int i=0;i<n;i++){
            cin>>in;
            int from=in[0]-'a',to=in[in.size()-1]-'a';
            ins[from]++;
            outs[to]++;
            edge[from][to]=true;
            fr=from;
        }
        bool is=true;
        for(int i=0;i<26;i++){
            if(ins[i]!=outs[i]) is=false;
        }
        if(!is) cout<<"NG"<<endl;
        else{
            is=true;
            bfs(fr);
            for(int i=0;i<26;i++){
                for(int j=0;j<26;j++){
                    if(edge[i][j]&&!used[i][j]) is=false;
                }
            }
            if(is) cout<<"OK"<<endl;
            else cout<<"NG"<<endl;
        }
    }
}

Measured memory_bytes: 924
N, K = map( int, input().split() )
MOD = 10 ** 9 + 7
 
def Combi( n, r ):
  n1 = 1
  n2 = 1
  for i in range( 1, r + 1 ):
    n1 = n1 * i % MOD
    n2 = n2 * ( n - i + 1 ) % MOD
  return ( n2 * pow( n1, MOD - 2, MOD ) ) % MOD
 
for i in range( 1, K + 1 ):
  if N - K + 1 >= i:
    print( ( Combi( N - K + 1, i ) * Combi( K - 1, i - 1 ) ) % MOD )
  else:
    print( 0 )

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
lli lcm(lli num1, lli num2){
    return num1 / gcd(num1, num2) * num2;
}
int main(){
  lli B,C,D,E,F,N,M,K,sum=0,num=0,ans=0;
  cin >> N;
  Vec(T,lli,N,0);Vec(L,lli,N,0);
  rep(i,0,N)cin >> T[i] >> L[i];
  rep(i,1,N){
    if(T[i-1]>T[i]||L[i-1]>L[i]){
      B=T[i-1]/T[i];
      if(T[i-1]%T[i]!=0)B++;
      C=L[i-1]/L[i];
      if(L[i-1]%L[i]!=0)C++;
      T[i]*=max(B,C);L[i]*=max(B,C);
    }
  }
  Out(T[N-1]+L[N-1]);
}

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

using ull = unsigned long long;
#define rep(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)

#define vec(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)

vec(ull, 0, burgerP, 0L);
vec(ull, 0, burgerNum, 0L);

ull eat(int num, ull xx)
{
    if (xx <= 0L)
        return 0L;
    if (num == 0)
        return 1L;
    if (xx >= burgerNum[num] - 1L)
        return burgerP[num];
    if (xx > burgerNum[num - 1] + 2L)
        return 1L + burgerP[num - 1] + eat(num - 1, xx - burgerNum[num - 1] - 2L);
    if (xx >= burgerNum[num - 1] + 2)
        return 1L + burgerP[num - 1];
    if (xx > 1)
        return eat(num - 1, xx - 1L);
    return 0L;
}

int main()
{
    //-----------------
    int n = 0;
    ull x = 0;
    cin >> n >> x;
    burgerP.assign(n + 1, 0L);
    burgerNum.assign(n + 1, 0L);
    rep(i, n + 1)
    {
        if (i == 0)
        {
            burgerP[i] = 1L;
            burgerNum[i] = 1L;
            continue;
        }
        burgerP[i] = 2L * burgerP[i - 1] + 1L;
        burgerNum[i] = 2L * burgerNum[i - 1] + 3L;
    }

    cout << eat(n, x) << endl;
    //----------------
    return 0;
}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  int N, K; cin >> N >> K;
  string S; cin >> S;

  //main
  
  
  // output
  S[K-1] = S[K-1] + 32;
  
  cout << S << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace Test06
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string strOfnum;
			while ((strOfnum = Console.ReadLine()) != null)
			{
				string[] abStr = strOfnum.Split();
				int sum = int.Parse(abStr[0]) + int.Parse(abStr[1]);
				char[] count = sum.ToString().ToCharArray();
				Console.WriteLine(count.Length);

			}
		}
	}
}

Measured memory_bytes: 9088
#include<iostream>
#include<string>
#include <cstdlib>
using namespace std;

int main(){
  string s;
  cin >> s;
  int diff = 0;
  for ( int i = 0; i < s.length(); i++){
    if ( i % 2 == s[i] - '0') diff++;
  }

  cout << min(diff, (int)(s.length() - diff) ) << endl;

  return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		long a = sc.nextLong();
	    if (a % 2 == 0) {
	    	System.out.println(a);
	    } else {
	    	System.out.println(a*2);
	    }
	}

    static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N,M;
string a[60],b[60];

bool check(){
  for(int h=0;h<N;h++){
    for(int w=0;w<N;w++){
      if(h+M-1>=N||w+M-1>=N)continue;

      bool flag=true;
      for(int x=0;x<M;x++){
        for(int y=0;y<M;y++){
          if(a[h+x][w+y]!=b[x][y]){
            flag=false;
          }
        }
      }
      if(flag)return true;
    }
  }
  return false;
}

signed main(){
  cin>>N>>M;
  for(int t=0;t<N;t++)cin>>a[t];
  for(int t=0;t<M;t++)cin>>b[t];

  if(check()){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  bool x = false;
  int a = A;
  while(true){
    if(a % B == C){
      x = true;
      break;
    }else if(a % B == 0){
      break;
    }else{
      a += A;
    }
  }
  if(x){
    cout << "YES";
  }else{
    cout << "NO";
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  int count = 0;
  
 for (int i = 0; i < N; i++) {
   int A;
   cin >> A;   
   int subcount = 0;
   for (int j = 0; ; j++){
     if (A % 2 == 1)
       break;
     else{
       subcount ++;
       A /= 2;
     }
   }
     if(i == 0)
       count = subcount;
     else if(count > subcount){
     count = subcount;
     }
 }
   cout << count << endl;
}

Measured memory_bytes: 3604
#include <stdio.h>
int main()
{
	int n, m, l, i, j, k;
	scanf("%d %d %d", &n, &m, &l);
	int a[n][m], b[m][l];
	long long int c[n][l];
	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			c[i][j]=0;
		}
	}
	for(i=0; i<n; i++){
		for(j=0; j<m; j++){
			scanf("%d", &a[i][j]);
		}
	}
	for(i=0; i<m; i++){
		for(j=0; j<l; j++){
			scanf("%d", &b[i][j]);
		}
	}
	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			for(k=0; k<m; k++){
				c[i][j]+=a[i][k]*b[k][j];
			}
			if(j==0){
				printf("%lld", c[i][j]);
			} else {
				printf(" %lld", c[i][j]);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 756
#include <iostream>
#include <algorithm>

using namespace std;

int main() {

    string s, c = "";
    cin >> s;

    int i = 0;
    while (i < s.length()) {
        char v = (s[i] == ',') ? ' ' : s[i];
        c += v;
        i++;
    }
    cout << c;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String[] input = br.readLine().split(" ");
            double thisWorldTime = Double.parseDouble(input[0]);
            double addSpeed = Double.parseDouble(input[1]);
            BigDecimal elapsedTimeOnFastWorld = new BigDecimal(thisWorldTime / addSpeed);

            System.out.println(elapsedTimeOnFastWorld.setScale(10, RoundingMode.HALF_UP));
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 23120
N=int(input())
honest=[0 for i in range(N)]
liar=[0 for i in range(N)]
for i in range(N):
  a=int(input())
  for j in range(a):
    x,y=map(int,input().split())
    if y==0:
      liar[i]|=(1<<(x-1))
    else:
      honest[i]|=(1<<(x-1))

ans=0
for i in range(2**N):
  ok=True
  for j in range(N):
    if (i>>j)&1:
      hon=honest[j]
      pat=i
      while hon>0:
        if hon&1==1 and pat&1==0:
          ok=False
          break
        hon>>=1
        pat>>=1
      li=liar[j]
      pat=i
      while li>0:
        if li&1==1 and pat&1==1:
          ok=False
          break
        li>>=1
        pat>>=1
      if not ok:
        break
  if ok:
    val=i
    cnt=0
    while val>0:
      if val&1==1:
        cnt+=1
      val>>=1
    ans=max(ans,cnt)
        
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};



signed main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);

	printf("%d\n", (a+b)*c/2);

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        int H = sc.nextInt();
        int W = sc.nextInt();
        sc.nextLine();

        boolean A[][] = new boolean[H][W];
        List<Pos> posSet = new ArrayList<>();
        int numOfBlack = 0;

        for (int i = 0; i < H; i++) {
            String line = sc.nextLine();
            for (int j = 0; j < W; j++) {
                boolean b = (line.charAt(j) == '#');
                A[i][j] = b;
                if (b) {
                    numOfBlack++;
                    posSet.add(new Pos(i, j));
                }
            }
        }

        int SIZE = H * W;
        int count = 0;
        while(numOfBlack < SIZE) {
            count++;
            List<Pos> nextPosSet = new ArrayList<>();

            Iterator<Pos> iterator = posSet.iterator();
            while(iterator.hasNext()) {
                Pos next = iterator.next();
                if (next.i > 0 && !A[next.i - 1][next.j]) {
                    nextPosSet.add(new Pos(next.i - 1, next.j));
                    A[next.i - 1][next.j] = true;
                    numOfBlack++;
                }
                if (next.j > 0 && !A[next.i][next.j - 1]) {
                    nextPosSet.add(new Pos(next.i, next.j - 1));
                    A[next.i][next.j - 1] = true;
                    numOfBlack++;
                }
                if (next.i < H - 1 && !A[next.i + 1][next.j]) {
                    nextPosSet.add(new Pos(next.i + 1, next.j));
                    A[next.i + 1][next.j] = true;
                    numOfBlack++;
                }
                if (next.j < W - 1 && !A[next.i][next.j + 1]) {
                    nextPosSet.add(new Pos(next.i, next.j + 1));
                    A[next.i][next.j + 1] = true;
                    numOfBlack++;
                }
            }

            posSet = nextPosSet;
        }

        System.out.println(count);
    }

    public static class Pos {
        public int i;
        public int j;

        public Pos(int i, int j) {
            this.i = i;
            this.j = j;
        }
    }
}


Measured memory_bytes: 62572
#include <iostream>
#include <cmath>
#include <complex>
#include <vector>
#include <cstdio>

using namespace std;
typedef complex<double> P;

int main(){
    double x,y;
    vector<P> pol;
    char c;
    while(cin >> x >> c >> y){
        pol.push_back(P(x,y));
    }
    double S = 0;
    for(int i=1; i<pol.size(); i++){
        pol[i] -= pol[0];
    }
    for(int i=1; i<pol.size()-1; i++){
        double s = (conj(pol[i])*pol[i+1]).imag();
        S+=s;
    }
    printf("%.10f\n",abs(S/2));
    return 0;
}
    
        

Measured memory_bytes: 1248
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt");
    if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a, b, c; cin >> a >> b >> c;
    if(a+b+c >= 22) cout << "bust";
    else cout << "win";
    cout << endstr;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	int N, v, test;
	double tax = 1.08;


	cin >> N;

	v = N / tax;
	
	for (int i = v - 1; i <= v + 1; i++) {
		test = i * tax;
		if (test == N){
			cout << i;
			goto end;
		}
	}

	cout << ":(";

	end:

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import io
import sys
import math

def solve(ac_lst,l,r):
    # implement process
    #l=2,r=3
    if l == 1:
        return ac_lst[r-2]
    return ac_lst[r-2] - ac_lst[l-2]
    

def make_ac_lst(s):
    ac_lst = [0] * len(s)
    for i in range(len(s)-1):
        if i != 0:
            ac_lst[i] += ac_lst[i-1]
        if s[i] == "A" and s[i+1] == "C":
            ac_lst[i] += 1
    ac_lst[-1] = ac_lst[-2]

    if _DEB: logd(f"{ac_lst}")
    return ac_lst

def main():
    # input
    n,q = map(int, input().split())
    s = input()
    
    # process
    ans = ""
    ac_lst = make_ac_lst(s)

    for _ in range(q):
        l,r = map(int, input().split())
        ans += str( solve(ac_lst,l,r) ) + "\n"
         
    # output    
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
8 3
ACACTAAC
7 8
2 3
1 8
"""
_EXPECTED = """\
2
0
3

"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

Measured memory_bytes: 14200
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	int F[101][10];
	int P[101][11];
	scan(N);
	rep1(i,N){
		rep(j,10){
			scan(F[i][j]);
		}
	}
	rep1(i,N){
		rep(j,11){
			scan(P[i][j]);
		}
	}
	ll riekimax=-INF;
	rep1(i,(1<<10)-1){
		int kaburi[101]={0};
		ll rieki=0;
		rep1(mise,N){
			int bit=i;
			rep(j,10){
				kaburi[mise]+=(bit&1)*F[mise][j];
				bit>>=1;
			}
			rieki+=P[mise][kaburi[mise]];
		}
		riekimax=max(riekimax,rieki);
	}
	prin(riekimax);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {

    int w, h, n;
    cin >> w >> h >> n;

    int xmin = 0, xmax = w, ymin = 0, ymax = h;

    int x, y, a;

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

        cin >> x >> y >> a;
        if (a == 1) xmin = max(xmin, x);
        if (a == 2) xmax = min(xmax, x);
        if (a == 3) ymin = max(ymin, y);
        if (a == 4) ymax = min(ymax, y);
    }

    if (xmin >= xmax || ymin >= ymax) {
        cout << 0 << endl;
    } else {
        cout << (xmax - xmin) * (ymax - ymin) << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(524287)

n,m,*l = map(int,open(0).read().split())
pas = [[] for _ in range(n)]
for x,y in zip(l[::2],l[1::2]):
	pas[x-1].append(y-1)

INF = float("inf")
done = [-INF]*n

def dfs(t):
	if done[t] >= 0:
		pass
	elif pas[t]:
		done[t] = max(dfs(s) for s in pas[t]) + 1
	else:
		done[t] = 0
	return done[t]

print(max(dfs(i) for i in range(n)))


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

public class Main {

	static final int INF = 1<<29;

	int N, start, goal;
	int[][] graph;
	int[][] limit;
	
	void run(){
		Scanner in = new Scanner(System.in);
		for(;;){
			N = in.nextInt();
			int M = in.nextInt();
			if(N==0) return;
			start = in.nextInt()-1; goal = in.nextInt()-1;
			graph = new int[N][N];
			limit = new int[N][N];
			for(int i=0; i<M; i++){
				int x,y,d,c;
				x = in.nextInt()-1; y = in.nextInt()-1; d = in.nextInt(); c = in.nextInt();
				graph[x][y] = graph[y][x] = d;
				limit[x][y] = limit[y][x] = c;
			}
			double ans = solve();
			if(ans < 0) System.out.println("unreachable");
			else System.out.printf("%.7f\n", ans);
		}
	}

	class State{
		double dist;
		int prev, cur, v;
		State(double _d, int _p, int _c, int _v){
			this.dist  = _d;
			this.prev = _p;
			this.cur = _c;
			this.v = _v;
		}
	}

	class Cmp implements Comparator<State>{
		public int compare(State a, State b){
			return a.dist>b.dist?1:a.dist<b.dist?-1:0;
		}
	}

	double solve(){
		double[][] sub = new double[N][N];
		for(int i=0; i<N; i++){
			for(int j=0; j<N; j++){
				sub[i][j] = graph[i][j]>0?(double)graph[i][j] / limit[i][j]:INF;
			}
		}
		sub[goal][goal] = 0.0;
		for(int k=0; k<N; k++)for(int i=0; i<N; i++)for(int j=0; j<N; j++)
			sub[i][j] = min(sub[i][j], sub[i][k] + sub[k][j]);
		if(sub[start][goal] == INF) return -1;
		
		double[][][] dist = new double[N][N][31];
		for(int i=0; i<N; i++)for(int j=0; j<N; j++)for(int k=0; k<31; k++)
			dist[i][j][k] = INF;
		
		PriorityQueue<State> Q = new PriorityQueue<State>(11,new Cmp())	;
		Q.add(new State(sub[start][goal], start, start, 0));
		
		while(!Q.isEmpty()){
			State tp = Q.poll();
			if(tp.cur == goal && tp.v == 1) return tp.dist;
			if(dist[tp.prev][tp.cur][tp.v] != INF) continue;
			double d = tp.dist - sub[tp.cur][goal];
			dist[tp.prev][tp.cur][tp.v] = d;
			for(int i=0; i<N; i++)if(i!=tp.prev && graph[tp.cur][i] > 0){
				for(int dv=-1;dv<=1;dv++){
					int nv = tp.v + dv;
					if(0<nv && nv<=limit[tp.cur][i] && dist[tp.cur][i][nv] == INF){
						double nd = d + (double)graph[tp.cur][i]/nv;
						Q.add(new State(nd + sub[i][goal], tp.cur, i, nv));
					}
				}
			}
		}
		return -1;
	}

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

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


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

  bool judge = true;
  int down1 = 0;
  for(int i=0; i<n-1; i++){
    if(h.at(i) >= h.at(i+1)+2){
      judge = false;
      break;
    }else if(down1 == 0 && h.at(i) == h.at(i+1)+1){
      down1 = 1;
    }else if(down1 == 1 && h.at(i) == h.at(i+1)+1){
      judge = false;
      break;
    }else if(down1 == 1 && h.at(i) < h.at(i+1)){
      down1 = 0;
    }
  }

  if(judge){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

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

int main()
{
    int N;
    cin >> N;
    vector<P> xy(N);
    for(int i=0;i<N;++i){
        cin >> xy[i].first >> xy[i].second;
    }
    sort(xy.begin(), xy.end());

    int p, q, ans=0, c;
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            p = xy[j].first - xy[i].first;
            q = xy[j].second - xy[i].second;
            c = 0;
            for(int k=0;k<N;++k){
                for(int l=k+1;l<N;++l){
                    if(xy[l].first - xy[k].first == p && xy[l].second - xy[k].second == q){
                        ++c;
                    }
                }
            }
            ans = max(c, ans);
        }
    }

    cout << N - ans << endl;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline

L = []
sums = []
ans = []

def main():
    global L,ans,sums
    N,Q= map(int, input().split())
    ans = [0]*(N+1)
    sums = [0]*(N+1)
    L=[]
    [L.append([])for _ in range(N+1)]
    for _ in range(N-1):
        A,B = map(int, input().split())
        L[A].append(B)
        L[B].append(A)
    for _ in range(Q):
        p,x = map(int, input().split())
        sums[p]+=x
    dfs(1,0)

    print(*ans[1:N+1])


def dfs(p,pre):
    global ans
    ans[p] = ans[pre] + sums[p]
    for ki in L[p]:
        if pre==ki:
            continue    
        dfs(ki,p)


if __name__ == '__main__':
    main()

Measured memory_bytes: 238304
#include<stdio.h>
int main()
{
	int i,j;
	int a[100];
	for(i=0;i<100;i++)
	a[i]=0;
	for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		{
			a[i*j]=i*j;
		}
	}
	int n,g=2;
	scanf("%d",&n);
	for(i=0;i<100;i++)
	{
		if(n==a[i])
		{g=1;break;
		}
	}
	if(g==1) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;

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

  int n;
  cin>>n;
  int t[n];
  int sum = 0;
  rep(i,n) {
    cin>>t[i];
    sum += t[i];
  }
  int m;cin>>m;
  int p[m], x[m];
  rep(i,m) {
    cin>>p[i]>>x[i];
  }
  rep(i,m) cout << sum - t[p[i] - 1] + x[i] << endl;
  

  return 0;
}


Measured memory_bytes: 256
N = int(input())
data = list(range(N))
m = 0
while m < N:
    data[m] = int(input())
    m += 1

kei = 0
max = 0
for i in range(len(data)):
    kei += data[i]
    if max < data[i]:
        max = data[i]

kei = kei - max / 2
print(int(kei))


Measured memory_bytes: 9188
import itertools

def calculate_distance(x1, x2):
    l2_norm = (x1[0] - x2[0])**2 + (x1[1] - x2[1])**2
    return l2_norm**(1/2)

N = int(input())
point = []
for i in range(N):
    a,b = map(int,input().split())
    point.append([a, b])
    

distance = 0
M = 0
for a in itertools.permutations(range(N)):
  M += 1
  
  for i in range(N-1):
        start, end = a[i], a[i+1]
        distance += calculate_distance(point[start], point[end])
print(distance/M)


Measured memory_bytes: 3064
N, K = map(int, input().split())
P = list(map(lambda x: int(x)-1, input().split()))
C = list(map(int, input().split()))

ans = -float("inf")

for st in range(N):
  S = []
  temp = P[st]
  S.append(C[temp])
  while temp != st:
    temp = P[temp]
    S.append(S[-1] + C[temp])
  cnt = len(S)
  loop, k = divmod(K, cnt)
  point = 0
  if S[-1] >= 0:
    if k == 0:
      loop -= 1
      k += cnt
    point += S[-1] * loop
  else:
    if loop >= 1:
      k = cnt
  ans = max(ans, point + max(S[:k]))

print(ans)

Measured memory_bytes: 81196
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int h,n,sum=0;
  cin>>h>>n;
  long int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    sum+=a[i];
  }
  if(h<=sum)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 500000

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

void insert(int);
void inorder(struct node *);
void preorder(Node *);

int main(){
  int n,i,j,z;
  char com[10],in[] = "insert",pr[] = "print";

  scanf("%d",&n);
  root=NULL;
  for(i = 0;i < n;i++){
    scanf("%s",com);
    if(strcmp(com,pr)==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else{
      scanf("%d",&z);
      insert(z);
    }
  }
  
  
  return 0;
}

void insert(int key){
  Node *y = NULL;
  Node *x = root;//y->xの親 x->root
  Node *z;

  z = (struct node *)malloc(sizeof(struct node));
  z->key = key;
  z->left = NULL;
  z->right = NULL;
  
  while(x != NULL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

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

void inorder(Node *r){
  if(r == NULL) return;
  inorder(r->left);
  printf(" %d",r->key);
  inorder(r->right);
}

void preorder(Node *r){
  if(r == NULL) return;
  printf(" %d",r->key);
  preorder(r->left);
  preorder(r->right);
}



Measured memory_bytes: 25160
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,A,B = MI()
    ans = 0
    def digit_sum(n):
        l = list(str(n))
        s=0
        for i in l:
            a = int(i)
            s+=a
        return s

        
    for i in range(1, N + 1):
        if A <= digit_sum(i) <= B:
            ans += i
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 41196
N, x = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

num = 0
0.upto(A.size - 2).each do |i|
  if A[i] + A[i + 1] > x
    d = (x - (A[i] + A[i + 1])).abs
    if A[i + 1] >= d
      A[i + 1] -= d
      num += d
    else
      num += ((A[i] + A[i + 1]) - x).abs
      A[i + 1] = 0
      A[i] = x
    end
  end
end

puts num


Measured memory_bytes: 8588
def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


Q = int(input())
LR = []
for i in range(Q):
    l, r = map(int, input().split())
    LR.append((l, r))

c2017 = [0]
total = 0
for i in range(1, 10**5+1):
    if is_prime(i) and is_prime((i+1)//2):
        total += 1
    c2017.append(total)

for i in range(Q):
    l, r = LR[i]
    ans = (c2017[r] - c2017[l-1])
    print(ans)


Measured memory_bytes: 18300