akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=1e6+5,M=5e3+5,INF=1e9,mod=998244353;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
ll fac[N],ifac[N],n,m;
ll C(int n,int m){
	if(n<0||m<0||n-m<0)return 0;
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main(){int lim=1e6;
	fac[0]=1;rep(i,1,lim)fac[i]=fac[i-1]*i%mod;
	ifac[lim]=qpow(fac[lim],mod-2,mod);
	repd(i,lim-1,0)ifac[i]=ifac[i+1]*(i+1)%mod;
	ll res=0;read(n,m);if(n>m)swap(n,m);
	rep(i,1,n)
		res=(res+C(i+i,i)*C(n+m-i-i,n-i))%mod;
	res=m+(res*qpow(2,mod-2,mod)%mod*qpow(C(n+m,n),mod-2,mod)%mod);
	res%=mod;cout<<res<<endl;
}

Measured memory_bytes: 15872
n=int(input())
l=list(map(int, input().split()))
cnt=0
import itertools
for a, b, c in itertools.combinations(l, 3):
  if a==b or a==c or b==c:
    cnt+=0
  elif a+b<=c or a+c<=b or b+c<=a:
    cnt+=0
  else:
    cnt+=1
print(cnt)
      

Measured memory_bytes: 9172
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int A = cin.nextInt();
        int B = cin.nextInt();
        Console.WriteLine((A - 1) * (B - 1));
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

llong N;
vector<llong> color;
vector<vector<llong>> edges;

bool check(llong now, llong col) {
	for (auto edge: edges[now]) {
		if (color[edge] != -1 && abs(color[edge] - col) != 1)
			return false;
	}
	return true;
}

llong solve(llong start) {
	fill(ALL(color), -1);
	color[start] = 1;
	queue<llong> que;
	que.push(start);
	while (que.size()) {
		llong now = que.front();
		que.pop();

		for (auto edge: edges[now]) {
			if (color[edge] != -1) continue;
			if (check(edge, color[now] + 1)) {
				color[edge] = color[now] + 1;
				que.push(edge);
			} else if (check(edge, color[now] - 1)) {
				color[edge] = color[now] - 1;
				que.push(edge);
			} else {
				return -1;
			}
		}
	}

	llong ret = 0;
	for (auto col : color)
		ret = max(ret, col);

	return ret;
}

int main() {
	cin >> N;
	edges.resize(N+1);
	string S;
	for (int i = 1; i <= N; ++i) {
		cin >> S;
		for (int j = 1; j <= N; ++j) {
			if (S[j-1] == '1') {
				edges[i].push_back(j);
			}
		}
	}

	color.resize(N+1);
	llong ans = -1;
	for (int i = 1; i <= N; ++i) {
		ans = max(ans, solve(i));
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

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

		String str = scan.nextLine();
		
		for(char c : str.toCharArray()) {
			if(c>64 && c<91) System.out.print((char)(c+32));
			else if(c>96 && c<123) System.out.print((char)(c-32));
			else System.out.print((char)c);
		}
		System.out.println();

		scan.close();
	}
}



Measured memory_bytes: 27000
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long LL;

const int N = 4010;

int r[N], g[N], b[N];
char s[N];

int main()
{
    int n;
    scanf("%d", &n);
    scanf("%s", s + 1);
    
    for(int i = 1; i <= n; i ++)
    {
        r[i] = r[i - 1], g[i] = g[i - 1], b[i] = b[i - 1];
        if(s[i] == 'R')  r[i] ++;
        else if(s[i] == 'G')  g[i] ++;
        else  b[i] ++;
    }
    
    LL res = 0;
    for(int i = 1; i <= n; i ++)
        for(int j = i + 1; j <= n; j ++)
            if(s[i] != s[j])
            {
                char c = (int)'R' + 'G' + 'B' - s[i] - s[j];
                if(c == 'R')  res += r[i - 1];
                else if(c == 'G')  res += g[i - 1];
                else  res += b[i - 1];
                if(i - (j - i) >= 1 and s[i - (j - i)] == c)  res --;
            }
    printf("%lld\n", res);
    return 0;
}

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

typedef long long ll;

const int N = 300;
ll dist[N + 5][N + 5];

int dp[N + 5][N + 5];
int vis[N + 5];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m, l;
	cin>>n>>m>>l;
	for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) {
		dist[i][j] = ((i == j)?0:2e9);
		dp[i][j] = -2;
	}
 	for(int i = 0;i < m;i++) {
		ll u, v, w;
		cin>>u>>v>>w;
		dist[u][v] = min(dist[u][v], w);
		dist[v][u] = min(dist[v][u], w);
	}
	for(int k = 1;k <= n;k++)
		for(int i = 1;i <= n;i++)
			for(int j = 1;j <= n;j++) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
	for(int i = 1;i <= n;i++) {
		dp[i][i] = -1;
		queue<int> q;
		q.push(i);
		while(!q.empty()) {
			int cur = q.front();
			q.pop();
			for(int j = 1;j <= n;j++) {
				if(dp[i][j] == -2 && dist[cur][j] <= l) {
					dp[i][j] = dp[i][cur] + 1;
					q.push(j);
				}
			}
		}
	}
	for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) {
		if(dp[i][j] == -2) dp[i][j] = -1;
		else if(i == j) dp[i][j] = 0;
	}
	int q;
	cin>>q;
	while(q--) {
		int u, v;
		cin>>u>>v;
		cout<<dp[u][v]<<'\n';
	}
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N,ans=0;cin>>N;
    vector<int> ma(N,0);
    REP(i,N)cin>>ma[i];
    for(;;){
        bool is=true;
        REP(i,N){
            if(ma[i]%2!=0)is=false;
            ma[i]/=2;
        }
        if(!is)break;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#coding: utf-8
from functools import reduce
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
N, X = map(int, input().split())
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
it = iter(x)
value = x[0]
for i in it:
    value = gcd(value, i)
print(value)

Measured memory_bytes: 14596
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt = 0;
  for(int i=0; i<N-2; i++){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C'){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
*A, = map(int, input().split())

target = []
while K:
    target.append(K%2)
    K//=2
target.extend([0]*(50-len(target)))

b = [0]*50
for i in A:
    p = 0
    while i:
        b[p] += i%2
        i //=2
        p += 1

target.reverse()
b.reverse()

c = [0]*50
for i in range(50):
    e, f = b[i], N-b[i]
    if e==f:
        c[i] = 0
    elif e>f:
        c[i] = 0
    else:            
        c[i] = 1

ans = 0
for i in range(50):
    if target[i]:
        o = []
        for j in range(i):
            o.append(target[j])
        o.append(0)
        for j in range(i+1, 50):
            o.append(c[j])
        v = 0
        for j in range(50):
            if o[j]:
                v += (2**(50-j-1))*(N-b[j])
            else:
                v += (2**(50-j-1))*b[j]
        ans = max(ans, v)

v = 0
for j in range(50):
    if target[j]:
        v += (2**(50-j-1))*(N-b[j])
    else:
        v += (2**(50-j-1))*b[j]
ans = max(ans, v)

print(ans)

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

int main() {
	int n,ans=0;
	cin >> n;
	vector<int> d(n);


	for (int i = 0; i < n; i++) {
		cin >> d[i];
	}
	
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			ans += (d[i] * d[j]);
		}
	}
	cout << ans<< endl;

}



