akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
//vector <bool> prime(boolsize,1);
//void seive()
//{
//    ll n=boolsize;
//    prime[0]=prime[1]=0;
//    for(ll i=2;i<=sqrt(boolsize);i++)
//    {
//        if(prime[i]==1)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//            {
//                prime[j]=0;
//            }
//        }
//    }
//}

/// check for test case before submitting
void vfun()
{
    string s;
    cin>>s;
    cout<<s[0]<<s.size()-2<<s[s.size()-1]<<endl;

}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0); ///cant use scanf, printf
    cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    //cin>>test;
    while(test--)
    {

        //fun();
        vfun();
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not




Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int n;
    cin>>n;
    vi a(n);
    FOR(i,0,n){
        cin>>a[i];
    }
    map<int,int> mp;
    LL ans=0,sm=0;
    FOR(i,0,n){
        sm++;
        int rest=sm-a[i];
        ans+=mp[rest];
        mp[a[i]+i+1]++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 21048
input_nk = gets.chomp
n,k = input_nk.split.collect{ |item| item.to_i}
sump = Rational(0)

1.upto(n) do |start|
  if start < k
    coin =  Math.log(k.to_f/start.to_f,2).ceil
    sump += Rational(0.5 ** (coin))
  else
    sump += Rational(1)
  end
end

puts (sump/n).to_f

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

using namespace std;

int main()
{   int n,l;
    cin>>n>>l;
    int lhl=l,rhl=n+l-1;
    int k=(n*(lhl+rhl))/2;
    if(lhl*rhl<0)
    cout<<k;
    else
    {
      if(abs(lhl)<=abs(rhl))
        cout<<k-lhl;
      else
        cout<<k-rhl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[10010],v[10010];
ll n,k,res=-0x3f3f3f3f3f3f3f3f;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i],a[i]--;
	for(int i=0;i<n;i++) cin>>v[i];
	for(int i=0;i<n;i++){
		int x=i,l=0;
		ll s=0,num=0;
		bool f=1;
		while(x!=i||f){
			f=0;
			l++;
			x=a[x];
			s+=v[x];
			num+=v[x];
			if(l<=k)res=max(res,num);
		}
		num=0;
		if(k>=l&&s>0){
			for(int j=1;j<=l;j++){
				x=a[x];
				num+=v[x];
				res=max(res,num+s*((k-j)/l));
			}
		}
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 3744
#include <iostream>
#include <string>
using namespace std;
int main(){
	string a;
	cin >> a;
	char x=a[0];
	char y=a[1];
	char z=a[2];
	if (x=='R' && y=='R' && z=='R'){
		cout << 3;
	}
	else if (x=='R' && y=='R' && z!='R'){
		cout << 2;
	}
	else if (x!='R' && y=='R' && z=='R'){
		cout << 2;
		
	}
	else if (x!='R' && y!='R' && z!='R'){
		cout << 0;
	}
	else{
		cout << 1;
	}
	return 0;
}

Measured memory_bytes: 3124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define QUERY_PUSH 0
#define QUERY_ACCESS 1
#define QUERY_POP 2

typedef struct Slice {
    int *list;
    int len;
    int size;
} * Slice;

void initSlice(Slice *);
void pushBack(Slice, int);
void randomAccess(Slice, int);
int popBack(Slice);

int main(void)
{
    Slice arr;
    initSlice(&arr);
    int n, query, val;

    scanf("%d", &n);
    while (n--) {
        scanf("%d", &query);
        if (query == QUERY_PUSH) {
            scanf("%d", &val);
            pushBack(arr, val);
        } else if (query == QUERY_ACCESS) {
            scanf("%d", &val);
            randomAccess(arr, val);
        } else if (query == QUERY_POP) {
            popBack(arr);
        }
    }

    return 0;
}

void initSlice(Slice * s)
{
    *s = (Slice) malloc(sizeof(struct Slice));
    (*s)->len = 0;
    (*s)->size = 0;
    (*s)->list = NULL;
}

void pushBack(Slice s, int x)
{
    if (s->len == s->size) {
        if (s->size)
            s->size *= 2;
        else
            s->size = 2;
        int *tmp = (int *) malloc(s->size * sizeof(int));
        memcpy(tmp, s->list, sizeof(int) * s->len);
        s->list = tmp;
    }
    s->list[s->len++] = x;
}

void randomAccess(Slice s, int p)
{
    printf("%d\n", s->list[p]);
}

int popBack(Slice s)
{
    int x = s->list[--s->len];
    if (s->len <= s->size / 4) {
        s->size /= 2;
        int *tmp = (int *) malloc(s->size * sizeof(int));
        memcpy(tmp, s->list, s->len * sizeof(int));
        s->list = tmp;
    }
    return x;
}


Measured memory_bytes: 6404
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[n];
		int s1=0;
		int s2=0;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		for(int i=0;i<n;i=i+2){
			s1=s1+a[i];
		}
		for(int i=1;i<n;i=i+2){
			s2=s2+a[i];
		}
		System.out.println(Math.abs(s2-s1));
	}

}

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

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

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

int main() {
  ll a, b;
  cin >> a >> b;
  ll x = gcd(a, b);
  map<ll, int> f1 = prime_factor(x);

  cout << f1.size() + 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dl double long
#define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i)
#define rrep(i, m, n) for(ll i = (ll)(m); i > (ll)(n); --i)
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;

int main(void){
    int x;
    cin >> x;
    rep(i, -256, 256){
        rep(j, -256, 256) if(pow(i, 5)-pow(j, 5) == x){
            cout << i << ' ' << j << endl;
            return 0;
        }
    }
    return 0;
}

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

int main() {
  double N; cin >> N;
  double cnt = 0;
  for (int i = 1; i <= N; i++) {
    if (i%2==1) cnt++;
  }
  cout << cnt/N << endl;
  return 0;
}

Measured memory_bytes: 256
# frozen_string_literal: true

def cin
  gets.split.map(&:to_i)
end

N, M = cin

ac = wa = 0
misses = Array.new(N + 1, 0)

M.times do
  p, s = gets.split
  p = p.to_i

  next if misses[p] == -1

  if s == 'WA'
    misses[p] += 1
  elsif s == 'AC'
    ac += 1
    wa += misses[p]
    misses[p] = -1
  end
end
puts "#{ac} #{wa}"


Measured memory_bytes: 2556
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	float T,X;
	cin >> T >> X;
	cout << T / X << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                                                       \
    for(long long hoge = 0; (hoge) < (n); ++(hoge))                            \
    cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int H[N];
    for(int i = 0; i < N; i++) {
        cin >> H[i];
    }
    sort(H, H + N);
    long long ans = 0;
    for(int i = 0; i < N - K; i++) {
        ans += H[i];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

typedef long long i64;
typedef pair<i64, i64> pii;

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  reps(i, 1, n) cin >> a[i];

  vector<int> X(n + 1);
  vector<int> b;
  for (int i = n; i >= 1; --i) {
    int res  = 0;
    for (int j = i; j <= n; j += i) {
      res ^= X[j];
    }
    if (res != a[i]) {
      X[i] = 1;
      b.push_back(i);
    }
  }

  cout << b.size() << "\n";
  for (int i = 0; i < b.size(); ++i) {
    cout << b[i];
    if (i < b.size() - 1) cout << ' ';
    else cout << "\n";
  }

  return 0;
}

Measured memory_bytes: 3192
def m():
    n, T = map(int, input().split())
    t = list(map(int, input().split()))
    ans = 0
    for i in range(1, n):
        diff = abs(t[i-1] - t[i])
        if diff <= T:
            ans += diff
            continue
        ans += T
    ans += T
    return ans


print(m())

Measured memory_bytes: 26836
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val N = ni()

    def calcK: Option[Int] = {
      rep(1e5.toInt, 1) { k =>
        if (k * (k + 1) == 2 * N) return Some(k)
      }
      None
    }

    calcK match {
      case None => out.println("No")
      case Some(k) =>
        val len = 2 * N / k
        val S = Array.fill[ArrayBuffer[Int]](len)(ArrayBuffer())

        var num = 1
        0 until len foreach { i =>
          i + 1 until len foreach { j =>
            S(i) += num
            S(j) += num
            num += 1
          }
        }

        out.println("Yes")
        out.println(len)
        rep(S.length) { i =>
          out.println(s"$k ${S(i).mkString(" ")}")
        }
    }
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int): Array[Int] = map(n)(_ => ni())
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def rep(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def rep_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    rep(n)(i => res(i) = f(i))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    rep(as.length)(i => s += as(i))
    s
  }
}

Measured memory_bytes: 48460
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};




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

    int n;
    cin >> n;
    vector<int> a(n);
    int sum = 0;
    bool zero = false;
    int mi = INF;
    rep(i,n){
        cin >> a[i];
        mi = min(mi,abs(a[i]));
        if(a[i] < 0){
            sum++;
        }else if(a[i] == 0){
            zero = true;
        }
    }
    ll ans = 0;
    rep(i,n){
        ans += abs(a[i]);
    }
    if(!zero && sum % 2 == 1){
        ans -= mi*2;
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 640
//
// Created by swift on 2020/8/2.
//

#include<bits/stdc++.h>
using namespace std;
int n,k,a[200001],mx;
bool check(int x){
    int tmp=0;
    for(int i=1;i<=n;i++){
        int num=ceil(double(a[i])/double(x));
        tmp+=num-1;
    }
    return tmp<=k;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        mx=max(mx,a[i]);
    }
    int l=1,r=mx,ans;
    while(l!=r){
        int mid=(l+r)/2;
        if(check(mid)){
            r=mid;
        }
        else{
            l=mid+1;
        }
    }
    printf("%d\n",l);
    return 0;
}

