akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
public class Main {
    static List<Integer> al[];
    static boolean visited[];
    static int depth[];
    private static void bfs(int x){
        Queue<Integer> q = new LinkedList<>();
        q.add(x);
        depth[x] = 1;
        while(q.size() > 0){
            int xx = q.poll();
            for(int child : al[xx]){
                if(!visited[child]){
                    visited[child] = true;
                    q.add(child);
                    depth[child] = xx+1;
                }
            }
        }
    }
    private static void solver(InputReader sc, PrintWriter out) {
       int n = sc.nextInt();
       int m = sc.nextInt();
       al = new ArrayList[n];
       visited = new boolean[n];
       depth = new int[n];
       for(int i=0; i<n; i++) al[i] = new ArrayList<>();
       for(int i=0; i<m; i++){
           int x = sc.nextInt()-1;
           int y = sc.nextInt()-1;
           al[x].add(y);
           al[y].add(x);
       }
       bfs(0);
       for(int i=1; i<n; i++){
          if(depth[i]==0){
              out.println("No");
              return;
          }
       }
       out.println("Yes");
       for(int i=1; i<n; i++){
           out.println(depth[i]);
       }
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }

    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());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair{
    int x,y;
    Pair(int x, int y){
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}

Measured memory_bytes: 71960
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
template<class T> struct Prim {
 
    struct Edge {
        int to; T cost;
        Edge (int t, T c) : to(t), cost(c) {}
        bool operator < (const Edge &a) const {
            return cost > a.cost;
        }
    };
 
    int N;
    int root;
    vector< vector< Edge > > G;
    vector< vector< Edge > > MST;
    vector< bool > used;
 
    Prim (int n) : G(n), MST(n), used(n), N(n), root(-1) {}
 
    void add_edge(int a, int b, T cost) {
        G[a].push_back(Edge(b,cost));
        G[b].push_back(Edge(a,cost));
        root = a;
    }
 
    void init() {
        priority_queue< pair< Edge, int > > que;
        for (int i = 0; i < G[root].size(); i++) {
            que.push(make_pair(G[root][i],root));
        }
        for (int i = 0; i < N; i++) {
            used[i] = false;
            MST[i].clear();
        }
        used[root] = true;
        while (que.size() != 0) {
            Edge e = que.top().first;
            int from = que.top().second;
            que.pop();
            if (used[e.to]) continue;
            used[e.to] = true;
            MST[e.to].push_back(Edge(from,e.cost));
            MST[from].push_back(e);
            for (int i = 0; i < G[e.to].size(); i++) {
                que.push(make_pair(G[e.to][i],e.to));
            }
        }
    }
 
    T get_cost(void) {
        T ret = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < MST[i].size(); j++) {
                ret += MST[i][j].cost;
            }
        }
        return ret / 2;
    }
 
    vector< Edge > & operator [] (int n) {
        return MST[n];
    }
 
    int size(void) {
        return N;
    }
 
};
 
map< pair<ll,ll>, int> trans;
 
int main () {
 
    int N; cin >> N;
 
    Prim<ll> inst(100010);
 
    vector< pair<ll,ll> > xy(N);
 
    REP(i,N) cin >> xy[i].first >> xy[i].second;
    sort(xy.begin(),xy.end());
    REP(i,N) {
        trans[xy[i]] = i + 1;
    }
 
    REP(i,N - 1) {
        ll cost = min(abs(xy[i].first-xy[i+1].first),abs(xy[i].second-xy[i+1].second));
        inst.add_edge(trans[xy[i]],trans[xy[i+1]],cost);
    }
 
    vector< pair<ll,ll> > ct(N);
    REP(i,N) ct[i] = make_pair(xy[i].second,xy[i].first);
 
    sort(ct.begin(),ct.end());
 
    REP(i,N - 1) {
        ll cost = min(abs(ct[i].first-ct[i+1].first),abs(ct[i].second-ct[i+1].second));
        pair<ll,ll> a = make_pair(ct[i].second,ct[i].first);
        pair<ll,ll> b = make_pair(ct[i+1].second,ct[i+1].first);
        inst.add_edge(trans[a],trans[b],cost);
    }
 
    int v = trans.begin() -> second;
 
    inst.init();
 
    cout << inst.get_cost() << endl;
 
    return 0;
}

Measured memory_bytes: 34328
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define p_b push_back
#define pl pair<ll,ll>
#define m_p make_pair
#define MOD 1000000007
#define F(i,a,b) for(i=a;i<b;i++)
#define RF(i,a,b) for(i=a;i>=b;i--)
#define nfs ios_base::sync_with_stdio(false);cin.tie(NULL)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,q;
    cin >> n >> k >> q;
    ll arr[n+1]= {0};
    ll i;
    for(i=0;i<q;i++)
    {

        ll a;
        cin >> a;
        arr[a]++;

    }
    for(i=1;i<=n;i++)
    {


        if(arr[i] + k - q > 0)
        {

            cout << "Yes" << endl;
        }
        else
        {

            cout << "No" << endl;

        }
    }
    return 0;

}


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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

