akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define For(i,a,b) for(int i=a;i<b;i++)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//vector<vector<int>> data(a,vector<b>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数

int main() {
  ll a,b,c,d;
  ci(a>>b>>c>>d);
  d/=50;
  ll e=0;
  For(i,0,a+1)
    For(j,0,b+1)
      For(k,0,c+1)
        if(10*i+2*j+k==d)
          e++;
  co(e);
}

Measured memory_bytes: 256
#include <iostream>
#include <cctype>

int main()
{
    int N, K;
    char s[51] = {};
    std::cin >> N >> K;
    std::cin >> s;

    if (isupper(s[K-1]))
        s[K-1] += 'a' - 'A';

    std::cout << s << std::endl;
    return 0;
}


Measured memory_bytes: 888
// --https://kenkoooo.com/atcoder/#/table/soma62jp
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstring>

using namespace std;

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

	int N, ans = 0;

	cin >> N;

	vector<int>a(N);

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

	sort(a.rbegin(), a.rend());

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			ans += a[i];
		}
		else {
			ans -= a[i];
		}
	}

	cout << ans << endl;

	return 0;

}

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

int main(){
  int n,k;
  scanf("%d%d",&n,&k);
  vector<int> v(n);
  for(int& x:v){
    scanf("%d",&x);
  }
  vector<bool> dp(k+1);
  
  for(int i=0;i<=k;i++){
    for(int j=0;j<n;j++){
      if(i-v[j]>=0 && !dp[i-v[j]])
        dp[i]=true;
    }
  }
  if(dp[k])
    printf("First\n");
  else 
    printf("Second\n");
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	int co=0;
	rep(i,n){
		int a;cin>>a;
		if(a%4==0)co+=2;
		else if(a%2==0)co++;
	}
	if(co>=n/2*2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
def C(n,k)
  k = n - k if n - k < k 
  k.times.inject(1){|s,i| s * (n - i) / (i + 1) }
end
K, S = gets.split.map(&:to_i)
ans = (0..3).inject(0) do |t, i|
  sign = i.even? ? 1 : -1
  n = S + 3 - (K + 1) * i - 1
  n >= 2 ? t + sign * C(n, 2) * C(3, i) : t
end
puts ans


Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int n,m,t,d;
string fld[32];
bool amida(){
    int pos=t;
    for(int i=d-1;i>=0;i--){
        if(fld[i][pos-1]=='1')pos--;
        else if(fld[i][pos]=='1')pos++;
    }
    if(pos==m)return true;
    else return false;
}
int main(){
    while(cin>>n,n){
        cin>>m>>t>>d;
        for(int i=0;i<d;i++){
            string str;
            cin>>str;
            fld[i]="0"+str+"0";
        }
        if(amida()){
            cout<<0<<endl;
            continue;
        }
        bool flag=true;
        for(int i=0;i<d;i++){
            string str=fld[i];
            for(int j=1;j<n;j++){
                if(str[j]!='0'||str[j-1]!='0'||str[j+1]!='0')continue;
                fld[i][j]='1';
                if(amida()){
                    cout<<i+1<<" "<<j<<endl;
                    flag=false;
                    break;
                }
                fld[i][j]='0';
            }
            if(!flag)break;
        }

        if(flag)cout<<1<<endl;
    }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = x + y;
        b[i] = x - y;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    cout << max(a.back() - a.front(), b.back() - b.front()) << "\n";
    return 0;
}


Measured memory_bytes: 4768
#include "bits/stdc++.h"
using namespace std;
#define all(v) (v).begin(), (v).end()
#define io ios::sync_with_stdio(0)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define rson rt << 1 | 1, mid + 1, r
#define lson rt << 1, l, mid
#define lll __int128
#define pii pair<int, int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eps 1e-12
#define int long long
const int mod = 1e9 + 7;
inline int ksm(int a, int b)
{
    int ans = 1;
    for (; b; b >>= 1, a = a * a % mod)
        if (b & 1)
            ans = ans * a % mod;
    return ans;
}

signed main()
{
    io;
    int n;cin>>n; int ans=0;int mi=1e9;
    rep(i,1,n){
        int x;cin>>x;
        if(x <= mi)ans++;
        mi=min(mi,x);
       
    }
    cout<<ans<<endl;


    getchar(); //

    getchar();
}


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

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

#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

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

struct UnionFind
{
	vector<int> d;
	UnionFind(int n = 0) : d(n, -1) {}

	int find(int x)
	{
		if (d[x] < 0)
			return x;
		return 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)]; }
};