Measured memory_bytes: 4476
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int k = 1; k <= n; k++) {
                ans += __gcd(__gcd(i, j), k);
            }
        }
    }
    cout << ans;
}



Measured memory_bytes: 3660
N = int(input())
A = list(map(int,input().split()))
SUMA = sum(A)
MOD = 10**9 + 7
C = [0] * (N-1)
for i in range(N-1):
  SUMA -= A[i]
  C[i] = SUMA
ans = 0
for i in range(N-1):
  ans += A[i]*C[i]
  ans %= MOD
print(ans)

Measured memory_bytes: 31628
# https://atcoder.jp/contests/abc129/tasks/abc129_c

n, m = map(int, input().split())
mod = 10 ** 9 + 7
broken = set()
for _ in range(m):
    broken.add(int(input()))

dp = [0 for _ in range(n + 1)]
dp[0] = 1
for i in range(n):
    for j in range(2):
        if i + 1 in broken:
            dp[i + 1] = 0
        else:
            if i - j >= 0:
                dp[i + 1] += dp[i - j] % mod

ans = dp[n] % mod
print(ans)


Measured memory_bytes: 88048
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;

string ans;
int cnt = 0;

int main()
{
	getline(cin, ans);

	for(int i = 1; i < ans.length(); i++)
	{
		if(ans[i] == ans[i-1])
		{
			if(ans[i] == '1') ans[i] = '0';
			else ans[i] = '1';
			cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cctype>
#include<queue>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<ctime>
#include<cstdlib>
#include<map>
#include<utility>
#include<iomanip>
#include<set>
#include<stack>
#define lowbit(i) ((i)&(-i))
using namespace std;
typedef long long ll;typedef pair<int,int> pii;
typedef pair<ll,ll> pll;typedef vector<string> vss;
typedef vector<int> vii;typedef vector<pii> vpi;
typedef vector<ll> vll;typedef vector<pll> vpl;typedef long double ld;
typedef unsigned long long ul;typedef queue<int> qii;typedef queue<pii> qpi;
int n,x,y,dp[100005],start;
vii v[100005],tmp;
void dfs(int now,int par){
	int ret=0,c=0;
	for(int i=0;i<v[now].size();i++){
		int to=v[now][i];
		if(to==par) continue;
		dfs(to,now);
	}
	tmp.clear();
	for(int i=0;i<v[now].size();i++){
		int to=v[now][i];
		if(to==par) continue;
		if(!dp[to]) c++;
		else ret+=dp[to];
	}
	ret+=max(0,c-1);
	dp[now]=ret;
}
int mx=0;
int main()
{
// 	freopen("","r",stdin);
// 	freopen("","w",stdout);
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for(int i=0;i<n;i++){
		if(v[i].size()>mx){
			mx=v[i].size();
			start=i;
		}
	}
	if(mx<=2){
		puts("1");
		return 0;
	}
	dfs(start,-1);
//	for(int i=0;i<n;i++) cout<<dp[i]<<' ';cout<<'\n';
	cout<<dp[start]<<'\n';
	return 0;
}
/*
17
0 1
0 2
0 3
1 4
1 5
4 10
4 11
2 6
6 12
6 13
3 7
3 8
3 9
8 16
16 14
16 15
*/

Measured memory_bytes: 12032
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;



int main(void){
	ll A,B,N,ans;
	cin>>N>>A>>B;
	if(A<=B){
		if(N==1){
			if(A==B){
				ans=1;
			}else{
				ans=0;
			}
		}else{
			ans = (N-2)*(B-A)+1;
		}
	}else{
		ans=0;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N, D = map(int,input().split(" "))
x = [list(map(int, input().split(" "))) for i in range(0,N)]
count = 0
for i in range(0,N):
    if x[i][0]**2 + x[i][1]**2 <= D**2:
        count += 1
print(count)

Measured memory_bytes: 45452
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: i16 = read();
    let b: i16 = read();
    println!("{}", std::cmp::max(std::cmp::max(a + b, a - b), a * b));
}


Measured memory_bytes: 4352
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

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)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}


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

    if(a == 0){
        cout << "1" <<endl;
    }else
    {
        cout << "0" <<endl;
    }
    
}





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

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

using namespace std;

const int INF=1<<29;

int main(){
	int n,m,x; scanf("%d%d%d",&n,&m,&x);
	vector<int> c(n);
	vector<vector<int>> a(n,vector<int>(m));
	rep(i,n){
		scanf("%d",&c[i]);
		rep(j,m) scanf("%d",&a[i][j]);
	}

	int ans=INF;
	rep(S,1<<n){
		int cost=0;
		vector<int> b(m);
		rep(i,n) if(S>>i&1) {
			cost+=c[i];
			rep(j,m) b[j]+=a[i][j];
		}
		bool ok=true;
		rep(j,m) if(b[j]<x) ok=false;
		if(ok) ans=min(ans,cost);
	}
	printf("%d\n",ans<INF?ans:-1);

	return 0;
}


Measured memory_bytes: 3796
using System;
using System.Linq;

class Program
{
  public static void Main(string[] args)
  {
    int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
    if (s[1] % s[0] == 0) Console.WriteLine(s[0] + s[1]);
    else Console.WriteLine(s[1] - s[0]);
  }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    string str;
    cin>>str;
    if(str=="0"){
      break;
    }
    int sum=0;
    for(int i=0;i<(int)str.size();i++){
      sum+=str[i]-'0';
    }
    cout<<sum<<endl;
  }
  return 0;
}


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

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

    vector<int> vec(2*N);
    for (int i = 0; i < 2 * N; i++) {
        cin >> vec.at(i);
    }

    sort(vec.begin(), vec.end());

    int ans = 0;

    for (int i = 0; i < 2 * N; i += 2) {
        ans += vec.at(i);
    }
    
    cout << ans << endl;
}

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


