akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
#define MAX 4000


int solve(int N)
{
	int  ans = 0;
	vector<pair<int, int>> AB;
	int kouho[10][10];
	for (int i = 0; i < 10; i++)
	{
		for (int j = 0; j < 10; ++j)
		{
			kouho[i][j]=0;
		}
	}
	for (int i = 1; i < N+1; ++i)
	{
		pair<int, int> temp;
		int top, tail;
		for (int j = 6; j >= 0; --j)
		{
			top = i / pow(10, j);
			if (top != 0)
			{
				temp.second = top;
				break;
			}
		}
		temp.first = i - (i / 10) * 10;
		if (temp.first != 0)
		{
			AB.push_back(temp);
			++kouho[temp.first][temp.second];
		}
	}
	for (int i = 1; i < 10; ++i)
	{
		for (int j = 1; j < 10; ++j)
		{
			ans += kouho[i][j] * kouho[j][i];
		}
	}
	return ans;
}

int main(int argc, char* argv[]) {

	int N;
	cin >> N;
	cout<<solve(N);
	return 0;
}


Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vec;

#define vecc vector<vector<ll>>
#define LM LLONG_MAX
#define int long long int
 
#define ff first
#define ss second
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

#define M 1000020
#define MOD 1000000007

signed main()
{
        FAST;
        
        ll n;
        cin>>n;
        
        cout<<3*n*n;
        
        
}

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

using namespace std;

#define f first 
#define s second 
#define mp make_pair
#define pb push_back

typedef long long ll;

const int mod=1e9+7;
const int INF=INT_MAX;

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

int lcm(int a,int b){
    return a*b/gcd(a,b);
}


int main(){
    int n,m;
    cin >> n >> m;
    vector<int> l(m),r(m);
    for(int i=0;i<m;i++){
        cin >> l[i] >> r[i];
    }
    int L=0,R=n+1;
    for(int i=0;i<m;i++){
        L=max(L,l[i]);
        R=min(R,r[i]);
    }
    cout << (L<=R?R-L+1:0) << endl;
    return 0;
}

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

int main() {
    vector<vector<vector<int> > > a(4, vector<vector<int> >(3, vector<int>(10)));
    int n; cin >> n;
    for(int i=0; i<n; i++) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        a[b-1][f-1][r-1] += v;
    }
    for(int i=0; i<4; i++) {
        for(int j=0; j<3; j++) {
            for(int k=0; k<10; k++) {
                cout << " ";
                cout << a[i][j][k];
            }
            cout << endl;
        }
        if(i == 3) break;
        cout << "####################" << endl;
    }
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int x; cin >> x;
    int ans = 0;
    if(x == 1) {
        cout << 1 << endl;
        return 0;
    }
    for(int i = 2; i <= sqrt(x); i++){
        int j = i, preans = i;
        while (preans < x) preans *= j;
        if(preans > x) preans /= j;
        ans = max(ans, preans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;

int main() {
    ll a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f;
    double mx = 0.0;
    P mxp;
    rep(i,30){
        rep(j,30){
            ll water = i*a*100 + j*b*100;
            if(water > f) break;
            ll rest = f - water;
            ll limit = min(rest,water/100*e);
            if(limit==0) break;
            vector<bool> put(3001,false);
            put[0] = true;
            rep(k,3000){
                if(k+c<=3000) put[k+c] = put[k+c] || put[k];
                if(k+d<=3000) put[k+d] = put[k+d] || put[k];
            }
            ll sugar = 0;
            for(ll k=limit; k>=0; k--){
                if(put[k]){
                    sugar = k;
                    break;
                }
            }
            if(mx < sugar/(double)(sugar+water)){
                mx = sugar/(double)(sugar+water);
                mxp = P(water+sugar, sugar);
            }
        }
    }
    if(mxp.first != 0 || mxp.second != 0) cout << mxp.first << " " << mxp.second << endl;
    else cout << 100*a << " " << 0 << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  val r = Array(2,3,5,7)

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = BigInt(a).modPow(d,n).toLong

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,BigInt(x).modPow(2,n).toLong, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,BigInt(x).modPow(2,n).toLong,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n<1000) (2 to Math.sqrt(n).toInt).forall(n%_ != 0)
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    println((0 until n).count{ _=> {
        val m = readInt; isPrime(m)
      }
    })
  }
}

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

import math

# 半径1の円の面積
# 1     * pi
# 半径rの円の面積
# r ^ 2 * pi

# 半径rの円の面積は
# 半径1の円の面積のr^2倍である.

r = int(input())

