akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

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

        for(int i=0;i<n;i++){
            String str1 = sc.nextLine();
            if(str1.contains("Hoshino")){
                String str2 = str1.replace("Hoshino","Hoshina");
                System.out.println(str2);
            }else{System.out.println(str1);}

        }
    }
}


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

using namespace std;

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

  int n; 
  cin >> n;
  string res = "No";
  for (int i = 1; i < 10; ++i) {
    for (int j = 1; j < 10; ++j) {
      if (i * j == n) res = "Yes";
    }
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
/*****************************************************************
***   Author       : Md.Belal mondol shuvo                     ***
***   E-mail       : belalcseiu20@gmail.com                    ***
***   University   : Islamic University,Dept. of CSE           ***
***   Team         : IU_Little_Boys                            ***
***   Facebook     : https://web.facebook.com/mdbelal.mondol   ***
*****************************************************************/

#include<bits/stdc++.h>
#define ll long long int
#define clr(x) memset(x,0,sizeof(x))
#define MOD  1000000007
using namespace std;

ll ar[1003];

int main()
{
     ll  i,j,k,n,ca=1,tc,sum=0,a=0,b=0,c=0;
    cin>>k>>n>>a>>b;
    cout<<max(k*n,a*b)<<endl;


  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
H = []
for i in range(N):
    H.append(int(input()))

H = sorted(H)
min_diff = float('inf')
for i in range(0, N-K+1):
    diff = H[i+K-1] - H[i]
    if diff < min_diff:
        min_diff = diff
print(min_diff)


Measured memory_bytes: 51160
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>

using namespace std;
int main(){
    while (1) {
        int a,b,t;
        cin >> a >> b;
        if (a == 0 && b == 0) break;
        if (a>b){
            t=a;
            a=b;
            b=t;
        }
    
        cout << a << " " << b <<endl;
    }
        
    
}


Measured memory_bytes: 2988
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
int n;

void solve() {
    int a=1;
    bool f=false;
    rep(i,10) {
        if((n>>i)&1) {
            if(f) cout<<" "<<a;
            else {
                cout<<a;
                f=true;
            }

        }
        a<<=1;
    }
    cout<<endl;

}
int main() {
    while(cin>>n) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"

using namespace std;

#define dbg(x) { cerr << #x << " - " << x << endl; }

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int tot = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		tot += a[i];
	}
	int curr = 0;
	int diff = INT_MAX;
	for(int i = 0; i < n; i++) {
		curr += a[i];
		diff = min(diff, abs(tot - 2 * curr));
	}
	cout << diff << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
int cmp(const void *a, const void *b);
//your code here!

int main(void){
    char N[3];
    scanf("%s", N);
    printf((N[0]=='9'||N[1]=='9')?"Yes\n":"No\n");
    return 0;
}

int cmp(const void *a, const void *b){
    ll A=*(ll *)a, B=*(ll *)b;
    if(A==B)return 0;
    else return A>B ? 1:-1;//昇順ソート
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

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

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

	int N;
    int maxx=0;
    string S;

    map<string,int> mp;

    cin>>N;

    for (int i = 0; i < N; i++)
    {
        cin>>S;
        mp[S]++;

        maxx=max(mp[S],maxx);
    }

    vector<string> vec;

    for(auto x:mp){
        if(x.second==maxx){
            vec.push_back(x.first);
        }
    }

    sort(all(vec));

    for (size_t i = 0; i < vec.size(); i++)
    {
        cout<<vec.at(i)<<endl;
    }
    
    
    

	return 0;
}

Measured memory_bytes: 25584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    long double A, B, H, M;
    cin >> A >> B >> H >> M;
    printf("%.15Lf\n", sqrt(A*A + B*B - 2.0*A*B*cos(abs(H*2.0*M_PI/12.0 - M*2.0*M_PI/60.0 + M*2.0*M_PI/720.0))));
    return 0;
}


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

int main() {
  int N,cnt=1;
  cin >> N;
  vector<int> vec(N);
  for(int i=0; i<N; i++) {
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  for(int i=0; i<N; i++) {
    if(vec[i]<vec[i+1]) {
      cnt++;
    }
    else {
      cnt+=0;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
l, r = 0
nl, nr = 0
M.times do |i|
  l, r = gets.split.map(&:to_i)
  if i == 0
    nl, nr = l, r
  end
  if r < nl or nr < l
    puts 0
    exit
  end
  if nl < l
    nl = l
  end
  if r < nr
    nr = r
  end
  # puts "i=#{i} #{nl} #{nr}"
end

puts nr-nl+1

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
//#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
typedef pair<int,int> P;
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define lowbit(x) (x&-x)
const ll INF=0x3f3f3f3f;
const double EPS=1e-7;
const int N=5e5+10;
const ll mod=1e9+7;
inline ll read()
{  ll f=1,x=0;char ch=getchar();
   for(;ch>'9'||ch<'0';ch=getchar())if(ch=='-') f=-1;
   for(;ch<='9'&&ch>='0';ch=getchar()) x=x*10+ch-'0';
   return x*f;
}
struct node
{ int l,r,i;
}q[N];
int n,m,a[N],t[N],ans[N];
bool cmp(node a,node b)
{  
   return a.r<b.r;
}
void add(int x,int k)
{  while(x<=n)
   {  t[x]+=k;
      x+=lowbit(x);
   }
}
int ask(int x)
{  int res=0;
   while(x)
   {  res+=t[x];
      x-=lowbit(x);
   }
   return res;
}
int main()
{  cin>>n>>m;
   map<int,int>ma;
   for(int i=1;i<=n;i++)cin>>a[i];
   for(int i=1;i<=m;i++)cin>>q[i].l>>q[i].r,q[i].i=i;
   sort(q+1,q+1+m,cmp);
   int pre=1;
   for(int i=1;i<=m;i++)
   {  for(int j=pre;j<=q[i].r;j++)
      {  int v=a[j];
         if(ma[v])
         {  add(ma[v],-1);

         }
         ma[v]=j;
         add(j,1);
      }
      pre=q[i].r+1;
      ans[q[i].i]=ask(q[i].r)-ask(q[i].l-1);
   }
   for(int i=1;i<=m;i++)printf("%d\n",ans[i]);
}

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

using namespace std;

const int BIN = (1 << 17);
const long long INF = (1LL << 60);
const long long MOD = (long long)1e9 + 7;

struct Tree {
   long long m[2 * BIN];
   Tree() {
       for (int i = 0; i < 2 * BIN; i++) m[i] = INF;
   }
   void push(int x, long long val) {
       x += BIN;
       m[x] = val;
       x /= 2;
       while(x) {
           m[x] = min(m[x * 2], m[x * 2 + 1]);
           x /= 2;
       }
   }
   long long get(int l, int r, int x = 1, int lx = 0, int rx = BIN) {
       if (l >= rx || r <= lx) return INF;
       if (l <= lx && rx <= r) return m[x];
       int mid = (lx + rx) / 2;
       return min(get(l, r, x * 2, lx, mid), get(l, r, x * 2 + 1, mid, rx));
   }
} tree;


int bins(int r, long long val, auto &x) {
    int l = -1;
    while (r - l > 1) {
        int mid = (l + r) / 2;
        if (val < x[mid]) r = mid;
        else l = mid;
    }
    return r;
}


int main() {
    int n;
    long long a[2];
    cin >> n >> a[0] >> a[1];
    vector <long long> x(n);
    for (auto &v : x) {
        cin >> v;
    }
    sort(x.begin(), x.end());
    for (int i = 1; i < n; i++) {
        tree.push(i - 1, x[i] - x[i - 1]);
    }

    vector <vector<long long>> dp(n, vector <long long> (2, 0));
    dp[0][0] = dp[0][1] = 1;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 2; j++) {
            long long val = x[i] - a[j];
            int z = bins(i, val, x);
            if (z == i) {
                dp[i][j] = (dp[i - 1][j] + dp[i - 1][j ^ 1]) % MOD;
                continue;
            }
            if (tree.get(z, i - 1) < a[j ^ 1]) continue;
            dp[i][j] = dp[z][j ^ 1];
        }
    }

    cout << (dp[n - 1][0] + dp[n - 1][1]) % MOD;
    
    return 0;
}


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

int main() {
    int n,x;
    cin>>n;
    int c=1;
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>x;
        if(x==c){
            c++;
        }
        else{
            ans++;
        }
    }
    if(ans==n)
        ans=-1;
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

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

        BigDecimal a = new BigDecimal(sc.nextLong());
        BigDecimal b = BigDecimal.valueOf(sc.nextDouble());

        System.out.println(a.multiply(b).setScale(0, BigDecimal.ROUND_DOWN));
    }
}


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


    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;
    
    void solve(){
        long long n;
        cin>>n;
        int total=0;
        for(ll i=2;i*i<=n;i++){
            if(n%i==0){
                ll num=0;
                while(n%i==0){
                    n=n/i;
                    num++;
                }
                for(ll j=1; ; j++){
                    if(num<j)
                        break;
                    num-=j;
                    total++;
                }
            }
        }
        if(n!=1)
            total++;
        cout<<total;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}


const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

  COMinit();

  ll n, k;
  cin >> n >> k;

  if(n <= (k-1)){
    cout << COM(2*n-1, n-1) << endl;
  }else{

    ll ans = 0;
    

      for(int l = 0; l <= k; l++){
        ll tmp;
        tmp = 0;
        tmp = (tmp + (COM(n, l) * COM(n-1, n-l-1)) % MOD) % MOD;
        ans = (ans + tmp) % MOD;
      }

      cout << ans << endl;

  }

  return 0;
}


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

