akhauriyash/Code-Regression huggingface dataset:
point = []

t=int(input())

import math

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

while t:
    a,b = map(int, input().split())
    point.append((a,b))
    t-=1

u = len(point)

s= 0

for i in range(u):
    for j in range(u):
        if i==j:
            continue
        s += distance(point[i][0],point[i][1],point[j][0],point[j][1])


print(s/u)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<stack>
#include<cmath>
#include<queue>

using namespace std;

int main() {
  string s;
  cin >> s;

  if (s[0] != 'A') {
    cout << "WA" << endl;
    return 0;
  }


  int c =0;
  for (int i=2; i<s.length() - 1; i++) if (s[i] == 'C') c++;
  if (c != 1) {
    cout << "WA" << endl;
    return 0;
  }

  c = 0;
  for (int i=0; i<s.length(); i++) {
    if (s[i] >= 65 && s[i] <= 90) c++;
  }

  if (c != 2) {
    cout << "WA" << endl;
    return 0;
  }

  cout << "AC" << endl;
}


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

int64_t encode(vector<int>& c){
    int64_t ret = 1e18;
    for(int i=0; i<4; i++){
        int64_t result = 0;
        for(int j=0; j<4; j++){
            result *= 1000;
            result += c[(i+j)%4];
        }
        ret = min(ret, result);
    }
    return ret;
}

int main(){
    int N;
    cin >> N;
    vector<int> C[400];
    map<int64_t, int> mp;
    for(int i=0; i<N; i++){
        C[i].resize(4);
        for(int j=0; j<4; j++) cin >> C[i][j];
        mp[encode(C[i])]++;
    }

    int64_t ans = 0;
    for(int i=0; i<N; i++){
        int64_t ci = encode(C[i]);
        mp[ci]--;
        for(int j=i+1; j<N; j++){
            int64_t cj = encode(C[j]);
            mp[cj]--;

            for(int k=0; k<4; k++){
                int64_t result = 1;
                vector<int64_t> use;
                for(int l=0; l<4; l++){
                    vector<int> c = {C[i][(l+1)%4], C[i][l], C[j][(3-l+k)%4], C[j][(3-l-1+k+4)%4]};
                    int64_t code = encode(c);
                    if(mp[code] > 0){
                        result *= mp[code];
                        if(c[0]==c[2] && c[1]==c[3]){
                            result *= (c[0]==c[1] ? 4 : 2);
                        }
                        mp[code]--;
                        use.push_back(code);
                    }else{
                        result = 0;
                        break;
                    }
                }
                ans += result;
                for(auto code : use) mp[code]++;
            }

            mp[cj]++;
        }
        mp[ci]++;
    }
    cout << ans/3 << endl;
    return 0;
}

Measured memory_bytes: 20224
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
  int N; cin >> N;
  vector<ll> A(N);
  rep(i,N) cin >> A[i];
  map<ll,int> nums;
  rep(i,N){
    nums[A[i]]++;
  }
  ll ans = 1;
  int cnt = 0;
  for(auto it = nums.rbegin(); it != nums.rend(); it++){
    if(cnt == 0 && it -> second >= 4){
      ans *= (it -> first) * (it -> first);
      cnt = 2;
      break;
    }
    if(it -> second >= 2){
      ans *= it -> first;
      cnt++;
    }
    if(cnt == 2) break;
  }
  if(cnt <= 1) ans = 0;
  cout << ans << endl;
}


Measured memory_bytes: 7296
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>

int main() {
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	string a;
	rep(i, n) {
		a += s[i];
		a += t[i];
	}
	cout << a << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        Map<Integer, Integer> h = new TreeMap<>();
        for (int i = 0; i < n; i++) {
            if (h.containsKey(a[i])) {
                h.put(a[i], h.get(a[i]) + 1);
            } else {
                h.put(a[i], 1);
            }
        }
        long max4 = 0;
        long max21 = 0;
        long max22 = 0;
        for (int k : h.keySet()) {
            if (h.get(k) >= 4) {
                max4 = (max4 < k) ? k : max4;
            }
            if (h.get(k) >= 2) {
                if (max21 < k) {
                    max22 = max21;
                    max21 = k;
                } else if (max22 < k) {
                    max22 = k;
                }
            }
        }
        long ans = (max4 * max4 > max21 * max22) ? max4 * max4 : max21 * max22;
        System.out.println(ans);
    }
}

Measured memory_bytes: 51248
//By Vlgd
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int A[100000],n,k;
int ck(ll P){
	int i=0;
	for(int j=0;j<k;j++){
		ll sum=0;
		while(sum+A[i]<=P){
			sum+=A[i++];
			if (i==n) return n;
		}
	}
	return i;
}
ll solve(){
	ll l=0;
	ll r=1000000000;
	ll mid;
	while(r-l>1){
		mid=(r+l)/2;
		int v=ck(mid);
		if (v==n) r=mid;
		else l=mid;
	}
	return r;
}
int main(){
	scanf("%d%d",&n,&k);
	for (int i=0;i<n;i++) scanf("%d",&A[i]);
	printf("%lld\n",solve());
}


Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

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

		int R = sc.nextInt();

		if (R < 1200) {
			System.out.println("ABC");
		} else if (R < 2800) {
			System.out.println("ARC");
		} else {
			System.out.println("AGC");
		}

		sc.close();
	}

}