print(r**2)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  long n;
  cin >> n;
  vl cnt(100001,0);
  long sum = 0;
  rep(i,n){
    long a;
    cin >> a;
    cnt[a]++;
    sum += a;
  }
  long q;
  cin >> q;
  rep(i,q){
    long b,c;
    cin >> b >> c;
    long g = cnt[b];
    cnt[b] = 0;
    sum -= g*b;
    cnt[c] += g;
    sum += g*c;
    cout << sum << endl;
  }
}

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

namespace ALDS1_4_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int k = int.Parse(input[1]);
            int[] bag = new int[N];
            int total = 0;
            for (int i = 0; i < N; i++)
            {
                bag[i] = int.Parse(Console.ReadLine());
                total += bag[i];
            }
            int min = total / k - 1;
            if (bag.Max() > min) min = bag.Max() - 1;
            int pos = 0;
            int contain = 0;

            while (total != contain)
            {
                min++;
                int[] track = new int[k];
                pos = 0;
                contain = 0;
                for (int i = 0; i < k; i++)
                {
                    while (pos < N &&track[i] + bag[pos] <= min)
                    {
                        track[i] += bag[pos];
                        pos++;
                    }
                    contain += track[i];
                }   
            }

            Console.WriteLine(min);

        }
    }
}

Measured memory_bytes: 10632
n=int(input())
abc = [list(map(int, input().split())) for i in range(n)]
#[[10,40,70],[20,50,80],[30,60,90]]
A = [0]
B = [0]
C = [0]
for i in range(n):
  a = abc[i][0] + max(B[-1], C[-1])#10+max(0,0),20+max(40,70)=90,30+max(120,120)=150
  b = abc[i][1] + max(A[-1], C[-1])#40+max(0,0),50+max(10,70)=120,60+max(90,120)=180
  c = abc[i][2] + max(A[-1], B[-1])#70+mac(0,0),80+max(10,40)=120,90+max(90,120)=210
  A += [a]#0,10,90,150
  B += [b]#0,40,120,180
  C += [c]#0,70,120,210
print(max(A[-1], B[-1], C[-1]))

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

int numsum(int x)
    {
     int cnt=0;
     while(x!=0)
         {
          cnt+=x%10;
          x/=10;
         }
     return cnt;
    }
int main()
{

int n,ans=666;
cin>>n;
for(int i=1;i<=n/2+1;i++)
    ans=min(ans,numsum(i)+numsum(n-i));
cout<<ans;
     
return 0;
}

Measured memory_bytes: 256
use std::io;
use std::cmp;

fn main() {
    let s = read_one::<String>().chars()
        .collect::<Vec<_>>();

    let mut cnt = 0;
    let mut len = 0;
    for c in s.iter() {
        if ['A', 'C', 'G', 'T'].contains(c) {
            len += 1;
        } else {
            len = 0;
        }
        cnt = cmp::max(cnt, len);
    }

    println!("{}", cnt);
}

#[allow(unused)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}


#[allow(unused)]
fn read_one<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 2112
/////////////////////////////////TEST CASES////////////////////////////////////
/*
*/
/////////////////////////////////////CODE//////////////////////////////////////		
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a ; i > b ; i--)
#define fastio ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define PI 3.14159265
typedef long long ll;
#define vl vector<ll> 
#define IN(inp) ll inp;cin>>inp;
#define pb push_back
#define all(a) a.begin(),a.end()
#define FR(i,a) for(auto i:a)
#define what(A) cout<<#A<<" is "<<A<<endl;
ll MAX = 100000000000;
ll MOD = 1000000007;
string s, t,ans="";
ll dp[3010][3010],vis[3001][3001];
ll check(ll pos1, ll pos2)
{
	if (vis[pos1][pos2])
		return dp[pos1][pos2];
	vis[pos1][pos2] = 1;
	if (pos1 == s.length() or pos2 == t.length())
		return 0;
	if (s[pos1] == t[pos2])
	{
		dp[pos1][pos2] +=1 + check(pos1+1,pos2+1);
	}
	else
		dp[pos1][pos2] += max(check(pos1 + 1, pos2), max(check(pos1, pos2 + 1), check(pos1 + 1, pos2 + 1)));
	return dp[pos1][pos2];

}
void solve()
{
	cin >> s >> t;
	check(0, 0);
	ll i = 1, j =1;
	while (i <= s.length() and j <=t.length())
	{
		//what(i)
		if (dp[i][j] + 1 == dp[i - 1][j - 1] and s[i-1]==t[j-1])
		{
			ans += s[i-1];
			i++, j++;
		}
		else if (dp[i - 1][j] == dp[i][j])
			i++;
		else
			j++;
	}
	//reverse(all(ans));
	cout << ans;
}
int main()
{
	fastio
		//freopen("input.txt", "rt", stdin);
		//freopen("output.txt", "wt", stdout);
		ll test = 1;
	//cin >> test;
	while (test--)
	{
		solve();
	}
}