int main()
{
	fast;
	int n, m, k;
	cin >> n >> m >> k;
	vvi fr(n), bl(n);
	UnionFind uf(n);
	FOR(m)
	{
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		fr[x].pb(y);
		fr[y].pb(x);
		uf.unite(x, y);
	}
	FOR(k)
	{
		int x, y;
		cin >> x >> y;
		x--;
		y--;
		bl[x].pb(y);
		bl[y].pb(x);
	}
	FOR(n)
	{
		// total connected - self node - edges
		int ans = uf.size(i) - 1 - fr[i].size();
		for (auto &x : bl[i])
			if (uf.same(i, x))
				ans--;
		cout << ans << " ";
	}
	cout << en;
}

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

int main(){

int N;

cin>>N;
int data[N];


for (int i=0;i<N;++i){
    cin>>data[i];

}
int M=0;
cin>>M;
int P[M];
int sum[M];
int P_time[M];


for (int i=0;i<M;++i){
cin>>P[i];
sum[i]=0;
cin>>P_time[i];
}


int a=sizeof(P_time)/sizeof(*P_time);

for (int i=0;i<M;i++){
    for (int j=0;j<N;j++){
        if (P[i]==j+1){

            sum[i]+=P_time[i];

        }
        else {
        sum[i]+=data[j];
        }
    }
}



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

    cout<<sum[i]<<endl;
}










    return 0;

}

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

fun main(args: Array<String>) {

    var (A,B,C,D) = readLine()!!.split(" ").map { it.toLong() }
//    var N = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
//    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    fun gcd(a:Long, b:Long):Long {
        if (a%b == 0L) return b
        return gcd(b, a%b)
    }

    A--
    var ac = A/C
    var ad = A/D
    var acd = A/(C/gcd(C,D)*D)
    var bc = B/C
    var bd = B/D
    var bcd = B/(C/gcd(C,D)*D)

    println(B-A - (bc+bd-bcd -(ac+ad-acd)))

//    println("%.9f".format(ans))
}


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

int main() {
 string s;
    cin>>s;
    
    if(s=="SSS") {
     cout << 0;
    } else if(s=="RRR") {
     cout << 3;
    } else if( s=="RRS" || s=="SRR") {
     cout << 2;
    } else {
     cout << 1;
    }
    
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;


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

    ll a = 0;
    ll c = 0;
    REP(i, s.size()-1) {
        if (s[i] == 'A') {
            a++;
        } else if (s[i] == 'B' && s[i + 1] == 'C') {
            c += a;
            i++;
        } else {
            a = 0;
        }
    }

    cout << c << endl;
}


Measured memory_bytes: 640
#!/usr/bin/env python3

# from numba import njit

# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left

INF = 10**10

# @njit
def solve(n,c,k,t):
  res = 1
  busCapacity = c
  time = 0
  for i in range(n):
    if i == 0:
      busCapacity -= 1
      time = t[0]
    elif busCapacity > 0 and time + k >= t[i]:
      # 載せられるとき
      busCapacity -= 1
    else:
      # 載せられないとき
      res += 1
      busCapacity = c-1
      time = t[i]

  return res



def main():
  N,C,K = map(int,input().split())
  T = list(sorted(int(input()) for _ in range(N)))
  print(solve(N,C,K,T))
  return

if __name__ == '__main__':
  main()


