akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int sums[11];
int main() {
  string s; cin >> s;
  int res = 0;
  for (auto i = 0; i < s.size(); i++) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      sums[i + 1] = sums[i] + 1;
    } else {
      sums[i + 1] = 0;
    }
    res = max(res, sums[i+1]);
  }
  cout << res << endl;
}

Measured memory_bytes: 256
var h = [],hs = 0;
h[0] = new Array(2);
h[0][0] = -1;h[0][1] = -1;
 
function insert(key){
    h[++hs] = key;
 
    var i = hs;
 
    while(h[i][1] < h[Math.floor(i / 2)][1]){
        var ex = h[i];
        h[i] = h[Math.floor(i / 2)];
        h[Math.floor(i / 2)] = ex;
        i = Math.floor(i / 2);
    }
}
 
function extract(){
    if(hs <= 0)
        return;
 
    var ret = h[1];
 
    h[1] = h[hs--];
 
    i = 1;
    while((i * 2 <= hs && h[i][1] > h[i * 2][1]) || (i * 2 + 1 <= hs && h[i][1] > h[i * 2 + 1][1])){
        var l = i * 2;var r = i * 2;
        if(i * 2 + 1 <= hs)
            r++;
        var m = h[l][1] <= h[r][1] ? l : r;
        var ex = h[i];
        h[i] = h[m];
        h[m] = ex;
        i = m;
 
    }
    return ret;
}


function Main(input){
    input = input.split("\n");
    var n = parseInt(input[0],10);

    var graph = new Array(n);

    for(var i = 0;i < n;i++){
        input[i + 1] = input[i + 1].split(" ");
        var u = parseInt(input[i + 1][0],10);
        var k = parseInt(input[i + 1][1],10);
        graph[u] = new Array(k);
        for(var j = 0;j < k;j++)
            graph[u][j] = new Array(2);
        for(var j = 0;j < k;j++){
            graph[u][j][0] = parseInt(input[i + 1][j * 2 + 2],10);
            graph[u][j][1] = parseInt(input[i + 1][j * 2 + 3],10);
        }
    }

    var count = 1;
    var sum = Array(n);
    for(var i = 0;i < n;i++)
        sum[i] = 1000000000;
    sum[0] = 0;
    for(var i = 0;i < graph[0].length;i++){
        insert(graph[0][i]);
    } 
    while(count < n){
        var aa = extract();
        if(sum[aa[0]] < 1000000000)
            continue;

        sum[aa[0]] = aa[1];
        count++;

        for(var i = 0;i < graph[aa[0]].length;i++){
            graph[aa[0]][i][1] += sum[aa[0]];
            insert(graph[aa[0]][i]);
        }
    }

    for(var i = 0;i < n;i++){
        console.log(i + " " + sum[i]);
    }
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 18940
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
const int N = 1e5;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	string s;
	cin>>s;
	int flag = 0;
	for(int i = 1; i < 4; i++){
		if(s[i] == s[i-1]){
			flag = 1;
		}
	}
	// if(s[0] == s[2] && s[1] == s[3]){
	// 	flag = 1;
	// }
	if(!flag) cout<<"Good";
	else{
		cout<<"Bad";
	}
	return 0;
}


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

vector<int> dic;
vector<int> arr(N,1);

void Eratosthenes(){

	for(int i = 2; i < sqrt(N); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}
    for(int i = 2; i < N; i++){
		if(arr[i]){
            dic.push_back(i);
		}
	}
}