Measured memory_bytes: 144792
// In His Name

#include <bits/stdc++.h>

#define pb push_back
#define F first
#define S second
#define gcd __gcd
#define int long long
#define ull unsigned long long

using namespace std;

typedef pair<int, int> pii;

/*const int N = 1e5 + 1e2, INF = 1e15;
int n, mx, W, v[N], w[N], ps[N], dp[110][N];*/

const int N = 1e5 + 1e2, INF = 1e15;
int n, W, mx, w[N], v[N], dp[110][N], ps[N];

main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> W;
	for(int i = 1 ; i <= n ; i++){
        cin >> w[i] >> v[i];
	}
	for(int i = 1 ; i <= n ; i++){
        ps[i] = ps[i - 1] + v[i];
	}
	for(int i = 0 ; i <= n ; i++){
        for(int j = 0 ; j <= 1e5 ; j++){
            dp[i][j] = INF;
        }
	}
	for (int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= ps[i] ; j++){
            if(v[i] > j){
                dp[i][j] = dp[i - 1][j];
            }
            dp[i][j] = min(dp[i - 1][j] , dp[i - 1][j - v[i]] + w[i]);
        }
	}
	for (int i = 0; i <= n ; i++){
        for (int j = 0 ; j <= 1e5 ; j++){
            if (dp[i][j] <= W){
                mx = max (mx , j);
            }
        }
	}
	cout << mx + 1;
}
	/*cin >> n >> W;
	for (int i = 1 ; i <= n ; i++)
		cin >> w[i] >> v[i];
	for (int i = 1 ; i <= n ; i++)
		ps[i] = ps[i - 1] + v[i];
	for (int i = 0 ; i <= n ; i++){
		for (int j = 0 ; j <= 1e5 ; j++){
			dp[i][j] = INF;
		}
	}
	for (int i = 1 ; i <= v[0] ; i++){
		dp[0][i] = w[0];
	}
	for (int i = 1 ; i <= n ; i++){
		for (int j = 1 ; j <= ps[i] ; j++){
			if (v[i] > j){
				dp[i][j] = dp[i - 1][j];
			}
			dp[i][j] = min (dp[i - 1][j] , dp[i - 1][j - v[i]] + w[i]);
		}
	}
	for (int i = 0 ; i <= n ; i++){
		for (int j = 0 ; j <= 1e5 ; j++){
			if (dp[i][j] <= W){
				mx = max (mx , j);
			}
		}
	}
	cout << mx + 1;
}*/

Measured memory_bytes: 81408
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		class qube{
			Scanner sc = new Scanner(System.in);
			int [] face = new int[6];
			Integer i,dump=0;
			String e;
			String es[];

			qube(){
				for(i=0;i<6;i++){
					face[i]=sc.nextInt();
				}
			}

			void swap(int a,int b){
				dump = this.face[a];
				this.face[a] = this.face[b];
				this.face[b] = dump;

			}
			void scn(){
				e =sc.next();
				es = e.split("");
			}
			void pt(){
				System.out.printf("%d\n", this.face[0]);
				System.exit(0);
			}

			void move(){
				scn();
				for(i=0;;i++){

					if(i.equals(this.es.length)){
						this.pt();
					}
					if(this.es[i].equals("E")){
						swap(0,2);
						swap(0,5);
						swap(0,3);
					}
					else if(this.es[i].equals("N")){
						swap(4,5);
						swap(4,1);
						swap(4,0);
					}
					else if(this.es[i].equals("S")){
						swap(1,5);
						swap(1,4);
						swap(1,0);
					}
					else{
						swap(3,5);
						swap(3,2);
						swap(3,0);
					}
				}
			}

		}

		qube q = new qube();
		q.move();
	}

}


Measured memory_bytes: 26552
import sys

# X: 今いる座標
# K: 移動回数
# D: 移動する距離
X, K, D = map(int, input().split())

# 0を目指す

# 0からの距離
distance = abs(X)

# ちょうど0に到達できる？
if distance % D == 0 and K >= distance // D:
    # 0に到達した後の移動回数が偶数なら0
    remaining_move_count = K - distance // D
    if remaining_move_count % 2 == 0:
        print(0)
    else:
        # 奇数ならD
        print(D)
    sys.exit()

# 0に届かないとき
if distance > K * D:
    print(distance - K * D)
    sys.exit()

# 以降は0を超えるとき