#define N 500000
#define SENTINEL 1000000000

int num,L[N/2+2],R[N/2+2];
int cnt=0;

void merge(int [],int,int,int);
void mergeSort(int [],int,int);

int main(){
    int i,j;
    int l,m,r;
    int A[N];

    scanf("%d",&num);
    for(i=0;i<num;i++){
        scanf("%d",&A[i]);
    }
    l=0;

    mergeSort(A,0,num);
    for(i=0;i<num;i++){
        if(i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",cnt);
    return 0;
}

void merge(int A[],int l,int m,int r){
    int n1,n2;
    int i,j,k;

    n1 = m-l;
    n2 = r-m;

    for(i=0;i<n1;i++){
        L[i] = A[l+i];
    }
    for(j=0;j<n2;j++){
        R[j] = A[m+j];
    }
    L[n1] = SENTINEL;
    R[n2] = SENTINEL;

    i=j=0;
    for(k=l;k<r;k++){
        cnt++;
        if(L[i] <= R[j]){
            A[k] = L[i];
            i++;
        }
        else{
            A[k] = R[j];
            j++;
        }
    }
}

void mergeSort(int A[],int l,int r){
    int mid;
    if(l+1<r){
        mid = (l+r)/2;
        mergeSort(A,l,mid);
        mergeSort(A,mid,r);
        merge(A,l,mid,r);
    }
}


Measured memory_bytes: 5608
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

vector<ll> divisors(ll n) {
    vector<ll> v;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            v.push_back(i);
            if (i * i != n) {
                v.push_back(n / i);
            }
        }
    }
    return v;
}