int main(){
    int n,i=0;
    cin>>n;
    Eratosthenes();
    while(n > dic[i] ){
        i++;
    }
    cout<<dic[i]<<endl;

    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch LunlunNumber | diff LunlunNumber.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address LunlunNumber.cpp && ./a.out

/*
 
 4/4/2020
 
 5:22-6:04 AC
 
 */

int K;

void solve() {
  priority_queue<LL> Q;
  FOR(i,1,10) Q.emplace(-i);
  vector<LL> res;
  while(SZ(res)<K) {
    LL n=Q.top(); Q.pop();
    n=-n;
    res.push_back(n);
    int dd=n%10LL;
    LL base=10LL*n;
    
    auto add=[&](int d) {
      if(d>=0&&d<=9) {
        LL a=base+d;
        Q.emplace(-a);
      }
    };
    add(dd-1),add(dd),add(dd+1);
  }
//  dumpc(res);
//  vector<LL> ans=res;
//  if(SZ(res)>=100) dumpC(res.end()-100,res.end());
//  sort(ALL(ans));
//  assert(ans==res);
  cout<<res[K-1]<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>K;
  solve();
  
  return 0;
}


Measured memory_bytes: 3008
//When I hit my pocket...

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    ll k,a,b;cin>>k>>a>>b;
    if(a+1>=b){
        cout<<1+k<<nnn;
        return 0;
    }
    if(a<k){
        k-=a-1;
        ll ans = a;
        ans+=(b-a)*(k/2);
        if(k%2==1)ans++;
        cout<<ans<<nnn;
    }else cout<<1+k<<nnn;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<typename T>
struct BIT{ //1-indexed
    vector<T> bit;
    int size;
    BIT(int n):size(n), bit(n+1, 0){}
    T sum(int i){
        T s=0;
        while(i>0){
            s+=bit[i];
            i-=(i&(-i));
        }
        return s;
    }
    void add(int i, T x){
        while(i<=size){
            bit[i]+=x;
            i+=(i&(-i));
        }
    }
};
template<typename T>
struct RangeAddRangeSum{
	int n;
	BIT<T> bit, bit2;
	RangeAddRangeSum(int n):n(n), bit(n), bit2(n){}
	void add(int l, int r, const T &x){
		bit.add(l+1, x);
		bit.add(r+1, -x);
		bit2.add(l+1, l*x);
		bit2.add(r+1, -r*x);
	}
	T sum(int r){
		return r*bit.sum(r)-bit2.sum(r);
	}
	T sum(int l, int r){
		return sum(r)-sum(l);
	}
};
int main()
{
	int n, q;
	scanf("%d %d", &n, &q);
	RangeAddRangeSum<ll> seg(n);
	for(int i=0; i<q; i++){
		int t;
		scanf("%d", &t);
		if(t==0){
			int a, b; ll x;
			scanf("%d %d %lld", &a, &b, &x); a--;
			seg.add(a, b, x);
		}else{
			int a, b;
			scanf("%d %d", &a, &b); a--;
			printf("%lld\n", seg.sum(a, b));
		}
	}
	return 0;
}



Measured memory_bytes: 4404
#include<stdio.h>
int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
long long d[300010]={1,1};
long long e[300010]={};
int M=1e9+7;
int aCb(int a,int b,int m){
  long long s=1,i;
  if(b<0)return 0;
  if(b>a-b)b=a-b;
  return (((d[a]*e[b])%M)*e[a-b])%M;
  for(i=0;i<b;i++)s=(((s*(a-i))%m)*inv(i+1,m))%m;  
  return (int)s;
}
int main(){
  int h,w,k,a,i;
  long long s,b;
  for(i=2;i<300005;i++)d[i]=(d[i-1]*i)%M;
  for(i=0;i<300005;i++)e[i]=inv(d[i],M);
  scanf("%d %d %d",&h,&w,&k);
  for(i=0;i<=k;i++){
    a=k-i;
    b=aCb(h+w+k+k,h+i+i,M);
    b=(b*(aCb(h+i+i,i,M)-aCb(h+i+i,i-1,M)+M)%M)%M;
    b=(b*(aCb(w+a+a,a,M)-aCb(w+a+a,a-1,M)+M)%M)%M;
    s=(s+b)%M;
  }
  printf("%lld\n",s);
  return 0;
}
    

Measured memory_bytes: 5288
N = int(input())
C, S, F = [], [], []
for i in range(N-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)
for i in range(N):
    t = 0
    for j in range(i,N-1):
        if t < S[j]:
            t = S[j]
        elif t % F[j] != 0:
            t += F[j] - t % F[j]
        t += C[j]
    print(t)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 2010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
string s = "a";
vector<string> ans;
void make(int cnt,ll m){
    if (cnt == 0){
        ans.push_back(s);
    }
    else{
        rep(i,m+1){
            s += ('a'+i);
            make(cnt-1,max(m,i+1));
            s.pop_back();
        }
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    make(n-1,1);
    SORT(ans);
    rep(i,ans.size()){
        PRINT(ans[i]);
    }
}


Measured memory_bytes: 9716
N=int(raw_input())
a = map(int,raw_input().split())

colors = [0 for i in range(8)]
special = 0
for i in range(N):
    if a[i]<3200:
        if colors[int(a[i]/400)]==0:
            colors[int(a[i]/400)]=1
    else:
        special += 1
if sum(colors)==0:
    print str(1) + " " +str(special)      
else:
    print str(sum(colors)) + " " +str(sum(colors)+special)

Measured memory_bytes: 2568
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

const int N = 1e5 + 5;
bool pres[N];
int deg[N], par[N], taka[N], aka[N];

void dfs1(int ii, int pp, graph &g)
{
	par[ii] = pp;
	bool ans = false;
	for (auto jj : g[ii])
		if (jj != pp)
			dfs1(jj, ii, g);
	for (auto jj : g[ii])
		if (jj != pp)
			pres[ii] |= pres[jj];
	return;
}

void dfs2(int ii, int pp, graph &g, int h, int block, int *arr)
{
	arr[ii] = h;
	pres[ii] = true;
	for (auto jj : g[ii])
		if (jj != pp && jj != block)
			dfs2(jj, ii, g, h + 1, block, arr);
	return;
}

void solve()
{
	int n, t, a;
	cin >> n >> t >> a;
	graph g(n + 1, v32());
	int u, v;
	for (int i = 0; i < n - 1; i++)
	{
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
		deg[u]++;
		deg[v]++;
	}
	pres[t] = true;
	dfs1(a, -1, g);
	if (deg[t] == 1 && par[t] == a)
	{
		cout << 0 << ln;
		return;
	}
	int src = -1;
	for (auto jj : g[a])
		if (pres[jj])
		{
			src = jj;
			break;
		}
	dfs2(t, -1, g, 0, a, taka);
	dfs2(src, a, g, 1, a, aka);
	aka[a] = 0;
	int ans = 0;
	for (int i = 1; i < n + 1; i++)
		if (pres[i] && deg[i] && taka[i] < aka[i])
			ans = max(ans, aka[i]);
	cout << ans-1 << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


Measured memory_bytes: 13824
import java.util.Scanner;

public class Main{
  static int N;
  static int A[];
  static int ans;
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    A = new int[N];
    for(int i=0;i<N;i++){
      A[i]=sc.nextInt();
    }
    for(int i=0;i<N-1;i++){
      gcd(i);
    }
    System.out.println(A[N-1]);
  }

  static void gcd(int m){
    int x = A[m];
    int y = A[m+1];
    int z = 0;
    if(x<=y){
      z = x;
      x = y;
      y = z;
    }
    while((z = x % y)!=0){
      x = y;
      y = z;
    }
    A[m+1]=y;
    }

}


Measured memory_bytes: 50452
#include <stdio.h>
 
int main(void)
{
  long long a, r;
  double b;
  
  scanf("%lld", &a);
  scanf("%lf", &b);
  
  r = (long long)(b * 100 + 0.5);
  
  r *= a;
  
  r /= 100;
  
  printf("%lld", r);
  
  return 0;
}

Measured memory_bytes: 1748
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
const int MOD=1e9+7;
 
int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int ans=0;
    repr(i,1,n) {
        vector<int> al(26);
        int bot=0;
        rep(j,i) ++al[s[j]-'a'];
        repr(j,i,n) {
            if (al[s[j]-'a']>0) {
                ++bot;
                al[s[j]-'a']=0;
            }
        }
        ans=max(ans,bot);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<char>a(n);
    vector<char>b(n);
    for(int i=0; i<n; i++){
        if(s[i] != s[n-1-i]){
            cout << "No" << endl;
            return 0;
        }
    }

    for(int i=0; i<n/2; i++){
        if(n%2==0){
            if(s[i]!=s[n/2-1-i]){
            cout << "No" << endl;
            return 0;
            }
            if(s[n/2+i]!=s[n-1-i]){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if(s[i]!=s[n/2-1-i]){
            cout << "No" << endl;
            return 0;
            }
            if(s[n/2+1+i]!=s[n-1-i]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3624
A[20000],B[10000];z(int*a,int*b){return*b-*a;}
main(n,i,j){for(;scanf("%d",&n),n;puts(i<n?"No":"Yes")){
for(i=0;i<n*2;i++)scanf("%d",A+i);
qsort(A,n,4,z);
for(i=0;i<n;i++){for(j=0;j<n;j++)if(A[j+n])A[i]--,A[j+n]--;if(A[i])break;}
}exit(0);}

Measured memory_bytes: 732
#include<stdio.h>
	int main(){
		int a,b,c,d,e,f;
		while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)!=EOF){
			printf("%.3lf %.3lf\n",(double)(c*e-b*f)/(a*e-b*d)+1e-15,(double)(a*f-c*d)/(a*e-b*d)+1e-15);
		}
		return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef unsigned long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const ll inf = 1e18;
const int N = 1e6+9;

bool isOverflow(ll a, ll b) { 
    // Check if either of them is zero 
    if (a == 0 || b == 0)
        return false; 
      
    ll result = a * b; 
    if (a == result / b) 
        return false; 
    else
        return true; 
} 
void solve() {
	ll a, b, n;
	cin>>n;
	int ok=1, zero=0;
	ll s=1;
	for(int i=1;i<=n;++i) {
		cin>>a;
		if(a==0) zero=1;
		if(isOverflow(s, a)) ok=0;
		s*=a;
		if(s>inf) ok=0;
	}
	if(zero) cout<<0<<endl;
	else if(ok) cout<<s<<endl;
	else cout<<-1<<endl;
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
    	solve();
    }
    return 0;
}

// ll, reset, 1, bottom

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

int main(){
  int N;
  double a, b; // 分子, 分母
  cin >> N;
  
  b = N;
  a = N%2 ? (N+1)/2.0 : N/2.0;
 
  printf("%.6f\n", a/b);
  return 0;
}
  

Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    A = []
    for i in range(N):
        A.append(deque(map(lambda x: int(x)-1, input().split())))
    
    dbg('hoge')
    ans = 0
    players = deque(range(N))
    calc = 0
    
    match = defaultdict(lambda : -1)
    first = True
    while True:
        mathced = False
        next_players = deque()
        next_match = defaultdict(lambda : -1)
        # dbg('day',ans)
        for i in players:
            # dbg(i,ans,players,A,match)
            calc += 1
            a = A[i]
            if len(a) == 0:
                continue
            j = a[0]
            b = A[j]

            
            
            if match[j] == i and match[i] == j:
                # dbg(i,j)
                b.popleft()
                # if b[0] != i:
                #     dbg('fuga')
                a.popleft()
                mathced = True
                match[i] = -1
                match[j] = -1
                if len(a) > 0:
                    next_match[i] = a[0]
                    next_players.append(i)

                if len(b) > 0:
                    next_match[j] = b[0]
                    next_players.append(j)


            else:
                next_match[i] = a[0]

        players = next_players
        match.update(next_match)
        if first:
            dbg('hogehoge')
            first = False
            players = range(N)
            continue
        ans += 1
        if not mathced or len(players) == 0:
            break

        
    print(ans if mathced and len(next_players)==0 else -1)
    dbg(calc,mathced,len(next_players),len(a),len(b))







    

    ans = 0

    

    
   
main()

Measured memory_bytes: 102968
import math

N = int(input())
List = []

for i in range(N):
  List.append(list(map(int,input().split())))
  
tot = 0

for m in range(N):
  for n in range(N):
    tot += math.sqrt((List[m][0]-List[n][0])**2+(List[m][1]-List[n][1])**2)

print(tot/N)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
ll mod=1e9+7;
       

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


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define long int64_t
using namespace std;

struct Solver {
	void solve() {
		int N, M;
		cin >> N >> M;
		vector<vector<int>> cn( M );
		for( int i = 0; i < M; ++i ) {
			int k;
			cin >> k;
			for( int j = 0; j < k; ++j ) {
				int s;
				cin >> s;
				cn[i].push_back( s-1 );
			}
		}
		vector<int> p( M );
		for( int i = 0; i < M; ++i ) { cin >> p[i]; }

		int ans = 0;
		for( int swb = 0; swb < (1<<N); ++swb ) {
			bool ok = true;
			for( int i = 0; i < M; ++i ) {
				int onsw = 0;
				for( auto x: cn[i] ) {
					if( swb & (1 << x) ) { onsw += 1; }
				}
				if( onsw%2 != p[i] ) {
					ok = false;
					break;
				}
			}
			ans += ok;
		}

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


Measured memory_bytes: 3632
inputs = input().split()
inputs = list(map(lambda x: int(x), inputs))
x_array = [inputs[0], inputs[1]]
y_array = [inputs[2], inputs[3]]
max = -1000000000000000000

for x in x_array:
    for y in y_array:
        if(max < x * y):
            max = x * y

print(max)

Measured memory_bytes: 9180
N, M = map(int, input().split())
min_c = 0
max_c = N
for i in range(M):
    L, R = map(int, input().split())
    min_c = max(min_c, L)
    max_c = min(max_c, R)

print(max(0, max_c - min_c + 1))


Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>

using namespace std;

char S[11];
map<string, int> m;

int main()
{
    int N;

    cin >> N;
    while(N--){
        cin >> S;
        ++m[S];
    }
    cout << m.size();

    return 0;
}


Measured memory_bytes: 19228
#include <iostream>
#include <cstring>
#define MOD 1000000007
using namespace std;

int a,b,c;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a>>b>>c;
	if(a==5&&b==5&&c==7)cout<<"YES";
	else if(a==5&&b==7&&c==5)cout<<"YES";
	else if(a==7&&b==5&&c==5)cout<<"YES";
	else cout<<"NO";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int ar[100005];
int e[100005];
int32_t main(){
	int n;cin>>n;for(int i=1;i<=n;i++) cin>>ar[i];
	e[n]=1;
	for(int i=n-1;i>=1;i--){
		if(ar[i]>=ar[i+1]) e[i]=e[i+1]+1;
		else e[i]=1;
	}
	cout<<*max_element(e+1,e+n+1)-1;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
import collections as cl
from math import factorial

def comb(n, r):
    if n >= r:
        return factorial(n) // (factorial(n - r) * factorial(r))
    else:
        return 0
  
n = int(input())
a = list(map(int, input().split()))

clc = cl.Counter(a)

# 1. 数字が等しいペアを選ぶ総数
npair = 0
for (k, v) in clc.items():
    npair += comb(v, 2)

# 2. (取り除いた数字と同じ数字を選ぶ総数) - (1)
for a_ in a:
    print(npair - (clc[a_] - 1))


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

vector<P>E[30];
int d[30];
int e[30];

int main(){
	memset(d,0x3f,sizeof(d));
	memset(e,0x3f,sizeof(e));
	int n,m;cin>>n>>m;
	rep(i,m){
		int a,b,c,d;scanf("%d,%d,%d,%d",&a,&b,&c,&d);
		a--;b--;
		E[a].push_back(P(b,c));E[b].push_back(P(a,d));
	}
	int s,g,a,b;scanf("%d,%d,%d,%d",&s,&g,&a,&b);
	s--;g--;
	priority_queue<P,vector<P>,greater<P>>pque;
	pque.push(P(s,0));
	d[s]=0;
	while(!pque.empty()){
		P p=pque.top();pque.pop();
		if(p.second>d[p.first])continue;
		for(P i:E[p.first]){
			if(d[i.first]>d[p.first]+i.second){
				d[i.first]=d[p.first]+i.second;
				pque.push(P(i.first,d[i.first]));
			}
		}
	}
	pque.push(P(g,0));
	e[g]=0;
	while(!pque.empty()){
		P p=pque.top();pque.pop();
		if(p.second>e[p.first])continue;
		for(P i:E[p.first]){
			if(e[i.first]>e[p.first]+i.second){
				e[i.first]=e[p.first]+i.second;
				pque.push(P(i.first,e[i.first]));
			}
		}
	}
	cout<<a-b-d[g]-e[s]<<endl;
}

Measured memory_bytes: 3252
from statistics import median

la = []
lb = []
for _ in range(int(input())):
    a, b = map(int, input().split())
    la.append(a)
    lb.append(b)

ma = median(la)
mb = median(lb)
if len(la) % 2:
    print(int((mb - ma) + 1))
else:
    print(int(2 * (mb - ma) + 1))

Measured memory_bytes: 28936
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[3] = {-1,0,1};
int main(){
    int h,w;cin>>h>>w;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    rep(i,h){
        int now = i;
        cout<<s[now]<<endl;
      cout<<s[now]<<endl;
    }
}



Measured memory_bytes: 256
//wawando's template

#include <iostream>
#include <string>
#include <fstream>
#include <functional>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <set>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>  //clock_t , clock() , CLOCKS_PER_SEC
#include <cstring>
#include <cctype>
#include <climits> // LLONG_MAX , LLONG_MIN , INT_MAX , INT_MIN

//MACROS
#define pb              push_back
#define mp              make_pair
#define INF             1000000000     //1 billion safer for floyd warshall, avoid overflow

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int main() {
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(0);
  	string s;
  	cin >>s;
  	if(s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) cout <<"Bad" <<endl;
  	else cout <<"Good" <<endl;
  return 0;
}


Measured memory_bytes: 256
ninzu, syurui = map(int, input().split())

shoji = [ 0 for _ in range(ninzu) ]

for _ in range(syurui):
    num = int(input())
    
    if num == 1:
        man = int(input())
        shoji[man-1] += 1
    else:
        mans = map(int, input().split())
        for man in mans:
            shoji[man-1] += 1

ans = 0
for sman in shoji:
    if sman == 0:
        ans += 1

print(ans)


Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	long long ans=0;
	for (int i=1;i<=n;i++)
	ans+=i*(n-i+1LL);
	for (int i=1;i<n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		if (a>b)
		swap(a,b);
		ans-=a*(n-b+1LL);
	}
	printf("%lld",ans);
}

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	bool vis[101];
	memset(vis, 0, sizeof(vis));
	int x, n;
	cin >> x >> n;
	for (int i=0; i<n; i++) {
		int x;
		cin >> x;
		vis[x] = true;
	}
	for (int i=0;; i++) {
		if (x-i == 0) {cout << 0; return 0;}
		if (!vis[x-i]) {cout << x-i; return 0;}
		if (x+i > 100) {cout << 101; return 0;}
		if (!vis[x+i]) {cout << x+i; return 0;}
	}
}

Measured memory_bytes: 3620
n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]

li = []

for i in range(2**10):
    if i == 0:
        continue
    ans = 0
    co = [0]*n
    for j in range(10):
        if (i>>j &1)==1:
            for k in range(n):
                if f[k][j]==1:
                    co[k] +=1
    #print(i,bin(i),co)
    for l in range(n):
        ans += p[l][co[l]]
    li += [ans]
print(max(li))

Measured memory_bytes: 9124
S = input()
n = len(S)

while True:
    m = len(S)
    S = S[:m - 2]
    if not S:
        print(1)
        exit()
    m = len(S)
    if S[:int(m / 2)] + S[:int(m / 2)] == S:
        print(len(S))
        exit()


Measured memory_bytes: 38384
fn main() {
    const N_MAX: usize = 50;
    let mut layers = [1 as u64; N_MAX + 1];
    let mut patties = [1 as u64; N_MAX + 1];
    for i in 1..N_MAX + 1 {
        layers[i] = 2 * layers[i - 1] + 3;
        patties[i] = 2 * patties[i - 1] + 1;
    }

    let v = read_nums();
    let (N, X) = (v[0] as usize, v[1]);
    println!("{}", solve(N, X, &layers, &patties));

    fn solve(n: usize, x: u64, layers: &[u64], patties: &[u64]) -> u64 {
        if x == 0 {
            return 0;
        }
        if n == 0 {
            return 1;
        }
        let mut l = [0; 6];
        let mut p = [0; 6];
        l[0] = 0;
        p[0] = 0;
        l[1] = l[0] + 1;
        p[1] = p[0] + 0;
        l[2] = l[1] + layers[n - 1];
        p[2] = p[1] + patties[n - 1];
        l[3] = l[2] + 1;
        p[3] = p[2] + 1;
        l[4] = l[3] + layers[n - 1];
        p[4] = p[3] + patties[n - 1];
        l[5] = l[4] + 1;
        p[5] = p[4] + 0;
        if x <= l[1] {
            p[1]
        } else if x <= l[2] {
            p[1] + solve(n - 1, x - l[1], layers, patties)
        } else if x <= l[3] {
            p[3]
        } else if x <= l[4] {
            p[3] + solve(n - 1, x - l[3], layers, patties)
        } else {
            p[5]
        }
    };
}

fn read_str() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).expect("Failed to read input.");
    s
}

fn read_num() -> u64 {
    read_str().trim().parse().expect("Could not parse.")
}

fn read_nums() -> Vec<u64> {
    let s = read_str();
    let a: Vec<&str> = s.split(' ').collect();
    let mut v: Vec<u64> = Vec::new();
    for x in a {
        v.push(x.trim().parse().expect("Could not parse."));
    }
    v
}

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

bool is_palindrome(string s)
{
	bool equal = true;
	for (int i=0;i<s.length()/2;i++)
	{
		if (s[i]!=s[s.length()-1-i])
		{
			equal=false;
			break;
		}
	}
	return equal;
}
int main ()
{
//	ios_base::sync_with_stdio(false);
//	cin.tie(NULL);
	
//	freopen ("//specify file name","r",stdin);
//	freopen ("output.txt","w",stdout);
	
	int a,b;
	cin>>a>>b;
	
	int count=0;
	
	for (int i=a;i<=b;i++)
	{
		if (is_palindrome(to_string(i)))
			++count;
		
	}
	cout<<count;
	
	return 0;
	
}

Measured memory_bytes: 256
n=int(input())
s=[input() for i in range(n)]
for i in range(n):
  s[i]=sorted(s[i])
s=sorted(s)
counta=1
ans=0
for i in range(n-1):
  if s[i]==s[i+1]:
    counta+=1
  else:
    ans+=counta*(counta-1)//2
    counta=1
ans+=counta*(counta-1)//2
print(ans)

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
	fast_io
	vi a(3);
	for(int& i: a) cin>>i;
	sort(a);
	cout<<(a[1]-a[0]+a[2]-a[1]);
	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        String s = sc.next();
        int n = s.length();
        int ans = n;
        int[] num = new int[n + 1];

        if (s.charAt(0) != s.charAt(1)) {
            num[1] = 1;
            num[2] = 2;
        } else {
            num[1] = 1;
            num[2] = 1;
        }

        for (int i = 3; i <= n; i++) {
            if (s.charAt(i - 2) == s.charAt(i - 1)) {
                num[i] = num[i - 3] + 2;
            } else {
                num[i] = num[i - 1] + 1;
            }
        }
        System.out.println(num[n]);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 25044
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main(){
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    ll dis = abs(B - A);
    ll v = V - W;
    bool flag = false;
    if(T * v >= dis) flag = true;
    if(flag) cout << "YES" << endl;
    else cout << "NO" << endl;

}

Measured memory_bytes: 3588
n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)

arr_even = arr.select {|i| i.even? }
t = []
for i in arr_even do
  if i % 3 == 0 || i % 5 == 0
    t << 'Ok'
  end
end

if t.size == arr_even.size
  print('APPROVED')
else
  print('DENIED')
end


Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string s; cin >> s;
    rep(i,s.size()) {
        if(s[i] == 'C') {
            repk(j,i+1,s.size()) {
                if(s[j] == 'F') {cout << "Yes" << endl; return 0;}
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=200005,INF=1<<30;
int par[MAX];

vector<int> G[MAX];


void BFS(){
    queue<int> Q;
    Q.push(0);
    
    while(!Q.empty()){
        int u=Q.front();Q.pop();
        for(int to:G[u]){
            if(par[to]==-1){
                par[to]=u;
                Q.push(to);
            }
        }
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    
    for(int i=0;i<N;i++) par[i]=-1;
    par[0]=0;
    
    for(int i=0;i<M;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    
    BFS();
    
    bool ok=true;
    
    for(int i=1;i<N;i++) if(par[i]==-1) ok=false;
    
    if(!ok) cout<<"No\n";
    else{
        cout<<"Yes\n";
        for(int i=1;i<N;i++){
            cout<<par[i]+1<<"\n";
        }
    }
}



Measured memory_bytes: 12916
import java.util.Scanner;

public class Main {

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

		String ref = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				return;
			}
			int[] k = new int[n];
			for(int i=0;i<n;i++){
				k[i] = stdIn.nextInt();
			}
			stdIn.nextLine();		// 空回し
			String s = stdIn.nextLine();
			String ans = "";
			int idx = -1;
			for(int i=0;i<s.length();i++){
				if(++idx==n) idx = 0;
				char nowChar = s.charAt(i);
				int nowIdx = ref.indexOf(nowChar);
				int nextIdx = nowIdx-k[idx];
				if(nextIdx<0) nextIdx += 52;
				char nextChar = ref.charAt(nextIdx);
				String temp = String.valueOf(nextChar);
				ans += String.valueOf(temp);
			}
			System.out.println(ans);
		}
	}
}

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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define PI 3.14159265359 //πの値
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

 
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
ll N, s; cin >> N;
ll ans = 0;
ll sum = 0;
vector<ll> data(N);
REP(i, N) {
cin >> data[i];
sum += data[i];
}
REP(i, data.size()-1){
  sum -= data[i];
  ans += data[i]*(sum%MOD);
  ans %= MOD;
}
  cout << ans;
}

Measured memory_bytes: 4764
import math

input1 = input()
input1 = input1.split()
N, D = int(input1[0]), int(input1[1])
point = []
x = []
y = []
for i in range(N):
    input2 = input()
    input2 = input2.split()
    point.append(input2)
    x.append(int(input2[0]))
    y.append(int(input2[1]))
m = []
for i in range(N):
    dist = math.sqrt(x[i]*x[i] + y[i]*y[i])
    m.append(dist)
count = 0
for i in range(N):
    if(m[i]<=D):
        count = count+1
print(count)


Measured memory_bytes: 91664
S=input()
c = 0
def judge(S):
    c = 0
    if len(S)==1:
        return 'No'
    for i in range(len(S)):
        if i%2==0:
            if S[i] =='h':
                c += 1
            else:
                return 'No'
        else:
            if S[i] =='i':
                c -=1
            else:
                return 'No'
    if c==0:
        return 'Yes'
    else:
        return 'No'
print(judge(S))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;
using ll = long long;
using P = pair<ll, ll>;
vector<int> to[100005];
int cost[100005];

int x[10];
int y[10];

double dist(ll i, ll j) {
    int xx = (x[i]-x[j])*(x[i]-x[j]);
    int yy = (y[i]-y[j])*(y[i]-y[j]);
    return sqrt(xx+yy);
}

signed main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];

    sort(v.begin(), v.end());

    double ans = 0;
    rep(i, n-1) {
        v[i+1] = (v[i]+v[i+1])/2.0;
    }
    cout << v[n-1] << endl;

    return 0;
}



Measured memory_bytes: 2560
N=int(input())
A,B,C=[list(sorted(map(int,input().split()))) for i in range(3)]

count=0

def bs_l(lis,x):
    low,high=0,len(lis)
    while low<high:
        mid=(low+high)//2
        if lis[mid]<x:
            low=mid+1
        else:
            high=mid
    return low        

def bs_r(lis,x):
    low,high=0,len(lis)
    while low<high:
        mid=(low+high)//2
        if lis[mid]>x:
            high=mid
        else:
            low=mid+1
    return low        

for i in B:
    count+=bs_l(A,i)*(N-bs_r(C,i))


print(count)

Measured memory_bytes: 29120
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

n,m = map(int,input().split())
d = [[inf]*n for i in range(n)]
for i in range(n):
    d[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
edge = deepcopy(d)
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])
ans = set()
for i in range(n):
    for j in range(n):
        if edge[i][j] < inf and edge[i][j] > 0:
            ans.add((i,j))
for i in range(n):
    a = set()
    for j in range(n):
        if edge[i][j] !=inf and edge[i][j] > d[i][j]:
            a.add((i,j))
    ans = ans & (ans-a)
print(m-len(ans)//2)

Measured memory_bytes: 44764
// abc124_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    int ans = 0;
    REP(i, N) {
        bool ok = true;
        REP(j, i) {
            if (H[j] > H[i]) ok = false;
        }
        if (ok) ans++;
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 256