# 0手前に行く移動回数
before_zero_count = distance // D
# 0手前の座標
before_zero_point = distance - before_zero_count * D
# 残り移動回数が偶数なら0手前の座標が答え
remaining_move_count = K - before_zero_count
if remaining_move_count % 2 == 0:
    print(before_zero_point)
elif X < 0:
    print(D - before_zero_point)
else:
    print(abs(before_zero_point - D))


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

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt");
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        int m     = int.Parse(spl[0]);
        int d     = int.Parse(spl[1]);

        long c = 0;

        for(int i=4; i<=m; i++) {
            for(int j=22; j<=d; j++) {
                int d10 = j / 10;
                int d1 = j % 10;
                if (d10 < 2 || d1 < 2) continue;

                if (d10 * d1 == i) c++;
            }
        }

        return c;
    }

}

Measured memory_bytes: 13140
using System;
using System.Collections.Generic;

class Program
{
	public static int Main(string[] args)
	{
		string[] str = Console.ReadLine().Split(' ');
		int n = int.Parse(str[0]);
        int answer = 0;
        for (int i = 1; i <= n;i++){
            if (i % 2 == 1){
                int divisor_num = 0;
                float tmp = i;
                for (int j = 1; j <= i; j++)
                {
                    if(tmp/j == Math.Floor(tmp/j)){
                        divisor_num++;
                    }
                }
                if (divisor_num == 8) {
                    answer++;
                    //Console.WriteLine(i);
                }
            }
        }
        Console.WriteLine(answer);
		return 0;
	}
}


Measured memory_bytes: 11092
import java.util.*;
import java.lang.*;


public class Main {

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

        int n = sc.nextInt();
        int[] a = new int[n];
        
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count++;
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.print(a[i]);
            if (i != n - 1) {
                System.out.print(' ');
            }
        }
        System.out.println();
        System.out.println(count);
    }
}


Measured memory_bytes: 26364
e1,e2,e3,e4 = map(int,input().split())

if(e1 == e2 and e3 == e4):
    print("yes")
elif(e2 == e3 and e1 == e4):
    print("yes")
elif(e1 == e3 and e2 == e4):
    print("yes")
else:
    print("no")


Measured memory_bytes: 5592
#if 1

#include <bits/stdc++.h>
using namespace std;
int n,l[105],x;

int main()
{
    cin >> n >> x;
    int ans = 1,sum = 0;
    for(int i = 1;i <= n;i++)
    {
        cin >> l[i];
        sum += l[i];
        if(x >= sum) ans++;
    }
    cout << ans;
}

#endif // 1

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

signed main(){
  lint N, K; cin >> N >> K;
  vector<lint> a(N);
  for(int i = 0; i < N; i++) cin >> a[i], a[i]--;
  vector<bool> visit(N, false);
  vector<lint>  counter(N, 0);
  visit[0] = true;
  lint now = 0, before, after;
  for(int i = 0; i < 1e6; i++){
    lint next = a[now];
    if(visit[next]) {
      before = counter[next]; after = i + 1;
      break;
    }
    else{
      visit[next] = true;
      now = next; counter[now] = i + 1;
    }
  }
  if(K < before){
    now = 0;
    for(int i = 0; i < K; i++) now = a[now];
  }
  else{
    K = ((K - after) + (after - before) * 10000) % (after - before);
    if(K < 0) K += (after - before);
    for(int i = 0; i <= K; i++) now = a[now];
  }
  cout << now + 1 << endl;
}

Measured memory_bytes: 6432
n,k = map(int, input().split())
al = list(map(int, input().split()))
fl = list(map(int, input().split()))
al.sort()
fl.sort(reverse=True)

ok, ng = 10**12+1, -1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    ok_flag = True
    # ...
    cnt = 0
    for a,f in zip(al,fl):
        v = a*f
        rem = a*f-mid
        cnt += max( (rem-1)//f+1, 0)
    if cnt <= k:
        ok = mid
    else:
    	ng = mid
print(ok)

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	queue<string> q;
	unordered_map<string,int> dist;
	q.push("01234567");
	dist.emplace("01234567",0);
	while(q.size()){
		string s=q.front(); q.pop();
		int d=dist[s];
		int x=s.find('0');
		rep(k,4){
			int i=x/4+"\xff\x1\0\0"[k],j=x%4+"\0\0\xff\x1"[k];
			if(i<0 || 2<=i || j<0 || 4<=j) continue;
			int y=i*4+j;
			swap(s[x],s[y]);
			if(!dist.count(s)){
				q.push(s);
				dist.emplace(s,d+1);
			}
			swap(s[x],s[y]);
		}
	}
	
	for(int a[8];;){
		rep(i,8) cin>>a[i];
		if(cin.eof()) break;
		string s(8,'0');
		rep(i,8) s[i]+=a[i];
		cout<<dist[s]<<endl;
	}
}

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