Measured memory_bytes: 25044
#include <iostream>
#include <cstdlib>
#include <vector>
#define MAX 150

std::vector<std::vector<int> > makeArray(); 
void search(std::vector<std::vector<int> > v, int h, int w);

int main(void) {
    std::vector<std::vector<int> > v = makeArray();
    int h;
    int w;
    std::cin >> h >> w;
    while (h != 0 || w != 0) {
        search(v, h, w);
        std::cin >> h >> w;
    }
    return EXIT_SUCCESS;;
}

std::vector<std::vector<int> > makeArray() {
    std::vector<std::vector<int> > v(MAX, std::vector<int>(MAX, 0)); 
    for (int i = 0; i < MAX; i++) {
        for (int j = 0; j < MAX; j++) {
            v[i][j] = (i+1)*(i+1)+(j+1)*(j+1);
        }
    }
    return v;
}

void search(std::vector<std::vector<int> > v, int h, int w) {
    int value = h * h + w * w;
    int res_v = 1000000000;
    int res_h = h;
    int res_w = w;
    int max_j = MAX;

    for (int i = 0; i < MAX; i++) {
        for (int j = i + 1; j < max_j; j++) {
            if (v[i][j] > value) {
                if( v[i][j] < res_v) {
                    res_v = v[i][j];
                    res_h = i;
                    res_w = j;
                    max_j = j;
                }
                break; 
            } else if (v[i][j] == value && i > h) {
                res_v = v[i][j];
                res_h = i;
                res_w = j;
                max_j = j;
                std::cout << res_h + 1 << " " << res_w  + 1 << std::endl;
                return;;
            }
        }
    }
    std::cout << res_h + 1 << " " << res_w  + 1 << std::endl;
    return;
}

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