Measured memory_bytes: 13508
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P pair<int,int>
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n,l;
  cin >> n >> l;
  vint A(n);
  rep(i,0,n) cin >> A[i];
  rep(i,0,n-1){
    if(A[i] + A[i+1] >= l){
      cout << "Possible" << endl;
      rep(j,0,i){
        cout << j+1 << endl;
      }
      rrep(j,n-2,i+1){
        cout << j+1 << endl;
      }
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << "Impossible" << endl;
}

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

// #LIB#

using namespace std;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');

int main() {
  ll n;
  cin >> n;
  vector<ll> s(n - 1 - 0 + 1);
  rep(i, n - 1 - 0 + 1) cin >> s[i];
  vector<vector<ll>> s_stepsum_l(n), s_stepsum_r(n);
  repr(i, 1, n) {
    ll sum = 0, cur = 0;
    s_stepsum_l[i].push_back(sum);
    while (cur < n) {
      sum += s[cur];
      s_stepsum_l[i].push_back(sum);
      cur += i;
    }
    sum = 0;
    cur = n - 1;
    s_stepsum_r[i].push_back(sum);
    while (cur >= 0) {
      sum += s[cur];
      s_stepsum_r[i].push_back(sum);
      cur -= i;
    }
  }
  ll ans = 0;
  for (ll a_b = 1; a_b <= n - 2; ++a_b) {
    ll n_1_a;
    for (ll nend = 0; (n_1_a = a_b * nend) < n - 1 - a_b; ++nend) {
      ll a = n - 1 - n_1_a, b = a - a_b;
      if (2 * a <= n - 1 && a % a_b == 0) continue;
      updatemax(ans, s_stepsum_l[a_b][nend + 1] + s_stepsum_r[a_b][nend + 1]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 38744
d = [[-1,0],[0,1],[1,0],[0,-1]]
while True:
    n = int(input())
    if n==0: break
    x,y = [0],[0]
    for _ in range(n-1):
        vn,vd = map(int,input().split())
        x,y = x+[x[vn]+d[vd][0]],y+[y[vn]+d[vd][1]]
    print(max(x)-min(x)+1,max(y)-min(y)+1)

Measured memory_bytes: 7628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int m, d[200000], c[200000];
int ans;
int cnt;
int ke;

signed main() {
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> d[i] >> c[i];
		cnt += d[i] * c[i];
		ke += c[i];
	}
	cout << ke - 1 + (cnt - 1) / 9 << endl;
}

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

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

  ll A; cin >> A;
  ll B; cin >> B;
  ll C; cin >> C;
  ll ans = (A + B - 1) / B * C;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3612
n,k=map(int,input().split())
x=list(map(int, input().split()))
a=[]
for i in range(n-k+1):
    j=i+k-1
    if x[i]<=0 and x[j]<=0:
        a.append(abs(min(x[i],x[j])))
    elif x[i]<=0 and x[j]>=0:
        a.append(2*min(abs(x[i]),abs(x[j]))+abs(max(abs(x[i]),abs(x[j]))))
    elif x[i]>=0 and x[j]>=0:
        a.append(max(x[i], x[j]))
print(min(a))

Measured memory_bytes: 14480
def mod_inverse(n, mod=10**9+7):
    return pow(n, mod-2, mod)


def combination(n, k, mod=10**9+7):
    numer = denom = 1
    for i in range(k):
        numer = (numer * (n-i)) % mod
        denom = (denom * (i+1)) % mod
    return (numer * mod_inverse(denom, mod)) % mod


mod = 10**9+7
r1, c1, r2, c2 = map(int, input().split())
ans = combination(r1+c1, r1) - combination(1+r2+c1, 1+r2) - combination(1+r1+c2, r1) + combination(2+r2+c2, 1+r2)
print(ans % mod)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void input(string &x,string &y){
	cin>>x>>y;
}
int lcs(string x,string y){
	vector<vector<int>> tb(vector<vector<int>>((int)x.size()+1,vector<int>(y.size()+1,0)));
	for(int i=1;i<(int)x.size()+1;i++){
		for(int j=1;j<(int)y.size()+1;j++){
			if(x[i-1]==y[j-1])  tb[i][j]=tb[i-1][j-1]+1;
			else tb[i][j]=max(tb[i-1][j],tb[i][j-1]);
		}
	}
	return tb[(int)x.size()][(int)y.size()];
}
int main(){
	int q;
	cin>>q;
	string x,y;
	for(int i=0;i<q;i++){
		input(x,y);
		cout<<lcs(x,y)<<endl;
	}
	return 0;
}



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

// types - only for stuff used a lot 
using ll = long long;
#define vv vector
#define Pp pair

// IO
#define get(x) scanf("%d",&x)
#define getl(x) scanf("%lld",&x);

// Operations
#define pb push_back
#define pob pop_back
#define sz(a) int(a.size()) 
#define re(a,b) a=max(a,b) // relax
#define ri(a,b) a=min(a,b) // relaxi

// Debugging

#ifndef LOCAL
#define cerr if (0) cerr
#else
#define cerr cout
#endif

#define print(arr,n) {for (int _ = 0; _ < n; _++) cerr<<arr[_]<<" "; cerr << endl; }
#define printv(vec)  {for (int _ : vec) cerr<<_<<" "; cerr<<endl;}

const int mod = 1e9+7, oo = 1e9;
const ll loo = 1e18;

// Functions 
ll modpow(ll a, ll b) {
	ll ans = 1; // faster modpow than recursive
	for (; b; b/=2,a=a*a%mod)
		if (b&1) ans = (ans*a)%mod;
	return ans;
}
ll gcd(ll a, ll b) {
	while (a) b%=a,swap(a,b);
	return b;
}
#define bitcount __builtin_popcountll
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)


/* 

   ALRIGHT HACKERS, THIS IS WHERE THE ACTUAL CODE BEGINS

 */

const bool DEBUG = 1;
const int mxn = 5001;

int n;
int sz[mxn];
ll dp[mxn][mxn];
ll pr[mxn];
vv<int> adj[mxn];

void add(ll &a, ll b) {
	if (b >= mod) b%=mod;
	a+=b; if (a>=mod) a-=mod;
}

void dfs(int v, int p) {
	f(i,0,mxn) dp[v][i] = 0;
	sz[v] = 1; dp[v][1] = 1;
	for (int w : adj[v]) if (w != p){
		dfs(w,v);	
		vv<ll> nxtlayer(sz[v]+sz[w]+1,0);
		f(i,0,sz[v]+1) f(j,0,sz[w]+1)
			add(nxtlayer[i+j],dp[v][i]*dp[w][j]);
		sz[v] += sz[w];
		f(i,0,sz[v]+1)
			dp[v][i] = nxtlayer[i];
	}
	f(i,1,sz[v]+1) if (!(i%2)) {
		add(dp[v][0],(mod-1)*dp[v][i]%mod*pr[i]);
	}
}

void init() {
	pr[0]=1; pr[1] = 0;
	f(i,2,mxn)
		pr[i] = pr[i-2]*(i-1)%mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	get(n);
	f(i,0,n-1) {
		int a, b; get(a); get(b);
		adj[--a].pb(--b); adj[b].pb(a);
	}
	init();
	dfs(0,-1);
	cout << (mod-dp[0][0])%mod << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}




Measured memory_bytes: 196480
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W,X;
long long A[200001] = {};
long long B[200002] = {};
long long tt[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vpl;



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

	N = b / a;

	cout << min(N,c) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b,c,x;
    scanf("%d%d%d",&a,&b,&c);
    while(a<=b){
        if (c%a==0) {
                x ++;
        }
    a ++;
    }
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 2752
import java.util.*;


public  class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] values = new int[3][3];
        for (int y = 0; y < 3; y++) {
        	for (int x = 0; x < 3; x++) {
        		values[y][x] = sc.nextInt();
        	}
        }
        
        int[] a_values = new int[3];
        int[] b_values = new int[3];
        a_values[0] = 0;
        for (int x = 0; x < 3; x++) {
        	b_values[x] = values[0][x];
        }
        for (int y = 1; y < 3; y++) {
        	a_values[y] = values[y][0] - b_values[0];
        }
        
        for (int y = 0; y < 3; y++) {
        	for (int x = 0; x < 3; x++) {
        		if (values[y][x] != a_values[y] + b_values[x]) {
        			System.out.println("No");
        			return;
        		}
        	}
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 23636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            while (true) {
                int n = sc.nextInt();
                if (n == 0) { break; }
                int[] scores = new int[n];
                for (int i = 0; i < scores.length; i++) {
                    scores[i] = sc.nextInt();
                }
                double average = 0, variance = 0;           
                for(int j = 0;j < scores.length; j++) {
                    average += scores[j];
                }
                average /= scores.length;
                for (int k = 0; k < scores.length; k++) {
                    variance += (scores[k] - average) * (scores[k] - average);
                }
                variance /= scores.length;
                System.out.println(Math.sqrt(variance));
            }
        }
    }
}



Measured memory_bytes: 31736
using System;

namespace ForAtCoder
{
    class Program
    {
        static void Main()
        {
            int x = int.Parse(Console.ReadLine());

            for (int i = 0; i < 10000; i++)
            {
                for (int j = -10000; j < 10000; j++)
                {
                    if ((i * i * i * i * i) - (j * j* j* j * j) == x)
                    {
                        Console.WriteLine(i.ToString() + " " + j.ToString());
                        return;
                    }
                }
            }
        }
    }

}


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

int main(){
    long long int N,K;
    cin >> N >> K;
    vector<int>dp(N,2e9);
    vector<int>h(N);
    for(long long int i=0;i<N;i++){
        cin >> h.at(i);
    }
    dp.at(0)=0;
    for(long long int i=1;i<N;i++){
        for(long long int m=1;m<=K;m++){
            if(i-m >=0){
                dp.at(i) = min(dp.at(i),dp.at(i-m)+abs(h.at(i-m)-h.at(i)));
            }
        }
    }
    cout << dp.at(N-1) << endl;

}

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

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m);
    vector<int> b(m);
    vector<int> ans(n, 0);
    for(int i = 0;i < m;i++){
        cin >> a.at(i) >> b.at(i);
    }
    for(int i = 0;i < m;i++){
        ans.at(a.at(i) - 1)++;
        ans.at(b.at(i) - 1)++;
    }
    for(int i = 0;i < n;i++){
        cout << ans.at(i) << endl;
    }
}

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