Measured memory_bytes: 256
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		int N = nextInt(); // N人
		int K = nextInt(); // Kcm
		int[] h = nextIntArray(N);

		int sum = 0;
		for(int a: h) {
			if(a>=K)sum++;
		}
		out.println(sum);
	}


	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

}

Measured memory_bytes: 45968
#include<stdio.h>
char s[999];int cnt[26];
int main(){
	scanf("%s",s);
	for(int i=0; s[i]; i++)
		cnt[s[i]-'a']++;
	bool flag=true;
	for(int i=0; i<26; i++)
		if(cnt[i]%2)
			flag=false;
	puts(flag?"Yes":"No");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string a,b;
  cin>>a>>b;
  int n=stoi(a+b);
  string s="No";
  rep(i,1,400){
    if(i*i==n) s="Yes";
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256
'use strict';
function Main(input) {
    input = input.split("\n");
    let tmp = input[0].split(" ");

    if(tmp=="A") {
        console.log("T");
        return 0;
    }
    if(tmp=="T") {
        console.log("A");
        return 0;
    }
    if(tmp=="C") {
        console.log("G");
        return 0;
    }
    if(tmp=="G") {
        console.log("C");
        return 0;
    }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#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, k, c;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  auto getPositions = [&]() {
    vector<int> res;
    for (int i = 0; i < n && res.size() < k;) {
      if (s[i] == 'o') {
        res.push_back(i);
        i += c+1;
      } else {
        ++i;
      }
    }
    return res;
  };
  vector<int> l, r;
  l = getPositions();
  reverse(s.begin(),s.end());
  r = getPositions();
  rep(i,k) r[i] = n-1-r[i];
  reverse(s.begin(),s.end());

  vector<int> lastL(n+1, -1);
  rep(i,k) lastL[l[i]+1] = i;
  rep(i,n) {
    if (lastL[i+1] == -1) lastL[i+1] = lastL[i];
  }
  vector<int> lastR(n+1, -1);
  rep(i,k) lastR[r[i]] = i;
  for (int i = n-1; i >= 0; --i) {
    if (lastR[i] == -1) lastR[i] = lastR[i+1];
  }

  rep(i,n) {
    if (s[i] == 'x') continue;
    int li = lastL[i];
    int ri = lastR[i+1];
    int cnt = 0;
    if (li != -1) cnt += li+1;
    if (ri != -1) cnt += ri+1;
    if (li != -1 && ri != -1 && r[ri]-l[li] <= c) {
      --cnt;
    }
    if (cnt >= k) continue;
    printf("%d\n", i+1);
  }
  return 0;
}

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

int main(){
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if( a+b+c >= 22 ){
    
    cout << "bust" << endl;
    
  }
  
  else{
    
    cout << "win" << endl;
    
  }
  
}


Measured memory_bytes: 256
def resolve():
    x, n = map(int, input().split())
    if n ==0:
        print(x)
    else:
        p = list(map(int, input().split()))
        ans = 0
        diff = 10**5
        for i in range(-1, 102):
            if i in p:
                continue
            else:
                if diff > abs(x-i):
                    ans = i
                    diff = abs(x-i)
        print(ans)
resolve()

Measured memory_bytes: 61772
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

ll MOD = 998244353;
template<class T> T pow(T a, T b) {
	if (b == 0)return 1;
	if (b % 2) {
		T ret = pow(a, (b - 1) / 2);
		return ((ret * ret) % MOD * a) % MOD;
	}
	else {
		T ret = pow(a, b / 2);
		return (ret * ret) % MOD;
	}
}

int main() {
	init();

	int N; cin >> N;
	vector<int>d(N);
	map<int, ll>mp;
	rep(i, 0, N) {
		cin >> d[i];
		mp[d[i]]++;
	}
	if (d[0] == 0 && mp[0] == 1) {
		ll ans = 1;
		for (auto p : mp) {
			if (p.first == 0)continue;
			else if (p.second == 0) {
				cout << 0 << "\n";
				return 0;
			}
			ans *= pow(mp[p.first - 1], p.second) % MOD;
			ans %= MOD;
		}
		cout << ans << "\n";
	}
	else {
		cout << 0 << "\n";
	}

	return 0;
}

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

#define int long long

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int N = 1e5 + 5;

map < int , int > H;
vector < int > V[N];
pp A[N];
int sz[N];

int f(int x, int d){
    int t = d;
    for(int i=0; i<V[x].size(); i++)
        t += f(V[x][i], d+1);
    return t;
}

signed main(){
    int n;
	cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        scanf("%lld",&x);
        A[i] = mp(x,i);
        H[x] = i;
    }
            
    sort(A+1 , A+n+1);
    for(int i=n; i>=2; i--){
        int x = A[i].nd;
        sz[x]++;
        H[ A[i].st ] = 0; 
        int par = H[ A[i].st - n + 2 * sz[x] ];
        if(par == 0){
            cout << -1;
            return 0;
        }
        
        sz[par] += sz[x];
        V[par].pb(x);
    }
    
    if(f(A[1].nd, 0) != A[1].st){
        cout << -1;
        return 0;
    }
    
    for(int i=1; i<=n; i++)
        for(int j=0; j<V[i].size(); j++)
            printf("%lld %lld\n", i, V[i][j]);
    
    return 0;
}

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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()
    h = input_to_int_tuple()

    if n <= k:
        return 0

    h_sorted = sorted(h)
    return sum(h_sorted[:n - k])


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 26148
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<cstring> // ??????????????????????±???????????????????
using namespace std;