signed main(void){
    string S;
    cin >> S;
    vector<string> day = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    cout << 7 - (find(day.begin(), day.end(), S) - day.begin()) << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<<29;
const double PI = 3.14159265358979323846;











int main(){


       
        

        string s,t;
        cin >> s >> t;

        int n = s.size();
        int m = t.size();

        string ans = "~";
        for(int i = 0; i <= n-m; i++){
                string s2 = s;
                bool ok = true;
                for(int j = 0; j < m; j++){
                        if(s[i+j] != t[j] && s[i+j] != '?'){
                                ok = false;
                        }
                        s2[i+j] = t[j];
                }
                if(ok){
                        replace(all(s2), '?' , 'a');
                        ans = min(ans, s2);
                }
        }

        if(ans == "~"){
                cout << "UNRESTORABLE" << endl;
        }
        else{
                cout << ans << endl;
        }
       

        return 0;

}












Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
//---------------------------------------------------
//library zone!!!!!
typedef long long ll;
typedef long double ld;
#define rep(i,j) for(ll i=0;i<(long long)(j);i++)
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	ll x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ld mod_pow(ld x, ll n, ll p) {
	ld res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
signed main() {
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<4;i++){
		if(s[i]=='2') ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int P = Integer.parseInt(sc.next());
        int Q = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        
        int ans = 0;
        
        if(P <= Q && P <= R) {
            if(Q <= R) {
                ans = P+Q;
            }else {
                ans = P+R;
            }
        }else if(Q <= P && Q <= R) {
            if(P <= R) {
                ans = Q+P;
            }else {
                ans = Q+R;
            }
        }else if(R <= Q && R <= P) {
            if(Q <= P) {
                ans = R+Q;
            }else {
                ans = R+P;
            }
        }
        
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
	int n;
	cin >> n;
	map<ll,ll> mp;
	ll temp;
	rep(i,n) {
		cin >> temp;
		mp[temp]++;
	}
	for(auto& i : mp) {
		//cout << itr->first << " " << itr->second << endl;
		if (i.second >= 2){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;


  return 0;
}


Measured memory_bytes: 12800
//ALDS1_4_C Search - Allocation

#include <iostream>
#define MAX 100000
#define MAX_K 100000
#define MAX_W 10000
using namespace std;
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P)
{
    int i = 0;
    for (int j = 0; j < k; j++)
    {
        llong s = 0;
        while (s + T[i] <= P)
        {
            s += T[i];
            i++;
            if (i == n)
                return n;
        }
    }

    return i;
}

int solve()
{
    llong left = 0;
    llong right = MAX_K * MAX_W;
    llong mid;
    while (right - left > 1)
    {
        mid = (right + left) / 2;
        int v = check(mid);
        if (v >= n)
            right = mid;
        else
            left = mid;
    }

    return right;
}

int main(int argc, char const *argv[])
{
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> T[i];
    }
    llong ans = solve();
    cout << ans << endl;
    return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n,r;
    cin >> n >> r;
    lint ans=r;
    if(n<10){
        ans += 100 * (10 - n);
    }
    cout << ans << "\n";
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

#if !ONLINE_JUDGE
#define debug
#endif

using namespace std;
 
/*******  All Required define Pre-Processors and typedef Constants *******/
#define mem(a, b) memset(a, (b), sizeof(a))
#define repd(i,k) for(int i=k;i>=0;i--)
#define rep(i,k) for(int i=0;i<k;i++)
#define repn(i,k1,k2) for(ll i=k1;i<k2;i++)
#define sz(x) (ll)(x).size()
#define ff first
#define ss second

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define ee6 (ll)1000001
#define ee5 (ll)100001

#define trav(a, v) for(auto& a : v)

#define tt ll t;cin>>t; while(t--)
typedef long long int ll;
 
typedef pair<ll, ll> pr;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pr> vpr;
typedef vector<vpr>vvpr;
typedef vector<vi> vvi;

//*X.find_by_order(2) element at index=2
//X.order_of_key(1) how many elements strictly less than 1

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;

#ifdef debug
#define dbg(...) { cerr<<"[ "; dump(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.ff<<","<<x.ss<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const unordered_map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
} 
 
template <typename Arg1>
void dump(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void dump(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    dump(names.substr(1+(int)name.size()), args...);
}
#else
    #define dbg(args...)
#endif
 
ll powmod(ll x, ll y) 
{ 
    ll res = 1;  
    x = x % MOD;
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % MOD; 
        y = y>>1; // y = y/2 
        x = (x*x) % MOD;   
    } 
    return res; 
} 
int A[ee5];
int main()
{
    #if !ONLINE_JUDGE
    //freopen("in.txt","r",stdin);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
        
    int n,k;cin>>n>>k;
    
    for(int i=0;i<n;i++){
        cin>>A[i];
    }     

    cout<<(n-1+k-2)/(k-1);

}

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

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

	if(a > b){
		temp = a;
		a = b;
		b = temp;
	}

	if(b > c){
		temp = b;
		b = c;
		c = temp;
	}

	if( a > b){
		temp = a;
		a = b;
		b = temp;
	}

	cout << a << " " << b << " " << c << endl;

	return 0;
}

Measured memory_bytes: 3048
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,i,mh,h,ans=1;
    cin>>n;
    for (i=0;i<n;i++)
    {
        cin>>h;
        if (i==0)
            mh=h;
        else if (h>=mh)
            ans++;
        mh=max(mh,h);
    }
    cout<<ans<<endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

void solve(){
	int n, k;
	cin >> n >> k;
	if ((n + 1) / 2 >= k) {
		printf("YES\n");
	} else {
		printf("NO\n");
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define  vi vector<int>
#define pb push_back
//#define int long long
#define boost ios_base::sync_with_stdio(false);	cin.tie(0);	cout.tie(0)
#define pi pair<int,int>
#define F first
#define S second
#define FOR(i,n) for(int i=0;i<n;i++)
using namespace std;
 
//int mod=(int)(1e9+7);
 
void solve()
{   
	int N;
	cin>>N;
	int ret=0;
	FOR(i, N)
	{
		int a;
		cin>>a;
		if(((i+1)%2!=0) && (a%2 != 0))
			ret++;
	}
	cout<<ret<<"\n";
}
 
signed main()
{ boost;
 //cout<<fixed<<setprecision(14 );
  // int t;cin>>t;
  // for(int i=1;i<=t;i++)
  solve();
 // cout<<"Case #"<<i<<": "<<solve()<<endl;
 
return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>

int main() {
	int x,max=0,jj,ii;
	std::cin >> x;

	if (x == 1) {
		std::cout << 1 << std::endl;
		exit(0);
	}

	for (int i = 2;i<10; i++) {

		for (int j = 2;j<32; j++ ) {
			jj = std::pow(j, i);
			if (jj > x) {
				break;
			}
			ii = jj;
			if (jj == x) {
				break;
			}
		}
		if (max < ii) {
			max = ii;
		}
	}

	std::cout << max << std::endl;

	return 0;
}

Measured memory_bytes: 1020
n = int(input())
k = int(input())
m = n
l = []
while m > 0:
    l.append(m%10)
    m //= 10

try:
  n_ = n-(l[-1]*10**(len(l)-1))
  m_ = n_
  l_ = []
  while m_ > 0:
      l_.append(m_%10)
      m_ //= 10

  n__ = n_-(l_[-1]*10**(len(l_)-1))
  m__ = n__
  l__ = []
  while m__ > 0:
      l__.append(m__%10)
      m__ //= 10
except:
  pass
      
def d1(lst):
  ans = 0
  for num,i in enumerate(lst):
    if num != (len(lst)-1):
      ans += 9
    else:
      ans += i
  return ans

def d2(lst,lst_):
  ans = 0
  for num,i in enumerate(lst):
    if num != (len(lst)-1):
      ans += 81*num
    else:
      ans += (i-1)*9*num+d1(lst_)
  return ans

def d3(lst,lst_,lst__):
  ans = 0
  for num,i in enumerate(lst):
    if num != (len(lst)-1):
      ans += 729*(num-1)*num//2
    else:
      ans += (i-1)*81*(num-1)*num//2+d2(lst_,lst__)
  return ans

if k ==  1:
  print(d1(l))
if k ==  2:
  print(d2(l,l_))
if k ==  3:
  print(d3(l,l_,l__))

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#define PI 3.14159265358979323846

int main(void) {

	int N, M;
	scanf("%d%d", &N, &M);

	int a[50], b[50];
	int count = 0;

	for (int i = 0; i < M; i++) {
		scanf("%d%d", &a[i], &b[i]);
	}



	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < M; j++) {
			if (i == a[j] || i == b[j]) {
				count++;
			}
		}
		printf("%d\n", count);
		count = 0;
	}


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#define ll long long
#define endl '\n'
using namespace std;
int N; vector<int> vec;

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false); cin >> N;
    map<int, int> mp;
    for(int i = 0; i < N; i++)
    {
        int temp; cin >> temp;
        vec.push_back(temp);
        mp[temp-1] += 1;
        mp[temp] += 1;
        mp[temp+1] += 1;
    }
    int ret = 0;
    for(int i = 0; i < N; i++)
        ret = max(ret, mp[vec[i]]);
    
    
    
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 5112
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  vector<int> X(N);
  rep(i, N) cin >> X[i];

  vector<int> S = X;
  std::sort(S.begin(), S.end());

  std::map<int, int> pos;
  rep(i, N) {
    pos[S[i]] = i;
  }

  rep(i, N) {
    int num = X[i];

    if (pos[X[i]] < N / 2) cout << S[N / 2] << endl;
    else cout << S[N / 2 - 1] << endl;
  }

  return 0;
}


Measured memory_bytes: 12928
#include <iostream>
#include <cstdio>
#include <cctype>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

char UP    = 'N';
char DOWN  = 'S';
char RIGHT = 'E';
char LEFT  = 'W';

class Dice{
public:
    int und;
    int over;
    int up;
    int down;
    int right;
    int left;

    Dice(int arr[]){
        und   = arr[5];
        over  = arr[0];
        up    = arr[4];
        down  = arr[1];
        right = arr[2];
        left  = arr[3];
    }

    void upd(int& a, int& b, int& c, int& d){
        int tmp;
        tmp = a;
        a = b;
        b = c;
        c = d;
        d = tmp;
    }

    void move(char order){
        if (order == UP){
            upd(und, up, over, down);
        }else if(order == DOWN){
            upd(und, down, over, up);
        }else if(order == RIGHT){
            upd(und, right, over, left);
        }else{
            upd(und, left, over, right);
        }
    }

    void show(){
        cout << over << endl;
    }
};

int main(int argc, char const *argv[])
{
    int a[6];
    for(auto &x: a){
        cin >> x;
    }
    Dice d(a);
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i ++){
        d.move(s[i]);
    }
    d.show();
    return 0;
}


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