typedef struct node {
	int score, a, b, c;
} node;

typedef struct {
	bool operator()(node &a, node &b) {
		return a.score < b.score;
	}
} comparison;


typedef long long int lli;

typedef pair<int, int> pii;

typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<lli> vlli;

typedef unordered_map<int, int> umapii;
typedef unordered_map<char, pii> umapcpii;
typedef unordered_map<char, int> umapci;
typedef unordered_map<char, lli> umapclli;
typedef unordered_map<lli, lli> umapllilli;
typedef unordered_map<string, int> umapsi;
typedef unordered_map<string, lli> umapslli;
typedef unordered_map<string, pii> umapspii;

typedef unordered_set<int> usti;
typedef unordered_set<char> ustc;
typedef unordered_set<string> usts;
typedef unordered_set<lli> ustlli;

typedef priority_queue<int> max_heapi;
typedef priority_queue<pii> max_heapii;
typedef priority_queue<lli> max_heaplli;
typedef priority_queue<string> max_heaps;
typedef priority_queue<vi> max_heapvi;

typedef priority_queue<int, vector<int>, greater<int> > min_heapi;
typedef priority_queue<pii, vector<pii>, greater<pii> > min_heapii;
typedef priority_queue<vi, vector<vi>, greater<vi> > min_heapvi;