int main(){
	int a,b,s=0,l;
	while( cin >> a >> b  ){
		char str[100];
		s=a+b;
		sprintf(str,"%d",s);
		l = strlen(str); // ???????????????????????????
		cout << l << "\n";
	}
	return 0;
}

Measured memory_bytes: 3204
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;

const ll N = 3010;
const ll p = 998244353;
ll n, s;
ll a[N];
ll f[N][N];

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

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

	f[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= s; j++) {
			f[i + 1][j] += f[i][j] * 2 % p, f[i + 1][j] %= p;
			if (j + a[i + 1] <= s) f[i + 1][j + a[i + 1]] += f[i][j], f[i][j + a[i + 1]] %= p;
		}
	}
	cout << f[n][s] << endl;

	return 0;
}

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

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

const int MOD = 1e+9 + 7;

int main()
{
    int N;
    cin >> N;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];

    long long ans = 0;
    for(int i = 0; i < 60; ++i){
        long long count = 0;
        REP(j, N){
            if(A[j] & ((long long) 1<<i)) ++count;
        }
        ans += (count*(N-count) %MOD) * (((long long) 1<<i) % MOD);
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a <= c && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  int n;
  double t, a;
  cin >> n;
  cin >> t >> a;
  vector<double> d(n);
  double htmp;
  for(int i=0;i<n;i++){
    cin >> htmp;
    htmp = t - htmp*0.006;
    d.at(i) = abs(a-htmp);
  }
  int palace = distance(d.begin(), min_element(d.begin(), d.end()));
  cout << palace+1 << endl;
}



Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use num::integer::lcm;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
        a: [usize;n]
    }

    let mut counter = 1;
    let mut ans = 0;

    for i in 0..n {
        if a[i] != counter {
            ans += 1;
        } else {
            counter += 1;
        }
    }

    if counter == 1 {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


Measured memory_bytes: 4720
#include <iostream>
#include <cstdio>
using namespace std;
string a, b, c;
int main()
{
	cin >> a >> b >> c;
	printf("%c", a[0] - 32);
	printf("%c", b[0] - 32);
	printf("%c", c[0] - 32);

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	public static int mark_game(ArrayList<Integer> lenge,int N) {
		int result = 0;
		if(N <= 1) {
			for(int x : lenge) {
				result += x;
			}
			return result;
		}

		lenge.remove(lenge.size()-1);
		return mark_game(lenge,N-1);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc  = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		ArrayList<Integer> data = new ArrayList<Integer>();
		ArrayList<Integer> lenge = new ArrayList<Integer>();
		
		for(int i = 0; i < M; i++) {
			data.add(sc.nextInt());
		}
		data.sort((a,b) -> Integer.compare(a,b));
		
		for(int i = 0; i < M-1; i++) {
			lenge.add(Math.abs(data.get(i)-data.get(i+1)));
		}
		lenge.sort((a,b) -> Integer.compare(a,b));
		
		if(N >= M) {
			System.out.println(0);
		}else {
			System.out.println(mark_game(lenge,N));
		}
		
		
		sc.close();
	}
}


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

string S,T;
int mn;

int main(){
	cin>>S>>T;
	mn=0xE869120;
	for(int i=0;i<=S.size()-T.size();i++){
		int c=0;
		for(int j=0;j<T.size();j++){
			if(S[i+j]!=T[j])c++;
		}
		mn=min(mn,c);
	}
	cout<<mn<<endl;
}


Measured memory_bytes: 3632
s=input()
test=0
i=0
n=len(s)
if n%2==0:
   while  i<n:
      if s[i]=="L":
         test+=1
      if s[i+1]=="R":
         test+=1
      i+=2
else:
   while i+1<n:
      if s[i]=="L":
         test+=1
      if s[i+1]=="R":
         test+=1
      i+=2
   else:
      if s[i]=="L":
         test+=1
if test==0:
   print("Yes")
else:
   print("No")


Measured memory_bytes: 3064
K = int(input())
A, B = list(map(int, input().split()))

t = 0
flg = False
for i in range(1000):
    t += K
    if A <= t <= B:
        flg = True
        break
    if t > B:
        break

if flg:
    print("OK")
else:
    print("NG")
    

Measured memory_bytes: 9112
n, m = gets.split.map(&:to_i)
arr = []
n.times do |i|
  arr[i] = gets.split.map(&:to_i)
end
arr.map!{|i| i.drop(1) }
res = Hash.new(0)
n.times do |i|
  arr[i].each do |j|
    res[j] += 1 if [*1..m].include?(j)
  end
end
puts res.values.delete_if{|i| i != n}.count


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n,s=0,t;
	cin>>n;
	t=n;
	while (t>0){
		s+=t%10;
		t/=10;
	}
	if (n%s==0){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    for i in range(1, 10):
        for j in range(1, 10):
            if i * j == n:
                print("Yes")
                exit()
    print("No")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38400
N = int(input())
A = [int(i) for i in list(input().split())]

cnt_sum = 0
for i in range(N):
    tmp = A[i]
    cnt = 0
    while True:
        if tmp % (2**(cnt + 1)) == 0:
            cnt += 1
            pass
        else:
            break
    cnt_sum += cnt
print(cnt_sum)


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

using namespace std;

const int maxn=1e4;
int n;

int main()
{
	
	cin >> n;
	int x[2*n];
	for(int i = 0; i < n*2; i++){
		cin >> x[i];
	}

	sort(x,x+2*n);
	
	int t = 0;
	for(int i = 0; i < 2*n; i+=2){
		t += x[i];
	}
	
	cout << t;
	
	return 0;
	
}


Measured memory_bytes: 256
#include <stdio.h>

bool p[10];

bool pos(int n) {
	while (n) {
		if (p[n % 10]) return false;
		n /= 10;
	}
	return true;
}

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	while (k--) {
		int x;
		scanf("%d", &x);
		p[x] = true;
	}
	for (int i = n;; i++) {
		if (pos(i)) {
			printf("%d\n", i);
			return 0;
		}
	}
}

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

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

    ll ans = 0;
    ans = x / 11 * 2;
    if(x % 11 > 6) ans += 2;
    else if(x % 11 > 0) ans += 1;
    put(ans);
    
}

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