const ll MOD = (ll) 1e9 + 7;

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

    vector<ll> dp(N + 1, 0LL);
    dp[0] = 1LL;
    map<int, int> idx;
    for (auto i : C) {
        idx[i] = -1;
    }

    for (int i = 1; i <= N; ++i) {
        if (i != 1 and C[i - 1] == C[i - 2]) {
            dp[i] = dp[i - 1];
        } else {
            if (idx[C[i - 1]] == -1) {
                dp[i] = dp[i - 1];
            } else {
                dp[i] = (dp[i - 1] + dp[idx[C[i - 1]]]) % MOD;
            }
            idx[C[i - 1]] = i;
        }
    }
    cout << dp[N] << endl;

    return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int main() {
	int N, M, tmp;
	cin >> N;
	for(int i = 0; i < N; i++) {
		cin >> tmp;
		if(m.count(tmp) == 0) m[tmp] = 1;
		else m[tmp]++;
	}
	cin >> M;
	bool ans = true;
	for(int i = 0; i < M; i++) {
		cin >> tmp;
		if(m.count(tmp) == 0 || m[tmp] == 0) {
			ans = false;
			break;
		}
		m[tmp]--;
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
typedef long long ll;
const int MOD = 1000000007;
#define PI 3.1415
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n + 1);
	for (int i = 2; i <= n; i++)
		cin >> a[i];
	vector<int> ans(n + 1, 0);
	for (int i = 2; i <= n; i++)
		ans[a[i]]++;
	for (int i = 1; i <= n; i++)
		cout << ans[i] << endl;
	return 0;
}


Measured memory_bytes: 4832
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const double PI = acos(-1.0);
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

template<typename T>
struct edge {
    int src,to;
    T cost;

    edge() = default;
    edge(int to, T cost) : src(-1), to(to), cost(cost) {}
    edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
    bool operator<(const edge &e) const {
        return cost < e.cost;
    }
};

template<typename T>
vector<T> Dijkstra(vector<vector<edge<T>>> &G, int s, T inf) {
    vector<T> dist(G.size(),inf);

    using Pi = pair<T, int>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> pq;
    dist[s] = 0;
    pq.emplace(dist[s],s);
    while (!pq.empty()) {
        T d; int v;
        tie(d,v) = pq.top(); pq.pop();
        if (d > dist[v]) continue;
        for (auto &e : G[v]) {
            if (dist[e.to] > dist[v] + e.cost) {
                dist[e.to] = dist[v] + e.cost;
                pq.emplace(dist[e.to],e.to);
            }
        }
    }

    return dist;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;

    vector<vector<edge<int>>> G(N);
    rep(i,N-1) {
        int u,v,w; cin >> u >> v >> w;
        G[u].emplace_back(v,w);
        G[v].emplace_back(u,w);
    }

    auto dist = Dijkstra<int>(G,0,1e9);
    int p = max_element(all(dist)) - dist.begin();
    auto dist2 = Dijkstra<int>(G,p,1e9);
    int q = max_element(all(dist2)) - dist2.begin();
    auto dist3 = Dijkstra<int>(G,q,1e9);
    rep(i,N) cout << max(dist2[i],dist3[i]) << ln;
}


Measured memory_bytes: 3940
n,d=[int(x) for x in input().rstrip().split()]
l=[]
for i in range(n):
  x=[int(i) for i in input().rstrip().split()]
  l.append(x)

ans=0
for i in range(n):
  ni=l[i]
  for j in range(i+1,n):
    nj=l[j]
    now=0
    for k in range(d):
      now+=(ni[k]-nj[k])**2
    now=now**0.5
    if now.is_integer():
      ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <utility>