typedef long long ll;

bool solve(){
    ll a, b, c, d;
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    if (a < b){
        return false;
    }
    if (b > d){
        return false;
    }
    ++ c;
    ll gcd = std::__gcd(b, d);
    ll div = c / gcd;
    if (c % gcd > a % gcd){
        ++ div;
    }
    c = div * gcd + a % gcd;
    return c >= b;
}

int main(){
    int test;
    scanf("%d", &test);
    while (test --){
        puts(solve() ? "Yes" : "No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n;

    cin >> n;

    if (n >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3672
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)
	b := scanInts(n)

	cnta := 0
	cntb := 0

	for i := 0; i < n; i++ {
		cnta += max(0, (b[i]-a[i])/2)
		cntb += max(0, a[i]-b[i])
	}

	if cnta >= cntb {
		fmt.Fprintln(wr, "Yes")
	} else {
		fmt.Fprintln(wr, "No")
	}
}


Measured memory_bytes: 1152
import sys
from collections import deque
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
s = [[_ for _ in S()] for _ in range(N)]

root = [[] for _ in range(N+1)]
for i in range(N):
  for j in range(N):
    if s[i][j] == "1":
      root[i + 1].append(j + 1)
#print(root)

ans = -1
for i in range(1, N+1):
  Vnum = [-1 for _ in range(N+1)]
  Vnum[i] = 1

  queue = deque([i])
  while queue:
    #print(queue)
    x = queue.popleft()
    for j in root[x]:
      if Vnum[j] == -1:
        Vnum[j] = Vnum[x] +1
        queue.append(j)
      else:
        if Vnum[j] == Vnum[x] or abs(Vnum[j] - Vnum[x]) > 1:
          break
    else:
      continue
    break
  else:
    ans = max(ans, max(Vnum))

print(ans)

Measured memory_bytes: 44268
#include <bits//stdc++.h>
using namespace std;
#define rep(i,s,k) for(int i=s;i<k;i++)
#define int long long
signed main(void){
    int n,m,a,b,c;
    int ans=0;
    cin>>n;
    ans=(n-1)/2;
    cout<<ans<<endl;
    return 0;
    
    
}



Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int N, K;

    scanf("%d %d", &N, &K);
    //printf("N:%d,K:%d\n", N, K);//

    int d[K];
    int A[K][N];
    int sunuke[N];
    int trick = 0;

    int i,j;

    for (i = 0; i < N;i++){
        sunuke[i] = 0;
    }

        for (i = 0; i < K; i++)
        {
            scanf("%d", &d[i]);
            //printf("d:%d\n", d[i]); //
            for (j = 0; j < d[i]; j++)
            {
                scanf("%d", &A[i][j]);
                //printf("A:%d\n", A[i][j]);
                sunuke[A[i][j] - 1] += 1;
                //printf("j:%d\n", j);
            }
        }

    for (i = 0; i < N;i++){
        //printf("sunuke:%d\n", sunuke[i]);
        if(sunuke[i] == 0){
            trick++;
        }
    }

    printf("%d", trick);

    return 0;
}

Measured memory_bytes: 1760
def main(n, a):
    indexes = {i + 1 for i in range(n)}
    reduced = set()
    for s in a:
        reduced |= s
    return len(indexes - reduced)


if __name__ == '__main__':
    N, K = map(int, input().split())
    A = []
    for _ in range(K):
        input()
        A.append(set(tuple(map(int, input().split(' ')))))
    print(main(N, A))


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

int main() {
  int n;
  cin >> n;
  
  int ans = 0;  
  for (int i=1; i<=n; i++) {
    if (i < 10) {
      ans++;
    }
    
    else if (100 <= i && i < 1000) {
      ans++;
    }
    
    else if (10000 <= i && i < 100000) {
      ans++;
    }
  }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream> // cin, cout, string
#include <algorithm> // sort, min, max
#include <vector>
#include <utility> // pair, swap
#include <functional>

using namespace std;

// #define int long long

using ll = long long;
using ld = long double;

using vi = vector<int>;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
// const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)

#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int N;
int u[limit], v[limit], w[limit];

vector<vector<pii>> G;

int a[limit];

void dfs(int i, int c) {
  if(a[i] > 0) return ;
  a[i] = c;
  for(auto&& j : G[i]) {
    if(j.sd % 2 == 1) dfs(j.ft, 3-c);
    else dfs(j.ft, c);
  }
}

signed main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> N;
  G.resize(N+1);
  rep(i, N-1) cin >> u[i] >> v[i] >> w[i];
  rep(i, N) {
    G[u[i]].pb( mp(v[i], w[i]) );
    G[v[i]].pb( mp(u[i], w[i]) );
  }

  for_(i, 1, N+1) dfs(i, 1);

  for_(i, 1, N+1) cout << (a[i]==1 ? 0 : 1) << endl;

  return 0;
}


Measured memory_bytes: 9344
//#include "pch.h"
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <math.h>
#define OO INT_MAX
#define mp(x,y) make_pair(x,y)
#define x first
#define y second
#define ll unsigned long long int
#define pp pair<int,int>
#define heap priority_queue<pp, vector<pp>, greater<pp>>
using namespace std;



int main()
{
//	freopen("test.txt", "r", stdin);
	
	int a, b;
	cin >> a >> b;
	string s1(a, to_string(b)[0]);
	string s2(b, to_string(a)[0]);
	if (b > a) {
		cout << s2;
	}
	else if (a > b) {
		cout << s1;
	}
	else
		cout << s1;
}



Measured memory_bytes: 256
def iin(): return int(input())
def nl(): return list(map(int, input().split()))
def ary(r, c, v): return [[v for _ in range(c)] for _ in range(r)]

n, k = nl()

d = dict()
for i in range(1, n + 1):
    t = i % k
    d[t] = d.get(t, 0) + 1

ans = 0
if k % 2 == 0:
    ans += d.get(k // 2, 0) ** 3
ans += d.get(0, 0) ** 3
print(ans)

Measured memory_bytes: 15084
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
vector<int>adj[N+2],bl[N+2],v;
int vis[N+2],ans[N+2],tmp[N+2];
void dfs(int node)
{
  v.push_back(node);vis[node]=1;
  for(auto x:adj[node])
  {
    if(vis[x])continue;
    dfs(x);
  }
}
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  int n,m,k;cin>>n>>m>>k;
  for(int i=1;i<=m;i++)
  {
    int u,v;cin>>u>>v;
    adj[u].push_back(v);adj[v].push_back(u);
    //bl[u].push_back(v);bl[v].push_back(u);
  }
  for(int i=1;i<=k;i++)
  {
    int u,v;cin>>u>>v;
    bl[u].push_back(v);bl[v].push_back(u);
  }
  for(int i=1;i<=n;i++)
  {
    if(vis[i])continue;v.clear();
    dfs(i);
    //cout<<v.size()<<endl;

    for(auto x:v)tmp[x]=1;
    for(auto x:v)
    {
      ans[x]=v.size()-adj[x].size()-1;
      for(auto z:bl[x])ans[x]-=tmp[z];
    }
    for(auto x:v)tmp[x]=0;
  }
  cout<<ans[1];
  for(int i=2;i<=n;i++)cout<<" "<<ans[i];
    cout<<endl;
  return 0;
}

Measured memory_bytes: 65020
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();


        System.out.println(xor(a-1) ^ xor(b));
    }

    static long xor(long a) {
        a = Math.max(a, 0);
        long res = 0;
        int d4 = (int) (a % 4);
        long[] d4a = {0, 1, 1, 0};
        int d8 = (int)  (a % 4);
        long[] d8a = {0, 0, 1, 0, 0, 0, 1, 0};
        long[] da = {1, 0, 1, 0};
        res += d4a[d4];
        res += d8a[d8] << 1;
        for(int i=2; i<50; i++) {
            if((a >> i) % 2 == 1) {
                res += da[d4] << i;
            }
        }
        return res;

    }

}