int main(){

  const double EPS = 1e-10;

  int n;
  double x1,y1,x2,y2,x3,y3,x4,y4;
  cin>>n;
  while(n--){
    cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
    if( abs( (y2-y1)*(x4-x3) - (y4-y3)*(x2-x1)) < EPS )
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }
}

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

using namespace std;
using ll = long long;

int main() {
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;

    if (u == s) {
        a--;
    }
    if (u == t) {
        b--;
    }

    cout << a << ' ' << b << endl;
    return 0;
}

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

using namespace std;

int main(){
  int N;
  cin >> N;
  if(N == 0){
    int a;
    cin >> a;
    if(a == 1) puts("1");
    else puts("-1");
    return 0;
  }
  vector<long long> A(N + 1), B(N + 1);
  for(int i = 0; i <= N; i++){
    cin >> A[i];
  }
  
  long long nodes = 1;
  
  long long sum = A[N];
  B[N] = 0ll;
  for(int i = N - 1; i >= 0; i--){
    B[i] = sum;
    sum += A[i];
    
    if(i <= 30){
      B[i] = min((1ll << i) - A[i], B[i]);
    }
  }
  
  nodes = 1ll;
  for(int i = 1; i <= N; i++){
    B[i] = min(B[i - 1] * 2ll - A[i], B[i]);
    if(B[i] < 0ll){
      puts("-1");
      return 0;
    }
    nodes += A[i] + B[i];
  }
  
  cout << nodes << endl;
  
  return 0;
}