#include <string>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int main()
{
    int n, q;
    cin >> n >> q;
    queue<pair<string, int>> ps;
    repi(i, n, 0)
    {
        string name;
        int time;
        pair<string, int> p;
        cin >> name >> time;
        p.first = name;
        p.second = time;
        ps.push(p);
    }
    int now = 0;
    while (ps.size())
    {
        int time = 0;
        time = min(ps.front().second, q);
        now += time;
        ps.front().second -= time;
        if (ps.front().second)
        {
            pair<string, int> tmp;
            tmp = ps.front();
            ps.pop();
            ps.push(tmp);
        }
        else
        {
            cout << ps.front().first << " " << now << endl;
            ps.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 6384
#include<iostream>
#include<vector>

int main() {
	int N;

	std::cin >> N;

	std::vector<int> A(N);

	for (int i = 0; i < N; i++)
		std::cin >> A[i];

	int answer = 0;

	for (std::vector<int>::size_type i = 0; i < A.size(); i++)
		while (A[i] % 2 == 0) {
			answer += 1;
			A[i] /= 2;
		}

	std::cout << answer << std::endl;

	return 0;
}

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

vector<int> query[50];
int n,m,q;
long long int res = 0;
void dfs(int idx,vector <int> sel)
{
	if(idx==n)
	{
		long long int sum = 0;
		for(int i=0;i<q;i++)
		{
			long long int val = sel[query[i][1] - 1] - sel[query[i][0] - 1];
			if(val==query[i][2])
			{
				sum += query[i][3];
			}
		}
		res = max(res,sum);
		return;
	}

	if(idx==0)
	{
		for(int i=1;i<=m;i++)
		{
			vector <int> v = sel;
			v.push_back(i);
			dfs(idx+1,v);
		}
	}
	else
	{
		for(int i=sel[idx-1];i<=m;i++)
		{
			vector <int> v = sel;
			v.push_back(i);
			dfs(idx+1,v);			
		}
	}
}
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n >> m >> q;

	for(int i=0;i<q;i++)
	{
		int a,b,c,d;
		cin >> a >> b >> c >> d;
		query[i] = {a,b,c,d};
	}

	dfs(0,{});

	cout << res << '\n';
	
	return 0;
}

Measured memory_bytes: 3652
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 2005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
#define next dsodfds
#define prev dskjfodsa
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
char a[MAXN],b[MAXN];
int sum[MAXN];
int next[MAXN],prev[MAXN];
int dp[MAXN];
void left_shift()
{
    char ch=a[1];
    for(int i=1;i<n;i++) a[i]=a[i+1];
    a[n]=ch;
}
void right_shift()
{
    char ch=a[n];
    for(int i=n;i>=2;i--) a[i]=a[i-1];
    a[1]=ch;
}
//go left
int dist(int from,int to)
{
    if(from>=to) return from-to;
    else return from+(n-to);
}
int main()
{
    scanf("%s",a+1);scanf("%s",b+1);
    n=strlen(a+1);
    bool f=false;
    for(int i=1;i<=n;i++) if(b[i]=='1') f=true;
    if(!f)
    {
        for(int i=1;i<=n;i++) if(a[i]!=b[i]) {puts("-1"); return 0;}
        puts("0");
        return 0;
    }
    for(int i=1;i<=n;i++) if(b[i]=='1') {next[1]=i;break;}
    for(int i=n;i>=2;i--) if(b[i]=='1') next[i]=i; else next[i]=next[i%n+1];
    for(int i=n;i>=1;i--) if(b[i]=='1') {prev[n]=i; break;}
    for(int i=1;i<=n-1;i++) if(b[i]=='1') prev[i]=i; else prev[i]=prev[i-1+(i==1?n:0)];
    int ans=2*n;
    for(int i=0;i<n;i++)
    {
        int cnt=0;
        for(int j=1;j<=n;j++) if(a[j]!=b[j]) cnt++;
        memset(dp,0,sizeof(dp));
        for(int j=1;j<=n;j++)
        {
            if(a[j]!=b[j])
            {
                int ori=j+i;
                if(ori>n) ori-=n;
                int l=prev[ori],r=next[ori];
                int f=max(i,dist(ori,l)),g=dist(r,ori);
                dp[f-1]=max(dp[f-1],g);
            }
        }
        for(int j=n;j>=i;j--) dp[j]=max(dp[j],dp[j+1]);
        for(int j=n;j>=i;j--) ans=min(ans,2*(j+dp[j])-i+cnt);
        left_shift();
    }
    for(int i=0;i<n;i++)
    {
        int cnt=0;
        for(int j=1;j<=n;j++) if(a[j]!=b[j]) cnt++;
        memset(dp,0,sizeof(dp));
        for(int j=1;j<=n;j++)
        {
            if(a[j]!=b[j])
            {
                int ori=j-i;
                if(ori<=0) ori+=n;
                int l=prev[ori],r=next[ori];
                int f=dist(ori,l),g=max(i,dist(r,ori));
                dp[g-1]=max(dp[g-1],f);
                //printf("%d %d %d\n",j,g,f);
            }
        }
        for(int j=n;j>=i;j--) dp[j]=max(dp[j],dp[j+1]);
        for(int j=n;j>=i;j--) ans=min(ans,2*(j+dp[j])-i+cnt);
        right_shift();
    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main()
{
  int N; cin >> N;

  vector<int> t(N), v(N);
  int T = 0;
  REP(i, N) { cin >> t[i]; T += t[i]; }
  REP(i, N) cin >> v[i];

  vector<double> maxv(2*T + 1, 1e10);
  maxv[0] = maxv[2*T] = 0;
  int now = 0;
  REP(i, N) {
    for (int j = now; j <= now + 2*t[i]; j++) {
      maxv[j] = min(maxv[j], (double)v[i]);
    }
    now += 2*t[i];
  }

  for (int i = 1; i <= 2*T; i++) {
    maxv[i] = min(maxv[i], maxv[i-1] + 0.5);
  }
  for (int i = 2*T-1; i >= 0; i--) {
    maxv[i] = min(maxv[i], maxv[i+1] + 0.5);
  }

  //for (int i = 0; i <= 2*T; i++) {
  //  cout << (i / 2.0) << ',' << maxv[i] << endl;
  //}

  double ans = 0;
  REP(i, 2*T) {
    ans += (maxv[i] + maxv[i + 1])*0.25;
  }
  cout << fixed << setprecision(20) << ans << endl;

  return 0;
}

Measured memory_bytes: 512
use proconio::input;
fn main() {
    input!{
        mut n:i64,
    }
    let v:Vec<i64>=func(n);
    let mut ans:i64=digit(n);
    for i in v{
        ans=std::cmp::min(ans,digit(i));
    }
    println!("{}",ans);
}

fn digit(mut n:i64)->i64{
    let mut res:i64=0;
    while n>0{
        n/=10;
        res+=1;
    }
    res
}

fn func(n:i64)->Vec<i64>{
    let mut v:Vec<i64>=Vec::new();
    for i in 2..((n as f64).sqrt() as i64 +1){
        if n%i==0{
            v.push(n/i);
        }
    }
    v
}

Measured memory_bytes: 2044
import java.util.*;
public class Main {
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    int k = scan.nextInt();
	    ArrayList<Integer> list = new ArrayList<Integer>();
	    for(int i = 0; i < n; i++) {
	    	list.add(scan.nextInt());
	    }
	    int sum = 0;
	    for(int i= 0; i < k; i++) {
	    	Integer min = list.stream().mapToInt(v -> v).min().orElseThrow(NoSuchElementException::new);
	        list.remove(min);
	        sum += min;
	    }
	    System.out.println(sum);
	}
 
}

Measured memory_bytes: 34492
from collections import Counter
N = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f  == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
b = prime_factorize(N)
mycounter = Counter(b)
c = mycounter.most_common()
m = list(range(1,100))
count = 0
for i, j in c:
    sum = 0
    for k in m:
        sum += k
        if j < sum:
            count += k-1
            break
print(count)


Measured memory_bytes: 9336
from collections import defaultdict
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
dic = defaultdict(int)
for d in D:
    dic[d] += 1
def find(a, i):
    l = 0
    r = len(a)-1
    mid = (l+r)//2
    while l <= r:
        if i == a[mid]:
            return mid
        elif i < a[mid]:
            r = mid - 1
        else:
            l = mid + 1
        mid = (l+r)//2
    return -1
keys = list(dic.keys())
keys.sort()
for i in range(M):
    j = find(keys, T[i])
    if j == -1 or dic[keys[j]] == 0:
        print("NO")
        exit(0)
    dic[keys[j]] -= 1
print("YES")

Measured memory_bytes: 41700
import sys
from collections import namedtuple
from itertools import starmap
readline = sys.stdin.readline
EPS = 1e-9
class Segment(object):
    __slots__ = ('fi', 'se')
    def __init__(self, fi, se):
        self.fi = fi
        self.se = se
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def dot(a, b):
    return a.real * b.real + a.imag * b.imag
def norm(base):
    return abs(base) ** 2
def project(s, p2):
    base = s.fi - s.se
    r = dot(p2 - s.fi, base) / norm(base)
    return s.fi + base * r
def reflect(s, p):
    return p + (project(s, p) - p) * 2.0
def ccw(p1, p2, p3):
    a = p2 - p1
    b = p3 - p1
    if cross(a, b) > EPS: return 1
    if cross(a, b) < -EPS: return -1
    if dot(a, b) < -EPS: return 2
    if norm(a) < norm(b): return -2
    return 0
def intersect4(p1, p2, p3, p4):
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 and
			ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0)
def intersect2(s1, s2):
    return intersect4(s1.fi, s1.se, s2.fi, s2.se)
def getDistance(a, b):  return abs(a - b)
def getDistanceLP(l, p):
    return abs(cross(l.se - l.fi, p - l.fi) / abs(l.se - l.fi))
def getDistanceSP(s, p):
    if dot(s.se - s.fi, p - s.fi) < 0.0: return abs(p - s.fi)
    if dot(s.fi - s.se, p - s.se) < 0.0: return abs(p - s.se)
    return getDistanceLP(s, p)
def getDistances(s1, s2):
    if intersect2(s1, s2): return 0.0
    return min(getDistanceSP(s1, s2.fi), getDistanceSP(s1, s2.se),
               getDistanceSP(s2, s1.fi), getDistanceSP(s2, s1.se))
n = int(readline())
for _ in [0] * n:
    p0, p1, p2, p3 = starmap(complex, zip(*[map(int, input().split())] * 2))
    s1 = Segment(p0, p1)
    s2 = Segment(p2, p3)
    print("{0:.10f}".format(getDistances(s1, s2)))

Measured memory_bytes: 8116
#include <bits/stdc++.h>
using namespace std;
#define el '\n'
typedef long long ll;
ll cut = 0;
pair<int,int > edge[100005];
int par[1000005];
ll sz[100005];
int find(int x) {
  return par[x] == x ? x : par[x] = find(par[x]);
}
void upd_cnt(int u, int v) {
  cut -= sz[u]*(sz[u]-1)/2 + sz[v]*(sz[v]-1)/2;
  cut += (sz[u]+sz[v])*(sz[u]+sz[v]-1)/2;
}
void upd(int u, int v) {
  int pu = find(u);
  int pv = find(v);
  if (pu == pv) return;
  if (sz[pu] > sz[pv]) swap(pu, pv);
  upd_cnt(pu, pv);
  sz[pu] += sz[pv];
  par[pv] = pu;
  return;
}
int main() {
  ll n;
  int m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> edge[i].first >> edge[i].second;
  }
  ll all = n*(n-1)/2;
  for (int i = 1; i <= n; i++) {
    par[i] = i;
    sz[i] = 1;
  }
  vector<ll> out;
  for (int i = m-1; i >= 0; i--) {
    out.push_back(all-cut);
    upd(edge[i].first, edge[i].second);
  }
  reverse(out.begin(), out.end());
  for (ll x: out) cout << x << el;
  return 0;
}

Measured memory_bytes: 4212
local n = io.read("*n")
local a = {}
local am = {}
for i = 1, n do
  local v = io.read("*n")
  a[i] = v
  if not am[v] then am[v] = 1 else am[v] = am[v] + 1 end
end
table.sort(a)
local ret = 0
local mul = 1
while mul <= a[n] do
  mul = mul * 2
end
for i = n, 2, -1 do
  local v = a[i]
  while v + v < mul do
    mul = mul // 2
  end
  if am[v] then
    am[v] = am[v] - 1
    if am[v] == 0 then am[v] = nil end
    local dst = mul - v
    if am[dst] then
      ret = ret + 1
      am[dst] = am[dst] - 1
      if am[dst] == 0 then am[dst] = nil end
    end
  end
end
print(ret)


Measured memory_bytes: 17240
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int):
    #A,B,C = map(int,input().split())
    if A != B and A != C:
        print(A)
    elif B != A and B != C:
        print(B)
    else:
        print(C)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())