Measured memory_bytes: 23892
<?php
$fp = fopen('php://stdin', 'r');

while (feof($fp) == false) {
  $line = fgets($fp);
  if ($line == "") break;
  $n = explode(' ', $line);
  $x = ($n[2]*$n[4] - $n[1]*$n[5]) / ($n[0]*$n[4] - $n[1]*$n[3]);
  $y = ($n[0]*$n[5] - $n[2]*$n[3]) / ($n[0]*$n[4] - $n[1]*$n[3]);
  echo number_format($x, 3)." ".number_format($y, 3).PHP_EOL;
}

Measured memory_bytes: 6628
#include <bits/stdc++.h>
#define ll long long

#define TASKNAME ""

using namespace std;

const int INF = 1e9 + 7;
const int MAXN = 1e5 + 7;
const double EPS = 1e-8;
const int LOGN = 30;

ll gcd(ll a, ll b) {
    if (!a) {
        return b;
    }
    return gcd(b % a, a);
}



int main() {
    #ifdef MY
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #else
        //freopen(TASKNAME".in", "r", stdin);
        //freopen(TASKNAME".out", "w", stdout);
    #endif // MY
    ll n, t;
    cin >> n >> t;
    for (int i = 1; i < n; i++) {
        ll x;
        cin >> x;
        t = x / gcd(t, x) * t;
    }
    cout << t;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 12:02:39 2020

@author: naoki
"""

a,b,x = map(int,input().split()) # 整数a,b及び割る数xを入力
if a!=0:
    print((b//x+1) - ((a-1)//x+1))
else:
    print(b//x + 1)

Measured memory_bytes: 2940
object Main extends App {
	val s = scala.io.StdIn.readLine.toList
	val t = s.reverse

	var ans = 0
	val size = s.size/2

	for(i <- 0 until size){
		if(s(i) != t(i)){
			ans += 1
		}
	}

	print(ans)

}

Measured memory_bytes: 27324
fun main(args: Array<String>) {
    val n = readInt()
    val x = readIntList()
    val sorted = x.sorted()
    val len = x.size
    val mid = (len / 2) - 1
    val median = sorted[mid]
    for (i in 0 until n) {
        println(
                when {
                    x[i] <= median -> sorted[mid + 1]
                    else -> sorted[mid]
                }
        )
    }
}

fun printYesOrNo(flag: Boolean) {
    println(if (flag) "YES" else "NO")
}

fun readIntList(): List<Int> = readLine()!!.split(' ').map { it.toInt() }

fun readInt(): Int = readLine()!!.toInt()

fun err(print: Any) {
    System.err.println(print)
}

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

typedef long long ll;

#define PB push_back
#define MP make_pair

const int mx = 1e7 + 1;
int c[mx];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n; cin >> n;
    for (ll i = 1; i <= n; ++i) {
        for (ll j = 0; (j += i) <= n; ) {
            ++c[j];
        }
    }
    ll ans = 0;
    for (ll i = 1; i <= n; ++i) {
        ans += i * c[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 42620
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <iterator>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

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

using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;

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

    vector<int> a(n);
    REP(i,n) cin >> a[i];

    int res = 1e8;

    for (int i=-100; i<=100; i++) {
        int c = 0;
        REP(j,n) {
            c += (a[j]-i)*(a[j]-i);
        }
        res = min(res, c);
    }

    cout << res << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define INF 1000000007
#define pi 3.141592653589793
using namespace std;
int sdkys(int a,int b){
    if(b==0) return a;
    return sdkys(b,a%b);
}
int sskbs(int a,int b){
    return a*b/sdkys(a,b);
}
int sosu(int a){
    if(a==2){
        return 1;
    }
    for(int i=2;i<sqrt(a)+1;i++){
        if(a%i==0){
            return 0;
        }
    }
    return 1;
}
vector<int> aa,ab;
int n,m,cnt=0,ans=0;
pair<int,int> pp[220000];
string s,sa[220000];
char c;
queue<int> que;
signed main(){
    cin>>s;
    rep(i,s.size()){
        if(s[i]=='B'){
            cnt++;
        }else{
            ans+=cnt;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 10736
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(void){
    ll N=0,M=0;
    cin >> N >>M;
    ll a=0,b=0;
    ll count=0;
    
    vector<vector<ll>> vec(N, vector<ll>(2));
    for (ll i = 0; i < N; i++) {
        cin >> vec.at(i).at(0);
    }
    
    
    for (ll i = 0; i < M; i++) {
        cin >> a >>b;
        if(vec.at(a-1).at(0)<=vec.at(b-1).at(0))
        vec.at(a-1).at(1)=-1;
        if(vec.at(a-1).at(0)>=vec.at(b-1).at(0))
        vec.at(b-1).at(1)=-1;
    }
    
    for (ll i = 0; i < N; i++) {
        // cout << vec.at(i).at(1) << endl;
        
        if(vec.at(i).at(1)==0){
         count++;   
        }
    }
    
    cout << count;
    
    
    
}

Measured memory_bytes: 8780
inp = input()
inp2 = inp.split()
A=int(inp2[0])
B=int(inp2[1])
C = B*(100**A)
if B == 100:
	if A == 0:
		C = 101
	elif A == 1:
		C = 10100
	elif A == 2:
		C = 1010000
print(C) 

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>
// #include <cstdlib>
// #include <stdlib.h>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll right = accumulate(a.begin(), a.end(), 0LL);
  ll left = 0;
  int index = 0;
  rep(i, n){
    right -= a[i];
    left += a[i];
    if (right - left ==  0){
      cout << 0 << endl;
      return 0;
    }

    if (right - left < 0){
      index = i;
      break;
    }
  }
  // cout << right << endl;
  // cout << left << endl;
  // cout << right - left << endl;
  // cout << (right + a[index]) - (left -a[index]) << endl;
  long long ans1 = min(abs(left - right), abs(right - left));
  long long ans2 = min(abs((right + a[index]) - (left -a[index])), abs((left -a[index]) - (right + a[index])));
  cout << min(ans1, ans2) << endl;
  return 0;
}

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

int main() {
  uint64_t Ans = 0;  // 回答：マスの個数
  uint64_t H; cin >> H; // 縦マス数
  uint64_t W; cin >> W; // 横マス数

  // 奇数列は、(H+1) /2
  // 偶数列は、H - (H+1) /2
  // 列数を２で割り、商×（ (H+1)/2 + (H+1)/2-1)
  // 列数が奇数なら、奇数列を１つ追加

  // １．偶数列まで、
  Ans = W/2* ( ( H+1 ) / 2 +  H - (H+1) / 2);
  if (debug) {cout << "A:Ans:" << Ans << endl;}
  // ２．奇数列がある場合
  if ( W%2 ){
    Ans += (H+1)/2;
  }

  // １列しか無いときは、動けない。
  if ( H == 1 || W == 1 ) { Ans = 1;}


  cout << Ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
ll euclidean_gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}


int main() {
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  bool ok = true;
  if(s[a]!='-') ok = false;
  rep(i,a){
    if(!(s[i]>='0'&&s[i]<='9')) ok = false;
  }
  for(int i = a+1; i < s.size(); ++i){
    if(!(s[i]>='0'&&s[i]<='9')) ok = false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main(){
  string S;
  cin >> S;
  
  int p = 700;
  if(S.at(0)=='o'){
    p+=100;
  }
  if(S.at(1)=='o'){
    p+=100;
  }
  if(S.at(2)=='o'){
    p+=100;
  }
  cout << p << endl;
  return 0;
}


Measured memory_bytes: 256
ACGT=['A','C','G','T']
def chkAcgt(s):
    p=0
    c=s[p]
    while c in ACGT:
        p+=1
        if p>len(s)-1:
          break
        c=s[p]
    return p

def resolve():
    S=list(input())
    mx=0
    while True:
        if S[0] not in ACGT:
            S.pop(0)
        else:
            mx=max(mx,chkAcgt(S))
            del S[:chkAcgt(S)]

        if len(S)==0:
            break
    print(mx)
resolve()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int dp[2005][2005];
int c[2005][2005];
int sum[2005];
int p[4005];
int main()
{
    int n , k;
    cin>>k>>n;
    dp[1][1] = 1;
    p[0] = 1;
    for(int i = 1;i <= 4000;i++) p[i] = (1LL * p[i - 1] * 2) % mod;
    for(int i = 1;i <= k;i++) sum[i] = dp[0][i] = 1;
    for(int i = 1;i <= n;i++){
        for(int j = 1;j <= k;j++){
            dp[i][j] = sum[j - 1];
            if(j == 1) dp[i][j] = 1;
            sum[j] = (sum[j] + dp[i][j]) % mod;
        //    printf("%d %d %d\n",i,j,dp[i][j]);
        }
    }
    c[0][0] = 1;
    for(int i = 1;i <= k;i++){
        c[i][0] = 1;
        for(int j = 1;j <= i;j++) c[i][j] = (c[i - 1][j] + c[i-1][j - 1]) % mod;
    }
    for(int i = 2;i <= k*2;i++){
        int ttl = k;
        int pc = 0;
        for(int j = 1;j <= k;j++){
            if(i - j <= k && i - j >= 1 && j <= i - j) {
                ttl--;
                if(j * 2 != i) pc++;
            }
        }
        //printf("I %d , ttl %d %d\n",i,ttl,pc);
        int ans = (1LL * dp[n][ttl] * p[pc]) % mod;
        for(int j = 1;j <= pc;j++){
            int tmp = (1LL * dp[n][ttl - j] * c[pc][j]) % mod;
            tmp = (1LL * tmp * p[pc - j]) % mod;
            if(j & 1) ans = (ans + mod - tmp) % mod;
            else ans = (ans + tmp) % mod;
        }
        if(i % 2 == 0){
            ans = (ans + 1LL * dp[n - 1][ttl] * p[pc]) % mod;
            for(int j = 1;j <= pc;j++){
                int tmp = (1LL * dp[n - 1][ttl - j] * c[pc][j]) % mod;
                tmp = (1LL * tmp * p[pc - j]) % mod;
                if(j & 1) ans = (ans + mod - tmp) % mod;
                else ans = (ans + tmp) % mod;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 30848
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>
#include <cstring>


int main() {
    int n; std::cin >> n;
    std::vector<int> weight(n), value(n);
    for (int i = 0; i < n; i++) {
        std::cin >> value[i] >> weight[i];
    }
    const int D = 10;
    const int B = 100000;
    auto chmax = [](int &a, int b) { return a = std::max(a, b); };
    std::vector<std::vector<int>>
        dp(1 << D, std::vector<int>(B + 2, -1e9));
    dp[0][0] = 0, dp[0][weight[0]] = value[0];
    for (int i = 1; i < std::min(1 << D, n); i++) {
        int par = (i - 1) / 2;
        for (int j = 0; j <= B; j++) {
            chmax(dp[i][j], dp[par][j]);
            if (j + weight[i] <= B)
                chmax(dp[i][j + weight[i]], dp[par][j] + value[i]);
        }
    }
    for (int i = 0; i < std::min(1 << D, n); i++) {
        for (int j = 0; j < B; j++) {
            chmax(dp[i][j + 1], dp[i][j]);
        }
    }
    int q; std::cin >> q;
    std::vector<std::pair<int, int>> buf;
    while (q--) {
        int v, lim; std::cin >> v >> lim;
        v--;
        buf.clear();
        while (v >= 1 << D) {
            buf.emplace_back(weight[v], value[v]);
            v = (v - 1) / 2;
        }
        int m = buf.size();
        int ans = 0;
        for (int i = 0; i < (1 << m); i++) {
            int wg = 0, vl = 0;
            for (int j = 0; j < m; j++) {
                if (~(i >> j) & 1) continue;
                wg += buf[j].first;
                vl += buf[j].second;
            }
            int targ = lim - wg;
            if (targ < 0) continue;
            chmax(ans, vl + dp[v][targ]);
        }
        std::cout << ans << std::endl;
    }
    return 0;
}


Measured memory_bytes: 407096
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		sc.nextInt();
		sc.nextInt();
		sc.nextInt();
		int e = sc.nextInt();
		int k = sc.nextInt();
		if(e - a <= k) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}

	}

}


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

int main(){
  int n;
  cin >> n;
  
  int result = INT_MAX;
  for(int i = 0; i < n && result; i++){
    int a;
    cin >> a;
    for(int j = 0; j < result; j++){
      if(a%2){
        result = j;
        break;
      }
      a/=2;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 256
K = int(input())
A = list(map(int,input().split()))

high = 10**18
low = 0

while high-low > 1:
    mid = (high+low)//2
    tmp = mid
    for i in range(K):
        tmp = tmp//A[i]*A[i]
    if tmp <= 2:
        low = mid
    else:
        high = mid
    L = low
    
high = 10**18
low = 0

while high-low > 1:
    mid = (high+low)//2
    tmp = mid
    for i in range(K):
        tmp = tmp//A[i]*A[i]
    if tmp >= 2:
        high = mid
    else:
        low = mid
    S = high

if S <= L:
    print(S,L)
else:
    print(-1)

Measured memory_bytes: 63984
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] answers = new int[N + 1];

		for (int i = 0; i < N - 1; i++) {
			answers[scan.nextInt()]++;
		}

		for (int i = 1; i <= N; i++) {
			System.out.println(answers[i]);
		}
	}
}

Measured memory_bytes: 60428
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
using namespace std;


int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    long long int x, k, d;
    cin >> x >> k >> d;
    x = abs(x);
    long long int l = x/d;
    l = min(k,l);
    if((k-l) % 2 == 0){
        cout << abs(x - l*d) << '\n';
    } 
    else{
        cout << abs(x - (l+1)*d) << '\n';
    }
    return 0;
}

Measured memory_bytes: 3636
import math
N = int(input())
A = list(map(int,input().split()))
B = []
for i in range(N):
    B.append(A[i]-(i+1))
B.sort()
M1, M2 = B[N//2],B[N//2]
if N > 1:
    M2 = B[N//2+1]
C1, C2 = [], []
for i in range(N):
    C1.append(abs(B[i]-M1))
    C2.append(abs(B[i]-M2))
print(min(sum(C1),sum(C2)))

Measured memory_bytes: 37700
#include <iostream>
 
int main(){
    int h, w;
    while(1){
        std::cin >> h >> w;
        if(!h && !w)
            break;
        for(int j = 0; j < h; j++){
            for(int i = 0; i < w; i++){
                std::cout << '#';
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3084