Measured memory_bytes: 4756
import java.util.Scanner;

public class Main {

	public static boolean isprime(int x){
	  if (x == 2) {
	    return true;
	  }
	  if(x < 2  ||x %2==0) {
	    return false;
	  }
	 int i = 3;
	  while (i <= Math.sqrt(x)) {
	    if( x % i==0) {
	      return false;
	    }
	    i = i + 2;
	  }
	 return true;

	}

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int count=0;
		for(int i=0;i<n;i++) {
			int num=scanner.nextInt();
			if(isprime(num)==true) {
				count=count+1;
			}
		}
		System.out.println(count);
	}
}



Measured memory_bytes: 41132
#include <cstdio>
#include <cctype>
#define int long long
#define reg register
using namespace std;
const int MaxN=100051;
template <class t> inline void rd(t &s)
{
s=0;
reg char c=getchar();
while(!isdigit(c))
c=getchar();
while(isdigit(c))
s=(s<<3)+(s<<1)+(c^48),c=getchar();
return;
}
int a[MaxN];
signed main(void)
{
int n;rd(n);
reg bool flg=false;
for(int i=1;i<=n;++i)
rd(a[i]);
for(int i=1;i<n;++i)
{
if(a[i]>a[i+1])
{
if(flg)
return puts("No"),0;
--a[i];
flg=true;
if(a[i]>a[i+1])
return puts("No"),0;
}
else if(a[i]<a[i+1])
flg=false;
}
puts("Yes");
return 0;
}

Measured memory_bytes: 896
N = int(input())
x = 0
 
for i in range(1,N+1):
 
    if i%3 == 0:
            print(" %d"%i,end = "");
    else:
        x = i
        while (x):
            if x%10 == 3:
                print(" %d"%i,end = "")
                break
            x //= 10
print()


Measured memory_bytes: 5876
#include <iostream>

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

using namespace std;