int main() {
  char x,y; cin >> x >> y;
  if(x == y){
    cout << "H";
  }
  else{
    cout << "D";
  }
}

Measured memory_bytes: 3604
(stdin => {
  // Define Function
  // const cube = n => Math.pow(n, 2)
  // Declare Variable
  const inputs = stdin.toString().trim().split('\n')
  const x = parseInt(inputs[0], 10)
  const time =parseInt(x/(60*60))
  const hun= parseInt((x%3600)/60)
  const byo=parseInt(x%60)
  


  console.log(`${time}:${hun}:${byo}`)


 
})(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 15112
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
const int N=1e5+100;
typedef pair<int,int>pii;
int f[N],a[N];
int find(int x)
{
	return x==f[x]?x:f[x]=find(f[x]);
}
priority_queue<pii,vector<pii>,greater<pii> >q[N];
vector<int>v;
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++) cin>>a[i],f[i]=i;
	f[n]=n;
	for(int i=1,x,y;i<=m;i++)
	{
		cin>>x>>y;
		f[find(x)]=find(y);
	}
	ll ans=0;
	for(int i=0;i<n;i++)
	 q[find(i)].push({a[i],i});
	for(int i=0;i<n;i++)
	{
		if(q[i].size())
		{
			v.push_back(i);
			ans+=q[i].top().first;
			a[q[i].top().second]=2e9;
		}
	}
	if(v.size()==1) cout<<0<<endl; 
	else if(n<2*(v.size()-1)) cout << "Impossible" << endl;
	else
	{
		sort(a,a+n);
		n=v.size()-2;
		for(int i=0;i<n;i++)
		 ans+=a[i];
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

#define int long long
#define ff first
#define ss second
#define pii pair<int, int>
#define pb emplace_back
#define pf emplace_front
#define mp make_pair
#define ld long double
#define all(x) x.begin(), x.end()
#define uniq(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())

typedef complex<ld> base;

void fft (vector<base>& a, bool invert)
{
	int n = (int)a.size();
	if (n == 1)
        return;
	vector<base> a0(n / 2), a1(n / 2);
	for (int i = 0, j = 0; i < n; i += 2, j++) {
		a0[j] = a[i];
		a1[j] = a[i + 1];
	}
	fft(a0, invert);
	fft(a1, invert);
    ld pi = acos(-1);
	ld ang = 2 * pi / n * (invert ? -1 : 1);
	base w(1),  wn(cos(ang), sin(ang));
	for (int i = 0; i < n / 2; i++)
    {
		a[i] = a0[i] + w * a1[i];
		a[i + n / 2] = a0[i] - w * a1[i];
		if (invert)
			a[i] /= 2,  a[i + n / 2] /= 2;
		w *= wn;
	}
}

void mult(vector<int>& x)
{
    vector<base> a(all(x));
	int sz = 1;
	while (sz < (int)a.size())
        sz *= 2;
    sz *= 2;
    a.resize(sz, 0);
	fft(a, 0);
	for (int i = 0; i < sz; i++)
		a[i] *= a[i];
	fft(a, 1);
	x.resize(sz);
	for (int i = 0; i < sz; i++)
		x[i] = (int)(a[i].real() + 0.5);
}

const int maxn = 2e5 + 9;
int mod = 2e5 + 3;
int a[maxn];
int cnt[maxn];

signed main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    a[0] = 1;
    a[1] = 2;
    for (int i = 2; i < mod - 1; i++)
        a[i] = (a[i - 1] * a[1]) % mod;
    for (int i = 0; i < mod - 1; i++)
        cnt[a[i]] = i;
    vector<int> x(mod, 0);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int b;
        cin >> b;
        if (!b)
        {
            i--;
            n--;
            continue;
        }
//        cout << cnt[b] << "\n";
        x[cnt[b]]++;
        ans -= a[(2 * cnt[b]) % (mod - 1)];
    }
//    for (int i = 0; i < (int)x.size(); i++)
//    {
//        if (x[i])
//            cout << "   " << i << " " << x[i] << "\n";
//    }
    mult(x);
    int cur = 1;
    for (int i = 0; i < (int)x.size(); i++)
    {
//        if (x[i])
//            cout << i << " " << x[i] << "\n";
        ans += cur * x[i];
        cur = (cur * a[1]) % mod;
    }
    cout << ans / 2;
}


Measured memory_bytes: 57644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef long long ll;
const ll INF = 1e18L + 1;