ips=lambda:input().split()

"""========main code==============="""
a=ip()
if( a.islower()):
    print("a")
else:
    print("A")


Measured memory_bytes: 65040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll ai, ao, at, aj, al, as, az;
    cin >> ai >> ao >> at >> aj >> al >> as >> az;
    ll ans = 0;
    if ((ai >= 1) && (aj >= 1) && (al >= 1)) {
        ans = 3;
        ans += (ai - 1) / 2 * 2;
        ans += (aj - 1) / 2 * 2;
        ans += (al - 1) / 2 * 2;
        ans += ao;
    }
    ll tmp = 0;
    tmp += ai / 2 * 2;
    tmp += aj / 2 * 2;
    tmp += al / 2 * 2;
    tmp += ao;
    ans = max(ans, tmp);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int a[105];
int b[105];
int main()
{
	int N;
	cin >> N;
	for(int i = 1; i <= N; i++)
	cin >> a[i] >> b[i];
	int flag = 0;
	for(int i = 3; i <= N; i++)
	if(a[i] == b[i] && a[i-1] == b[i-1] && a[i-2] == b[i-2])
	{
		flag = 1;
		break;
	}
	if(flag)
	cout << "Yes" << endl;
	else cout << "No" << endl;
 } 

Measured memory_bytes: 3112
n, k = map(int, (input().split()))
h = [int(i) for i in input().split()]