int main(){

	int n;
	int *a, *b;
	int *data;
	cin >> n;

	a = new int[n];
	b = new int[n];
	data = new int[100010];

	REP(i, n){
		cin >> a[i] >> b[i];
	}
	REP(i, 100010){
		data[i] = 0;
	}
	REP(i, n){
		data[a[i]]++;
		data[b[i]+1]--;
	}
	int num = 0;
	REP(i, 10){
	//	cout << data[i] << " ";
	}
	//cout << endl;
	REP(i, 100010){
		num += data[i];
		data[i] = num;

	//	cout << data[i] << " ";
	}
	//cout << endl;

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


	//cout << "Ohuotn" << endl;

	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    string ss;
    cin >> ss;
    int f = stoi(ss.substr(0,2));
    int s = stoi(ss.substr(2,2));
    bool yymm = false, mmyy = false;
    if (s > 0 && s <= 12)
        yymm = true;
    if (f > 0 && f <= 12)
        mmyy = true;

    if (yymm && mmyy)
        cout << "AMBIGUOUS" << endl;
    else if (yymm) 
        cout << "YYMM" << endl;
    else if (mmyy)
        cout << "MMYY" << endl;
    else 
        cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env pypy3


M = 10 ** 9 + 7


def naive_inv_num(xs):
    n = len(xs)
    res = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if xs[i] > xs[j]:
                res += 1
    return res


def rep_inv_num(k, xs, mod=M):
    c1 = naive_inv_num(xs)
    c2 = naive_inv_num(xs * 2)
    c3 = naive_inv_num(xs * 3)
    d1 = c2 - c1
    f = c3 - 2 * c2 + c1
    res = c1
    res += (k - 1) * d1
    res %= mod
    res += f * (k - 1) * k // 2
    res %= mod
    res -= f * (k - 1)
    res %= mod
    return res


def main():
    _, k = (int(z) for z in input().split())
    xs = [int(x) for x in input().split()]
    res = rep_inv_num(k, xs)
    print(res)


if __name__ == "__main__":
    main()


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

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

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

class CWalkOnMultiplicationTable {
public:
    void solve(std::istream& in, std::ostream& out) {
        ll n;
        in >> n;
        ll ans = n-1;
        FOR(x,1,1000025){
            if(n%x != 0)continue;
            ll y = n / x;
            CHMIN(ans, x-1 + y-1);
        }
        out << ans << endl;
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CWalkOnMultiplicationTable solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    in.tie(0);
    out << std::fixed << std::setprecision(10);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld long double
#define vc vector<ll>
typedef pair<ll,ll>pairs;
int main() {
	// your code goes here
	std::ios::sync_with_stdio(false);
	ll t,n,i,j,k,l,c,f;
	cin>>n;
	vc a;
	string s="";
    char ch;
	while(n>0)
	{
	    n-=1;
	    ch='a'+(n%26);
	    s=ch+s;
	    n/=26;
	}
	cout<<s;
	return 0;
}


Measured memory_bytes: 3620
import sys
a=[0]*51
for i in range(10):a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6
for i in range(10,19):a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6-a[i-10]*4
for e in map(int,sys.stdin):print(a[e])


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

const int maxn = 3010, mod = 1e9 + 7;
int T, n, m, ans, f[maxn][maxn][2];

int main() {
	scanf("%d %d", &n, &m);
	f[0][0][1] = 1;
	for (int i = 1; i <= n; i++) f[0][i][0] = 1;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j <= n; j++) {
			for (int k = 0; k < 2; k++) {
				if (j >= 1) {
					(f[i + 1][j - 1][k | !(j - 1)] += f[i][j][k]) %= mod;
					(f[i + 1][j][k | !(j - 1)] += f[i][j][k]) %= mod;
				}
				if (n - j >= 1) {
					(f[i + 1][j][k] += f[i][j][k]) %= mod;
					(f[i + 1][j + 1][k] += f[i][j][k]) %= mod;
				}
			}
		}
	}
	for (int i = 0; i <= n; i++) {
		(ans += f[m][i][1]) %= mod;
	}
		printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 70784
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp make_pair
typedef long long Int;

int n, a[16];

Int pack(int *a) {
    Int b = 0;
    rep (i, n) b = b*16+a[i];
    return b;
}

void unpack(Int b, int *a) {
    rep (i, n) {
        a[n-1-i] = b%16;
        b /= 16;
    }
}

int solve() {
    static int b[16];
    queue<pair<int, Int> > q;
    const Int beg = pack(a);
    rep (i, n) b[i] = i+1;
    const Int end = pack(b);
    map<Int, int> rt;
    q.push(mp(0, beg));
    rt[beg] = 0;
    while (!q.empty()) {
        pair<int, Int> vv = q.front();
        q.pop();
        unpack(vv.second, b);
        if (vv.first <= 3) rep (i, n) rep (j, i) {
            reverse(b+j, b+i+1);
            const Int p = pack(b);
            if (rt.count(p) == 0) {
                if (vv.first < 3) q.push(mp(vv.first+1, p));
                rt[p] = vv.first+1;
            }
            reverse(b+j, b+i+1);
        }
    }
    set<Int> vis;
    q.push(mp(0, end));
    while (!q.empty()) {
        pair<int, Int> vv = q.front();
        q.pop();
        if (vis.count(vv.second)) continue;
        vis.insert(vv.second);
        if (rt.count(vv.second)) return vv.first+rt[vv.second];
        unpack(vv.second, b);
        rep (i, n) rep (j, i) {
            reverse(b+j, b+i+1);
            q.push(mp(vv.first+1, pack(b)));
            reverse(b+j, b+i+1);
        }
    }
    return -1;
}

int main() {
    scanf("%d", &n);
    rep (i, n) scanf("%d", a+i);
    printf("%d\n", solve());
    return 0;
}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);

ll ans = 0, N;

void dfs(ll a) {
    if(a <= N) {
        bool t = false, f = false, s = false;
        rep(i, to_string(a).size()) {
            if(to_string(a)[i] == '3') t = true;
            if(to_string(a)[i] == '5') f = true;
            if(to_string(a)[i] == '7') s = true;
        }
        if(t && f && s) ans++;
        dfs(a_n(10, to_string(a).size())*3 + a);
        dfs(a_n(10, to_string(a).size())*5 + a);
        dfs(a_n(10, to_string(a).size())*7 + a);
    }
}

int main() {
    cin >> N;
    dfs(3);
    dfs(5);
    dfs(7);
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("unroll-loops,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
// using namespace __gnu_pbds;
using namespace std;
 
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
typedef pair<long long ,long long> ii; 	
//typedef complex<long double> com;
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin >> n >> k;
	vector <ld> arr(n);
	for (int z=0;z<n;z++){
		cin >> arr[z];
	}
	ld ans = 0;
	for (int z=0;z<k;z++){
		ans += ld(arr[z]+1)/ld(2);
	}
	ld maxi = ans;
	for (int z=k;z<n;z++){
		ans += ld(arr[z]+1)/ld(2);
		ans -= ld(arr[z-k]+1)/ld(2);
		maxi = max(ans,maxi);
	}
	cout << setprecision(60) << maxi << endl;
} 
 

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
const int maxn=100100;
int beg[maxn],tto[maxn<<1],nex[maxn<<1],e;
void putin(int s,int t){
	tto[++e]=t;
	nex[e]=beg[s];
	beg[s]=e;
}
int dfsA(int u,int fa){
	int res=0,cnt=0;
	for(int i=beg[u];i;i=nex[i]){
		if(tto[i]==fa) continue;
		res+=dfsA(tto[i],u);
		cnt++;
	}
	if(fa==-1) res+=(cnt+1)/2;
	else res+=cnt/2;
	return res;
}
int B,bo;
multiset<int> sak[maxn];
multiset<int>::iterator it,itt;
int n;
int dfsB(int u,int fa){
	int v;
	for(int i=beg[u];i;i=nex[i]){
		if(tto[i]==fa) continue;
		v=dfsB(tto[i],u)+1;
		if(v>B){
			bo=0;
			return 0;
		}
		sak[u].insert(v);
		if(!bo) return 0;
	}
	int res=sak[u].size()&1?1:2,vl=0;
	if(fa==-1) res=sak[u].size()&1?1:0;
	while(!sak[u].empty()){
		itt=sak[u].end();
		itt--;
		v=*itt;
		it=sak[u].upper_bound(B-v);
		if(it==sak[u].begin()||(int)sak[u].size()==1){
			if(!res){
				bo=0;
				return 0;
			}
			res--;
			sak[u].erase(itt);
			vl=v;
			continue;
		}
		it--;
		if(it==itt) it--;
		sak[u].erase(it);
		itt=sak[u].end();
		itt--;
		sak[u].erase(itt);
	}
	return vl;
}
bool solve(int x){
	B=x,bo=1;
	for(int i=1;i<=n;i++)
		sak[i].clear();
	dfsB(1,-1);
	return bo;
}
int main(){
//	freopen("A.in","r",stdin);
//	freopen("A.out","w",stdout);
	scanf("%d",&n);
	int s,t;
	for(int i=1;i<n;i++){
		scanf("%d%d",&s,&t);
		putin(s,t);
		putin(t,s);
	}
	int A=dfsA(1,-1);
	int l=0,r=n,mid;
	while(r-l>1){
		mid=(l+r)>>1;
		if(solve(mid)) r=mid;
		else l=mid;
	}
	printf("%d %d\n",A,r);
	return 0;
}


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

ll sub(ll A, ll B){
    if(A == 0 || B == 0){
        return 0;
    }
    if(A > B){
        return sub(B, A);
    }

    if(B % A == 0){
        return (B / A) * 2 * A - A;
    }else{
        return (B / A) * 2 * A + sub(A, B % A);
    }
}

void solve(long long N, long long X){
    cout << N + sub(X, N - X) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    solve(N, X);
    return 0;
}


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

int main(){
  long long N,K;
  cin>>N>>K;
  vector<pair<long long,long long>>vec;
  long long a,b;
  for(int i=0;i<N;i++){
    cin>>a>>b;
    vec.emplace_back(a,b);
  }
  sort(vec.begin(),vec.end());
  long long itr=0;
  while(1){
    //cout<<itr<<" "<<vec[itr].first<<" "<<vec[itr].second<<" "<<K<<endl;
    K-=vec[itr].second;
    if(K<=0) break;
    itr++;

  }
  cout<<vec[itr].first<<endl;

  return 0;
}


  

Measured memory_bytes: 5368
import java.io.PrintWriter

fun main() {
    val pw = PrintWriter(System.out)

    val n = readInputLine()

    if (n.contains('7')) {
        pw.println("Yes")
    } else {
        pw.println("No")
    }

    pw.flush()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 35656
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int euler_phi(ll n){
  if(n == 0) return 0;
  ll ret = n;
  for(int i = 2; i*i <= n; i++){
    if(n % i == 0){
      ret -= ret/i;
      while(n % i == 0) n /= i;
    }
  }
  if(n > 1) ret -= ret/n;
  return ret;
}

int main(){
  ll n;
  cin >> n;
  cout << euler_phi(n) << endl;
}



Measured memory_bytes: 3108
/*ex4_2
ryo_1129*/
#include<stdio.h>
#include<math.h>
//プロトタイプ宣言
double distance(int length_hour,int length_minute,double rad);

int main(void){
    //変数宣言
    int A,B,H,M;
    double radlong,radshort,rad,length;
    //入力
    scanf("%d %d %d %d",&A,&B,&H,&M);
    //演習率πを決める。
    const double pi = 3.14159265358979;
    //時針、分針を求める。
    radlong = 2*pi*M/60;
    radshort = 2*pi*(H*60+M)/720;
    //角度の差を求める
    rad = radlong - radshort;
    //長さを求める。
    length = distance(A,B,rad);
    //出力
    printf("%.9f\n",length);
    return 0;
}
//辺と角度から長さを求める。余弦定理
double distance(int length_hour,int length_minute,double rad){
    double length;
    length = sqrt(pow(length_hour,2)+pow(length_minute,2)-2*length_hour*length_minute*cos(rad));
    return length;
}

Measured memory_bytes: 2584
// finish date: 2018/07/12
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int N, M;
    cin >> N >> M;
    list<int> lst;
    vb used(N, false);
    vvi edge(N);
    rep(i, M) {
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        edge[A].push_back(B);
        edge[B].push_back(A);

        if (i == 0) {
            lst.push_front(A);
            lst.push_back(B);
            used[A] = true;
            used[B] = true;
        }
    }
    bool flg;
    //左端点
    do {
        flg = false;
        for (int to:edge[lst.front()]) {
            if (!used[to]) {
                lst.push_front(to);
                used[to] = true;
                flg = true;
                break;
            }
        }
    } while (flg);
    //右端点
    do {
        flg = false;
        for (int to:edge[lst.back()]) {
            if (!used[to]) {
                lst.push_back(to);
                used[to] = true;
                flg = true;
                break;
            }
        }
    } while (flg);

    cout << lst.size() << endl;
    for (int e:lst) {
        cout << e + 1 << " ";
    }
    cout << endl;

    return 0;
}



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

int main()
{
	int w, h, x, y, r;

	cin >> w >> h >> x >> y >> r;

	if (0 <= x - r && x + r <= w && 0 <= y - r && y + r <= h)
		cout << "Yes" << endl;

	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
using namespace std;
typedef long long ll;
int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, T, sum = 0;
	cin>>n>>T;
	while(T--)
	{
		ll a;
		cin>>a;
		sum+=a;
	}
	if (sum >= n) puts("Yes");
	else puts("No");
	return 0;
}


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

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define RREP(i,a) for(int i = a;i >= 0;i--)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define range(x,min,max) ((min) <= (x) && (x) <= (max))
#define xyrange(x, minX, maxX, y, minY, maxY) (range(x, minX, maxX) && range(y, minY, maxY))

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef pair<int,int> PII;
typedef vector<PII> VPII;


const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
const int INF = 0x3f3f3f3f;

int N;
VI as;

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	cin >> N;
	rep (i, N) {
		int a;
		cin >> a;
		as.pb(a);
	}
	LL sum = accumulate(all(as), 0LL);
	cout << (sum % 2? "NO" : "YES") << endl;
	return 0;
}



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

int main() {

	int n; cin >> n;
	int ans = 0;
	for(int i = 1; i <= n; i ++) {

		int num; scanf("%d", &num);

		if(i % 2 == 1 && num % 2 == 1)
			ans ++;
	}	
	cout << ans << endl;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    
    rep(i, st.size()) {
        if (i % 2) {
            if (st[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (st[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256