#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define FORD(i, b, e) for (int i = (b); i >= (int)(e); i--)
#define ll long long
#define st f
#define nd s
#define pb PB
#define eb emplace_back
#define mp make_pair				
#define siz(c) SIZ(c)
const int inf = 1e9 + 7;
const LL INF = 1e18L + 7;
 
#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type
{int o = 0; p << "{"; for (auto c : y) {if (o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if (p > y) p = y;}
sim, class s> void maxi(n &p, s y) {if (p < y) p = y;}

#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif

#define I(x) #x " = ", (x), " "
#define A(a, i) #a "[" #i " = ", i, "] = ", a[i], " "

#ifndef LOCAL
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

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

#else
#include</Users/dawid/algo/mac/ordered_set>
#endif

#define int ll
const int mod = 1e9+7;
const int N = 2007;

int n, k, ans;

int a[N];
int ile[N];

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

	cin >> n >> k;

	for(int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		++ile[a[i]];

		for(int j = 1; j < i; ++j)
		{
			if(a[j]>a[i])
				++ans;
		}
	}

	ans *= k;
	ans %= mod;

	int suf = 0;
	int inne = 0;

	for(int i = N-1; i >= 0; --i)
	{
		inne += suf*ile[i];
		inne %= mod;
		suf += ile[i];
	}

	inne *= k*(k-1)/2%mod;
	inne %= mod;

	ans += inne;
	ans %= mod;

	cout << ans << endl;
}



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

#define EPS (1e-7)
#define INF (1<<25)
#define PI (acos(-1))

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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

int main() {
  int n; cin >> n;
  vector<string> s(n); REP(i,n) cin >> s[i];
  int ans = 0;
  REP(i,n) {
    bool f = true;
    REP(k,n) REP(j,n) {
      if (s[(i+k)%n][j] != s[(i+j)%n][k]) f = false;
    }
    if (f) ans++;
  }
  cout << n*ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
long long ans,sum[200050],arr[200050],xro[200050];
int n,l=1;
int main()
{
 	std::scanf("%d",&n);
 	for(register int i=1;i<=n;++i) std::scanf("%lld",&arr[i]),sum[i]=sum[i-1]+arr[i],xro[i]=xro[i-1]^arr[i];
 	for(register int r=1;r<=n;++r)
 	{
 		while((sum[r]-sum[l-1])!=(xro[r]^xro[l-1])) l++;
 		ans+=r-l+1;
    }
    std::printf("%lld",ans);
}



Measured memory_bytes: 4992
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Cell Distance
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_L = 200000;
const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

ll fracs[MAX_L + 1];

/* subroutines */

ll powmod(ll a, int n) {  // a^n % MOD
  ll pm = 1;
  while (n > 0) {
    if (n & 1) pm = (pm * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return pm;
}

inline ll invmod(ll a) { return powmod(a, MOD - 2); }

inline ll nck(int n, int k) {  // nCk % MOD
  return fracs[n] * invmod(fracs[n - k]) % MOD * invmod(fracs[k]) % MOD;
}

ll calc(int n, int m) {
  ll sum = 0;
  for (int d = 1; d < n; d++)
    sum = (sum + (ll)d * (n - d) % MOD) % MOD;
  return sum * m % MOD * m % MOD;
}

/* main */

int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);

  int l = n * m - 2;
  fracs[0] = 1;
  for (int i = 1; i <= l; i++)
    fracs[i] = fracs[i - 1] * i % MOD;

  ll ans = (calc(n, m) + calc(m, n)) % MOD * nck(l, k - 2) % MOD;
  printf("%lld\n", ans);
  
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main() {
  ll a, b, c, n;
  cin >> a >> b >> c >> n;

  for (int i = 0; i < n; i++) {
    if (c <= b) {
      c *= 2;
    }else if (b <= a) {
      if (b*2 >= c) {
        c *= 2;
      }else {
        b *= 2; 
      }
    }
  }

  if (a < b && c > b) {
    cout << "Yes\n";
  }else {
    cout << "No\n";
  }

  return 0;
}


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

int main(){
  int N,ans=0;
  cin>>N;
  vector<int> L(N);
  for(int i=0; i<N; i++){
    cin>>L.at(i);
  }
  sort(L.begin(),L.end());
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      for(int k=0; k<N; k++){
        if(i<j&&j<k){
          if(L.at(i)==L.at(j))continue;
          if(L.at(i)==L.at(k))continue;
          if(L.at(k)==L.at(j))continue;
          if(L.at(i)+L.at(j)<=L.at(k))continue;
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n,m = gets.chomp.split.map(&:to_i)
h = gets.chomp.split.map(&:to_i)

path = Array.new(n)
m.times do |i|
  a,b = gets.chomp.split.map(&:to_i)
  a -= 1
  b -= 1
  path[a] ||= Set.new
  path[b] ||= Set.new
  path[a].add b
  path[b].add a
end

visited = Set.new
ans = 0
n.times do |i|
  next if visited.include? i
  visited.add i

  if path[i].nil?
    ans += 1
    next
  end

  hi = h[i]
  flg = true
  path[i].each do |j|
    if hi > h[j]
      visited.add j
    else
      flg = false
      break
    end
  end
  if flg
    ans += 1
  end
end

puts ans



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

int main()
{
    long long int N;
    cin >> N;
    vector<long long int> A(N);
    long long int i;
    for (i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    long long int count = 0;
    long long int maxi = 0;
    for (i = 0; i < N; i++)
    {
        if (maxi > A[i])
        {
            count += maxi - A[i];
        }
        maxi = max(maxi, A[i]);
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 4824
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc130_b

n, x = map(int, input().strip().split())
l = list(map(int, input().strip().split()))

d = 0
i = 0
while i < n:
    d += l[i]
    if d > x:
        break
    i += 1

print(i+1)


Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    vector<int> count(N, 0);
    int A;
    rep(i,N-1) {
        cin >> A;
        count[A - 1]++;
    }
    rep(i,N) {
        cout << count[i] << endl;
    }
    
    return 0;
}

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

int main(void){
    ll N,M; cin >> N >> M;
    ll H,W;
    ll ans=0;
    if(N<=M){
        H=N; W=M;
    }
    else{
        H=M; W=N;
    }

    if(H==1) ans=abs(W-2);
    else if(H>=3){
        ans=(H-2)*(W-2);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>



int main(void){
  
  int N, M;
  
  scanf("%d %d", &N, &M);
  
  char A[N][N+1];
  char B[M][M+1];
  
  
  
  int i;
  int j;
  int x, y;
  int cnt;
  int ans = 0;
  
  for( i = 0; i < N; i++ ){
    scanf("%s", A[i] );
  }
  for( i = 0; i < M; i++ ){
    scanf("%s", B[i] );
  }
  
  
  for( x = 0; x < N - M + 1; x++ ){
    for( y = 0;  y < N - M + 1; y++ ){
      cnt = 0;
      for( i = 0; i < M; i++ ){
        for( j = 0; j < M; j++ ){
          if(A[x+i][y+j] == B[i][j])cnt++;
          else{break;}
        }
      }
      if( cnt == M*M ) ans = 1;
      if( ans ) break;
    }
    if( ans )break;
  }
  
  if( ans ) puts("Yes");
  else{     puts("No");}
  
  
  return 0;
}

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

#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 rep(i,j,k) for(int i=j; i<k; ++i)
#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 
	int a,b,c;cin>>a>>b>>c;
	if(a+b+c>=22)cout<<"bust";
	else cout<<"win";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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 lli mod = 1e9+7;
lli n;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

int main(void){
  cin >> n;
  modint a, b, c, d;
  a = 10;
  b = 9;
  c = 9;
  d = 8;
  a = a.pow(n);
  b = b.pow(n);
  c = c.pow(n);
  d = d.pow(n);
  modint ans = a-b-c+d;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define x first
#define y second
#define y1 WHO_DEFINE_Y1_IN_HEADER
#define all(v) v.begin(), v.end()
using namespace std;

typedef long long ll;
typedef pair<ll, ll> p;

struct asdf{
	ll h1, h2;
	int len, idx;
	bool operator < (const asdf &t) const {
		if(h1 != t.h1) return h1 < t.h1;
		if(h2 != t.h2) return h2 < t.h2;
		if(len != t.len) return len < t.len;
		return idx < t.idx;
	}
};

vector<asdf> v;

const ll base1 = 919, base2 = 1217;
const ll p1 = 1e9+7, p2 = (1e9)-63;
int pv;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; string s; cin >> n >> s;
	v.reserve(606060);
	
	for(int i=0; i<s.size(); i++){
		ll now1 = 0, now2 = 0;
		for(int j=i; j<s.size(); j++){
			if(j-i+1 > n/2+3) break;
			now1 = now1 * base1 % p1;
			now1 += s[j] - 'a';
			now1 %= p1;
			now2 = now2 * base2 % p2;
			now2 += s[j] - 'a';
			now2 %= p2;
			v.push_back({now1, now2, j-i+1, i});
		}
	}
	sort(v.begin(), v.end());
	int front = 0;
	int ans = 0;
	if(v.size() == 1){
		cout << 0; return 0;
	}
	for(int i=1; i<v.size(); i++){
		if(v[i-1].h1 != v[i].h1 || v[i-1].h2 != v[i].h2 || v[i-1].len != v[i].len){
			front = v[i].idx; continue;
		}
		if(front + v[i].len <= v[i].idx){
			ans = max<ll>(ans, v[i].len);
		}
	}
	cout << ans;
}

Measured memory_bytes: 229520
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AGC009MultipleArray
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            long[] A = new long[N];
            long[] B = new long[N];
            string[] vals;
            for (int i=0; i < N; i++)
            {
                vals = Console.ReadLine().Split(' ');
                A[i] = long.Parse(vals[0]);
                B[i] = long.Parse(vals[1]);
            }

            long push = 0;
            long t;
            for(int i = N-1; i >= 0; i--)
            {
                A[i] += push;
                t = (A[i] / B[i]);
                if (A[i] % B[i] != 0)
                    t++;
                push += t * B[i] - A[i];
            }

            Console.WriteLine(push);
        }
    }
}


Measured memory_bytes: 17292
#include <iostream>
#include <algorithm>
using namespace std;
const static int LEN=100;
void trace(int a[],int N)
{
    int i;
    for(i=0;i<N-1;i++){
        cout<<a[i]<<" ";
    }
    cout<<a[i]<<endl;
}
int selectsort(int a[], int N)
{
    int num=0;
    for(int i=0;i<N;i++){
        int minx=i;
        for(int j=i;j<N;j++){
            if(a[j]<a[minx]){
                minx=j;
            }
        }
        swap(a[i],a[minx]);
        if(minx!=i) num++;
    }
    return num;
}
int main()
{
    int n;
    cin>>n;
    int a[LEN];
    for(int i=0;i<n;i++) cin>>a[i];
    int x=selectsort(a,n);
    trace(a,n);
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 3100
#include<iostream>
using namespace std;
void dfs(int n,int a[],int num){
    if(n == 0){
        for(int i=0;i<num-1;i++) cout << a[i] << " ";
        cout << a[num-1] << endl;
    }
    for(int i=n;i>0;i--){
        if(num > 0 && a[num-1] < i) continue;
        a[num] = i;
        dfs(n-i,a,num+1);
    }
}

int main(){
    int n,a[40];
    while(cin >> n,n!=0) dfs(n,a,0);
    return(0);
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N;
	cin>>N;
	int M,sum;
	M=N;
	sum =0;
	for(int i=0;i<M;i++){
//i<Nがそもそも違う
	
		sum += N%10;
		N /=10;
		if(N<0) break;
	}
	//数字の和がsumなので,一番最初のNがsumで割り切れたらYes
	
	if (M%sum ==0){
		cout <<"Yes"<<endl;
	}
	else {
		cout <<"No"<<endl;
	}
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<cctype>
#include<cstring>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;


int main() {
    string text;
    cin >> text;
    int q;
    cin >> q;
    rep(i, q) {
        string order;
        cin >> order;
        int a, b;
        cin >> a >> b;
        if ( order == "print" ) {
            cout << text.substr(a, (b - a) + 1) << endl;
        } else if ( order == "reverse" ) {
            string rev = text.substr(a, (b - a) + 1);
            int n = rev.size();
            rep( i, n ) text[i + a] = rev[n - i - 1];
        } else if ( order == "replace" ) {
            string change;
            cin >> change;
            text = text. replace(a, b - a + 1, change);
        }
    }

    return 0;
}


Measured memory_bytes: 3172
#include<cstdio>
#include<algorithm>
#include<iostream>

using namespace std;

const int Mod=1e9+7;

int n,m;
bool map[1010][1010];
int f[1010][1010];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			char c;
			cin>>c;
			if(c=='#')
			{
				map[i][j]=1;
			}
		}
	}
	f[1][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(map[i][j])
			{
				continue;
			}
			else
			{
				f[i][j]+=f[i-1][j];
				f[i][j]+=f[i][j-1];
				f[i][j]%=Mod;
			}
		}
	}
	printf("%d",f[n][m]%Mod);
	return 0;
}

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    ll x;
    cin >> x;

    if(x==2){
        cout << 2 << endl;
        return 0;
    }

    ll num = 3;
    vector<ll> prime(0);
    prime.push_back(2);
    while(num < x){
        for(ll i=0;i<prime.size()+1;i++){
            if(i==prime.size()){
                prime.push_back(num);
            }
            if(prime[i]*prime[i]>num){
                prime.push_back(num);
                break;
            }
            if(num%prime[i]==0){
                break;
            }
        }
        num++;
    }

    ll nnum=x;
    ll ans=-1;
    while(nnum >= x){
        for(int i=0;i<prime.size()+1;i++){
            if(i==prime.size()){
                ans = nnum;
                break;
            }
            if(prime[i]*prime[i]>nnum){
                ans = nnum;
                break;
            }
            if(nnum%prime[i]==0){
                break;
            }
        }
        if(ans != -1){
            break;
        }
        nnum++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    cin >> N;
    if(400 <= N && N <= 599) cout << 8 << '\n';
    else if (600 <= N && N <= 799) cout << 7 << '\n';
    else if (800 <= N && N <= 999) cout << 6 << '\n';
    else if (1000 <= N && N <= 1199) cout << 5 << '\n';
    else if (1200 <= N && N <= 1399) cout << 4 << '\n';
    else if (1400 <= N && N <= 1599) cout << 3 << '\n';
    else if (1600 <= N && N <= 1799) cout << 2 << '\n';
    else if (1800 <= N && N <= 1999) cout << 1 << '\n';
}

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

public class AtCoder_151_A
{
    public static void Main()
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        string a = Console.ReadLine();
        string[] ans = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };

        for (int i = 0; i < ans.Length; i++)
        {
            if (ans[i] == a)
            {
                Console.WriteLine(ans[i + 1]);
                break;
            }
        }
    }
}


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

ll modPow(ll a, ll n) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}

int main(){
  ll K,ans=0,N;
  string S;
  cin >> K >> S;
  N=S.size();
  vector<ll> comb(K+1);
  comb.at(0)=1;
  rep(i,K){
    comb.at(i+1)=comb.at(i)*modPow(i+1,MOD-2);
    comb.at(i+1)%=MOD;
    comb.at(i+1)*=N-1+i+1;
    comb.at(i+1)%=MOD;
  }
  rep(i,K+1){
    ll x;
    x=modPow(26,K-i)*modPow(25,i);
    x%=MOD;
    x*=comb.at(i);
    ans+=x;
    ans%=MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12064
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000000
#define E_MAX 10000

main(){
  int n, i;
  int *A, *B;
  int C[E_MAX+1];
  
  scanf("%d", &n);
  
  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);
  
  for( i = 0; i <= E_MAX; i++) C[i] = 0;
  
  for( i = 0; i < n; i++){
    scanf("%d", &A[i+1]);
    C[A[i+1]]++;
  }
  
  for( i = 1; i <= E_MAX; i++) C[i] = C[i] + C[i-1];
  
  for( i = n+1; 0 < i; i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  
  for( i = 1; i <= n; i++){
    if( i == n ) printf("%d\n", B[i]);
    else printf("%d ", B[i]);
  }

  return 0;
  
}

Measured memory_bytes: 16268
#include <bits/stdc++.h>
using namespace std;
    
#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define read(a)  for(int i = 0; i < n; i++) cin >> a[i];
#define print(a)  for(int i = 0; i < n; i++) cout << a[i] << " ";
#define pb push_back
#define pql priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define pqlv priority_queue<vi>
#define pqsv priority_queue<vi, vvi, greater<vi>>
#define endl '\n'
#define N 10000002
#define MOD 1000000007

signed main() {
    int n;
    cin >> n;
    n--;
    string s;
    int cnt = 1;
    while(n >= 0) {
        int r = n % 26;
        // cout << r << endl;
        // if(r == 0) r = 26;
        s += (r + 'a');
        // if(r == 26) n += 26;
        n /= 26;
        n -= (cnt);
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
#define int long long
typedef long long ll;
#define MAXN 800006
int n , m , res = 0;
char S[MAXN];
signed main() {
    cin >> n;
    scanf("%s",S + 1); S[0] = 'A';
    for( int i = 1 ; i <= n ; ++ i ) if( S[i] != S[i - 1] )
        ++ res;
    cout << res << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>  
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;
const ll longINF=3e18;
const double eps=1e-8;
const double dinf=190.0;
const double pi=acos(-1);
const int INF=2e9+1;

int l[51],k,n,res;
        
int main() 
{        
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        cin>>n>>k;
        for (int i=0;i<n;i++)
                cin>>l[i];
        sort(l,l+n);
        for (int i=n-1;i>=n-k;i--)
                res+=l[i];
        cout<<res;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<int> num(N + 1);
	for (int i = 0; i < N + 1; ++i)
	{
		num[i] = i;
	}
	vector<int> div(N + 1);
	for (int i = 2; i < N + 1; ++i)
	{
		for (int j = 1; j < N + 1; ++j)
		{
			while (num[j] % i == 0)
			{
				++div[i];
				num[j] /= i;
			}
		}
	}
	unsigned long long int ans = 1;
	for (int i = 0; i < N + 1; ++i)
	{
		ans = ans * (div[i] + 1) % 1000000007;
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 256
from math import ceil,floor,sqrt
import sys
N=int(input())
ans=0

def f(x):
    if x==0:
        return False
    else:
       return (N//x)==N%x
if N<=10000:
    for i in range(1,N+1):
        if f(i):
            ans+=i
    print(ans)
    sys.exit()
for i in range(1,int(sqrt(N))+5):
    if N%i==0:
        t = N // i
        if f(i-1):
            ans+=(i-1)
        if f(t-1):
            ans+=(t-1)
print(ans)

Measured memory_bytes: 40428
#include<cstdio>
#include<cstring>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	char s[1001],ss[1001][1001];
	int len,max,x,i,cnt[1001],mx;
	max=-1;
	mx=-1;
	x=0;
	while(scanf("%s ",s)!=EOF) {
		len=strlen(s);
		if(max<len) max=len;
		strcpy(ss[x],s);
		for(i=0;i<x;i++) {
			if(strcmp(ss[i],s)==0) cnt[i]++;
			if(mx<cnt[i]) mx=cnt[i];
		}
		x++;
	}
	for(i=0;i<x;i++) {
		if(mx==cnt[i]) {
			printf("%s ",ss[i]);
			break;
		}
	}
	for(i=0;i<x;i++) {
		if(max==strlen(ss[i])) {
			printf("%s\n",ss[i]);
			break;
		}
	}
	return 0;
}
		

Measured memory_bytes: 1088
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
using namespace std;

void sieve(int n, list<int> &primes)
{
    vector<bool> v(n / 2 + 1, true);

    // check
    for (int i = 3, end = sqrt(n); i <= end; i += 2) {
        if (!v[i / 2])
            continue;
        for (int j = i * i / 2; j <= n / 2; j += i)
            v[j] = false;
    }

    primes.push_back(2);
    for (int i = 1; i <= n / 2; i++)
         if (v[i])
            primes.push_back(i * 2 + 1);
}

int main()
{
    list<int> primes;
    vector<int> inputs;

    // read all inputs
    for (int x; cin >> x;)
        inputs.push_back(x);

    // init sieve
    sieve(*max_element(inputs.begin(), inputs.end()), primes);

    for (auto x : inputs) {
        int count = 0;
        for (auto p : primes) // find
            if (p == x) {
                count++;
                break;
            } else if (p > x)
                break;
            else
                count++;
        cout << count << endl;
    }

    return 0;
}

Measured memory_bytes: 3732
#include <iostream>
#include <stdio.h>
#include <string.h>
#define int long long

using namespace std;

int x,y,ans=0;

signed main()
{
	scanf("%lld%lld",&x,&y);
	for(int i=x;i<=y;i<<=1) ans++;
	printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
const double pi = 3.14159265358979323846;

double calcAngle(double h, double m)  
{  
    // validate the input  
  
    // Calculate the angles moved  
    // by hour and minute hands  
    // with reference to 12:00  
    double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
  
    // Find the difference between two angles  
    double angle = (hour_angle - minute_angle);  
  
    // Return the smaller angle of two possible angles  
    angle = min(360 - angle, angle);  
  
    return angle;  
}

void	solve()
{
	double a, b, h, m;
	cin >> a >> b >> h >> m;

	double angle = calcAngle(h, m);
	angle = cos((angle * pi) / 180);
	double ans = sqrt(a * a + b * b - 2 * a * b * angle);
	printf("%0.10F\n", ans);
}

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

	solve();
}


Measured memory_bytes: 4252
n, a, b, c = map(int, input().split())
L = [int(input()) for _ in range(n)]
targets = [a, b, c]

ans = 10**9
from itertools import product
for comb in product([0, 1, 2, 3], repeat=n):
    if len(set(comb)) in [1, 2]:
        continue
    # a, b, c
    ls = [[], [], []]
    for i, c in enumerate(comb):
        if c == 3:
            continue
        ls[c].append(L[i])

    mps = 0
    for idx, ll in enumerate(ls):
        if len(ll) == 0:
            break
        tmp = (len(ll)-1)*10
        mps += tmp
        mps += abs(targets[idx] - sum(ll))
    else:
        ans = min(ans, mps)
    
print(ans)


Measured memory_bytes: 75080
# C - たくさんの数式
from itertools import product
s=list(input())
n=len(s)
answer=0
pattern=list(product(['+',''],repeat=n-1))
for i in range(2**(n-1)):
    formula=s[0]
    for j,k in zip(pattern[i],s[1:]):
        formula+=(j+k)
    answer+=eval(formula)

print(answer)

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

int main() {
  int N;
  cin >> N;
  char S[N];
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }

  string ans =  "Three";
  for (int i = 0; i < N; i++) {
      if (S[i] == 'Y') {
        ans ="Four";
      }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   998244353
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(12)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
#define    fbo    find_by_order
#define    ook    order_of_key
#define    upb    upper_bound
#define    lowb   lower_bound 
#define    lte(v,x)   upb(all(v),x)-v.be()
#define    gte(v,x)   v.end()-lowb(all(v),x)
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int main()
{       io 
int testcases=1;       //    cin>>testcases;
while(testcases--)
{




ll n;
cin>>n;

ll k=n%10;

if(k==3)
cout<<"bon";

else if(k==0||k==1||k==6||k==8)
cout<<"pon";

else
cout<<"hon";











}return 0;}

Measured memory_bytes: 3608
s = input()
right_cnt = 0
left_cnt = 0
total = 0
for i in range(len(s)):
  if s[i] == '<' and left_cnt == 0:
    right_cnt += 1
  elif s[i] == '<' and left_cnt > 0:
    k = max(right_cnt, left_cnt)
    l = min(right_cnt, left_cnt)
    total += (((k+1)*k) + (l*(l-1)))//2
    right_cnt = 1
    left_cnt = 0
  elif s[i] == '>':
    left_cnt += 1
k = max(right_cnt, left_cnt)
l = min(right_cnt, left_cnt)
total += (((k+1)*k) + (l*(l-1)))//2
print(total)


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

void solve(std::string S, std::string T){
    int ans = (int)T.size();
    for(int i = 0; i < S.size()-T.size()+1; i++){
        int cnt = 0;
        for(int j = 0; j < T.size(); j++){
            if(S[i+j] != T[j]) cnt++;
        }
        ans = min(cnt, ans);
    }
    cout << ans << endl;
    return;
}

int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


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

int main(){
    int m,f,r;
    cin >> m >> f >> r;
    while (true)
    {
        if(m == -1 && f == -1 && r == -1) break;
        
        if(m == -1 || f == -1) cout << "F" << endl;
        else if(m + f >= 80) cout << "A" << endl;
        else if(m + f >= 65 && m + f < 80) cout << "B" << endl;
        else if(m + f >= 50 && m + f < 65) cout << "C" << endl;
        else if(m + f >= 30 && m + f < 50 && r >= 50) cout << "C" << endl;
        else if(m + f >= 30 && m + f < 50 && r < 50) cout << "D" << endl;
        else cout << "F" << endl;
        
        cin >> m >> f >> r;
    }
    
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int d = n % 10;
    vector<int> hon{2, 4, 5, 7, 9};
    for(int a : hon){
        if(a == d){
            puts("hon");
            return 0;
        }
    }
    vector<int> pon{0,1,6,8};
    for(int a : pon){
        if(a == d){
            puts("pon");
            return 0;
        }
    }
    puts("bon");
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int n;int a[1000000];
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		int x;
		cin>>x;
		a[x]++;
	}
	for(int i=1;i<=n;i++)
		cout<<a[i]<<endl;
	return 0;
}


Measured memory_bytes: 4352