dp = [0] + [float('inf')] * (n - 1)

for i in range(n - 1):
    for j in range(1, k + 1):
        dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
        if i + j + 1 == n:
            break

print(dp[n - 1])


Measured memory_bytes: 55392
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	ll n, m;
	vector<ll>list(100005, -1);
	bool flag[100005];
	ll dp[100005];

	memset(dp, 0, sizeof(dp));
	memset(flag, false, sizeof(flag));

	cin >> n >> m;

	for (int i = 0; i < m; i++) {
		cin >> list[i];
		flag[list[i]] = true;
	}

	dp[0] = 1;

	if (flag[1] == false) {
		dp[1] = 1;
	}
	else {
		dp[1] = 0;
	}

	for (int i = 2; i <= n + 1; i++) {
		//if( flag[i] == false) dp[i] = dp[i - 1] + 1;
		if (flag[i] == false) dp[i] += dp[i - 1];

		dp[i] %= MOD;
		//if (flag[i] == false) dp[i] = dp[i - 1] * dp[i];
		//if( flag[i] == false) dp[i] = dp[i - 2] + 1;
		if (flag[i] == false ) dp[i] += dp[i - 2];

		dp[i] %= MOD;
	}


	for (int i = 0; i <= n + 1; i++) {
		//cout << "i->" << i << " " << dp[i] << endl;
	}

	cout << dp[n] << endl;




	getchar();
	getchar();
	return 0;
}

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

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

ll lcm(ll a,ll b){
  ll g = gcd(a,b);
  return a/g*b;
}

int main(){
  int n; cin>>n;
  ll ans=1LL;
  for(int i=0;i<n;i++){
    ll t; cin>>t;
    ans=lcm(ans,t);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define pb push_back
#define mod 1000000007
vector<ll>cost ,h ;

int main() {
    ll n ,i,k ;
    cin >> n>>k ;
    cost.resize(n+2) ;
    h.resize(n+2) ;
    for(i=0;i<n+2;i++) cost[i]=LLONG_MAX ;

    for(i=0;i<n;i++)  cin >> h[i] ;

    cost[0] = 0 ;
    for(i=1;i<n;i++) {

        for(ll j=1;j<=k;j++) {
            if (i-j<0) break ;
            cost[i] = min(cost[i],cost[i-j]+abs(h[i]-h[i-j])) ;
        }

    }
    cout << cost[n-1] << endl ;


}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    int h,w,k; cin >> h >> w >> k;
    string field[h*w];
    rep(i,h) cin >> field[i];
    string field2[h*w];

    int ans = 0;
    // rep(l,h) rep(m,w) field2[l][m] = field[l][m];
    // rep(l,h){
    //     rep(m,w){
    //         cout << field2[l][m];
    //     }
    //     cout << endl;
    // }

    rep(i,1<<h){
        rep(j,1<<w){
            //cout << i << j << endl;
            rep(l,h) rep(m,w) field2[l][m] = field[l][m];
            rep(l,h){
                if(i>>l&1){  // iビット目が立ってる(&1 = 1桁目が1か)
                    // i番目に対する処理
                    rep(m,w) field2[l][m] = '.';
                }
            }
            rep(l,w){
                if(j>>l&1){  // iビット目が立ってる(&1 = 1桁目が1か)
                    // i番目に対する処理
                    rep(m,h) field2[m][l] = '.';
                }
            }
            // rep(l,h){
            //     rep(m,w){
            //         cout << field2[l][m];
            //     }
            //     cout << endl;
            // }            
            int cnt = 0;
            //黒いマスがちょうどK個
            rep(a,h) rep(b,w) if(field2[a][b] == '#') cnt++;
            if(cnt == k) {ans++;}
//            cout << i << " " << j << endl;
        }
    }
    cout << ans << endl;
}

/*
g++ c.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
g++ c.cpp
oj t
*/


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

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    a *= 500;
    b *= 100;
    c *= 50;
    int ans = 0;
    for(int ai = a; ai >= 0; ai -= 500) {
        if(ai > x) continue;
        for(int bj = b; bj >= 0; bj -= 100) {
            if(ai + bj > x) continue;
            if(x - ai - bj <= c) ans++;
        }
    }
    cout << ans << endl;
}

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

