akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            B();
        }

        static void B()
        {
            var SA = Read().ToList();
            var SB = Read().ToList();
            var SC = Read().ToList();

            var nowCard = SA.First();
            SA.RemoveAt(0);
            while (true)
            {
                if (nowCard == 'a')
                {
                    if (SA.Count == 0)
                    {
                        Console.WriteLine("A");
                        return;
                    }
                    nowCard = SA.First();
                    SA.RemoveAt(0);
                }

                if (nowCard == 'b')
                {
                    if (SB.Count == 0)
                    {
                        Console.WriteLine("B");
                        return;
                    }
                    nowCard = SB.First();
                    SB.RemoveAt(0);
                }

                if (nowCard == 'c')
                {
                    if (SC.Count == 0)
                    {
                        Console.WriteLine("C");
                        return;
                    }
                    nowCard = SC.First();
                    SC.RemoveAt(0);
                }
            }
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int DigitsSum(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();

        static void Print(object value = null) => Console.Write(value.ToString());
        static void Println(object value = null) => Console.WriteLine(value.ToString());
    }
}


Measured memory_bytes: 11220
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
#define REP(i,st,ed) for(int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(int i=st,i##end=ed;i>=i##end;--i)
const int maxn=100005;
int n,a[maxn],l[maxn],r[maxn];
int dp[maxn][2];
int main(){
	scanf("%d",&n);
	REP(i,1,n){
		scanf("%d",&a[i]);
		l[i]=log2(a[i]);
		r[i]=l[i]+((1<<l[i])!=a[i]);
	}
	int tot=0;
	REP(i,1,n){
		tot+=r[i];
		dp[i][0]=max(dp[i-1][0]+min(l[i],r[i-1]),dp[i-1][1]+min(l[i],l[i-1]));
		dp[i][1]=max(dp[i-1][0]+min(r[i],r[i-1]),dp[i-1][1]+min(r[i],l[i-1]));
	}
	printf("%d\n",tot-max(dp[n][0],dp[n][1]));
	return 0;
}

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

#define DEBUG(X) if(X)
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

int main()
{
  FASTIO;
  string str;
  cin >> str;
  if(str[0] == str[1] && str[1] == str[2])
    cout << "No\n";
  else
    cout << "Yes\n";
  return 0;
}


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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<ll> W(N), V(N);
  for (int i = 0; i < N; i++) {
    cin >> W[i] >> V[i];
  }
  vector<vector<ll>> dp(N + 1, vector<ll>(M + 1, 0));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M + 1; j++) {
      dp[i + 1][j] = dp[i][j];
      if (j - W[i] >= 0) dp[i + 1][j] = max(dp[i][j], dp[i][j - W[i]] + V[i]);
    }
  }
  cout << dp[N][M] << '\n';
  return 0;
}


Measured memory_bytes: 80256
#include<iostream>
using namespace std;
int func1[100005]={0};
int func2[100005]={0};
int N;
int main()
{
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>func1[i];
		func2[func1[i]]=i;
	}
	for(int i=1;i<N;i++)
	{
		cout<<func2[i]<<" ";
	}
	cout<<func2[N]<<endl;
}