int main()
{
  int a, b;
  cin >> a >> b;
  int a_l = ceil(a / 0.08);
  int b_l = ceil(b / 0.10);
  float a_h = ((a + 1) / 0.08);
  float b_h = ((b + 1) / 0.10);
  int ans = -1;
  if (a_l >= b_l)
  {
    if (a_l < b_h)
    {
      ans = a_l;
    }
  }
  else
  {
    if (b_l < a_h)
      ans = b_l;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>


using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> vec(n);
    
    int tmp;
    
    for(int i=0;i<n-1;++i){
        cin>> tmp;
        vec[tmp-1]++;
    }
    
    for(int j=0;j<n;j++)cout << vec[j] <<endl;
}
    






Measured memory_bytes: 4048
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int A[1000000];
int X[1000000];
int main(){
  int T;
  cin >> T;
  for(int j=0;j<T;++j){
    int N,k,ans=0;
    cin >> N >> k;
    for(int i=0;i<N;++i) {
      cin >> X[i];
    }
    for(int i=0;i+1<N;++i){ 
      A[i]=X[i+1]-X[i];
    }
    sort(A,A+N-1);
    for(int i=0;i<max(0,N-k);++i){
      ans+=A[i];
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 5664
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s[100005],now;
long long sum[100005];
int main() {
	int N,c=1;
	cin >> N;
	long long p=0;
	for (int i = 1; i <= N; i++)
	{
		cin >>s[i];
		sort(s[i].begin(), s[i].end());
	}
	sort(s + 1, s + N + 1);
	for (int i = 1; i <= N; i++) {
		if (now != s[i])
		{
			now = s[i];
			sum[c] = 1;
			c++;
		}
		else
			sum[c - 1]++;
	}
		
	for (int i = 1; i < c; i++) {
		if (sum[i] != 1) {
			p = p + (sum[i] * (sum[i] - 1)) / 2;
		}
	}
	printf("%lld", p);
	return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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 maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
    ll X=tx-sx,Y=ty-sy;
    rep(i,Y) cout<<'U';
    rep(i,X) cout<<'R';
    rep(i,Y) cout<<'D';
    rep(i,X) cout<<'L';
    cout<<'L';
    rep(i,Y+1) cout<<'U';
    rep(i,X+1) cout<<'R';
    cout<<'D';
    cout<<'R';
    rep(i,Y+1) cout<<'D';
    rep(i,X+1) cout<<'L';
    cout<<'U';
}



Measured memory_bytes: 3632
N = int(input())
A = [0]+list(map(int, input().split()))

l = -1
ans = "Yes"
for i in range(1, N+1):
    if A[i] > A[i-1]:
        A[i] -= 1
    elif A[i] == A[i-1]:
        continue
    else:
        ans = "No"
print(ans)

Measured memory_bytes: 15020
import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    String[] data = br.readLine().split(" ");
    
    long h = Integer.parseInt(data[0]);
    long w = Integer.parseInt(data[1]);
    
    long result = (w/2+w%2)*(h/2+h%2) + (w-w/2-w%2)*(h-h/2-h%2);
    if (h == 1 || w == 1){
      result = 1;
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 21332
N = int(input())
e = [0] * (N + 1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i + 1):
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m): # e の要素のうち m-1 以上のものの個数
    return len(list(filter(lambda x: x >= m-1, e)))

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1)
    + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

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

const int maxn = 100100;

int a[maxn];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	int ans=0;
	for(int i=1;i<n-1;i++){
		if(a[n-1]-min(a[n-1]-a[i],a[i])<a[n-1]-min(a[n-1]-a[ans],a[ans])){
			ans=i;
		}
	}
	printf("%d %d\n",a[n-1],a[ans]);
	return 0;
}

Measured memory_bytes: 640
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include <bits/stdc++.h>
using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(long long r){
  cout << r *r << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long r;
  scanf("%lld",&r);
  solve(r);
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_7_C
{
    class Program
    {
        static void Main()
        {
            string[] rc = Console.ReadLine().Split(' ');
            int r = int.Parse(rc[0]);
            int c = int.Parse(rc[1]);
            int[,] table = new int[r + 1, c + 1];

            for (int i = 0; i < r; i++)
            {
                table[i, c] = 0;
                string[] data = Console.ReadLine().Split(' ');

                for (int j = 0; j < c; j++)
                {
                    table[i, j] = int.Parse(data[j]);
                    table[i, c] += table[i, j];
                }
            }
            for (int i = 0; i <= c; i++)
            {
                table[r, i] = 0;

                for (int j = 0; j < r; j++) table[r, i] += table[j, i];
            }
            for (int i = 0; i <= r; i++)
            {
                for (int j = 0; j <= c; j++)
                {
                    if (j != c) Console.Write(table[i, j] + " ");

                    else Console.WriteLine(table[i, j]);
                }
            }
        }
    }
}

Measured memory_bytes: 9300
#include <stdio.h>

int main() {
	int N, a[200000], t = 1, ans = 0, min = 2;
	scanf("%d",&N);
	for (int i = 0; i < N; i++) {
		scanf("%d",&a[i]);
	}
	for (int i = 0; i < N; i++) {
		if (min > a[i]) {
			min = a[i];
		}
		if (a[i]==t) {
			t++;
		}
		else {
			ans++;
		}
	}
	if (min == 2) {
		printf("-1");
	}
	else {
		printf("%d", ans);
	}
	return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#define N 200005

int n,a[N];

int s;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		s^=a[i];
	}
	for(int i=1;i<=n;i++)
		printf("%d ",s^a[i]);
}

Measured memory_bytes: 3264
#pragma warning disable
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using System.Collections;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	const int Mod = 1000000007;
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var I = G();
		var z = new string('#', I[1] + 2);
		WriteLine(z);
		for (var y = 0; y < I[0]; y++)
		{
			var s = ReadLine();
			WriteLine("#{0}#", s);
		}
		WriteLine(z);
	}
	long GCD(long a, long b)
	{
		var n = (ulong)Abs(a); var m = (ulong)Abs(b);
		if (n == 0) return (long)m; if (m == 0) return (long)n;
		int zm = 0, zn = 0;
		while ((n & 1) == 0) { n >>= 1; zn++; }
		while ((m & 1) == 0) { m >>= 1; zm++; }
		while (m != n)
		{
			if (m > n) { m -= n; while ((m & 1) == 0) m >>= 1; }
			else { n -= m; while ((n & 1) == 0) n >>= 1; }
		}
		return (long)n << Min(zm, zn);
	}
}

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
using vpi = vector<Pi>;
using vpl = vector<Pl>;