int main(){
  int N, M; cin >> N >> M;
  vector< string > A(N) ,B(M);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  for(int j = 0; j < M; j++){
    cin >> B[j];
  }
  
  bool ans = false;
  for(int xs = 0; xs <= N - M; xs++){
    for(int ys = 0; ys <= N - M; ys++){
      bool clr = true;
      for(int x = 0; x < M; x++){
        for(int y = 0; y < M; y++){
          if(A[x+xs][y+ys] != B[x][y]) clr = false;
        }
      }
      if(clr) ans = true;
    }
  }
  cout << (ans?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

struct Card{
	char suit;
	int value;
};

void BubbleSort(struct Card c[], int n)
{
	int i, j;
	struct Card temp;
	
	for(i = 0; i < n; i++)
	{
		for(j = n - 1; j >= i + 1; j--)
		{
			if(c[j].value < c[j-1].value)
			{
				temp = c[j];
				c[j] = c[j - 1];
				c[j - 1] = temp;
			}
		}
	}
}
	
void SelectionSort(struct Card c[], int n)
{
	int i, j, min;
	struct Card temp;
	
	for(i = 0; i < n; i++)
	{
		min = i;
		for(j = i; j < n; j++)
		{
			if(c[j].value < c[min].value)
			{
				min = j;
			}
		}
		temp = c[i];
		c[i] = c[min];
		c[min] = temp;
	}
}

int main(void)
{
	int n, i;
	
	scanf("%d", &n);
	
	struct Card c1[n], c2[n];
	
	for(i = 0; i < n; i++)
	{
		scanf(" %c%d",&c1[i].suit, &c1[i].value);
	}
	
	for(i = 0; i < n; i++)
	{
		c2[i] = c1[i];
	}
	
	BubbleSort(c1, n);
	SelectionSort(c2, n);
	
	for(i = 0; i < n; i++)
	{
		if(i != n-1)
		{
			printf("%c%d ", c1[i].suit, c1[i].value);
		}
		else
		{
			printf("%c%d\n", c1[i].suit, c1[i].value);
		}
	}
	
	printf("Stable\n");
	
	for(i = 0; i < n; i++)
	{
		if(i != n-1)
		{
			printf("%c%d ", c2[i].suit, c2[i].value);
		}
		else
		{
			printf("%c%d\n", c2[i].suit, c2[i].value);
		}
	}
	
	for(i = 0; i < n; i++)
	{
		if(c1[i].suit != c2[i].suit)
		{
			printf("Not stable\n");
			return 0;
		}
	}
	printf("Stable\n");
	return 0;
}
	


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;

class DPairCards {
public:
	void solve(std::istream& cin, std::ostream& cout) {
		int n,m;cin >> n >> m;
		vector<int> G(m,0),GP(m,0),cnt(100010,0),pairs(100010,0);
		for (int i = 0; i < n; ++i)
		{
			int v;cin >> v;
			cnt[v]++;
		}
		for (int i = 0; i < 100010; ++i)
		{
			pairs[i] = cnt[i]/2;
			G[i%m] += cnt[i];
			GP[i%m] += pairs[i];
		}
		int left = 0;
		for (int i = 0; i < (m-i)+1; ++i)
		{
//			cout << i << " : " << G[i] << " " << GP[i] << endl;
//            cout << m - i << " : " << G[m - i] << " " << GP[m - i] << endl;
			if(i == m-i){
				left += G[i] % 2;
				break;
			}
			if(i == 0){
			    left += G[i] % 2;
			    continue;
			}
			if(G[i] <= G[m-i]){
				swap(G[i],G[m-i]);
				swap(GP[i],GP[m-i]);
			}
			int d = G[i] - G[m-i];
			left += max(0,d - min((d/2),GP[i])*2);
		}
//		cout << left << " ";
		cout << (n-left)/2 << endl;
	}
};


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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define MMOD(i) ((i%MOD)+MOD)%MOD;
#define all(v) v.begin() , v.end()
#define vec(i,j) vector<vector<ll>>(i,vector<ll>(j,0))
const ll INF=99999999999999;
const ll MOD=1000000007;
const ll MAX_N=100010;
ll a,b,c,d,e,f,x,y,z,k,m,n,l,h,w,t,ans=0,sum;
vp p;
string s;
ll solve(){
    x=c;
    y=d;
    if(x<y)swap(x,y);
    while(x%y>0){
        x=x-(x/y)*y;
        swap(x,y);
    }
    x=c*d/y;

    return (b-(a-1))-(b/c-(a-1)/c)-(b/d-(a-1)/d)+(b/x-(a-1)/x);



}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>a>>b>>c>>d;
    cout<<solve()<<endl;
    
}

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


int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length()-1;i++)
	{
		if(s.substr(i,2)=="AC")
		{
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  int alim = f / (100 * a);
  int blim = f / (100 * b);

  double max = 0;
  int mass = 0;
  int s = 0;

  for(int i=0;i<=alim;i++) {
    for(int j=0;j<=blim;j++) {
      int m = 100 * a * i + 100 * b * j;
      if(m == 0 || m > f) continue;
      int masslim = f - m;
      int sugerlim = e * (a * i + b * j);
      int lim = min(masslim, sugerlim);
      int suger = 0;
      for(int k=0;c*k<=lim;k++) {
        if(c * k + (lim - c * k) / d * d > suger) suger = c * k + (lim - c * k) / d * d;
      }

      if((double)suger / (m + suger) > max) {
        max = (double)suger / (m + suger);
        mass = m + suger;
        s = suger;
      }
    }
  }

  if(max == 0) {
    mass = 100 * a;
    s = 0;
  }

  cout << mass << " " << s << endl;
}

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

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const int MX = 2200;
typedef __int128_t lll;

int n;
map<ll, pair<int, int>> mm;
vector<ll> pr;

int main() {
	for (ll j = 2; j < MX; ++j) {
		int fl = 0;
		for (int i = 2; i * i <= j; ++i)
			if (j % i == 0) {
				fl = 1;
				break;
			}
		if (!fl)
			pr.push_back(j);
	}
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		ll x;
		scanf("%lld", &x);
		ll gr1 = 1;
		ll gr2 = 1;
		for (ll j: pr) {
			if (x % j != 0)
				continue;
			int cc = 0;
			while (x % j == 0)
				x /= j, ++cc;
			if (cc % 3 == 1)
				gr1 *= j;
			else if (cc % 3 == 2)
				gr2 *= j;
		}
		ll g = llround(sqrt(x));
		if (g * g == x)
			gr2 *= g;
		else
			gr1 *= x;
		lll y = (lll)gr1 * gr1 * gr2;
		x = gr1 * gr2 * gr2;
		if (y < x) {
			++mm[y].second;
		}
		else {
			++mm[x].first;
		}
	}
	int ans = 0;
	for (auto x: mm) {
		if (x.first != 1)
			ans += max(x.second.first, x.second.second);
		else
			ans += min(1, x.second.first);
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 8320
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,K,tp;
int main(){
    cin >> N >> K;
    map<int,int> mps;
    set<int> st;
    rep(i,N) cin >> tp, mps[tp]++ , st.insert(tp);
    int num = max(0,sz(mps)-K);
    
    vector<P> p;
    for(auto itr = mps.begin(); itr != mps.end(); ++itr){
        p.pb(mp(itr->second,itr->first));
    }
    sort(ALL(p));
    
    int i = 0,ans = 0;
    while(i != num){
        ans += p[i].first;
        i++;
    }
    cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    int ans=0;
    rep(i,n){
        cin >> a[i];
        if((i+1)%2==1 and a[i]%2==1){
            ++ans;
        }
    }
    

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<iomanip>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
  int n,ans=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;++i){
    cin>>a[i];
  }
  int mi=10000000000;
  for(int i=0;i<n;++i){
    if(mi>a[i]){
      mi=a[i];
      ++ans;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3944
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;

// ■■■■■■■■■■■■■■■■headerここまで■■■■■■■■■■■■■■■■

int main() {

    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    if (n % 2 == 0) {

        int i1 = n / 2 - 1;
        int i2 = n / 2;
        int left = a[i1] + a[i2];
        int right = b[i1] + b[i2];
        cout << right - left + 1 << endl;

    }
    else {

        int i = (n - 1) / 2;
        int left = a[i];
        int right = b[i];
        cout << right - left + 1 << endl;

    }

    return 0;

}

Measured memory_bytes: 4792
n, T = map(int, input().split())

keep_cost = 1001
taken_t = 1001
for i in range(n):
    c,t = map(int, input().split())
    if T >= t:
        if c <= keep_cost:
            keep_cost = c
            taken_t = t

print(keep_cost if taken_t <= T else "TLE")

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

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

  if(a<=c && c<=b) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
use std::cmp;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let mut pairs = vec![];
    for _ in 0..n {
        let x: u64 = sc.read();
        let y: u64 = sc.read();
        let (min, max) = if x < y { (x, y) } else { (y, x) };
        pairs.push((min, max));
    }
    pairs.sort();

    let total_min = pairs[0].0;
    let total_max = pairs.iter().map(|p| p.1).max().unwrap();

    let left_max = pairs.iter().map(|p| p.0).max().unwrap();
    let right_min = pairs.iter().map(|p| p.1).min().unwrap();

    let ans1 = (left_max - total_min) * (total_max - right_min);

    let mut store_min = std::u64::MAX;
    let mut cur_max = left_max;
    let mut cur = cur_max - total_min;
    for i in 0..(n - 1) {
        let (_, max) = pairs[i];
        cur_max = cmp::max(max, cur_max);
        store_min = cmp::min(max, store_min);
        let next = pairs[i + 1].0;
        cur = cmp::min(cur, cur_max - cmp::min(store_min, next));
    }
    let ans2 = (total_max - total_min) * cur;
    println!("{}", cmp::min(ans1, ans2));
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=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 {
    mint res(*this);
    return res/=a;
  }
};

mint dp[61][2][2][2];

int main() {
  ll l, r;
  cin >> l >> r;
  dp[60][0][0][0] = 1;
  for (int i = 59; i >= 0; i--) {
    int lb = l>>i&1;
    int rb = r>>i&1;
    rep(j,2)rep(k,2)rep(s,2) { // mae no joutai
      mint pre = dp[i+1][j][k][s];
      rep(x,2)rep(y,2) { // senni
        if (x && !y) continue; // x = 1, y = 0
        int nj = j, nk = k, ns = s; // next no joutai
        // tsugi dou naru?
        if (!s && x != y) continue;
        if (x && y) ns = 1;
        // j: L <= X
        if (!j && !x && lb) continue;
        if (x && !lb) nj = 1;
        // k: Y <= R
        if (!k && y && !rb) continue;
        if (!y && rb) nk = 1;
        //
        dp[i][nj][nk][ns] += pre;
      }
    }
  }
  mint ans;
  rep(j,2)rep(k,2)rep(s,2) ans += dp[0][j][k][s];
  cout << ans.x << endl;
  return 0;
}

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

using namespace std;

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

int q[18][100010];

int maxv(int l, int r){
  int len = r - l + 1;
  int o = 31 - __builtin_clz(len);
  return max(q[o][l], q[o][r + 1 - (1 << o)]);
}

int searchl(int s, int e, int v){
  if(maxv(e, s) < v){
    return -1;
  }
  while(1){
    if(s == e){
      return s;
    }else if(s == e + 1){
      if(q[0][s] > v){
        return s;
      }else{
        return e;
      }
    }
    int h = (s + e) / 2;
    if(maxv(h, s) < v){
      s = h - 1;
    }else{
      e = h;
    }
  }
}

int searchr(int s, int e, int v){
  if(maxv(s, e) < v){
    return e + 1;
  }
  while(1){
    if(s == e){
      return s;
    }else if(s == e - 1){
      if(q[0][s] > v){
        return s;
      }else{
        return e;
      }
    }
    int h = (s + e) / 2;
    if(maxv(s, h) < v){
      s = h + 1;
    }else{
      e = h;
    }
  }
}

int main(){
  int n;
  cin >> n;
  REP(i, n){
    cin >> q[0][i];
  }
  REP(i, 18) if(i > 0){
    int d = 1 << i;
    REP(j, n - d / 2){
      q[i][j] = max(q[i - 1][j], q[i - 1][j + d / 2]);
    }
  }
  uint64_t r = 0;
  REP(i, n){
    int x = q[0][i];
    if(x == n) continue;
    int l1 = -1, l2 = -1, r1 = n, r2 = n;
    if(i > 0){
      l1 = searchl(i - 1, 0, x);
      l2 = l1 - 1;
      if(l1 > 0){
        l2 = searchl(l2, 0, x);
      }
    }
    if(i < n - 1){
      r1 = searchr(i + 1, n - 1, x);
      r2 = r1 + 1;
      if(r1 < n - 1){
        r2 = searchr(r2, n - 1, x);
      }
    }
    uint64_t v = x;
    if(l1 >= 0){
      r += v * (l1 - l2) * (r1 - i);
    }
    if(r1 < n){
      r += v * (i - l1) * (r2 - r1);
    }
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string s; cin >> s;
    bool containsA = false;
    bool containsB = false;
    for(auto c: s){
        if(c=='A') containsA = true;
        else containsB = true;
    }
    if(containsA && containsB){
        cout << "Yes\n";
    }else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int  long long
int A[100005];
const int mod = 1e9+7;
int inv(int x)
{
    int ans = 1;
    int n=mod-2;
    while(n)
    {
        if(n&1)
        {
            ans=(ans*x)%mod;
        }
        x= (x*x)%mod;
        n>>=1;
    }
    return ans;
}
int f[100005];
void init(int n)
{
    f[0]=1;
    for(int i=1; i<=n; i++)
    {
        f[i]=(f[i-1]*i)%mod;
    }
}
int C(int n,int m)
{

    return ((f[n]*inv(f[m]))%mod*inv(f[n-m]))%mod;
}
signed main()
{

    int n,k;
    scanf("%lld%lld",&n,&k);
    init(n);
    for(int i=1; i<=n; i++)
    {
        scanf("%lld",&A[i]);
    }
    sort(A+1,A+n+1);
    int a=0,b=0;
    for(int i=1; i<=n; i++)
    {
        if(i>=k)b=(b+A[i])%mod;
        if(i<=n-k+1)
        {
            a=(a+A[i])%mod;
        }
    }
    int x = k, y = n-k+1,ans=0;

    for(int i=0; i<n; i++)
    {

        ans=(ans+((b-a+mod)%mod*C(k+i-2,k-2))%mod)%mod;
        if(y>0)
        a=(a-A[y--]+mod)%mod;
        if(x<=n)
        b=(b-A[x++]+mod)%mod;

    }
    cout<<ans<<'\n';


}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
typedef long long ll;
int main(){
    int n,a,b;scanf("%d%d%d",&n,&a,&b);
    ll l = 1LL*a*(n-1) + b,r = 1LL*b*(n-1) + a;
    if(l > r) {puts("0");return 0;}
    else printf("%lld\n",(r-l+1));
    return 0;
}

Measured memory_bytes: 3184