typedef priority_queue<node, vector<node>, comparison> heap_node;
// change comparison struct for min_heap or max_heap for node


typedef vector<int> edgesi;
typedef vector<edgesi> graphi;

typedef vector<pii> edgespii;
typedef vector<edgespii> graphpii;


vector<vector<int> > delta4 = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
vector<vector<int> > delta8 = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {-1, -1}, {1, -1}, {-1, 1}};


static inline string get_substr(string &a, int &st, int &en) {
	return a.substr(st, en-st+1);
}

void add_element_count_map(umapii &umap, int &a) {
	if (umap.count(a) == 0)
		umap[a] = 1;
	else
		umap[a]++;
}

// static inline convertString(pii &a) {
	// return to_string(a.first) + "_" + to_string(a.second);
// }


static inline bool check_double_equal(double &a, double &b) {
	return abs(a - b) <= 1e-6;
}

// static inline count_number_of_element_sorted_arr(vector<T> &a, T &b) {
	// return upper_bound(a.begin(), a.end(), b) - lower_bound(a.begin(), a.end(), b);
// }


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

	long double x, s = 100;
	long double r = 0.01;

	cin>>x;
	
int y = 1;

	while (s < x) {
		s = s + (long long int)(s * r);
		// cout<<y<<" "<<s<<"\n";
		y += 1;
	}
	cout<<(y-1)<<"\n";


	return 0;
}	


Measured memory_bytes: 3788
x, y = map(int, input().split())
a = x
b = 0
if y % 2 != 0:
    print("No")
    quit()
else:
    while a >= 0:
        c = a * 2 + b * 4
        if c == y:
            print("Yes")
            quit()
        a -= 1
        b += 1
print("No")


Measured memory_bytes: 9176
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		//StringBuffer str = new StringBuffer(hoge1);
		//for(int i=0;i<N;i++) {}
		
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		String  S=sc.next();
		
		char a[]=S.toCharArray();
		StringBuffer str = new StringBuffer();
		for(int i=0;i<S.length();i++) {
			if(a[i]=='B') {
				if(str.length()==0)continue;
				str.delete(str.length()-1, str.length());
			}else {
				str.append(a[i]);
			}
			
			
			
		}
		p(str.toString());
		
	}
	
		
	
	
		
	
	
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 23764
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String s = in.next();
            int ans = 700;
            for (int i = 0; i < 3; i++)
                if (s.charAt(i) == 'o') ans += 100;
            out.println(ans);
        }

    }

    static class FastScanner {
        private InputStream in;
        private byte[] buffer = new byte[1024];
        private int bufPointer;
        private int bufLength;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (bufLength == -1)
                throw new InputMismatchException();
            if (bufPointer >= bufLength) {
                bufPointer = 0;
                try {
                    bufLength = in.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (bufLength == -1)
                    return -1;
            }
            return buffer[bufPointer++];
        }

        private static boolean isPrintableChar(int c) {
            return (c >= 33 && c <= 126);
        }

        public String next() {
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (!isPrintableChar(b))
                b = readByte();
            while (isPrintableChar(b)) {
                sb.append((char) b);
                b = readByte();
            }
            return sb.toString();
        }

    }
}