void solve() {
    int t;
    cin >> t;
    while (t--) {
        ll a, b;
        cin >> a >> b;
        if (a == b) {
            cout << (a - 1) * 2 << endl;
        } else if (abs(a - b) == 1) {
            ll c = sqrtl(a * b);
            cout << (c - 1) * 2 << endl;
        } else {
            ll c = sqrtl(a * b - 1);
            cout << c * 2 - (a * b <= c * (c + 1) ? 2 : 1) << endl;
        }
    }
}



Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const double PI = atan2(1, 1) * 4.0;

int main() {
    fastio();

    long double a, b, h, m;

    cin >> a >> b >> h >> m;

    long double r1 = 2.0 * PI * (h / 12.0 + m / (60.0 * 12.0));
    long double r2 = 2.0 * PI * m / 60.0;

    //cout << r1 << " " << r2 << endl;

    long double x1 = a * cos(r1), y1 = a * sin(r1);
    long double x2 = b * cos(r2), y2 = b * sin(r2);

    long double dx = abs(x1 - x2);
    long double dy = abs(y1 - y2);

    cout << setprecision(20) << sqrt(dx * dx + dy * dy) << endl;

    return 0;
}

Measured memory_bytes: 4188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);


ll modnum = 1e9+7;

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}

int main() {
    ll n; cin >> n;
    auto d1 = divisor(n);
    auto d2 = divisor(n-1);

    ll ans = d2.size()-1;
    for(auto k : d1) {
        if(k == 1) continue;
        ll tmpn = n;
        while(tmpn % k == 0) {
            tmpn /= k;
        }
        if(tmpn % k == 1) ans++;
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
n=int(input())
a=[0]+list(map(int,input().split()))
ball=[0]*(n+1)
for i in range(n,0,-1):
    c=1
    sum=0
    while c*i<=n:
        sum+=ball[c*i]
        c+=1
    ball[i]=(sum%2+a[i])%2
ans=[]
for i in range(1,n+1):
    if ball[i]!=0:
        ans.append(i)
print(len(ans))
"""if len(ans)==0:
    exit()"""
print(*ans)


Measured memory_bytes: 70876
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
  ll n,d;
  cin>>n>>d;
  ll c = 0;
  for(ll i=0; i<n; i++)
  {
    ll x, y;
    cin>>x>>y;
    if(x*x+y*y<=d*d)
      c++;
  }
  cout<<c<<endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> l(n);
  for (int i = 0; i < n; ++i) cin >> l[i];

  sort(l.begin(), l.end());
  int ans = 0;
  for(int i = n - 1; i > n - k - 1; --i) ans += l[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;

const int N = 100003;

int h[N], n, A, B;

int divc(int fz, int fm) {
	if (fz % fm == 0) return fz / fm;
	else return fz / fm + 1;
}

bool can(int x) {
	int res = x;
	for (int i = 1; i <= n; ++i) {
		if (1ll * B * x >= h[i])
			continue;
		int hi = h[i] - B * x;
		res -= divc(hi, A - B);
		if (res < 0) return false;
	}
	return true;
}

int main() {
	scanf("%d%d%d", &n, &A, &B);
	
	int left = 0, right = 0;
	
	for (int i = 1; i <= n; ++i) scanf("%d", h + i), right = max(right, divc(h[i], B));
	
	int mid;
	while (left < right) {
		mid = (left + right) >> 1;
		if (can(mid)) right = mid;
		else left = mid + 1;
	}
	
	printf("%d\n", left);
	
	return 0;
}

Measured memory_bytes: 512
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

win = [0 for i in range(n)]
for ai in a:
    win[ai-1] += 1

for i in range(n):
    if (q - win[i]) >= k:
        print('No')
    else:
        print('Yes')

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

int main() {
    while(1) {
	string str;
	cin >> str;
	if(str == "0") break;
	int sum = 0;
	for(int i=0; i<str.size(); i++) {
	    char ch = str[i];
	    sum += (ch - '0');
	}
	cout << sum << endl;
    }
}

Measured memory_bytes: 1192
/*
TASK: AGC141 - D - Powerful Discount Tickets
LANG: C++
NAME: picolylamine
*/
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>

using namespace std;

#define N_MAX 100001

struct list
{
	int val;
	int next;
};

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

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

	sort(A, A + N);

	list table[N_MAX];
	for (int i = N - 1; i >= 0; i--){
		table[i].val = A[i];
		table[i].next = i - 1;
	}

	int tail = N - 1;
	int cur = tail;
	for (int i = 0; i < M;){
		int next = table[tail].next;
		for (; i < M; i++){
			if (table[tail].val >= table[next].val){
				table[tail].val = table[tail].val / 2;
			}
			else{
				break;
			}
		}

		while (-1 != table[cur].next){
			if (table[table[cur].next].val <= table[tail].val){
				break;
			}
			cur = table[cur].next;
		}
		table[tail].next = table[cur].next;
		table[cur].next = tail;
		tail = next;
	}

	long long int sum = 0;
	for (int i = 0; i < N; i++){
		sum += (long long int)table[i].val;
	}

	printf("%lld", sum);

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

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

#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define ll long long
#define mkp make_pair
#define eb emplace_back

const int N = 1e6 + 9;
const int INF = 1e9 + 9;
const int mod = 1e9;
const int K = 25;
const int SZ = (1 << 17) - 1;

#define int ll

void solve() {
	string s;
	cin >> s;
	for (int i = 0; i < sz(s); ++ i) {
		s[i] = 'x';
	}
	cout << s;
}

main() {
	ios_base::sync_with_stdio(false);
	solve();
	return 0;
}

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

int amida[1001][102][102] = {} ;
int ans = 0 , t = 0 ;

void move( int now , int high ){
	if( high == 0 ) ans = now ;
	else {
		if( amida[high][now][now+1] == t ) move( now+1 , high-1 ) ;
		else if( amida[high][now-1][now] == t ) move( now-1 , high-1 ) ;
		else move( now , high-1 ) ;
	}
}

int main(){
	
	int n , m , start ;
	int h , a , b ;
	int max ;
	
	while(1){
		cin >> n >> m >> start ;
		
		if( n==0 && m==0 && start==0 ) break ;
		
		max = 0 ;
		t++ ;
		
		for( int i=0 ; i<m ; i++ ){
			cin >> h >> a >> b ;
			amida[h][a][b] = t ;
			if( max < h ) max = h ;
		}
		
		move( start , max ) ;
		
		cout << ans << endl ;
	}
	
return 0;
}

Measured memory_bytes: 41556
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <math.h>
#include <string>
#include <math.h>

using namespace std;

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

const ll mod = 1000000007;
const ll INF = 1000000000000;

string s, t;
vector<ll> vec[26];
bool jud = true;

ll ans;

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

	for (int i = 0; i < s.length(); i++)
	{
		vec[(s[i] - 'a')].push_back(i);
	}

	ll num;

	for (int i = 0; i < t.length(); i++)
	{
		if (i == 0)
		{
			if (vec[t[i] - 'a'].size() == 0)
			{
				jud = false;
				break;
			}
			else
			{
				ans = 1;
				num = vec[t[i] - 'a'][0];
			}
		}
		else
		{
			if (vec[t[i] - 'a'].size() == 0)
			{
				jud = false;
				break;
			}
			else
			{
				ll lb = -1, ub = vec[t[i] - 'a'].size();

				while (lb + 1 < ub)
				{
					ll mid = (lb + ub) / 2;
					if (vec[t[i] - 'a'][mid] > num)
					{
						ub = mid;
					}
					else
					{
						lb = mid;
					}
				}

				if (ub == vec[t[i] - 'a'].size())
				{
					ans++;
					num = vec[t[i] - 'a'][0];
				}
				else
				{
					num = vec[t[i] - 'a'][ub];
				}
			}
		}
	}
	
	if (jud)
	{
		cout << (ans - 1) * s.length() + num + 1 << endl;
	}
	else
	{
		cout << -1 << endl;
	}

	

	int www;
	cin >> www;
}


Measured memory_bytes: 1724
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

class UF {
 private:
  vi parent_, vrank_;
  vl setcnt_;

 public:
  UF(int N) : parent_(N), vrank_(N, 0), setcnt_(N, 1) {
    for (int i = 0; i < N; ++i) {
      parent_[i] = i;
    }
  }

  int find(int x) {
    if (parent_[x] == x) {
      return x;
    } else {
      return parent_[x] = find(parent_[x]);
    }
  }

  int setcnt(int x) { return setcnt_[find(x)]; }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    ll cnt = setcnt_[x] + setcnt_[y];
    // cout << "+" << cnt << endl;
    if (vrank_[x] < vrank_[y]) {
      parent_[x] = y;
      setcnt_[y] = cnt;
    } else {
      parent_[y] = x;
      setcnt_[x] = cnt;
      if (vrank_[x] == vrank_[y]) vrank_[x]++;
    }
  }

  bool same(int x, int y) { return find(x) == find(y); }
};

int main() {
  //
  int n, m;
  cin >> n >> m;
  vector<pii> edge;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edge.push_back(make_pair(a, b));
  }

  int cnt = 0;
  vvi dist(n, vi(n, -1));
  rep(x, m) {
    UF uf(n);
    rep(i, m) {
      if (i == x) continue;
      pii e = edge[i];
      uf.unite(e.first, e.second);
    }
    bool ok = true;
    rep(i, n) {
      rep(j, n) {
        if (i == j) continue;
        if (!uf.same(i, j)) {
          ok = false;
          break;
        }
      }
    }
    if (!ok) {
      // cout << edge[x].first << ":" << edge[x].second << endl;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k - 1])

Measured memory_bytes: 3060
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


using node_t = std::array<int, 3>;


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, A[111111];

  std::cin >> N;

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

  std::map<node_t, long long> map;

  map[{-1, -1, -1}] = 1;

  long long C = 0;

  for (int i = 0; i < N; i ++) {
    std::map<node_t, long long> map2;

    for (const auto& kv : map)
      for (int k = 0; k < 3; k ++) {
        node_t node = kv.first;

        if (node[k] + 1 == A[i]) {
          node[k] = A[i];

          (map2[node] += kv.second) %= MOD;
        }
      }

    std::swap(map, map2);
  }

  for (const auto& kv : map)
    (C += kv.second) %= MOD;

  std::cout << C << std::endl;

  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m; cin>>n>>m;
	vector<int>height(n);
	map<int,set<int>>adj;
	for(int i=0;i<n;i++) 
		cin>>height[i];
	for(int i=0;i<m;i++){
		int a,b; cin>>a>>b;
		a--, b--;
		adj[a].insert(height[b]);
		adj[b].insert(height[a]);
	}
	int cnt=0;
	for(int i=0;i<n;i++){
		if(adj[i].empty()) cnt++;
		else if (height[i]> *adj[i].rbegin()) cnt++;
	}
	cout<<cnt<<'\n';
	return 0;
}

Measured memory_bytes: 22444
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
	return getchar();
//    if (ib == ie) {
//        ib = ibuf;
//        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
//    }
//    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

#define fi first
#define se second

int main() {
    int n = read();
    int m = read();
    using P = pair<int, int>;
    vector<P> bomb;
    for (int i = 0; i < n; ++i) {
        int a = read(), b = read();
        bomb.emplace_back(a, b);
    }
    sort(begin(bomb), end(bomb));
    vector<int> b(n + 1);
    int lst = 0;
    for (int i = 0; i < n; ++i) {
        lst ^= b[i] = bomb[i].se ^ lst;
    }
    b[n] = lst;
    vector<vector<P> > g(n + 1);
    for (int i = 1; i <= m; ++i) {
        int l = read(), r = read();
        int ll = lower_bound(begin(bomb), end(bomb), P(l, 0)) - begin(bomb);
        int rr = upper_bound(begin(bomb), end(bomb), P(r, 1)) - begin(bomb);
        g[ll].emplace_back(rr, i);
        g[rr].emplace_back(ll, i);
    }
    vector<int> ans;
    vector<bool> vis(n + 1);
    function<void(int)> dfs = [&](int u) {
        vis[u] = true;
        for (auto &e : g[u]) {
            int v = e.fi, id = e.se;
            if (!vis[v]) {
                dfs(v);
                if (b[v]) {
                    b[u] ^= 1;
                    b[v] ^= 1;
                    ans.emplace_back(id);
                }
            }
        }
    };
    
	for(int i=n;i>=0;i--)
	{
		if(vis[i]) continue;
		dfs(i);
		if(b[i])
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	sort(all(ans));
	cout<<ans.size()<<endl;
	for(auto x:ans)
	{
		printf("%d ",x);
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 16372
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a <= 0 && b >= 0) ans = 0;
    else if(a > 0) ans = 1;
    else ans = ((b-a+1)%2==0 ? 1:2);
    
    if(ans == 0) cout << "Zero" << endl;
    else if(ans == 1) cout << "Positive" << endl;
    else cout << "Negative" << endl;
    
    

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int n,m;
  cin >> n >> m;
  int submit = (m * 1900) + ((n - m) * 100);
  cout << submit * pow(2,m) << endl;
  return 0;
}

Measured memory_bytes: 4196