akhauriyash/Code-Regression huggingface dataset:
<?php

//input
fscanf(STDIN,"%d %d",$n,$eat);

$atusa = [1];
$paty = [1];
for($i=1;$i<=$n;$i++){
    $paty[$i] = $paty[$i-1]*2+1;
    $atusa[$i] = 3+$atusa[$i-1]*2;
}

echo EatB($n,$eat,$paty,$atusa);

function EatB($n,$eat,$paty,$atusa){
    //echo $n."バーガーを".$eat."食う処理を開始中\n";
    if($eat==1)return 0;
    $eat--;//最初のバーガー食う
    
    if($eat==$atusa[$n-1]){//ちょうどバーガー食う
        //echo "paty".$paty[$n-1]."をちょうど食べました1 - ".($n)."バーガー\n";
        return $paty[$n-1];
    }elseif($eat<$atusa[$n-1]){
        //echo "2 : 食べかけ開始\n";
        $an = EatB($n-1,$eat,$paty,$atusa);
        //echo "2 : 食べかけ終了\n";
        //echo "paty".$an."を食べかけました - ".($n)."バーガー\n";
        return $an;
    }elseif($eat==$atusa[$n-1]+1){//真ん中の食う
        //echo "paty".$paty[$n-1]."+1をちょうど食べました3 - ".($n-1)."バーガー\n";
        return $paty[$n-1]+1;
    }elseif($eat<$atusa[$n-1]*2+1){//端の食う
        //echo "4 : 食べかけ開始\n";
        $an = $paty[$n-1]+1 + EatB($n-1,$eat-($atusa[$n-1]+1),$paty,$atusa);
        //echo "4 : 食べかけ終了\n";
        //echo "paty".$an."を食べかけました - ".($n)."バーガー\n";
        return $an;
    }else{//if($eat==$atusa[$n-1]+1){//端ぴったしくう
        //echo "paty".($paty[$n-1]*2+1)."をちょうど食べた5 - ".($n)."バーガー\n";
        return $paty[$n-1]*2+1;
    }
}
/*

B BPPPB P BPPPB B


2バーガーを3食う処理を開始中
2 : 食べかけ開始
1バーガーを2食う処理を開始中
paty1をちょうど食べました1 - 1バーガー
2 : 食べかけ終了
paty4を食べかけました - 2バーガー
4


*/

?>

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

void Main(){
	int n,m; cin >> n >> m;
	UnionFind uf(n);
	using P = pair<int,int>;
	vector<P> ab(m);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		a--; b--;
		ab[i] = P(a,b);
	}
	ll ans = (ll)n * (n-1);
	vector<ll> ansvec(1,ans);
	for(int i = m-1; i > 0; i--){
		auto [a,b] = ab[i];
		ll as = uf.size(a);
		ll bs = uf.size(b);
		if(uf.unite(a,b)){
			ll abs = uf.size(a);
			ans = ans - as * (n-as) - bs * (n-bs) + abs * (n-abs);
		}
		ansvec.push_back(ans);
	}
	for(int i=m-1; i>=0; i--){
		cout << ansvec[i]/2 << endl;
	}
}

Measured memory_bytes: 5436
from math import sqrt


def exponential(X: int) -> int:
    sq = int(sqrt(X) + 1)
    max_exp = 1
    for base in range(2, sq):
        num = 1
        while num * base <= X:
            num *= base
        max_exp = max(max_exp, num)
    return max_exp


if __name__ == "__main__":
    X = int(input())
    ans = exponential(X)
    print(ans)


Measured memory_bytes: 3060
a=input()
A=int(a)
b=int(a)
c=0
d=1
for i in range(b):
    if A>1:
        A=int(A/2)
        c=c+int(d)
        d=d*2
    elif A==1:
        c=c+int(d)
        break
    else: break
print(c)

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