Measured memory_bytes: 21332
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		for(int i = 1; i <=n ;i++) {
			if(String.valueOf(i).length() % 2 == 1)ans++;
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 28244
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout<< (x) << " "

int c2(int num){
    int ans = 0;
    while(num>0){
        if(num%2==1)return ans;
        else {ans++;num/=2;}
    }
    return ans;
}

int main(){
    int n;cin>>n;
    vector<int> v;
    rep(i,n){int tmp;cin>>tmp;if(tmp%2==0)v.push_back(c2(tmp));}
    if(v.empty()){co(0);return 0;}
    ll sum=0;
    for(auto i=v.begin();i!=v.end();i++){
        sum+=*i;
    }
    co(sum);
}

Measured memory_bytes: 384
#define DEBUGGING 0
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#if DEBUGGING
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                     \
  do {                                 \
    cerr << " (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ": ";      \
    debug(__VA_ARGS__);                \
    cerr << endl;                      \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, T;
  cin >> N >> T;
  vector<pair<int, int>> BA(N);
  REP(i, N) { cin >> BA[i].first >> BA[i].second; }
  sort(BA.begin(), BA.end());
  i64 bmax = 0;
  vector<i64> dp(3001, -1);
  REP(i, N) {
    dp[0] = 0;
    int a = BA[i].first;
    int b = BA[i].second;
    for (int t = T - 1; t >= 0; --t) {
      if (dp[t] >= 0) {
        bmax = max(bmax, dp[t] + b);
        if (t + a < T) {
          dp[t + a] = max(dp[t + a], dp[t] + b);
        }
      }
    }
  }
  cout << bmax << '\n';
}


Measured memory_bytes: 3648
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<iostream>
#include<string>
#include<set>
#include<list>
using namespace std;
typedef long long ll;
const int N = 1e5+10;
const int INF = 0x3f3f3f3f;
int max(int a,int b) {return a>b?a:b;}
int min(int a,int b) {return a>b?b:a;}
const double eps = 1e-7;
#define endl '\n'
#define pb(a) push_back(a)
#define ALL(x) x.begin(),x.end()

ll p5(ll a ){
	return a*a*a*a*a;
}
int main() {
    //ios::sync_with_stdio(false);
    ll x;
    scanf("%lld",&x);
    for(ll a=-120;a<=120;++a) {
    	for(ll b=-120;b<=120;++b) {
    		if(p5(a)-p5(b)==x ) {
    			cout<<a<<" "<<b<<endl;
    			return 0;
    		}
    	}
    }
    return 0;
}

Measured memory_bytes: 3676
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a, c, d;
	string b;
	cin >> a;
	cin >> b;
	cin >> c;
	if (b == "+") {
		d = a + c;
		cout << d;
	}
	else if (b == "-") {
		d= a - c;
		cout << d;
	}



}
	

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

typedef long long ll;
typedef std::pair<ll, ll> P;
typedef std::tuple<ll, ll, ll> t3;
constexpr ll INF = 1e15;
constexpr ll mod = 1e9+7;

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

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }


class Divisor {
private:
	vector<ll> F;
public:
	Divisor(ll N) {
		for (ll i = 1; i * i <= N; i++) {
			if (N % i == 0) {
				F.push_back(i);
				if (i * i != N) F.push_back(N / i);
			}
		}
		sort(begin(F), end(F));
	}
	int size() { return F.size(); }
	ll operator[](int k) { return F[k]; }
	const vector<ll>& factors() { return F; }
};

struct BMatch {
	const vector<vector<int>>& g;
	const int n;
	vector<int> match;
	vector<bool> used;

	BMatch(const vector<vector<int>>& g_) : g(g_), n(g_.size()) { }

	bool dfs(int v) {
		used[v] = true;
		for (int i = 0; i < g[v].size(); i++) {
			int u = g[v][i], w = match[u];
			if (w < 0 || !used[w] && dfs(w)) {
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
		return false;
	}

	int solve() {
		match.assign(n, -1);
		used.assign(n, false);
		int res = 0;
		for (int v = 0; v < n; v++) {
			if (match[v] < 0) {
				used.assign(n, false);
				if (dfs(v)) res++;
			}
		}
		return res;
	}
};

int main() {
	ll n;
	cin >> n;
	vector<P> ab(2 * n);
	rep(i, 2 * n) {
		cin >> ab[i].first >> ab[i].second;
	}
	vector<vector<int>> graph(2 * n);
	rep(i, n){
		auto p1 = ab[i];
		rep(j, n) {
			auto p2 = ab[n + j];
			if (p1.first < p2.first && p1.second < p2.second) {
				graph[i].push_back(n + j);
			}
		}
	}
	BMatch b(graph);
	auto ans = b.solve();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
using System;
using System.Linq;
public class c
{
  public static void Main()
  {
    int[] ab=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    int[] tower=new int[1000];
    int x=0;
    for(int i=0;i<1000;i++)
    {
      x+=i;
      tower[i]=x;
    }
    x=ab[1]-ab[0];
     Console.WriteLine(tower[x]-ab[1]);
  }
}

Measured memory_bytes: 11220
use std::vec::Vec;
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let r: f64 = read();
  let g: f64 = read();
  println!("{}", 2.0 * g - r );
}


Measured memory_bytes: 4352
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		System.out.println((a == b && b == c) || (a != b && b != c && c != a) ? "No" : "Yes");
	}
}


Measured memory_bytes: 35548
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include <vector>

using namespace std;

using ll = long long;