Measured memory_bytes: 1536
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
LL ans;
char s[500010];
int n;
map<pair<string,string>,int> M;
void dfs(int x,string A,string B){
	if (x>n){
		if (M.find(mp(A,B))==M.end()) M[mp(A,B)]=1;
		else ++M[mp(A,B)];
		return;
	}
	dfs(x+1,A+s[x],B);
	dfs(x+1,A,s[x]+B);
}
void DFS(int x,string A,string B){
	if (x<=n){
		if (M.find(mp(A,B))!=M.end())
			ans+=M[mp(A,B)];
		return;
	}
	DFS(x-1,A+s[x],B);
	DFS(x-1,A,s[x]+B);
}
int main(){
	cin>>n;
	scanf("%s",s+1);
	dfs(1,"","");
	DFS(n+n,"","");
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 42624
s = input()
opcount = 0
wcount = 0
bcount = 0
for i in range(len(s)):
  if s[i] == "B":
    bcount += 1
  else:
    if bcount>0:
      opcount += i-wcount
      wcount += 1
    else:
      wcount += 1
print(opcount)

Measured memory_bytes: 3500
#include <cstdio>
#include <cmath>
using namespace std;


int main (void)
{
	int h, w;
	int i, j;

	while (scanf("%d %d", &h, &w) != EOF && h != 0 || w != 0){
		for (i=0; i<h; i++){
			for (j=0; j<w; j++){
				if (j!=0 && j!=w-1){
					if(i!=0 && i!=h-1)
						printf(".");
					else
						printf("#");
				}
				else
					printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 1000
#include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <algorithm>
using namespace std;

int main()
{
    string a;
    int b,c,s[20],j;
    while(cin>>a)
    {
        b=a.length();

        c=0;
        j=0;
        memset(s,0,sizeof(s));
        for(int i=0;i<b;i++)
        {
            if(a[i]=='A')
                c++;
            else if(a[i]=='C')
                c++;
            else if(a[i]=='G')
                c++;
            else if(a[i]=='T')
                c++;
            else
            {
                s[j++]=c;

                c=0;

            }
        }
        s[j]=c;
        c=0;
        for(int i=0;i<20;i++)
        {
            if(s[i]>c)
            {
                c=s[i];
            }
        }
        printf("%d\n",c);
    }
    return 0;
}


Measured memory_bytes: 256
// B.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[])
{
	int c[2], k;
	cin >> c[0] >> c[1] >> k;
	for (int i = 0; i < k; ++i) {
		c[(i & 1) ^ 1] += c[i & 1] / 2;
		c[i & 1] /= 2;
	}
	cout << c[0] << " " << c[1] << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{

    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            long sum = 0;
            var As = Console.ReadLine().Split().Select(int.Parse).ToArray();
            for (int i = 1; i < N; i++)
            {
                var pre = As[i - 1];
                var current = As[i];
                if (pre > current)
                {
                    var dif = pre - current;
                    sum += dif;
                    As[i] += dif;
                }
            }

            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 47176
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7,N=1e5+5;
int n,x;
ll fac[N],ans=0,res=1;
ll power(int a,int b)
{
	ll ans=1,p=a;
	while(b)
	{
		if(b&1)ans=ans*p%mod;
		p=p*p%mod;
		b>>=1;
	}
	return ans;
}
main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		fac[i]=(fac[i-1]+power(i,mod-2))%mod;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		ans=(ans+x*(fac[i]+fac[n-i+1]-1+mod)%mod)%mod;
		res=res*i%mod;
	}
	cout<<ans*res%mod<<endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Main implements Runnable {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int a = in.nextInt();
        int b = in.nextInt();
        if(a == 1) a = 14;
        if(b == 1) b = 14;
        if(a > b) System.out.println("Alice");
        else if(b > a) System.out.println("Bob");
        else System.out.println("Draw");
    }
}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Integer>{
    @Override public Integer get(Object key){return containsKey(key)?super.get(key):0;}
    public void add(T key,int v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Integer>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}

Measured memory_bytes: 22228
k, n = map(int, input().split())
a_list = list(map(int, input().split()))
longest = 0

for i in range(n-1):
        distance = a_list[i+1] - a_list[i]
        longest = max(longest, distance)

print(k-max(longest, k-a_list[n-1]+a_list[0]))

Measured memory_bytes: 32308
let h = ref 0

let parent i = int_of_float (floor (float_of_int i) /. 2.)

let left i = 2*i

let right i = 2*i + 1

let extract (t : int array) =
  let ret = t.(1) in
  t.(1) <- t.(!h);
  decr h;
  let rec max_heapify i =
    let l = left i in
    let r = right i in
    let m = if l <= !h && t.(l) > t.(i) then l else i in
    let m = if r <= !h && t.(r) > t.(m) then r else m in
    if m <> i then begin
      let tmp = t.(i) in t.(i) <- t.(m); t.(m) <- tmp;
      max_heapify m
    end in
  max_heapify 1;
  ret

let insert x (t : int array) =
  incr h;
  t.(!h) <- x;
  let rec doit i =
    if i > 1 && t.(parent i) < t.(i) then begin
      let tmp = t.(i) in t.(i) <- t.(parent i); t.(parent i) <- tmp;
      doit (parent i)
    end in
  doit !h

let split str delim =
  let open String in
  let rec doit s acc =
    match
      try Some (rindex s delim) with _ -> None
    with
    | None -> s :: acc
    | Some i ->
      let s1 = sub s 0 i in
      doit s1 (sub s (i + 1) (length s - length s1 - 1) :: acc)
  in doit str []

let () =
  let t = Array.make 2000001 0 in
  let rec doit () =
    match split (read_line ()) ' ' with
    | ["extract"] -> (Printf.printf "%d\n" (extract t); doit ())
    | ["insert"; n] -> (insert (int_of_string n) t; doit ())
    | _ -> ()
  in doit ()

Measured memory_bytes: 20264
import math
a,b,x=map(int,input().split())
if a*a*b>=x*2:
  c=x*2/(b*a)
  print(math.degrees(math.atan(b/c)))
else:
  d=2*(b-x/a/a)
  print(math.degrees(math.atan(d/a)))

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

#define ll          long long

#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
ll ans(ll n,ll m) 
{ 
    ll bN[32],bM[32]; 
    ll i = 0; 
    while (n > 0) { 
        bN[i] = n % 2; 
        n = n / 2; 
        i++; 
    } 
    ll k = 0; 
    while (m > 0) { 
        bM[k] = m % 2; 
        m = m / 2; 
        k++; 
    } 
    ll num=0;
    for (int j=0;j<=k-1&&j<=i-1;j++) 
       {
           if(bN[j]==1&&bM[j]==1) num+=pow(2,j);
       }
       return num;
} 
void solve(){
    int a,b,c,k,max=0;
    cin>>a>>b>>c>>k;
    if(k>=a) {max+=a; k=k-a;}
    else {max+=k; k=0;}
    if(k>=b) {k=k-b;}
    else {k=0;}
    if(k>0) max+=k*(-1);
    cout<<max;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3704
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    cout << min((n + h - 1) / h, (n + w - 1) / w) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(void) {
    int N, H;
    int l, n;
    scanf("%d %d", &N, &H);
    int a[N], b[N];
    int count = 0;

    for(int i = 0; i < N; i++) {
        scanf("%d", &b[i]); //それぞれの標高//
        a[i] = 1;
    }

    for(int m = 1; m <= H; m++) {
        scanf("%d %d", &l, &n);
        if(b[l - 1] < b[n - 1]) {
            a[l - 1] = 0;
        }
        else if(b[l - 1] > b[n - 1]) {
            a[n - 1] = 0;
        }
        else {
            a[l - 1] = 0;
            a[n - 1] = 0;
        }
    }

    for(int i = 0; i < N; i++) {
        if(a[i] > 0) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 2932
use std::io::Read;
use std::collections::HashMap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut counts: HashMap<usize, usize> = HashMap::new();
    for _ in 0..n {
        let a: usize = iterator.next().unwrap().parse().unwrap();
        *counts.entry(a).or_insert(0) += 1;
    }

    let x: usize = counts.values().map(|it| *it - 1).sum();

    if x % 2 == 0 {
        (n - x).to_string()
    } else {
        (n - x - 1).to_string()
    }
}


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

int main() {

    int a,b;

    cin >> a >> b;
    
    if( a < b ) { 
        cout << "a < b" << endl;
    } else if( a > b ) { 
        cout << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }   

    return 0;
}



Measured memory_bytes: 3056
/*
{
######################
#       Author       #
#        Gary        #
#        2020        #
######################
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
const int MOD=1e9+7;
LL fact[200000+20],rfact[200000+20];
LL quick(LL A,LL B){
	if(B==0) return 1;
	LL  tmp=quick(A,B>>1);
	tmp*=tmp;
	tmp%=MOD;
	if(B&1)
		tmp*=A,tmp%=MOD;
 	return tmp;
}
LL c(int A,int B){
	return fact[A]*rfact[B]%MOD*rfact[A-B]%MOD;
}
vector<int> have[200000+20];
int fa[200000+20];
int root(int u){
	return fa[u]=(fa[u]==u? u:root(fa[u]));
}
void merge(int u,int v){
	if(root(u)!=root(v)){
		u=root(u);
		v=root(v);
		if(have[u].size()>have[v].size()){
			fa[v]=u;
			for(auto it:have[v])
				have[u].PB(it);
			have[v].clear();
		}
		else{
			fa[u]=v;
			for(auto it:have[u])
				have[v].PB(it);
			have[u].clear();
		}
	}
}
vector<int> col[200000+20];
int w[200000+20];
bool cmp(int A,int B){
	return w[A]<w[B];
}
vector<int> dsu[200000+20];
int main(){
	fastio;
	fact[0]=1ll;
	int n;
	int x,y;
	R(n);
	cin>>x>>y;
	rb(i,1,200000)
		fact[i]=fact[i-1]*i%MOD;
	rfact[200000]=quick(fact[200000],MOD-2);
	rl(i,200000-1,1)
		rfact[i]=rfact[i+1]*(i+1)%MOD;
	rfact[0]=1;
	rb(i,1,n){
		int c;
		R2(c,w[i]);
		col[c].PB(i);
		have[i].PB(c);
		fa[i]=i;
	}
	rb(i,1,n) sort(ALL(col[i]),cmp);
	priority_queue<mp,vector<mp>,greater<mp > > heap;
	rb(i,1,n){
		for(auto it:col[i]){
			if(w[it]+w[col[i][0]]<=x){
					merge(it,col[i][0]);
			}
		}
	}//连同色边 
	rb(i,1,n)
		if(root(i)==i){
			dsu[have[i][0]].PB(i);
			heap.push(II(w[col[have[i][0]][0]],have[i][0]));
		}
	rb(i,1,n){
		vector<int> ban;
		while(!heap.empty()&&heap.top().SEC==i)
			ban.PB(heap.top().FIR),heap.pop();
		if(!heap.empty())
		for(auto it:dsu[i]){
			if(w[it]+heap.top().FIR<=y){
				merge(it,col[heap.top().SEC][0]);
			}
		}
		for(auto it:ban)
			heap.push(II(it,i));
	}
	LL rest=1ll;
	rb(i,1,n)
	if(root(i)==i){
		sort(ALL(have[i]));
		int sum=0,sum_=0,las=-1;
		for(auto it:have[i]){
			if(las!=it){
				rest=rest*c(sum,sum_)%MOD;
				sum_=0;
				las=it;
			}
			sum_++;
			sum++;
		}
		rest=rest*c(sum,sum_)%MOD;
	}
	cout<<rest<<endl;
	return 0;
}
/** 程序框架：
  * DSU : 连边 
  * 1.将同色先连边 
  * 2.将异色连边
  *
  **/


Measured memory_bytes: 40120
# 2 2 4 1 4 1
# 1 4 1 2 2
n = int(input())
a = list(map(int,input().split()))
i2 = 0
i4 = 0
for i in range(n):
    if a[i]%4==0:
        i4 += 1
    if a[i]%2==0:
        i2 += 1

if n//2 <= i4:
    print('Yes')
else:
    tmp = n//2
    if n%2==0:
        if (tmp - i4) * 2 <= (i2 - i4):
            print('Yes')
        else:
            print('No')
    else:
        if (tmp - i4) * 2 + 1 <= (i2 - i4):
            print('Yes')
        else:
            print('No')
            

Measured memory_bytes: 20080
#include<iostream>
#include<tuple>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int n; cin>>n;
  vector<tuple<string, int, int>> a;
  for(int i = 1; i <= n; i++){
    string s;
    int p;
    cin >> s >> p;
    p = -p;
    a.push_back(tie(s, p, i));
  }
  sort(a.begin(), a.end());
  for(int i = 0; i < n; i++){
    cout << get<2>(a[i]) << endl;
  }
  

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (X, Y) = listOfLong()
    var ans = 0
    while ((X shl ans) <= Y) {
        ans += 1
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfLong() = listOfString().map(String::toLong)


Measured memory_bytes: 37620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    vector<int> cnt(n,0);
    int ans = 0;
    for (int i = n - 2; i >= 0;i--){
        if(h[i]>=h[i+1])
            cnt[i] += cnt[i + 1] + 1;
    ans = max(ans, cnt[i]);}
    cout << ans << endl;
}

Measured memory_bytes: 4032
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl endl

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int positive_surplus(int &a) { return (a + MOD) % MOD; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class BGuidebook {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int N;
    cin >> N;
    map<string, vector<pair<int, int>>> restaurant;
    rep(i, N) {
      string S;
      int P;
      cin >> S >> P;
      restaurant[S].emplace_back(P, i + 1);
    }
    for (auto &i : restaurant) {
      sort(ALL(i.second), greater<pair<int, int>>());
      for (auto &j : i.second) {
        cout << j.second << endl;
      }
    }
  }
};


signed main() {
  BGuidebook solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
from math import sqrt

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

# p << inf
def dxy(p):
    l = [(abs(x[i]-y[i]))**p for i in range(n)]
    sum_l = sum(l)
    return sum_l ** (1/p)

for p in range(1, 4):
    print(dxy(p))

ls = [abs(x[i]-y[i]) for i in range(n)]
print(max(ls))


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

#define ll long long
#define ld long double
#define fi first
#define se second
#define pi 3.1415926535
#define mod1 1000000007
#define mod2 1000000009
#define no_of_digits(n) floor(log10(n)) + 1
#define lcm(a, b) (a/__gcd(a,b)*b

using namespace std;


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


	char a, b;

	cin >> a >> b;
	int ia = a -'0', ib = b -'0';
	string ab(ia, b);
	string ba(ib, a);
	cout << min(ab, ba);
	return 0;
}

Measured memory_bytes: 256
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

a,b,k = readInts()

o = set(range(a,min(a+k,b)))
t = set(range(max(a,b-k+1),b+1))
ans = sorted(list(o|t))

for i in ans:
	print(i)

Measured memory_bytes: 3444
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

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

	ll ans = 1e15;
	for (ll i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			ans = min(ans, i + n / i - 2);
		}
	}

	cout << ans << endl;
}

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

val pw = PrintWriter(System.out)
fun solve(S: String){
    when(S){
        "SUN" -> 7
        "MON" -> 6
        "TUE" -> 5
        "WED" -> 4
        "THU" -> 3
        "FRI" -> 2
        "SAT" -> 1
        else -> 0
    }.let{ println(it) }
    pw.flush()
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val S = sc.next()
    solve(S)
}



Measured memory_bytes: 31384
import java.util.*;
class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a == b){
		    System.out.println("a == b");
		} else if(a < b){
		    System.out.println("a < b");
		} else {
		    System.out.println("a > b");
		}
	}
}



Measured memory_bytes: 26208
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
int d[128][128],solve[128];
int main(){
      int n,m,row,t;
      queue<int> que;
      cin >> n;
      for(int i= 0;i<n;i++){
            cin >>row>>m;
            for(int j = 0;j<m;j++){
                  cin>>t;
                  d[row][t] = 1;
            }
      }
      fill(solve,solve+n+2,-1);
      que.push(1);
      solve[1] = 0;
      while(!que.empty()){
            int p = que.front();
            que.pop();
            for(int i = 1;i<=n;i++){
                  if(d[p][i] && solve[i]==-1){
                        que.push(i);
                        solve[i] = solve[p] + 1;
                  }
            }
      }
      for(int i = 1;i<=n;i++)cout << i << ' '<< solve[i]<<endl;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
const long long MOD = 1000000007;

signed main(){
    string S;
    cin >> S;
    ll ans;
    if(S == "RRR") ans = 3;
    else if(S == "RRS" || S == "SRR") ans = 2;
    else if(S == "SSS") ans = 0;
    else ans = 1;
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 3620
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const int big=1e9+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
template<typename T>class seg_tree{
public:
	T treesum,treemax;
	int seghi,segmg;
	seg_tree *left;
	seg_tree *right;
	seg_tree(int hi,int mg){
		treesum=0;treemax=0;
		seghi=hi;segmg=mg;
		left=NULL;right=NULL;
		int tyu=(hi+mg)/2;
		if(hi+1<mg){make_left(hi,tyu);make_right(tyu,mg);}
	}
	~seg_tree(){delete left;delete right;}
	void make_left(int hi,int mg){if(this->left!=NULL){cout<<"ばぐ"<<endl;throw(1);}this->left=new seg_tree(hi,mg);}
	void make_right(int hi,int mg){if(this->right!=NULL){cout<<"ばぐ"<<endl;throw(1);}this->right=new seg_tree(hi,mg);}
	void setval(int pla,T val){//plaの要素をvalふやす
		if(seghi==pla&&segmg==pla+1){treesum+=val;treemax+=val;return;}
		if(pla<left->segmg){left->setval(pla,val);}
		else{right->setval(pla,val);}
		treesum=left->treesum+right->treesum;
		treemax=max(left->treemax,left->treesum+right->treemax);
	}
	T ask(){
		//区間(0,mg)について,0からの累積和最大を返す
		return treemax;
	}
};
int main(void){
	int n,m,i,ans;cin>>n>>m;
	ans=min(n,m);
	seg_tree<int>ki(0,m+1);
	for(i=1;i<=m;i++){ki.setval(i,-1);}
	vector<pair<int,int>>taka(n);//R,L
	vector<int>swa(n);
	for(i=0;i<n;i++){
		int l,r;cin>>l>>r;
		taka[i]=mp(r,l);
		swa[i]=l;
	}
	sort(taka.rbegin(),taka.rend());
	sort(swa.rbegin(),swa.rend());
	for(i=1;i<=m;i++){
		while(taka.size()>0&&taka.back().fir<=i){
			ki.setval(taka.back().sec,-1);
			taka.pob();
		}
		while(swa.size()>0&&swa.back()<=i){
			ki.setval(swa.back(),1);
			swa.pob();
		}
		//cout<<ki.ask()+i<<endl;
		mineq(ans,n+m-ki.ask()-i);
	}
	cout<<n-ans<<endl;
	RE;
}

Measured memory_bytes: 21376
int main(int argc,const char*argv[])
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b){
        if(b<c){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
// B - Not Found

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	string ans = "None";

	for (char c = 'a'; c <= 'z'; c++) {
		if (S.find(c) == string::npos) {
			ans = c;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

#define rep0(i, n) for (i = 0; i < n; i++)
#define rep(s, i, n) for (i = s; i < n; i++)
using namespace std;

long long a,b,c,d;

int main()
{
    int i;
    cin >> a >> b >> c >> d;
    long long m=a*c;
    m = max(a * d,m);
    m = max(b * c, m);
    m = max(b * d, m);
    cout << m << endl;

    return 0;
}

Measured memory_bytes: 3620
import math
from itertools import permutations

N = int(input())
points = [tuple(map(int, input().split(' '))) for _ in range(N)]

s = 0
count = 0
for routes in permutations(points):
    count += 1
    for p1, p2 in zip(routes, routes[1:]):
        x1, y1 = p1
        x2, y2 = p2
        s += math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

print(s / count)


Measured memory_bytes: 3064
# For taking integer inputs.
import math
from decimal import Decimal
from itertools import permutations


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()
a = inlist()
pref = [0] * (n)
suf = [0] * n
pref[0] = a[0]
suf[n-1] = a[n-1]
j = n - 2
for i in range(1, n):
    pref[i] = a[i] + pref[i-1]
    suf[j] = a[j] + suf[j+1]
    j -= 1

D = 10000000000000000
for i in range(0, n-1):

    s1 = pref[i]
    s2 = suf[i+1]
    d = abs(s1 - s2)
    if d < D:

        D = d

print(D)


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

#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

template <typename T>
T gcd(T x, T y)
{
    T xy = x * y;
    if (x < y)
        swap(x, y);
    T r;
    r = x % y;
    while (r != 0)
    {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
};


int main()
{
    int n,x;
    cin >> n >> x;
    vector<int> city(n);
    rep(i,n)
    {
        cin >> city[i];
    }
    vector<int> diff(n);
    rep(i,n)
    {
        diff[i] = abs(x-city[i]);
    }
    int ans = diff[0];
    rep(i,n)
    {
       ans = gcd(ans, diff[i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>

using namespace std;

typedef double elem;

struct node{
  elem x,y,z,r;
  vector<int> con;
  vector<elem> cost;
};

struct edge{
  int src;
  int dst;
  elem cost;
  edge(int s, int d, elem c):src(s),dst(d),cost(c){}
  bool operator>(const edge &e)const{
    return cost>e.cost;
  }
};

elem dist(const node &a, const node &b){
  double ret = sqrt(pow(a.x-b.x,2.0)+pow(a.y-b.y,2.0)+pow(a.z-b.z,2.0))-a.r-b.r;
  if(ret<0)ret=0;
  return ret;
}

typedef vector<node> Graph;

elem MST(Graph &G){
  bool vis[G.size()];
  elem ret=0;
  for(int i = 0; i <(int)G.size(); ++i)vis[i]=false;
  priority_queue<edge,vector<edge>,greater<edge> > Q;
  Q.push( edge(-1,0,0) );
  while(!Q.empty()){
    edge e = Q.top(); Q.pop();
    if( vis[e.dst] ) continue;
    ret+=e.cost;
    vis[e.dst]=true;
    for(int i=0;i<(int)G[e.dst].con.size();++i){
      if(!vis[G[e.dst].con[i]]){
	Q.push(edge(e.dst,G[e.dst].con[i],G[e.dst].cost[i]));
      }
    }
  }
  return ret;
}

int main()
{
  while(true){
    int n;
    cin >> n;
    if(n==0)break;
    Graph G;
    for(int i = 0; i < n; ++i){
      node t;
      cin >> t.x >> t.y >> t.z >> t.r;
      G.push_back(t);
    }
    for(int i = 0; i < n; ++i){
      for(int j = i+1; j < n; ++j){
	elem d = dist(G[i],G[j]);
	G[i].con.push_back(j);
	G[j].con.push_back(i);
	G[i].cost.push_back(d);
	G[j].cost.push_back(d);
      }
    }

    cout.precision(3);
    cout << fixed << MST(G) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 1e5;
vector<int> adj[N+9];
int vis[N+9], mxdist[N+9];

int dfs(int r) {
	if(vis[r]) return mxdist[r];
	vis[r]=1;
	int res=0;
	for(int x: adj[r]) {
		res=max(res, dfs(x)+1);
	}
	return mxdist[r] = res;
}
int main(){
	ios_base::sync_with_stdio(0);
	int a,b,n,m,T,cas=0;
	cin>>n>>m;
	for(int i=0;i<m;++i) {
		cin>>a>>b;
		adj[a].emplace_back(b);
	}
	int res=0;
	for(int i=1;i<=n;++i) {
		res=max(res, dfs(i));
	}
	cout<<res<<endl;
	return 0;
}

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

int main( void ) {
    double a, b;
    double c;
    cin >> a >> b >> c;
    int sum = 0;
    double cnt = a;
    while( cnt <= c + 0.5 ) {
        sum += (int)b;
        cnt += a;
    }
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] p = new int[n];
            for (int i = 0; i < n; i++) {
                int v = in.nextInt();
                p[v - 1] = i + 1;
            }
            for (int v : p)
                out.print(v + " ");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Measured memory_bytes: 46336
#![allow(unused_imports)]
// use itertools::Itertools;
use proconio::{input, marker::*};

fn main() {
    input! {
        a: usize,
        b: usize,
        x: usize
    };
    if a == b {
        println!("{}", (a % x == 0) as i32);
        return;
    }
    let left = if a % x == 0 { a / x } else { a / x + 1 };
    if x * left > b {
        println!("0");
        return;
    }
    let right = b / x;
    println!("{}", 1 + right - left);
}


Measured memory_bytes: 2072
#include <iostream>
#include <vector>
#include <string.h>
using namespace std;

int inf = 1e8;
int V,E;

struct edge{int to, cap, rev;};
vector<edge> G[101];
bool used[101];
void add_edge(int from, int to, int cap){
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}

int dfs(int v,int t,int f){
	if(v==t) return f;
	used[v] = true;
	for(int i=0;i<G[v].size();i++){
		edge &e = G[v][i];
		if(!used[e.to] && e.cap>0){
			int d = dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s,int t){
	int flow = 0;
	for(;;){
		memset(used,0,sizeof(used));
		int f = dfs(s,t,inf);
		if(f==0) return flow;
		flow += f;
	}
}

int main(){
	cin >> V >> E;
	for(int i=0;i<E;i++){
		int t,c,r;
		cin >> t >> r >> c;
		add_edge(t,r,c);
	}
	cout << max_flow(0,V-1) << endl;
}


Measured memory_bytes: 3156
#include<stdio.h>
#include<math.h>
int main(void){

  double r;
  double are,circ;
  scanf("%lf",&r);

  are=3.141592653589*r*r;
  circ=2*3.141592653589*r;

  printf("%f  %f\n",are,circ);

  return 0;
}



Measured memory_bytes: 2092
#include<bits/stdc++.h>
#define ED(x) ((int)x.size()-1)
#define _for(i,a,b) for(int i=(a);i<=(b);++i)
#define _rep(i,a,b) for(int i=(a);i>=(b);--i)
#define changxv ios::sync_with_stdio(0);cin.tie(0);

using namespace std;
typedef long long ll;

template<typename T>void dbg(const char*s,T h){cerr<<s<<'='<<h<<'\n';}
template<typename T,typename...A>void dbg(const char*s,T h,A...t){
  while(*s!=',')cerr<<*s++;cerr<<'='<<h<<", ";dbg(s+1,t...);
}
#define put(...) dbg(#__VA_ARGS__, __VA_ARGS__)

const int maxn=2003;
const int INF=0x3f3f3f3f;
const int P=2001;
const int mod=1e9+7;

struct node{
	int x,y;
}p[200003];
int f[maxn<<1][maxn<<1];
int fac[maxn<<2],invfac[maxn<<2];

int Qpow(int x,int k){
	int tmp=1;
	for(;k;k>>=1,x=(ll)x*x%mod)if(k&1)tmp=(ll)tmp*x%mod;
	return tmp;
}

void Pre(){
	const int lim=8002;
	fac[0]=invfac[0]=1;
	_for(i,1,lim)fac[i]=(ll)fac[i-1]*i%mod;
	invfac[lim]=Qpow(fac[lim],mod-2);
	_rep(i,lim-1,1)invfac[i]=(ll)invfac[i+1]*(i+1)%mod;
}

int C(int n,int m){
	if(n<m)return 0;
	return (ll)fac[n]*invfac[m]%mod*invfac[n-m]%mod;
}

int main(){changxv
	Pre();
	int n;cin>>n;
	_for(i,1,n){
		int x,y;cin>>x>>y;
		p[i]=(node){x,y};
		++f[-x+P][-y+P];
	}
	_for(i,1,2000+P){
		_for(j,1,2000+P){
			(f[i][j]+=(f[i-1][j]+f[i][j-1])%mod)%=mod;
		}
	}
	int ans=0;
	_for(i,1,n){
		(ans+=f[P+p[i].x][P+p[i].y])%=mod;
		(ans-=C(p[i].x+p[i].y<<1,p[i].x<<1)-mod)%=mod;
	}
	ans=(ll)ans*Qpow(2,mod-2)%mod;
	cout<<ans<<'\n';
return 0; }

Measured memory_bytes: 64512
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    LL a,b,c;
    cin >> a >> b >> c;

    bool ok = false;
    LL cab = c-a-b;
    if (0 < cab) {
        ok = (4*a*b < cab*cab);
    }
    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

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

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	int n;
	cin >> n;
	int max = 0, min = 114514;
	REP(i, n) {
		int a;
		cin >> a;
		if (a > max)max = a;
		if (a < min)min = a;
	}
	cout << max - min << endl;
}



Measured memory_bytes: 256