akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N; cin >> N;
  long long ans = 1LL << 60;
  for (long long i = 1; i*i <= N; i++) {
    if (N % i != 0) continue;
    long long j = N / i;
    ans = min(ans, i + j - 2);
  }
  cout << ans << endl;
}

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

int main(){
    string s;
    int nc[26]={};

    while(getline(cin, s)){
        for(int i=0; i<(int)s.length(); i++){
            if('a' <= s[i] && s[i] <= 'z') nc[s[i]-'a']++;
            if('A' <= s[i] && s[i] <= 'Z') nc[s[i]-'A']++;
        }
    }
    for(int i=0; i<26; i++){
        cout << (char)('a'+i) << " : " << nc[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;
int main(){
int n;
cin>>n;
vector<vector<int>>a(n+1,vector<int>(3));
a.at(0)={0,0,0};

int yokoidou=0,tateidou=0,zikan=0;

for(int i=1;i<n+1;i++){
    for(int j=0;j<3;j++){
        cin>>a.at(i).at(j);
    }
}

for(int i=0;i<n;i++){
   yokoidou=a.at(i+1).at(1)-a.at(i).at(1);
   tateidou=a.at(i+1).at(2)-a.at(i).at(2);
   zikan=a.at(i+1).at(0)-a.at(i).at(0);
if(yokoidou+tateidou>zikan||abs((yokoidou+tateidou)%2)!=abs(zikan%2)){
    cout<<"No"<<endl;
break;
}
if(i==n-1){
    cout<<"Yes"<<endl;
}
}
}













Measured memory_bytes: 5760
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz // math is your friend
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int x,y,z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl;

	return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
import math
N,M=map(int,input().split())
dd=defaultdict(int)
m=M
mod=10**9+7
for i in range(2,10**5):
    s=0
    while m%i==0 and m>1:
        m=m//i
        s+=1
    if s>0:
        dd[i]=s
if m>1:
    dd[10**9]=1
def f(n,k):
    a=1
    for i in range(1,k+1):
        a=a*(n-i+1)
        a%=mod
        a*=pow(i,mod-2,mod)
        a%=mod
    return a
ans=1
for l,t in dd.items():
    ans*=f(N-1+t,t)
    ans%=mod
print(ans)



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

int main(){
  ll N; cin>>N;
  vector<ll> P(N+1);
  ll ans=0;
  for(ll i=1; i<=N; i++) cin>>P[i];
  for(ll i=1; i<=N-1; i++){
    if(P[i]==i){
      P[i]=P[i+1];
      P[i+1]=i;
      ans++;
    }
  }
  if(P[N]==N) ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#ABC133_C

L,R=map(int,input().split())

ans=2019

if (R-L)>=2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019<=ans:
                ans=i*j%2019
    print(ans)

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

int memo[501][501][10][3][2];
// [n桁目][剰余][どの数字を使った]
// [どっちでも、上昇、下降][上限を超えそう/超えない]

char A[1024], B[1024];
int M;
char *str;

int dp(int n, int mod, int use, int updn, int limit)
{
	if (str[n] == '\0')	return mod == 0 && (use || updn);
	
	if (memo[n][mod][use][updn][limit]){
		return memo[n][mod][use][updn][limit];
	}
	
	int res = 0;
	for (int i = 0; i <= 9; i++){
		if ( (limit == 1 || (limit == 0 && i <= str[n] - '0')) && ((updn == 0 && (!use || (use != i))) || ((updn == 1 && i < use) || (updn == 2 && i > use))) ){
			int UPDN = 0;
			if (updn == 0){
				if (use != 0){
					if (i < use) UPDN = 2;
					else UPDN = 1;
				}
			}
			else UPDN = !(updn - 1) + 1;
			
			res += dp(n + 1, (mod * 10 + i) % M, i, UPDN, limit || i < str[n] - '0');
			res %= 10000;
		}
	}
	
	memo[n][mod][use][updn][limit] = res;
	return res;
}
			
int main()
{
	scanf("%s %s %d", A, B, &M);
	
	int p = strlen(A) - 1;
	while (true){
		if (A[p] > '0'){
			A[p]--;
			break;
		}
		else {
			A[p] = '9';
			p--;
		}
	}
	
	str = A;
	int tmp = dp(0, 0, 0, 0, 0);
	str = B;
	memset(memo, 0, sizeof(memo));
	printf("%d\n", (dp(0, 0, 0, 0, 0) - tmp + 10000) % 10000);
	
	return 0;
}

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

int main(){
	int N, M;
	while(std::cin >> N >> M, N, M){
		int mas[1001];
		int now = 0;
		for(int i=0;i<1001;++i)mas[i]=0;
		for(int i = 0; i < N; ++i){
			std::cin >> mas[i];
		}
		int ans = 0;
		int sai[1001];
		for(int i=0;i<1001;++i)sai[i]=0;
		for(int i = 0; i < M; ++i){
			std::cin>>sai[i];
		}
		for(int i=0;i<M;++i){
			now += sai[i];
			//std::cout<<now<<"!"<<std::endl;
			if(now >= N-1 && ans == 0){
				ans=i+1;
				break;
			}
			else now += mas[now];
			//std::cout<<now<<"!"<<std::endl;
			if(now >= N-1 && ans == 0){
				ans=i+1;
				break;
			}
		}
		std::cout << ans << std::endl;
	}
	return 0;
}
	
	

Measured memory_bytes: 1168
/*{{{*/
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>

using namespace             std;
typedef long long           ll;
typedef unsigned long long  ull;
typedef pair<ll, ll>        P;
const double                PIE = 3.141592;

#define rep_n(i, a, b)  for (int i=a; i<b; i++)
#define rep(i, n)       rep_n(i, 0, n)
#define all(v)          (v).begin(), (v).end()
#define item(v)         sizeof(v)/sizeof(v[0])
#define tov(v)          v, v+item(v)
#define mp(x, y)        make_pair(x, y)
#define mset(x, y)      memset(x, y, sizeof(x))
#define chmin(x,y)      (x=min(x, y))
#define chmax(x,y)      (x=max(x, y))
#define SORTI(v)        sort(v, v+item(v))
#define SORT(v)         sort(d.begin(), d.end());
#define UNIQUE(x)       x.erase(unique(all(x)), x.end())
#define ins(x, y, z)    x.insert(x.begin()+y, z)
#define era(x, y)       x.erase(x.begin()+y)
#define era1(x, y, z)   x.erase(x.begin()+y, x.begin()+z)
#define COUNT(x, y)     count(all(x), y)
#define FIND(x, y)      find(all(x), y) - x.begin()

#define ci1(a)          cin>>a 
#define ci2(a, b)       cin>>a>>b
#define ci3(a, b, c)    cin>>a>>b>>c
#define ci4(a, b, c, d) cin>>a>>b>>c>>d
#define co1(a)          cout<<a<<endl;
#define co2(a, b)       cout<<a<<" "<<b<<endl;
#define co3(a, b, c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define co4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
/*}}}*/

int main() {
    char a, b;
    ci2(a, b);
    if (a>b)        {co1(">");}
    else if (a<b)   {co1("<");}
    else            {co1("=");}
    vector<ll> v;



}

///*debug*/co1();


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <chrono>
#include <vector>

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

int main()
{
    int N;
    cin >> N;
    vector<edge_pair> ans_pairs;
    int sum = N;
    if (N % 2 == 0)
        sum++;
    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j < i; j++)
        {
            if (i + j == sum)
                continue;
            ans_pairs.push_back(edge_pair(j, i));
        }
    }
    cout << ans_pairs.size() << endl;
    for (int i = 0; i < ans_pairs.size(); i++)
    {
        cout << ans_pairs[i].first << " " << ans_pairs[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 384
=begin
N
P1 P2 ... Pn
=end

n= gets.chomp.to_i
ps = gets.chomp.split(" ").map(&:to_i)

min = 2 * 10 ** 6
count = 0

ps.each do |p|
  if min >= p
    count += 1
  end

  min = [min, p].min
end

puts count


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

int main(){

  string s;
  cin >> s;
  rep(i, 2){
    if(s[i] != s[i+1]){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";

  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
ans = Float::INFINITY

0.upto(n) do |i|
  x = i.to_s(6).each_char.map(&:to_i).sum
  y = (n - i).to_s(9).each_char.map(&:to_i).sum
  ans = [x + y, ans].min
end

puts ans

Measured memory_bytes: 14236
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    vector <int> triangles = {0};
    forn (i, 1, 60)
        triangles.pb(triangles.back() + i);
    long long n;
    cin >> n;
    int ans = 0;
    for (long long i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            int cnt = 0;
            while (n % i == 0) {
                n /= i;
                cnt++;
            }
            ans += --upper_bound(all(triangles), cnt) - triangles.begin();
        }
    }
    if (n > 1)
        ans++;
    cout << ans;
    return 0;
}

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

class unionfind {
  vector<int> par, s;
  
public:
  unionfind(int n) {
    for (int i = 0; i < n; i++) {
      par.push_back(i);
      s.push_back(1);
    }
  }
  
  int find(int n) {
    if (par.at(n) == n) return n;
    return find(par.at(n));
  }
  
  void merge(int m, int n) {
    m = find(m);
    n = find(n);
    if (s.at(m) > s.at(n)) swap(m, n);
    par.at(m) = n;
    s.at(n) += s.at(m);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  unionfind tr(n);
  for (int i = 0; i < q; i++) {
    int t, u, v;
    cin >> t >> u >> v;
    if (t == 0) {
      tr.merge(u, v);
    } else {
      cout << (tr.find(u) == tr.find(v)) << endl;
    }
  }
}


Measured memory_bytes: 4820
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#define ll long long 
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define REP(i,n) for (int i=0; i<(n); i++)
#define RREP(i,n) for (int i=(n-1); i>=0; i--)
#define ALL(x) x.begin(),x.end()
#define SZ(x) x.size()
#define MNTO(a,b) a = min(a,(__typeof__(a))(b))
#define MXTO(a,b) a = max(a,(__typeof__(a))(b))
#define pb push_back
#define debug(x) cerr<<#x<<" is "<<x<<endl
using namespace std;

// #define int ll

const int maxn = 1e5+5;
const int iinf = 1<<29;
const ll inf = 1ll<<60;
const ll mod = 1e9+7;


void GG(){cout<<"Impossible\n"; exit(0);}


main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    srand(time(NULL));
    int n; cin>>n;
    vector<int> v (n), a(n);
    REP(i,n) {
    	cin>>a[i]; v[a[i]]++;
    }
    sort(ALL(a));
    int mx = a[a.size()-1], mn = a[0];
    if (mn!=(mx+1)/2) GG();
    if (v[mn]!=(mx%2+1)) GG();
    FOR(i,mn+1, mx){
    	if (v[i]<2) GG();
    }
    cout<<"Possible"<<endl;

}

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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

const int MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); ++i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;
// TOP
void Main()
{
	vector<int> V(100010);
	int n;
	cin >> n;
	rep(i, n)
	{
		int x;
		cin >> x;
		if (x > 0)
			V.at(x - 1)++;
		V.at(x)++;
		V.at(x + 1)++;
	}
	auto it = max_element(V.begin(), V.end());
	cout << *it << endl;
}

// END

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,ans=0;
  cin >> n;
  vector<int> a(n),b(n),c(n);
  for(int i=0;i<n;i++)cin >> a[i];
  for(int i=0;i<n;i++)cin >> b[i];
  for(int i=0;i<n;i++)cin >> c[i];
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  for(int i=0;i<n;i++)ans+=(lower_bound(a.begin(),a.end(),b[i])-a.begin())*(c.end()-upper_bound(c.begin(),c.end(),b[i]));
  cout << ans << endl;
}


Measured memory_bytes: 4572
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 1000
//<<fixed << setprecision(9)
 
int main()
{
    int n,i,j,t,a;
    boost;
    int bulb;
    cin>>n>>bulb;
    vi arr[bulb];
    rep(i,0,bulb)
    {
        cin>>t;
        while(t--)
        {
            cin>>a;
            arr[i].pb(a);
        }
    } 
    int prr[bulb];
    rep(i,0,bulb) cin>>prr[i];
    int ans=0;
    rep(i,0,pow(2,n))
    {   
        int flag=1;
        rep(j,0,bulb)
        {
            int c=0;
            for(auto z:arr[j])
            {
                if(i&(1<<(z-1)))
                {
                    c++;
                }
            }
            if(c%2!=prr[j]) 
            {
                flag=0;break;
            }
        }
        if(flag) ans++;

    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pi pair<ll,ll>
#define fr freopen("in.txt","r",stdin)
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define frep(i,n) for(int i=1;i<=n;i++)
#define ll long long
#define f first
#define s second
#define maxn 200011

int main() {
    ll N;
    cin >> N;
    ll d= 0;
    ll S = N;
    while(S) {
        d+=S%10;
        S/=10;
    }
    if(N%d==0) {
        cout << "Yes";
    } else{
        cout << "No";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const int mod=1e9+7;
int p[maxn];
int sum[maxn];
int find(int x)
{
	if(x==p[x]) return x;
	return p[x]=find(p[x]);
}
void unt(int x,int y)
{
	int fx=find(x),fy=find(y);
	if(fx!=fy)
	{
		p[fx]=fy;
	}
 } 
int main()
{
	int cnt=0;int n,m;cin>>n>>m;
	for(int i=1;i<=n;i++) p[i]=i;
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		unt(x,y);
	}
	for(int i=1;i<=n;i++)
	{
		if(p[i]==i) cnt++;
	}
	cout<<cnt<<endl;
 } 

Measured memory_bytes: 640
#include<stdio.h>
int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	if (a < b)
	{
		printf("a < b\n");
	}
	if (a > b)
	{
		printf("a > b\n");
	}
	if (a == b)
	{
		printf("a == b\n");
	}
	return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> A(N,0);
    vector<ll> B(N,0);
    for(ll i=0;i<N;++i)cin>>A[i]>>B[i];
    sort(A.begin(), A.end());sort(B.begin(), B.end());
    if(N%2==1){
        prt((B[N/2]-A[N/2])+1)
    }
    else {
        ld a=((ld)A[N/2-1]+(ld)A[N/2])/2.0;
        ld b=((ld)B[N/2-1]+(ld)B[N/2])/2.0;
        ld k=b-a;
        ld r=2*k;
        ll R=r;
        prt(R+1)
    }
    
    return 0;
}


Measured memory_bytes: 6368
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}

ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll ans=0;
    string s;
    cin >> s;
    for (ll i=0;i<s.size()/2;i++){
        if (s[i]!=s[s.size()-i-1])ans++;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
n=int(input())
*a,=map(int, input().split( ))
b4=0;od=0;
for i in range(n):
    if a[i]%2:
        od+=1
    elif a[i]%4==0:
        b4+=1
if od>b4+1:
    print("No")
elif od==b4+1 and od+b4<n:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 62576
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  int n,data[11][11];
  while(1){
    for(int i=0;i<11;i++){
      for(int j=0;j<11;j++){
	data[i][j]=0;
      }
    }
    cin>>n;
    if(n==0){break;}
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	cin>>data[i][j];
      }
    }
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	data[i][n]+=data[i][j];
	data[n][i]+=data[j][i];
	data[n][n]+=data[i][j];
      }
    }
    for(int i=0;i<=n;i++){
      for(int j=0;j<=n;j++){
	printf("%5d",data[i][j]);
      }
       cout<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1188
fn main() {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };

    let n: i32 = s.parse().unwrap();

    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s = s.trim_right().to_owned();
        s
    };
    let v: Vec<char> = s.as_str().chars().collect();

    let mut res = 0;
    for (i, s) in v.iter().enumerate() {
        if i == 0 {
            res += 1;
            continue
        }
        if s != &v[i-1] {
            res += 1;
        }
    }


    println!("{}", res)
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll factorial(ll n) {
  ll answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}

ll combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

ll permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  int n;
  cin >> n;
  
  REP(i, n + 1) {
    if (floor(i * 1.08) == n)  {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        string t = Console.ReadLine();
        int S = s.Length;
        int T = t.Length;
        int len = Math.Min(S, T);
        int max = 0;
        for (int i = 1; i <= len; ++i) { if (s.Substring(S - i) == t.Substring(0, i)) { max = i; } }
        Console.WriteLine(Math.Max(S + T - max, N));
    }
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  string A, B; cin >> A >> B;
  cout << (A.size()>B.size()?"GREATER":A.size()<B.size()?"LESS":
           A>B?"GREATER":A<B?"LESS":"EQUAL") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>
#include <cctype>
#include <climits>
#include <list>
#include <queue>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  string s; cin>>s;
  bool ok = false;

  if(s[0] == s[1] && s[0] == s[2]) {
    ok = true;
  } else if(s[1] == s[2] && s[1] == s[3]) {
    ok = true;
  } else {
    ok = false;
  }

  string ans = ok ? "Yes" : "No";
  cout << ans << endl;
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 08.07.2020 11:28:00
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define ALL(v) (s).begin(), (s).end()
#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

  string s;
  cin>>s;

  int ans; 
  for(int i=2;i<SZ(s);i+=2)
  {
    bool flg=true;
    REP(j,(SZ(s)-i)/2)
    {
      if(s[j]!=s[j+(SZ(s)-i)/2])flg=false;
    }
    if(flg)
    {
      ans=SZ(s)-i;
      break;
    }
  }

  cout<<ans<<endl;

  return 0;
}

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

int main(){
  
  int n,k,sum=0;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i=0; i<k; i++){
    sum+=a[i];
  }
  cout << sum << endl;
}

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

int main(){
  string S;
  cin >> S;
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3))
    cout << "Bad";
  else
    cout << "Good";
}