int main()
{
    int a;
    string s;

    cin >> a >> s;

    if (a >= 3200)
    {
        cout << s << endl;
    }
    if (a < 3200)
    {
        cout << "red" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
int  pow(int x,int n) {int res=1; while(n){if(n&1) res=(res*x);x=(x*x);n>>=1;}return res;}
 
int max_point(int arr[][3], int n){
	int dp[n+1][3]={0};
	// base case
	dp[1][1]=arr[1][1];
	dp[1][2]=arr[1][2];
	dp[1][3]=arr[1][3];

	for(int i=2;i<=n;i++){
		dp[i][1]=arr[i][1] + max(dp[i-1][2], dp[i-1][3]);
		dp[i][2]=arr[i][2] + max(dp[i-1][1], dp[i-1][3]);
		dp[i][3]=arr[i][3] + max(dp[i-1][1], dp[i-1][2]);
	}

	return max(dp[n][1], max(dp[n][2], dp[n][3]));

}

int32_t main()
{
	//paawan9s
	FIO;
	int n; cin>>n;
	int arr[n+1][3];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=3;j++){
			cin>>arr[i][j];
		}
	}
	cout<< max_point(arr, n);
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

int main(void){
  char c[4];
  cin >> c[0] >> c[1] >> c[2];
  sort(c, c+3);
  if(c[0] == 'a' && c[1] == 'b' && c[2] == 'c'){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

typedef long long ll;

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

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

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

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int N,M,R;
	cin >> N >> M >> R;
	vector<int> r(R);
	FOR(i,0,R){
		cin >> r[i];
		r[i]--;
	}
	sort(ALL(r));
	vector<vector<int>> cost(N, vector<int>(N, INF));
	FOR(i,0,M){
		int a,b,c;
		cin >> a >> b >> c;
		a--;b--;
		cost[a][b] = min(cost[a][b], c);
		cost[b][a] = min(cost[b][a], c);
	}
	FOR(k,0,N)FOR(i,0,N)FOR(j,0,N)
		cost[i][j] = min(cost[i][j] , cost[i][k] + cost[k][j]);
	int ans = INF;
	do{
		int tmp = 0;
		FOR(i,1,R)tmp += cost[r[i-1]][r[i]];
		ans = min(ans, tmp);
	}while(next_permutation(ALL(r)));
	ANS(ans);
	return 0;
}


Measured memory_bytes: 384
S=input()
S=S[::-1]
dp=[[0]*13 for _ in [0]*(len(S)+1)]
dp[0][0]=1
#dp[n%2][m]:=下位n桁を決定したとき13でわった余りがmになるようなものの数
def pow_k(x,n,p=10**9+7):
    if n==0:
        return 1
    K=1
    while n>1:
        if n%2!=0:
            K=(K*x)%p
        x=(x*x)%p
        n//=2
    return (K*x)%p

p=10**9+7
for n in range(len(S)):
    x=pow_k(10,n,13)
    if S[n]=='?':
        for i in range(10):
            for m in range(13):
                dp[(n+1)][(m+i*x)%13]=(dp[(n+1)][(m+i*x)%13]+dp[n][m])%p
    else:
        s=int(S[n])
        for m in range(13):
            dp[(n+1)][(m+s*x)%13]=dp[n][m]%p

print(dp[len(S)][5]%p)

Measured memory_bytes: 90096
S = list(input())

for i in range(8):
    pq = str(S[0])
    ans = int(S[0])
    l = bin(i)[2:].zfill(3)
    for j in range(3):
        if l[j] == '1':
            ans += int(S[j+1])
            pq += '+'+str(S[j+1])
        else:
            ans -= int(S[j+1])
            pq += '-'+str(S[j+1])
    if ans == 7:
        pq += '=7'
        print(pq)
        exit()


Measured memory_bytes: 38768
R,G,B,N=[int(c) for c in input().split()]

C=sorted([R,G,B])


"""
if(C==[1,1,1]):
	print((N+2)*(N+1)//2)
	exit()
"""





count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==0):
			count+=1
print(count)




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

int main(void) {
    int n, m;
    cin >> n >> m;
    vector<pair<long int, long int>> a(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a.begin(), a.end());
    int i = 0;
    unsigned long long int sum = 0;
    while (m > 0) {
        sum += a[i].first;
        a[i].second--;
        if (a[i].second == 0) {
            ++i;
        }
        --m;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include <map>

using namespace std;

int main()
{
	string wordMax;
	map<string, int> n;
	map<string, int>::iterator i, nMax;
	string a;

	wordMax = "";
	while (cin>>a) {
		if ( n.count(a) ) {	// aðkeyÉÂvfª éA»ÌlðCNg
			n[a] ++;
		} else {			// aðkeyÉÂvfªÈ¢A»ÌvfðÇÁ
			n.insert( map<string, int>::value_type(a, 1) );
		}
		if ( a.size() > wordMax.size() ) wordMax = a;
	}

	nMax = n.begin();
	for (i = n.begin(); i != n.end(); i++) {
		if ( (*i).second > (*nMax).second ) nMax = i;
	}

	cout<<(*nMax).first<<" "<<wordMax<<endl;

	return 0;
}

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

using namespace std;

using intL = long long;

#define MOD_NUMBER 1000000007

template <class T> void vector_print(vector<T> vec) {
  for (unsigned int i = 0; i < vec.size(); i++) {
    cout << vec.at(i);
    if (i < vec.size()-1) {
      cout << " ";
    } else if (i == vec.size()-1) {
      cout << endl;
    }
  }
}

int main() {
  int a, b;
  cin >> a >> b;
  if ((a*b)%2) {
    cout << "Odd" << endl;
  } else {
    cout << "Even" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

	public class Main {

		public static void main(String[] args) {
			Scanner sc=new Scanner(System.in);
			String str=sc.next();
			
			if(str.charAt(2)==str.charAt(3)&&str.charAt(4)==str.charAt(5)) {
				System.out.println("Yes");
			}else {
				System.out.println("No");	
				}
		}

	}


Measured memory_bytes: 35688
# /usr/bin/python
# -*- coding: utf-8 -*-
import math
import heapq


def nine(n):
  ret = 0
  for r in range(6,0,-1):
    p,n = divmod(n,9**r)
    ret += p
  return ret+n

def six(n):
  ret = 0
  for r in range(7,0,-1):
    p,n = divmod(n,6**r)
    ret += p
  return ret+n



if __name__ == "__main__":
  N = int(input())
  heap_q = []
  for l in range(N+1):
    heapq.heappush(heap_q,nine(l)+six(N-l))
  print(heapq.heappop(heap_q))

Measured memory_bytes: 48220
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN(s);
  OUT("ABC"+s);
}

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

int main()
{
  ll n,i;
  cin>>n;
  string str;
  cin>>str;
  ll ans=1;
  for(i=1; i<n; i++)
  {
    if(str[i]!=str[i-1])
      ans++;
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    //*
    int a, b;
    cin >> a >> b ;
    //*/

    /*
    vector<int> vec(3);
    cin >> vec.at(0) >> vec.at(1) >> vec.at(2) ;
    
    sort(vec.begin(), vec.end());
    */
    
    //*
    if( a % b == 0 ){
        cout << 0 << endl;
    } else {
        cout << 1 << endl;
    }
    //*/
    
    //cout << vec.at(2) - vec.at(0) << endl;

    return 0; 
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
const int MOD=1e9+7;
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

using namespace std;

int a,b;
class ABC148C {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> a >> b;
		out << a*b/__gcd(a,b) << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ABC148C solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main() {
  int N;
  cin>>N;
  vector<int>L(N);
  for(int i=0;i<N;i++){
    cin>>L[i];
  }
  sort(L.begin(),L.end());
  int sum=0;
  
  for(int i=0;i<N-1;i++){
    sum+=L[i];
  }
  
  if(sum>L[N-1]){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<pair<int,int>>> Graph;
const int INF=1e9;
int main(){
	int n; cin >> n; 
	Graph g(n);
	for(int i=0; i<n-1; ++i){
		int u, v, w;
		cin >> u >> v >> w;
		--u; --v;
		w %= 2;
		g[u].push_back(make_pair(v,w));
		g[v].push_back(make_pair(u,w));
	}

	vector<int> color(n,0), dst(n,0);
	vector<bool> visit(n,0);
	stack<int> st;
	color[0]=1;
	visit[0]=1;
	st.push(0);
	while(!st.empty()){
		int z=st.top();
		st.pop();
		if(dst[z]%2==0) color[z]=1;

		for(auto i : g[z]){
			if(!visit[i.first]){
				visit[i.first]=1;
				dst[i.first]=i.second+dst[z];
				st.push(i.first);
			}
		}
	}

	for(int i : color) cout << i << endl;
}

Measured memory_bytes: 7168
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

a,b = inpl()
print((b-a+1)*(b-a)//2-b)

Measured memory_bytes: 38384
n=int(input())
x=list(input())
def str2int(z):
  flag=1
  a=0
  for i in reversed(x):
    if i=='1':a+=flag
    flag*=2
  return a
 
popc=x.count('1')
z=str2int(x)
if popc-1!=0:
  fl_1=z%(popc-1)
fl_0=z%(popc+1)

for i in range(n):
  if x[i]=='1':
    if popc-1==0:
      print(0)
      continue
    mod=(fl_1-pow(2,n-1-i,popc-1))%(popc-1)
  else:mod=(fl_0+pow(2,n-1-i,popc+1))%(popc+1)
  #print('mod : %s'%mod)
  cnt=1
  while mod!=0:
    pp=bin(mod).count("1")
    mod%=pp
    cnt+=1
  print(cnt)

Measured memory_bytes: 95192
#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() {
    string s; cin >> s;
    int ans = 0;
    rep(i, s.size() / 2) {
        if (s[i] != s[s.size() - i - 1])
            ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
a, b, c = map(int,input().split())
count = 0
#偶奇を一致させる
if a % 2 == b % 2 == c % 2:
    count = 0

elif a % 2 == b % 2 != c % 2:
    count += 1
    a += 1
    b += 1

elif b % 2 == c % 2 != a % 2:
    count += 1
    b += 1
    c += 1

elif a % 2 == c % 2 != b % 2:
    count += 1
    a += 1
    c += 1
maxnum = max(a, b, c)

while a < maxnum:
    a += 2
    count += 1

while b < maxnum:
    b += 2
    count += 1

while c < maxnum:
    c += 2
    count += 1

print(count)

Measured memory_bytes: 9168
import numpy as np
card = []
for i in range(3):
  card.append(list(map(int, input().split())))
card = np.array(card)
n = int(input())
for k in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if (card[i, j] == b):
                card[i, j] = 0
flag = 0
for i in range(3):
  if (sum(card[i,:]) == 0):
    flag = 1
  if (sum(card[:,i]) == 0):
    flag = 1
if (card[0,0]+card[1,1]+card[2,2] == 0):
  flag = 1
if (card[0,2]+card[1,1]+card[2,0] == 0):
  flag = 1
if (flag == 1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 21256
package main

import (
	"fmt"
	"strconv"
)

func isOK(s string) (res bool) {
	if _, err := strconv.Atoi(s); err == nil && s[0:1] != "-" {
		res = true
	} else {
		res = false
	}
	return
}

func main() {
	var a, b int
	var s string
	fmt.Scan(&a, &b, &s)
	if isOK(s[0:a]) && isOK(s[a+1:]) && s[a:a+1] == "-" {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
vector<int> adj[100004];
ll dp[100004][2];
ll dfs(int node,int par, int color)
{
	if(dp[node][color]!=-1)return dp[node][color];
	ll cur=1;
	for(auto v : adj[node])
	{
		if(v==par)continue;
		ll white=dfs(v,node,1);
		if(color==1)white=(white+dfs(v,node,0))%mod;
		cur=(white*cur)%mod;
	}

	dp[node][color]=cur;
	return dp[node][color];
	
}
int main()
{	
	
	int n,u,v;
	cin>>n;
	memset(dp, -1, sizeof dp);
	
	for(int i=0;i<n-1;i++)
	{
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);	
	}
	ll x=dfs(1,-1,0);
	ll y=dfs(1,-1,1);
	cout<<(x+y+mod)%mod;

}


Measured memory_bytes: 15616
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main(){
    int n; cin >> n;
    vector<int>v(n-1);
    for(auto & e : v) cin >> e;
    int ans = v.front();
    for(int i = 1; i < v.size(); ++i){
        ans += min(v[i],v[i-1]);
    }
    cout << ans + v.back() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
 
string s;
int cache[N][2];
 
int dp(int idx, int less)
{
	if(idx == s.size())
		return 1;
	int &ans = cache[idx][less];
	if(ans != -1)
		return ans;
	if(!less)
	{
		if(s[idx] == '0')
			ans = dp(idx + 1, less);
		else
		{
			ans = dp(idx + 1, 1);
			ans += 2 * dp(idx + 1, 0);
		}
	}
	else
	{
		ans = dp(idx + 1, 1);
		ans += 2 * dp(idx + 1, 1);
	}
	ans %= MOD;
	return ans;
}
 
int32_t main()
{
	IOS;
	memset(cache, -1, sizeof(cache));
	cin >> s;
	int ans = dp(0, 0);
	cout << ans;
	return 0;
}

Measured memory_bytes: 6736
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

    int N, X;
    cin >> N >> X;

    vector<int> m(N);
    int sum = 0;
    int min = 10000;

    for (int i = 0; i < N; ++i) {
        cin >> m[i];
        sum += m[i];
        if (m[i] < min) min = m[i];
    }

    cout << N + (X - sum) / min << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

#include<string>
#include<stdlib.h>

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007ll;// *1000000007ll;// 10^9+7


//変数
string s;






//サブ関数
//入力
void input()
{
	cin >> s;
}



//繰り返し累乗法
//in:  x,n,mod
//out: x^n(Mod mod)
template<typename T>
T mod_pow(T x, T n, T mod) {
	T res = 1;
	while (n > 0) {
		if (n & 1)res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

map<char, vector<ll>> accumu(string s)
{
	map<char, vector<ll>> res;
	res['A'] = res['B'] = res['C'] = res['?'] = vector<ll>(s.size());
	REP(i, s.size()) {
		res[s[i]][i] = 1;
	}
	for (auto& row : res) {
		for (int i = s.size() - 1; i > 0; i--) {
			row.second[i - 1] += row.second[i];
		}
	}
	return res;
}

// k を決定したときに満たすのは、何通り？
//( 決定できるそれぞれに対し、後ろの?の個数だけ場合がある )
vector<ll> define_c(const string& s, map<char,vector<ll>> acc)
{
	vector<ll> res(s.size(), 0);
	REP(i, s.size()) if (s[i] == 'C' || s[i] == '?') {
		if (i + 1 == s.size())res[i] = 1;
		else res[i] = mod_pow(3ll, acc['?'][i + 1], MOD);
	}
	for (int i = s.size() - 1; i > 0; i--) {
		res[i - 1] += res[i] * (s[i - 1] == '?' ? 3 : 1);
		res[i - 1] %= MOD;
	}
	return res;
}

vector<ll> define_a(const string& s, map<char,vector<ll>> acc)
{
	vector<ll> res(s.size(), 0);
	REP(i, s.size())if (s[i] == 'A' || s[i] == '?') {
		if (i == 0)res[i] = 1;
		else res[i] = mod_pow(3ll, acc['?'][0] - acc['?'][i], MOD);
	}
	REP(i, s.size() - 1) {
		res[i + 1] += res[i] * (s[i + 1] == '?' ? 3 : 1);
		res[i + 1] %= MOD;
	}
	return res;
}

//計算
void calc()
{
	ll res = 0;
	auto acc = accumu(s);
	auto numc = define_c(s, acc);
	auto numa = define_a(s, acc);

	FOR(i, 1, s.size() - 1) if (s[i] == 'B' || s[i] == '?') {
		res += numa[i - 1] * numc[i + 1];
		res %= MOD;
	}
	cout << res << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


Measured memory_bytes: 8256
N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ans = 0
A_sum = sum(A)
for n in range(0,N-1):
    A_sum -= A[n]
    temp = A[n] * A_sum % mod
    ans += temp
    ans = ans % mod
print(ans)

Measured memory_bytes: 31436
#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)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

// RangeMinimumQuery
template <typename T>
struct SegTree {
	T init_val;
	int n;
	vector<T> dat;
	
	SegTree(int _n, T init_val) : init_val(init_val) {
		n = 1;
		while (n < _n) n *= 2;
		dat.resize(n * 2 - 1, init_val);
	}
	
	void add(int i, T x) {
		i += n - 1;
		dat[i] += x;
		while (i > 0) {
			i = (i - 1) / 2;
			dat[i] = dat[i * 2 + 1] + dat[i * 2 + 2];
		}
	}
	
	void set(int i, T x) {
		dat[i + n - 1] = init_val;
		update(i, x);
	}
	
	// ??¢?´¢??????[a,b), ?????¨????????????k?????????[l,r)
	T query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return init_val;
		if (a <= l && r <= b) return dat[k];
		return query(a, b, k * 2 + 1, l, (l + r) / 2) + query(a, b, k * 2 + 2, (l + r) / 2, r);
	}
	
	T query(int a, int b) {
		return query(a, b, 0, 0, n);
	}
};

int main() {
	int n, q; cin >> n >> q;
	
	SegTree<ll> sg(n, 0);
	
	while (q--) {
		int com, x, y;
		scanf("%d %d %d", &com, &x, &y);
		if (com == 0) sg.add(x - 1, y);
		else printf("%lld\n", sg.query(x - 1, y));
	}
	return 0;
}

Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

typedef pair<int,int> pii;
typedef long long int ll;
typedef long double ld;

const int DMAX = 1e5+10;

inline int two(int n) { return 1 << n; }
inline int test(int n, int pos) { return (bool) (n & two(pos)); }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }

vector <int> V[DMAX];

bool uz[10];

char s[DMAX];
char t[DMAX];

int n;

inline int cmmdc(int x,int y){
    int r=0;
    while(y){
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}

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

    int x,y;

    cin>>x>>y;
    cout<<1LL*x*y/cmmdc(x,y)<<'\n';

    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<cstring>
#include<string>
#include<deque>
#include<map>
#include<cmath>
#include<stack>
#include<vector>
#include<queue>
#include<cstdlib>
using namespace std;
#define lck_max(a,b) ((a)>(b)?(a):(b))
#define lck_min(a,b) ((a)<(b)?(a):(b))
typedef long long LL;
const int maxn=1e6+7;
const int mod=998244353;
LL hash[maxn];
char s[maxn];
struct hh
{
	LL first,second;
}t;
inline void Hash()
{
	hash[0]=1;
	for(LL i=1;i<=maxn-1000;i++)
	{
		hash[i]=hash[i-1]*13%mod;
	}
}
inline void change(LL len)
{
	for(LL i=0;i<len;i++)
	{
		if(s[i]=='b') {s[i]='d';continue;}
		if(s[i]=='d') {s[i]='b';continue;}
		if(s[i]=='q') {s[i]='p';continue;}
		if(s[i]=='p') {s[i]='q';continue;}
	}
}
int main()
{
	Hash();
	scanf("%s",s);
	LL len=strlen(s);
	for(LL i=0;i<len;i++) t.first=(t.first+s[i]*hash[i])%mod;
	change(len);
	for(LL i=len-1;~i;i--) t.second=(t.second+s[i]*hash[len-i-1])%mod;
	if(t.first==t.second) puts("Yes");
	else puts("No");
return 0;
}


Measured memory_bytes: 8192
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)


Measured memory_bytes: 9196
class BSTree:
    def __init__(self):
        self.value, self.left, self.right = (None,) * 3

    def add(self, x):
        if self.value is None:
            self.value = x
        elif x < self.value:
            if self.left is None:
                self.left = BSTree()
            self.left.add(x)
        else:
            if self.right is None:
                self.right = BSTree()
            self.right.add(x)

    def find(self, x):
        if self.value == x:
            return True
        if self.left is not None and x < self.value:
            return self.left.find(x)
        if self.right is not None and self.value < x:
            return self.right.find(x)
        return False

    def delete_min(self):
        if self.left is None:
            return self.value, None
        else:
            value, self.left = self.left.delete_min()
            return value, self

    def delete(self, x):
        if self.value == x:
            if self.left is not None and self.right is not None:
                self.value, self.right = self.right.delete_min()
            else:
                return self.left or self.right
        elif x < self.value and self.left is not None:
            self.left = self.left.delete(x)
        elif self.value < x and self.right is not None:
            self.right = self.right.delete(x)
        return self

    def preorder(self):
        def get(t):
            return [] if t is None else t.preorder()
        return [self.value] + get(self.left) + get(self.right)

    def inorder(self):
        def get(t):
            return [] if t is None else t.inorder()
        return get(self.left) + [self.value] + get(self.right)


def print_list(l):
    print(' ' + ' '.join(map(str, l)))


def main():
    n = input()
    t = BSTree()
    for _ in range(int(n)):
        ip = input().split()
        if len(ip) == 1:
            print_list(t.inorder())
            print_list(t.preorder())
        else:
            command, k = ip[0], int(ip[1])
            if command == 'insert':
                t.add(k)
            elif command == 'find':
                print('yes' if t.find(k) else 'no')
            else:
                t = t.delete(k)


if __name__ == '__main__':
    main()



Measured memory_bytes: 121372
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

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

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

int main(){
    int N;
    cin>>N;
    vector<int>idx(N);
    for(int i=0;i<N;i++){
        int tmp;
        cin>>tmp;
        idx[tmp-1]=i;
    }
    int mx = 1;
    int cnt = 1;
    for(int i=1;i<N;i++){
        if(idx[i-1]<idx[i]){
            cnt++;
        }
        else cnt=1;
        mx = max(mx, cnt);
    }
    cout<<N-mx<<endl;
    return 0;
}

Measured memory_bytes: 1024
while 1:
    try:
        datas = list(int(x) for x in input().split(","))
        v1 = datas.pop(10)
        v2 = datas.pop(10)
        p = v1 * float(sum(datas)) / (v1 + v2)
        for i in range(10):
            p -= datas[i]
            if p <= 0:
                print(i+1)
                break
    except:
        break


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

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


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

long A, B, C;

int main(void) {
  cin >> A >> B >> C;

  if(A == B && B == C) {
    cout << (A % 2 == 0 ? -1 : 0) << endl;
    return 0;
  }

  long S = A + B + C;
  int cnt = 0;
  while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
    A = (S - A) / 2;
    B = (S - B) / 2;
    C = (S - C) / 2;
    cnt++;
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
//---------------------------------------------------------------------------//
int n;
int a[10000];
int main(){
        while(1) {
                cin>>n;
                if(n==0) {
                        return 0;
                }
                for(int i=0; i<n; i++) {
                        cin>>a[i];
                }
                int sum=0;
                sort(a,n);
                for(int i=1; i<n-1; i++) {
                        sum+=a[i];
                }
                cout<<sum/(n-2)<<endl;
                n=0;
        }
}

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

int main(){
  
  int n; cin >> n;
  
  int p = n/100;
  int q = n%100;
  
  if(1 <= p && p <= 12){
    if(1 <= q && q <= 12){
      cout << "AMBIGUOUS" << endl;
    }
    else{
      cout << "MMYY" << endl;
    }
  }
  
  else if(1 <= q && q <= 12){
    if(1 <= p && p <= 12){
      cout << "AMBIGUOUS" << endl;
    }
    else{
      cout << "YYMM" << endl;
    }
  }
  
  else{
    cout << "NA" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i=0; i<n; i++) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  int sum = 0;
  for (int i=0; i<k; i++) sum+=a[i];
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 384
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(10)
 
typedef long long ll;
typedef pair<int,int> P;
ll longinf=1ll<<60;
int inf=1<<29;

int N,M,Q;
pair<int,int> p[200002];
int cnt[502][502];
int usr[502];
int rui[502][502];
int Qu[502][502];
priority_queue<P,vector<P>,greater<P>> que;

int main(){
    cin>>N>>M>>Q;
    for(int i=0;i<M;i++){
        cin>>p[i].first>>p[i].second;
        int L=p[i].first;
        int R=p[i].second;
        rui[L][R]++;
        rui[L][N+1]--;
        usr[R]++;
        }
        for(int L=1;L<=N;L++){
            for(int R=L;R<=N;R++){
                cnt[L][R]=cnt[L][R-1]+rui[L][R];
            }
        }
        Qu[1][N]=M;
        for(int i=N;i>=2;i--){
            Qu[1][i-1]=Qu[1][i]-usr[i];
        }
        for(int R=N;R>=1;R--){
            for(int L=1;L<=R-1;L++){
                Qu[L+1][R]=Qu[L][R]-cnt[L][R];
            }
        }
        for(int i=0;i<Q;i++){
            int p,q;
            cin>>p>>q;
            cout<<Qu[p][q]<<endl;
        }

    
      return 0;
}

Measured memory_bytes: 5504
#include<cstdio>
const static int MAX_r = 100000;
int ruiseki[MAX_r];

bool IsPrime(unsigned n){
	for (unsigned i = 2; i*i <= n; ++i){
		if(!(n % i)) return false;
	}
	return true;
}

int main(){
	for (unsigned i = 3; i < MAX_r; i += 2){
		if(IsPrime(i) && IsPrime(i + 1 >> 1)) ruiseki[i]++;
	}
	for (int i = 5; i < MAX_r; i += 2){
		ruiseki[i] += ruiseki[i - 2];
	}
	int Q;
	scanf("%d", &Q);
	for (int i = 0; i < Q; ++i){
		int l, r;
		scanf("%d %d", &l, &r);
		printf("%d\n", l != 1 ? ruiseki[r] - ruiseki[l - 2] : ruiseki[r]);
	}
	return 0;
}

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

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

ostream& operator<<(ostream& os, const pair<char, int>& unit) {
  return os << unit.first << "^" << unit.second;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

struct Node {
  int l, r, v;
  Node *ls, *rs;

  void ch(int k, int x) {
    if (l == r) {
      v = x;
      return;
    }
    (k <= ls->r ? ls : rs)->ch(k, x);
    v = max(ls->v, rs->v);
  }

  int qry(int l, int r) const {
    if (this->l == l && this->r == r)
      return v;
    if (r <= ls->r)
      return ls->qry(l, r);
    if (l >= rs->l)
      return rs->qry(l, r);
    return max(ls->qry(l, ls->r), rs->qry(rs->l, r));
  }
};

const int N = 200010;

int n;
int p[N];
int modify[N][2];
bool high[N];

Node* build(int l, int r, int val) {
  static Node pool[N * 4], *top = pool;
  Node* p = top++;
  p->l = l;
  p->r = r;
  p->v = val;
  if (l == r) return p;
  int mid = (l + r) >> 1;
  p->ls = build(l, mid, val);
  p->rs = build(mid + 1, r, val);
  return p;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> n;
  for (int i = 1; i <= n; ++i)
    cin >> p[i];
  int mx = 0;
  for (int i = 1; i <= n; ++i)
    if (mx < p[i]) {
      mx = p[i];
      high[i] = true;
    }
  static Node *segTree[2];
  segTree[0] = build(1, n + 1, 0);
  segTree[1] = build(1, n + 1, -n * 2 - 1);
  for (int i = n; i; --i) {
    for (int j = 0; j < 2; ++j)
      segTree[j]->ch(p[i], segTree[j ^ !high[i]]->qry(p[i] + 1, n + 1) + 1 + high[i]);
  }
  int cx = 0, cy = 0, hx = 0, hy = 0, q = count(high + 1, high + n + 1, true);
  if (segTree[q & 1]->qry(1, n + 1) >= q) {
    for (int i = 1; i <= n; ++i) {
      segTree[0]->ch(p[i], 0);
      segTree[1]->ch(p[i], -n * 2 - 1);
      int ncx = cx + (hx < p[i]);
      q -= high[i];
      if ((cy + q - ncx >= 0 && segTree[(cy + q - ncx) & 1]->qry(max(hx, p[i]) + 1, n + 1) >= cy + q - ncx) ||
          (ncx + q - cy >= 0 && segTree[(ncx + q - cy) & 1]->qry(hy + 1, n + 1) >= ncx + q - cy)) {
        cout << 0;
        if (hx < p[i]) {
          hx = p[i];
          ++cx;
        }
      } else {
        cout << 1;
        if (hy < p[i]) {
          hy = p[i];
          ++cy;
        }
      }
    }
  } else
    cout << -1;

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}



Measured memory_bytes: 26496
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


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

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int main(){

    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>

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> Pll;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e9+7;

ll gcd(ll x,ll y){
  if(x<y)swap(x,y);
  return y? gcd(y,x%y):x;
}

template <typename T>
struct SegmentTree{
    using F = function<T(T,T)>;
    int n;
    F f;
    T ti;
    vector<T> dat;
    SegmentTree(){};
    SegmentTree(F f,T ti):f(f),ti(ti){}
    void init(int n_){
        n=1;
        while(n<n_) n<<=1;
        dat.assign(n<<1,ti);
    }
    void build(const vector<T> &v){
        int n_=v.size();
        init(n_);
        for(int i=0;i<n_;i++) dat[n+i]=v[i];
        for(int i=n-1;i;i--)
            dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
    }
    void set_val(int k,T x){
        dat[k+=n]=x;
        while(k>>=1)
            dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
    }
    //[a,b)
    T query(int a,int b){
        T vl=ti,vr=ti;
        for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
            if(l&1) vl=f(vl,dat[l++]);
            if(r&1) vr=f(dat[--r],vr);
        }
        return f(vl,vr);
    }
};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;cin>>N;
  vll A(N);
  for(ll i=0;i<N;i++){
    cin>>A[i];
  }
  SegmentTree<ll> seg([](ll a,ll b){return gcd(a,b);},0);
  seg.build(A);
  ll ans = 0;
  for(ll i=0;i<N;i++){
    seg.set_val(i,0);
    ans = max(ans,seg.query(0,N));
    seg.set_val(i,A[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    vector<int>a(n),b(n),c(n);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    int dp[n+1][3];
    for(int i=0;i<3;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<n;i++){
        dp[i+1][0]=max(dp[i][1]+a[i],dp[i][2]+a[i]);
        dp[i+1][1]=max(dp[i][0]+b[i],dp[i][2]+b[i]);
        dp[i+1][2]=max(dp[i][0]+c[i],dp[i][1]+c[i]);
    }
    cout << max(dp[n][0],max(dp[n][1],dp[n][2])) << endl;
}

Measured memory_bytes: 5580
# coding: utf-8

N = input()
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
vc = [_v - _c for _v, _c in zip(v, c)]
s = sum([_vc for _vc in vc if _vc > 0])
print(s)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
inline int add(int x,int y){
	return (x+y)%mod;
}
inline int mul(int x,int y){
	return (ll)x*y%mod;
}
inline int qpow(int base,int pw){
	if(pw<0) return 1;
	int res=1;
	while(pw>0){
		if(pw&1) res=mul(res,base);
		base=mul(base,base);
		pw>>=1;
	}
	return res;
}
int h[110],dp[110][110];
vector<int> hs;
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",h+i);
		hs.push_back(h[i]);
	}
	hs.push_back(0);
	sort(hs.begin(),hs.end());
	hs.erase(unique(hs.begin(),hs.end()),hs.end());
	for(int i=1;i<=n;i++)
		h[i]=lower_bound(hs.begin(),hs.end(),h[i])-hs.begin();
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=h[i]+1;j<=h[i-1];j++)
			dp[i][0]=add(dp[i][0],add(dp[i-1][j],dp[i-1][j]));
		dp[i][0]=add(dp[i][0],add(dp[i-1][0],dp[i-1][0]));
		for(int j=1;j<=h[i];j++){
			dp[i][j]=mul(dp[i-1][j],qpow(2,hs[h[i]]-hs[h[i-1]]));
			if(h[i-1]>=j) continue;
			if(j>1) dp[i][j]=add(dp[i][j],mul(add(dp[i-1][0],dp[i-1][0]),mul(add(qpow(2,hs[j]-hs[j-1])-1,mod),qpow(2,hs[h[i]]-hs[j]))));
			else dp[i][j]=add(dp[i][j],mul(dp[i-1][0],mul(add(qpow(2,hs[j])-2,mod),qpow(2,hs[h[i]]-hs[j]))));
		}
	}
	int ans=0;
	for(int i=0;i<(int)hs.size();i++)
		ans=add(ans,dp[n][i]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
    char A[11],B[11],C[11];
    int a,b;

    scanf("%s%s%s", A, B, C);

    a=strlen(A); b=strlen(B);

    if((A[a-1]==B[0])&&(B[b-1]==C[0]))
      printf("YES\n");
    else
      printf("NO\n");

return 0;
}


Measured memory_bytes: 128
K,N=map(int,input().split())
A=sorted(list(map(int,input().split())))

max_a = max(A)
min_a = min(A)
diff_min = max_a - min_a

if N == 2:
    if A[1] - A[0] < K - (A[1] - A[0]):
        diff_min = A[1] - A[0]
    else:
        diff_min = K - (A[1] - A[0])
else:
    for i in range(1,N-1):
        tmp = K - (A[i+1] - A[i])
        if tmp < diff_min:
            diff_min = tmp
        tmp = K - (A[i] - A[i-1])
        if tmp < diff_min:
            diff_min = tmp

print(diff_min)


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

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

const ll MOD = 1000000007;


int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<int>> aij(h, vector<int>(w));
    vector<tuple<int, int, int, int>> ansv;

    rep(i, h) rep(j, w) {
        cin >> aij[i][j];
    }

    int ans = 0;
    bool rev_flg = false;
    rep(i, h) rep(j, w) {
        int next_i;
        int next_j;
        int now_j;
        if ( i == h - 1 && j == w - 1 ) break;
        if ( j == w - 1 ) {
            next_i = i + 1;
            if ( !rev_flg ) {
                next_j = w - 1;
                now_j  = w - 1;
            }
            else {
                next_j = 0;
                now_j  = 0;
            }
        }
        else {
            next_i = i;
            if ( !rev_flg ) {
                next_j = j + 1;
                now_j  = j;
            }
            else {
                next_j = w - 1 - j - 1;
                now_j  = w - 1 - j;
            }
        }
        if ( aij[i][now_j] & 1 ) {
            aij[next_i][next_j]++;
            aij[i][now_j]--;
            ans++;
            ansv.emplace_back(i, now_j, next_i, next_j);
        }
        if ( j == w - 1 ) {
            rev_flg = !rev_flg;
        }
    }

    cout << ans << endl;
    rep(i, ansv.size()) {
        printf("%d %d %d %d\n", get<0>(ansv[i]) + 1, get<1>(ansv[i]) + 1, get<2>(ansv[i]) + 1, get<3>(ansv[i]) + 1 );
    }

    return 0;
}

Measured memory_bytes: 5232
/*Author- Soumak Poddar*/

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

#define ll long long int
#define sll signed long long int
#define ull unsigned long long int
#define um unordered_map
#define us unordered_set
#define mm multimap
#define mp make_pair
#define pb push_back
#define M 1000000007

bool comp(pair<int,int> a,pair<int,int> b)
{
   return a.second<b.second;
}

template<typename T>
T gcd(T a,T b)
{
   if(a==0)
      return b;
   return gcd(b%a,a);
}
template<typename T>
T lcm(T a,T b)
{
   T g=gcd<T>(a,b);
   return (a*b)/g;
}
template<typename T>
bool isprime(T n)
{
   if(n<=1)
      return false;
   for(int i=2;i<sqrt(n);i++)
      if(n%i==0)
         return false;
   return true;
}

void solve();
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);

   #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("error.txt", "w", stderr);
      freopen("output.txt", "w", stdout);
   #endif
   
   int t=1;
   // cin>>t;
   while(t--)
   {
      solve();
      cout<<"\n";
   }
   cerr<<"Time Taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
   return 0;
}
void solve()
{
   int d,t,s;
   cin>>d>>t>>s;
   double at=(double)d/s;
   if(at<=t)
      cout<<"Yes";
   else
      cout<<"No";
}

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

int main() {

    char a;
    cin >> a;

    if (int(a - 'a') <= 26 && int(a-'a') >= 0) {
        cout << "a" << endl;
    }
    else {
        cout << "A" << endl;
    }

    return 0;
}


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

int main () {

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

    int x[N], y[N];
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &x[i], &y[i]);
    }

    int index[N];
    for (int i = 0; i < N; i++) {
        index[i] = i;
    }

    double ans = 0.0;
    int paths = 0;
    do {
        for (int i = 1; i < N; i++) {

            double dist = sqrt(pow(x[index[i]]-x[index[i-1]],2) + pow(y[index[i]]-y[index[i-1]],2));
            ans += dist;
        }
        paths++;
    } while (next_permutation(index, index+N));

    printf("%.10lf\n", ans/paths);

    return 0;
}


Measured memory_bytes: 256