int main() {
    int n;
	scanf("%d", &n);
    int base = 1;
    while (base <= n) {
        base *= 2;
    }
    vector<ll> dp(n+1), bit(2*base);
    
	vector<int> h(n), a(n);
	
	for (int i=0; i<n; ++i) {
		scanf("%d", &h[i]);
	}

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

	for (int i=0; i<n; ++i) {
	    int tmp = base + h[i];
	    ll best = 0;
	    while (tmp > 1) {
	        if (tmp%2 == 1) {
	            if (bit[tmp-1] > best) {
	                best = bit[tmp-1];
	            }
	        }
	        tmp /= 2;
	    }
		dp[h[i]] = best + a[i];
		for (int j=base+h[i]; j>=1; j/=2 ) {
		    if (dp[h[i]] > bit[j]) {
		        bit[j] = dp[h[i]];
		    }
		}
	}
	ll ans = 0;
	for(int i=0; i<=n; i++) {
		if (dp[i] > ans) {
			ans = dp[i];
		}
	}
	printf("%lld\n", ans);

}

Measured memory_bytes: 10764
import sys
input = sys.stdin.readline
s = input()

ans1=0
ans2=0
# 01にする
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == '1':
            ans1+=1
    else:
        if s[i] == '0':
            ans1+=1
# 10にする
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == '0':
            ans2+=1
    else:
        if s[i] == '1':
            ans2+=1
print(min(ans1,ans2))

Measured memory_bytes: 3316
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    List<string> input = IO.GetStringList();
	    Console.WriteLine(input[1]+input[0]);
	    
	}
    
}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}


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

int main(int argc, char const *argv[]) {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == 7 && b == 5 && c == 5) {
    cout << "YES" << endl;
  } else if (a == 5 && b == 7 && c == 5) {
    cout << "YES" << endl;
  } else if (a == 5 && b == 5 && c == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000

class UnionFind {
public:
  vector<int> par, rank; // parent(negative := its root and abs-value is its size), depth
  UnionFind(int sz) : par(sz, -1), rank(sz, 0){}
  int find(int x){
    if(par[x]<0) return x;
    else return par[x] = find(par[x]);
  }
  void unite(int x, int y){
    x=find(x); y=find(y);
    if(x==y) return;  // already belong to same tree
    if(rank[x] < rank[y]){  // y becomes parent node
      par[y] += par[x];
      par[x] = y;
    } else {  // x becomes parent node
      par[x] += par[y];
      par[y] = x;
      if(rank[x]==rank[y]) rank[x]++;
    }
  }
  inline bool same(int x, int y){ return find(x) == find(y); }
  inline int size(int x){ return -par[find(x)]; }
};

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(m),b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--;
    b[i]--;
  }

  int ans = 0;
  rep(i,m){
    UnionFind uf(n);
    rep(j,m) if(i!=j) uf.unite(a[j], b[j]);
    if(uf.size(0)!=n) ans++;
  }

  cout << ans << endl;

  return 0;
}


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

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

string str;
int p;

bool equation(string s);
bool formula(string s);

//1:true 0:false
bool equation(string s){
  bool a=formula(s);
  if(s[p]=='=')p++;//'='
  bool b=formula(s);
  if((a && b) || (!a&&!b))return true;
  else return false;
}

//1:true 0:false -1:?????°
bool formula(string s){
  if(s[p]=='-'){
    p++;//'-'
    if(formula(s))return false;
    else return true;
  }
  else if(s[p]=='('){
    p++;//'('
    bool a=formula(s);
    char tmp=s[p];//?????????
    p++;//'*', '+', '->'
    if(s[p]=='>')p++;//'->'
    bool b=formula(s);
    p++;//')'

    if(tmp=='*'){
      if(a && b)return true;
      else return false;
    }
    else if(tmp=='+'){
      if(a || b)return true;
      else return false;
    }
    else{
      if(a && !b)return false;
      else return true;
    }
  }
  else{
    if(s[p]=='T'){p++; return true;}
    else if(s[p]=='F'){p++; return false;}
  }
}

void replace2(string *s, string c1, string c2){
  int pos;
  while((pos=(*s).find(c1, 0))!=string::npos){
    (*s).replace(pos, 1, c2);
  }
}