Measured memory_bytes: 256
import sys
from pprint import pprint
import math

def solve(N, k, r, s, p, t):
    score = [r, s, p]
    ans = 0
    for i in range(k):
        new_t = []
        # print("i", i)
        # print(math.ceil(N / k))
        # print(N // k + 1)
        for j in range(math.ceil(N / k)):
            # print(j * k + i)
            if j * k + i >= len(t):
                break
            v = t[j * k + i]
            if v == "r":
                v_tmp = 0
            elif v == "s":
                v_tmp = 1
            else:
                v_tmp = 2
            new_t.append(v_tmp)
        # debug
        # pprint(new_t)
        len_nt = len(new_t)
        # dp_i = [0] * 3
        dp = []
        for _ in range(len_nt + 1):
            dp.append([0] * 3)
        for l in range(len_nt):
            for m in range(3):
                # 前回の手がmの場合
                for n in range(3):
                    # 今回の手がnの場合
                    if m == n:
                        continue

                    # print(m, n)
                    # 勝つ場合
                    # print(new_t[l], n)
                    if new_t[l] - n == 1 or n - new_t[l] == 2:
                        # print("win", score[n])
                        dp[l+1][n] = max(dp[l+1][n], dp[l][m] + score[n])
                    # それ以外の場合
                    else:
                        dp[l+1][n] = max(dp[l+1][n], dp[l][m])
        # print("score", i, max(dp[len_nt]))
        # pprint(dp)
        ans += max(dp[len_nt])
    # pprint(dp)
    print(ans)  