#define debug(arr) cout << #arr << " = " << arr << '\n'
#define debug2(a,b) cout << "[" << #a << "," << #b << "] = " << "[" << a << "," << b << "]" << '\n'
template<class T> ostream &operator << (ostream& out, const vector<T>& arr) {
  cout << "{"; for (int i = 0; i < arr.size(); i++)cout << (!i ? "" : ", ") << arr[i]; cout << "}";
  return out;
}
template<class T> ostream &operator << (ostream& out, const vector<vector<T> >& arr) {
  cout << "{\n"; for (auto& vec : arr)cout << "  " << vec << ",\n"; cout << "}";
  return out;
}
template<class S,class T> ostream &operator << (ostream& out, const pair<S,T>& p){
  cout << "{" << p.first << "," << p.second << "}" << '\n';
  return out;
}
template<class T> istream &operator >> (istream& in, vector<T>& arr) {
  for (auto& i : arr)cin >> i; return in;
}

/////////////////////////////////////////////////////////////////////////

int op(int a,int b){
  return max(a,b);
}
int e(){
  return 0;
}
int main(void){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(20);
  segtree<int,op,e> seg(300030);
  int N,K,x,ans = 0;
  cin >> N >> K;
  REP(i,N){
    cin >> x;
    int L = max(x - K,0);
    int R = min(x + K,300000);
    int tmp = seg.prod(L,R+1) + 1;
    ans = max(ans,tmp);
    seg.set(x,tmp);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 8392
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <queue>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstring>
#include <cstdio>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

int main(void){
  int x, a;
  cin >> x >> a;

  if (x < a) cout << "0" << endl;
  else cout << "10" << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

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

    while (1) {
        if (b > a) break;
        b *= 2;
        k--;
    }

    while (1) {
        if (c > b) break;
        c *= 2;
        k--;
    }

    if (k >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3652
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

# print("Yes")
# print("No")

# print("YES")
# print("NO")



def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


N = int(input())
ans = 0

num1 = make_divisors(N)
for i in range(1,len(num1)):
    mm = N//num1[i]
    while(mm%num1[i]==0):
        mm = mm//num1[i]
    if mm%num1[i]==1:
        ans += 1
        # print(num1[i])

# print(num1)
num2 = make_divisors(N-1)
ans += len(num2)-1
# print(num2)

print(ans)




    
    




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

void solve(long long N, long long A, long long B, long long C, long long D, string S){
	if (D<C) {
		int cnts = 0, cntsm = 0;
		for (int i=A-1; i<C-1; i++) {
			if (S[i] == '.') {
				cnts = 0;
			} else {
				cnts++;
				cntsm = max(cntsm, cnts);
			}
		}

		bool flg = false;

		for (int i=B-1; i<D; i++) {
			if (S[i] == '.') {
				if (S[i-1] == '.' && (i+1 < N && S[i+1] == '.')) flg = true;
 			}
		}
		if (flg && cntsm < 2) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	} else {
		int cnts = 0, cntsm = 0;
		for (int i=A-1; i<C-1; i++) {
			if (S[i] == '.') {
				cnts = 0;
			} else {
				cnts++;
				cntsm = max(cntsm, cnts);
			}
		}
		cnts = 0;
		for (int i=B-1; i<D-1; i++) {
			if (S[i] == '.') {
				cnts = 0;
			} else {
				cnts++;
				cntsm = max(cntsm, cnts);
			}
		}
		if (cntsm < 2) cout << "Yes" << endl; else cout << "No" << endl;
	}
}

int main(){	
	long long N;
	long long D;
	string S;
	long long B;
	long long A;
	long long C;
	scanf("%lld",&N);
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	scanf("%lld",&D);
	cin >> S;
	solve(N, A, B, C, D, S);
	return 0;
}



Measured memory_bytes: 772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  string s;
  cin >> s;
  
  string ans;
  for(int i = 0; i < s.size(); i++) {
    ans = ans + s.at(i);
    i++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int W = scanner.nextInt();

    int[] w = new int[N];
    int[] v = new int[N];

    for (int i = 0; i < N; i++) {
      w[i] = scanner.nextInt();
      v[i] = scanner.nextInt();
    }

    long[][] vw = new long[4][N + 1];
    for (int i = 0; i < N; i++) vw[w[i] - w[0]][i] = v[i];
    for (int i = 0; i < 4; i++) {
      Arrays.sort(vw[i]);
      reverse(vw[i], 1, N);
      for (int j = 1; j <= N; j++) vw[i][j] += vw[i][j - 1];
    }

    long max = 0;
    for (int a = 0; a <= N; a++) {
      for (int b = 0; b <= N - a; b++) {
        for (int c = 0; c <= N - a - b; c++) {
          for (int d = 0; d <= N - a - b - c; d++) {
            long tw = (long) w[0] * a + (w[0] + 1L) * b + (w[0] + 2L) * c + (w[0] + 3L) * d;
            long tv = vw[0][a] + vw[1][b] + vw[2][c] + vw[3][d];
            if (tw > W) continue;
            max = Math.max(max, tv);
          }
        }
      }
    }
    System.out.println(max);
  }

  private static void swap(long[] a, int i, int j) {
    long tmp = a[i];
    a[i] = a[j];
    a[j] = tmp;
  }

  private static void reverse(long[] a, int i, int j) {
    if (i > j) throw new IllegalArgumentException("i must be less than j");
    while (i < j) {
      swap(a, i, j);
      i++;
      j--;
    }
  }
}


Measured memory_bytes: 24020
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int h, w;
  char mat[55][55];
  int cnt[55][55] {};
  cin >> h >> w;
  for (int i = 0; i < h; ++i) {
    cin >> mat[i];
  }

  auto hin = [&h](int n) { return 0 <= n && n < h; };
  auto win = [&w](int n) { return 0 <= n && n < w; };

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (mat[i][j] == '#') {
        if (hin(i+1)) ++cnt[i+1][j];
        if (hin(i-1)) ++cnt[i-1][j];
        if (win(j+1)) ++cnt[i][j+1];
        if (win(j-1)) ++cnt[i][j-1];
        if (hin(i+1) && win(j+1)) ++cnt[i+1][j+1];
        if (hin(i+1) && win(j-1)) ++cnt[i+1][j-1];
        if (hin(i-1) && win(j+1)) ++cnt[i-1][j+1];
        if (hin(i-1) && win(j-1)) ++cnt[i-1][j-1];
      }
    }
  }

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (mat[i][j] == '#') {
        printf("#");
      } else {
        printf("%d", cnt[i][j]);
      }
    }
    puts("");
  }

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
    int i;
    char c[20];
    scanf("%s",c);
    for(i=0;c[i]!='\0';i++)
    {
        if(c[i]==',')
            c[i]=' ';
    }
    printf("%s\n",c);
    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	cin >> N;
	if (N%2 == 0) {
	  cout << (N-1)/2 << endl;
	} else {
	  cout << N/2 << endl;
	}
}


Measured memory_bytes: 256
n, m = list(map(int, input().split()))

city = dict()

for i in range(n):
  city[i + 1] = 0
  
for i in range(m):
  s, e = list(map(int, input().split()))
  city[s] += 1
  city[e] += 1

for i in range(n):
  print(city[i + 1])

Measured memory_bytes: 3064