int main(){
  while(cin>>str, str!="#"){
    bool flag=true;
    rep(a,2) rep(b,2) rep(c,2) rep(d,2) rep(e,2) rep(f,2) rep(g,2) rep(h,2) rep(i,2) rep(j,2) rep(k,2){
      string tmp=str;
      //cout<<a<<b<<c<<d<<e<<f<<g<<h<<i<<j<<k<<endl;
      if(a==1)replace2(&tmp, "a", "T");
      else replace2(&tmp, "a", "F");
      if(b==1)replace2(&tmp, "b", "T");
      else replace2(&tmp, "b", "F");
      if(c==1)replace2(&tmp, "c", "T");
      else replace2(&tmp, "c", "F");
      if(d==1)replace2(&tmp, "d", "T");
      else replace2(&tmp, "d", "F");
      if(e==1)replace2(&tmp, "e", "T");
      else replace2(&tmp, "e", "F");
      if(f==1)replace2(&tmp, "f", "T");
      else replace2(&tmp, "f", "F");
      if(g==1)replace2(&tmp, "g", "T");
      else replace2(&tmp, "g", "F");
      if(h==1)replace2(&tmp, "h", "T");
      else replace2(&tmp, "h", "F");
      if(i==1)replace2(&tmp, "i", "T");
      else replace2(&tmp, "i", "F");
      if(j==1)replace2(&tmp, "j", "T");
      else replace2(&tmp, "j", "F");
      if(k==1)replace2(&tmp, "k", "T");
      else replace2(&tmp, "k", "F");
      //cout<<tmp<<endl;
      p=0;
      if(!equation(tmp))flag=false;
    }
    if(flag)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 2316
#include <bits/stdc++.h>
#define ll long long
#define MAXN 200002
#define MAXA 1000002

using namespace std;

int main() {

    int n, a[MAXN]; cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i];
    a[0] = 0;
    sort(a+1, a+n+1);
    bool hasdiv[MAXA]; fill(hasdiv, hasdiv+MAXA, true);
    int cnt = 0;

    for (int i=1; i<=n; i++)
        if (hasdiv[a[i]]) {
            if (a[i] != a[i+1]) cnt++;
            for (int j=a[i]; j<MAXA; j+=a[i]) hasdiv[j] = false;
        }

    cout << cnt << endl;

}


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

int main(){
    int n;  cin >> n;
    ll mini=0, ans;
    for(int i=0; i<n; i++){
        ll a, b;   cin >> a >> b;
        if(mini<a){
            ans = a+b;
            mini = a;
        }
    }
    cout << ans << endl;
    


}

Measured memory_bytes: 256
#include<stdio.h>

int T;
long long A,B,C,D;

int main(){
    scanf("%d",&T);
    for(int i=0;i<T;i++){
        scanf("%lld%lld%lld%lld",&A,&B,&C,&D);
        if(A<B||D<B){
            printf("No\n");
        }else if(C<B){
            long long a=D,b=B;
            while(a%b>0){
                long long t=a%b;
                a=b;
                b=t;
            }
            long long c=B-b+(A%b);
            if(c>C){
                printf("No\n");
            }else{
                printf("Yes\n");
            }
        }else{
            printf("Yes\n");
        }
        
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
     
     
int main(){
            
	int S; sd(S);

	int a , b;

	b = S % 100;
	a  = S / 100;

	
	if(a == 0 && b == 0)printf("NA\n");
	else if(a == 0 && b <= 12 ) printf("YYMM\n");
	else if(a == 0 && b > 12)printf("NA\n");
	else if(b== 0 && a <= 12)printf("MMYY\n");
	else if(b==0 && a > 12)printf("NA\n");
	else if(a > 12 && b > 12) printf("NA\n");
	else if(a > 12 && b <= 12 && b > 0)printf("YYMM\n");
	else if(a <= 12 && b > 12 && a > 0) printf("MMYY\n");
	else if(a <= 12 && b <= 12  && a > 0 && b > 0 )printf("AMBIGUOUS\n");         
    else printf("NA\n"); 
     
        
    return 0;
}


Measured memory_bytes: 256
# coding=utf-8
line = input().split(" ")
n = int(line[0])
z = int(line[1])
w = int(line[2])

a = []
for x in input().split(" "):
    a.append(int(x))

print(max(abs(w-a[n-1]), abs(a[n-2]-a[n-1])))


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

int main() {
  int a, b, c, d;
  cin>>a>>b>>c>>d;
  while (true) {
    c -= b;
    if (c <= 0) {
      cout<<"Yes"<<endl;
      return 0;
    }
    a -= d;
    if (a <= 0) {
      cout<<"No"<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3596
import java.io.*;
 
class Main {
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int i = 1;
    while(true){
      int data = Integer.parseInt(br.readLine());
      if(data == 0)
    	  break;
      
      sb.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(data)).append("\n");
    }
    System.out.print(sb);
  }
}

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(m);
  rep(i, 0, m) cin >> a[i];

  int ans = 1e9;
  int tmp = 0;
  rep(i, 0, x+1) {
    rep(j, 0, m) {
      if (i == a[j]) tmp++;
    }
  }
  ans = min(tmp, ans);
  tmp = 0;
  rep(i, x, n+1) {
    rep(j, 0, m) {
      if (i == a[j]) tmp++;
    }
  }
  ans = min(ans, tmp);
  cout<<ans<<endl;
}


Measured memory_bytes: 256