if __name__ == '__main__':
    n, k = map(int, sys.stdin.readline().strip().split(" "))
    r, s, p = map(int, sys.stdin.readline().strip().split(" "))
    t = list(sys.stdin.readline().strip())
    # debug
    # pprint(t)
    solve(n, k, r, s, p, t)

Measured memory_bytes: 61560
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vlll = vector<vll>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, LIS, digitDP, treeDP, Rerooting//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA, FordFulkerson//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q, T;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vector<vpll> path;
int main() {
	string S;
	cin >> S;
	ll pre = 0;
	for (i = 0; i < 3; i++) {
		if (S[i] == 'R') pre++;
		else {
			ans = max(ans, pre);
			pre = 0;
		}
	}
	ans = max(ans, pre);
	co(ans);
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n,k,s;
int main(){
    cin>>n>>k>>s;
    if(s==1000000000){
        REP(i,k)cout<<s<<" ";
        REP(i,n-k)cout<<1<<" ";
    }else{
        REP(i,k)cout<<s<<" ";
        REP(i,n-k)cout<<s+1<<" ";
    }
    cout<<endl;
}

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

int main() {
  int a, b;
  int kaiCnt = 0;

  cin >> a >> b;
  
  for(int i = a; i <= b; i++) {
    int t = i;
    if(t % 10 == (t / 10 / 10 / 10 / 10) % 10 &&
       (t / 10) % 10 == (t / 10 / 10 / 10) % 10) {
      kaiCnt++;
    }
  }
  cout << kaiCnt << endl;
  return 0;
}


Measured memory_bytes: 256
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

sums = [0,0,0]
curr_sum = 0
ps = primes(10**3)
pset = set(ps)
for i in range(3,10**5+1):
    for p in ps:
        if i%p == 0 and i not in pset:
            break
        if ((i+1)//2)%p == 0 and ((i+1)//2) not in pset:
            break
    else:
        curr_sum += 1
        # print(i)
    sums.append(curr_sum)
    

q = int(input())
ansl = []
for _ in range(q):
    l,r = map(int, input().split())
    ans = sums[r] - sums[l-1]
    ansl.append(ans)

for a in ansl: print(a)

# print(sums[:54])


Measured memory_bytes: 78960
#include<bits/stdc++.h>
#define R 10
#define C 10000
using namespace std;

int main(){
  int r,c,d[R][C],dcp[R][C],sum[C],cnt,ans;
  while(1){
    cin>>r>>c;
    if(!r&&!c)break;
    for(int i=0;i<r;i++)
      for(int j=0;j<c;j++)
	cin>>d[i][j],dcp[i][j]=d[i][j];
    ans=0;
    for(int i=0;i<(1<<r);i++){
      for(int j=0;j<r;j++)
	for(int k=0;k<c;k++)
	  d[j][k]=dcp[j][k];
      memset(sum,0,sizeof(sum));
      for(int j=0;j<r;j++){
	if(i&(1<<j)){
	  for(int k=0;k<c;k++)
	    d[j][k]=!d[j][k];
	}
	for(int k=0;k<c;k++)
	  sum[k]+=d[j][k];
      }
      cnt=0;
      for(int j=0;j<c;j++){
	if(sum[j]<r-sum[j])sum[j]=r-sum[j];
	cnt+=sum[j];
      }
      ans=max(ans,cnt);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1988
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-10;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
 
int b[110000];
long long finv[110000];
long long inv[110000];
long long fact[110000];
long long C(int a,int b){
	if(a<b)return 0;
	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
int t[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a+1;i++){
		scanf("%d",b+i);
		t[b[i]]++;
	}
	int key=0;
	for(int i=0;i<=a;i++)if(t[i]==2){
		key=i;
	}
	int L=a+2;
	int R=0;
	for(int i=0;i<=a;i++){
		if(b[i]==key){
			L=min(L,i);
			R=max(R,i);
		}
	}
	inv[1]=fact[0]=finv[0]=1;
	for(int i=2;i<110000;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<110000;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
	for(int i=1;i<=a+1;i++){
		long long ret=C(a+1,i);
		ret=(ret+mod-C(L+a-R,i-1))%mod;
		printf("%lld\n",ret);
	}
}

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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if (x >= r && y >= r && W - x >= r && H - y >= r){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);while((a%b)!=0){a=b;b=a%b;}return b;}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};



int main(){
  int n; cin>>n;
  int sum=0;
  int n10=INF;
  rep(i,n){
    int s; cin>>s;
    sum+=s;
    if(s%10!=0)
    n10=min(s,n10);
  }
  if(sum%10!=0)
  cout<<sum<<endl;
  else if(n10==INF)
  cout<<0<<endl;
  else{
    sum-=n10;
    cout<<sum<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int x[58], y[58];

double sq(double d) {
    return d * d;
}

double d(double X, double Y) {
    double ret = 0.0;
    for (int i = 0; i < n; ++i) {
        ret = max(ret, sqrt(sq(X - x[i]) + sq(Y - y[i])));
    }
    return ret;
}

double cal(double X) {
    double lo = 0, hi = 1000;
    for (int i = 0; i < 100; ++i) {
        double m1 = (lo + lo + hi) / 3, m2 = (lo + hi + hi) / 3;
        if (d (X,m1) < d(X, m2)) hi = m2;
        else lo = m1;
    }
    return d(X, lo);
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i];
    }
    double lo = 0, hi = 1000;
    for (int i = 0; i < 100; ++i) {
        double m1 = (lo + lo + hi) / 3, m2 = (lo + hi + hi) / 3;
        if (cal(m1) < cal(m2)) hi = m2;
        else lo = m1;
    }
    printf("%.12f\n", cal(lo));
    return 0;
}

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

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

using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  int a[100] = {};
  cin >> n;
  rep(i, n) cin >> a[i];
  bool flag = true;
  int ans = 0;
  while (flag) {
    flag = false;
    rep(i, n - 1) {
      if (a[i + 1] < a[i]) {
        int tmp = a[i];
        a[i] = a[i + 1];
        a[i + 1] = tmp;
        flag = true;
        ans++;
      }
    }
  }
  rep(i, n) {
    cout << a[i];
    if (i != n - 1) cout << ' ';
    else cout << endl;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
int main(){
  ll n; cin >> n;
  vector<ll> a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll ans = 0;
  rep(i,n){
    if(i%2==0&&a[i]%2==1)ans++;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3592
n = int(input())
a_list = list(map(int, input().split()))

min_a = min(a_list)
count = 0
while min_a % 2 == 0:
    min_a /= 2
    count += 1
for a in a_list:
    if a % 2 ** count != 0:
        a_count = 0
        while a % 2 == 0:
            a /= 2
            a_count += 1
        count = a_count

print(count)


Measured memory_bytes: 3060
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll ans;
ll n,k,q;
void solve()
{
    cin>>n;
    ll a[n+1],b[n+1],c[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    for(int i=1;i<n;i++)
    {
        cin>>c[i];
    }
    for(int i=1;i<=n;i++){
        
        if(i>1&&a[i]==a[i-1]+1)
            ans+=c[a[i-1]]+b[a[i]];
        else
            ans+=b[a[i]];
    }
    cout<<ans<<endl;
}   

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
   // int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(i % 2 == 0){
      if(!(s[i] == 'h' && s[i + 1] == 'i')){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#define vel vector<long long>
#define veb vector<bool>
#define vvel vector<vel>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
signed main() {
	int pr = 1000;
	pr *= pr * pr; pr += 7;
	int n; cin >> n;
	vel a(5);
	rep(i, 5) { cin >> a[i]; }
	sort(a.begin(), a.end());
	cout << ((n-1)/ a[0])+5 << endl;
	return 0;
}

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

using namespace std;

#define int long long

const int N = 1e5 + 5;
int k;

vector<long long> get(long long x)
{
    vector<long long> Res;
    Res.clear();
    Res.push_back(1);
    int Lim = sqrt(x) + 1;
    for (int i = 2; i <= Lim; i++)
    {
        if (x % i == 0)
        {
            int SZ = Res.size();
            long long t = 1;
            while (x % i == 0)
            {
                t = t * i;
                x /= i;
                for (int j = 0; j < SZ; j++)
                {
                    Res.push_back(Res[j] * t);
                }
            }
            Lim = sqrt(x) + 1;
        }
    }
    if (x > 1)
    {
        int SZ = Res.size();
        for (int i = 0; i < SZ; i++)
        {
            Res.push_back(Res[i] * x);
        }
    }
    return Res;
}

main() {
  ios_base::sync_with_stdio(false);
  cin >> k;
  vector <int> c;
  vector <int> e = get(k);
  for(auto &v : e) c.push_back(v);
  e = get(k - 1);
  for(auto &v : e) c.push_back(v);
  sort(begin(c), end(c)); c.erase(unique(begin(c), end(c)), end(c));
  int cnt = 0;
  for(auto &v : c) {
    if(v == 1) continue;
    int n = k;
    while(n % v == 0) n /= v;
    int u = n % v;
    cnt += (u == 1);
  }
  cout << cnt;
}


Measured memory_bytes: 384
import java.util.*;
import java.util.stream.Collectors;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        int f = 0, c = 0;
        Queue<Integer> que = new ArrayDeque<>();
        for (int i = 0; i < s.length(); i++) {
            if (s.substring(i, i + 1).equals("R")) {
                if (f == 1) {
                    f = 0;
                    que.add(c);
                    c = 0;
                }
                c++;
            } else {
                if (f == 0) {
                    f = 1;
                    que.add(c);
                    c = 0;
                }
                c++;
                if (i == s.length() - 1) {
                    que.add(c);
                }
            }
        }
        int ans[] = new int[s.length()];
        int pos = 0;
        while (que.size() > 0) {
            int x = que.poll();
            int y = que.poll();
            if ((x + y) % 2 == 0) {
                pos += x;
                ans[pos - 1] = (x + y) / 2;
                ans[pos] = (x + y) / 2;
                pos += y;
            } else if (x % 2 == 0) {
                pos += x;
                ans[pos - 1] = (x + y) / 2;
                ans[pos] = (x + y) / 2 + 1;
                pos += y;
            } else {
                pos += x;
                ans[pos - 1] = (x + y) / 2 + 1;
                ans[pos] = (x + y) / 2;
                pos += y;
            }
        }
        System.out.println(Arrays.stream(ans).mapToObj(String::valueOf).collect(Collectors.joining(" ")));
    }
}

Measured memory_bytes: 41864
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n + 1);
  a[0] = 0;
  for(int i = 1;i < n+1;i++){
    ll num = 0;
    cin >> num;
    a[i] = a[i - 1] + num;
  }
  /*for(auto& item:a)cout << item << " ";
  cout << endl;*/
  if(k == 1){
    cout << 0 << endl;
    return 0;
  }
  map<ll,ll> count;
  count[0]++;
  ll res = 0;
  if(a[1] % k == (ll)1)res++;
  for(int i = 1;i < n;i++){
    count[(a[i] - (i)) % k]++;
    if(i >= k - 1)count[(a[i - (k - 1)] - (i - (k - 1))) % k]--;//,cout << i << endl;
    res += count[(a[i + 1] - (i + 1)) % k];
    //cout << "i" << i << " " << res << endl;
        //for(auto& item:count)cout << i << "i " << item.first << " " << item.second << endl;
  }
  cout << res << endl;
  return 0;
}

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

#include <iostream>
using namespace std;
int main() {
  uint64_t n;
  cin >> n;
  string s;
  cin >> s;
  uint64_t cnt = 0;
  vector<int> r, g, b;
  r.reserve(n);
  g.reserve(n);
  b.reserve(n);
  for (size_t i = 0; i < n; i++) {
    if (s[i] == 'R') {
      r.emplace_back(i);
    } else if (s[i] == 'G') {
      g.emplace_back(i);
    } else {
      b.emplace_back(i);
    }
  }
  vector<int> vals(3);
  for (size_t i = 0; i < n; i++) {
    for (size_t j = i + 1; j < n; j++) {
      int diff = j - i;
      if (2 * j - i < n) {
        if (s[i] != s[j] && s[j] != s[2 * j - i] && s[i] != s[2 * j - i]) cnt++;
      }
    }
  }

  cout << r.size() * g.size() * b.size() - cnt << endl;
  return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

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

  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();

  if((a < b) && (b < c))
   System.out.println("Yes");

  else
   System.out.println("No");
 }
}


Measured memory_bytes: 26352
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, M; cin >> N >> M;
  vector<int> As(N); for (auto &A : As) cin >> A;
  int c = 0, s = accumulate(As.begin(), As.end(), 0);
  for (auto A : As)
    {if (A >= (s + 4 * M - 1) / (4 * M)) ++c;}
  puts(M <= c ? "Yes" : "No");}

Measured memory_bytes: 3596
S = input()
ns = [0 for i in range(len(S) + 1)]

for i in range(len(S)):
    if S[i] == '<':
        ns[i + 1] = ns[i] + 1

for i in range(len(S)):
    if S[-1 - i] == '>':
        ns[-2 - i] = max(ns[-1 - i] + 1, ns[-2 - i]) 

s = 0
for n in ns:
    s += n

print(s)


Measured memory_bytes: 26136
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#define debug cout

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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



int main() {
	int n;
	IL{
		cin>>n;
		if(n==0)break;
		int res=0;
		for(int i=0;i*i<=n;++i){
			rep(j,i+1){
				if(i*i+j*j>n)break;
				rep(k,j+1){
					if(i*i+j*j+k*k>n)break;
					rep(l,k+1){
						if(i*i+j*j+k*k+l*l>n)break;
						if(i*i+j*j+k*k+l*l==n)++res;
					}
				}
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import sys
read = sys.stdin.buffer.read
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
import math


def main():
	
	k=II()
	
	ans=0
	
	li=[[0]*(k+1) for i in range(k+1)]
	
	for a in range(1,k+1):
		for b in range(1,k+1):
			li[a][b]=math.gcd(a,b)
	
	
	for a in range(1,k+1):
		for b in range(1,k+1):
			for c in range(1,k+1):
				ans+=math.gcd(li[a][b],c)
				
	
	print(ans)





	
if __name__ == "__main__":
	main()


Measured memory_bytes: 9332