akhauriyash/Code-Regression huggingface dataset:
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> A;
  
  ll h = A % 10;
  
  if (h == 3)
    return "bon";
  else if (h <= 1 || h == 6 || h == 8)
    return "pon";
  else
    return "hon";
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3640
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

int main()
{
    fast();
    ll n,l;
    cin>>n>>l;

    ll sum=0;
    for(ll i=1;i<=n;i++)
        sum = sum + l + i - 1;

    ll ans=sum-l ,diff = abs(l);

    for(ll i=2;i<=n;i++)
    {
        ll cur_sum=sum - (l+i-1);
        if( abs(cur_sum - sum )<diff)
        {
            diff=abs(cur_sum-sum);
            ans=cur_sum ;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define MOD 1000000007
//#define eps 1e-10
#define R freopen("555input.txt","r",stdin);
#define W freopen("555output.txt","w",stdout);
#define N 55
#define M 16000
int i,j,n,t,l,f[N];
char s[5][N];
LL ans;
int main()
{
    
    scanf("%d",&n);
    scanf("%s",s[1]);
    scanf("%s",s[2]);
    for(i=0;i<n;i++)
    {
        if(s[1][i]==s[2][i])f[i]=1;
    }
    for(i=0;i<n;)
    {
        if(i==0)
        if(!f[i]){ans=6;i+=2;}
        else {ans=3;i++;}
        else if(f[i]){if(f[i-1])ans=(ans*2)%MOD;i++;}
        else {if(f[i-1]) ans=(ans*2)%MOD;else ans=(ans*3)%MOD;i+=2;}
    }
    cout<<ans;
    return 0;
}




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

int main() {
    int n, l[210], sum = 0;
    cin >> n;
    for (int i = 0; i < 2 * n; i++) cin >> l[i];
    sort(l, l + 2 * n);

    for (int i = 0; i < 2 * n; i += 2) {
        sum += min(l[i], l[i + 1]);
    }

    cout << sum << endl;
    return 0;
}

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

int main() {
    int N, M, C;
    cin >> N >> M >> C;

    vector<int> B(M);
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }
    vector<vector<int>> A(N, vector<int>(M));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int cnt = C;
        for (int j = 0; j < M; j++) {
            cnt += A[i][j] * B[j];
        }
        if (cnt > 0) {
            ans++;
        }
    }

    cout << ans << endl;
}

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

int main(void)
{
    int r, D, x;
    cin >> r >> D >> x;

    for (int i = 0; i < 10; i++) {
        x *= r;
        x -= D;
        cout << x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import numpy as np
N=int(input())
A_list = np.array(list(map(int, input().split()))) # "1 2 3"と入力
B_list = np.array(list(map(int, input().split())))# "1 2 3"と入力

D_list= A_list-B_list

need_study=0
do_study=0
note_num=[]
answer=0
for num in D_list:
    if num<0:
        answer+=1
        need_study+=num
    else:
        note_num.append(num)
        do_study += num
if (need_study)*(-1)>do_study:
    print(-1)
else:
    note_num.sort()
    note_num.reverse()
    change_score=0
    need_socre=(need_study)*(-1)
    while change_score<need_socre:
        change_score += note_num[0]
        answer += 1
        note_num.pop(0)
    print(answer)

Measured memory_bytes: 31776
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x,y;
    cin >> x >> y;
    if(x >= 0 && y >= 0){
        if(x < y){
            print(y-x);
            return 0;
        }else{
            if(y == 0){
                print(x-y+1);
            }else{
                print(x-y+2);
            }
        }
    }else if(x < 0 && y < 0){
        if(x < y){
            print(y-x);
            return 0;
        }else{
            print(1 + abs(x-y) + 1);
        }
    }else{
        if(x < y){
            if(abs(x) == abs(y)){
                print(1);
            }else if(abs(x) < abs(y)){
                print(x+y+1);
            }else{
                if(y == 0){
                    print(abs(y+x));
                }else{
                    print(abs(y + x) +1);
                }
            }
        }else{
            if(abs(x) == abs(y)){
                print(1);
            }else if(abs(x) < abs(y)){
                print(abs(x+y)+1);
            }else{
                print(x+y+1);
            }
        }
        // if(abs(x) == abs(y)){
        //     print(1);
        // }else if(abs(x) > abs(y)){
        //     print(x+y);
        // }else{
        //     print(x+y+1);
        // }
        // if(x < y){
        //     print(x+y+1);
        //     return 0;
        // }else{
        //     print(abs(x+y)+1);
        //     return 0;
        // }
    }
}


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

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        long lcm = 1L;
        for (int i = 0; i < N; ++i) {
            long T = sc.nextLong();
            lcm = lcm(lcm, T);
        }
        _out.println(lcm);
    }
    private static long lcm(long a, long b) {
        long gcd = gcd(a, b);
        return a / gcd * b;
    }
    private static long gcd(long a, long b) {
        if (a < b) {
            return gcd(b, a);
        }
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 22356
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力
            string youbi;
            youbi = Console.ReadLine();

            //計算
            string cntDay = "";
            switch (youbi) {
                case "SUN":
                    cntDay = "7";
                    break;
                case "MON":
                    cntDay = "6";
                    break;
                case "TUE":
                    cntDay = "5";
                    break;
                case "WED":
                    cntDay = "4";
                    break;
                case "THU":
                    cntDay = "3";
                    break;
                case "FRI":
                    cntDay = "2";
                    break;
                case "SAT":
                    cntDay = "1";
                    break;
                default:
                    break;

            }

            //出力
            Console.WriteLine(cntDay);
        }
    }
}


Measured memory_bytes: 13152
n = int(input())
p = input().split()
ans = 0
for i in range(n-2):
    if int(p[i]) < int(p[i+1]) and int(p[i+1]) < int(p[i+2]):
        ans += 1 
    else:
        if int(p[i]) > int(p[i+1]) and int(p[i+1]) > int(p[i+2]):
            ans += 1
print(ans)

Measured memory_bytes: 3064
N, M = gets.chomp.split(" ").map(&:to_i)
A = Array.new(N, nil)
e = false
M.times do |i|
  s, c = gets.chomp.split(" ").map(&:to_i)
  s -= 1
  if !A[s].nil? && A[s] != c
    e = true
  end
  A[s] = c
end
if e || (A[0] == 0 && N > 1)
  puts -1
  exit
elsif A[0].nil? && N == 1
  puts 0
  exit
end
A[0] = 1 if A[0].nil?
puts A.map{|v| v.nil? ? 0 : v }.join


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char str[4],cmp[4];
    int i,cnt=0;
    for(i=0;i<3;i++)
    {
        cin>>str[i];
    }
    for(i=0;i<3;i++)
    {
        cin>>cmp[i];
        if(str[i]==cmp[i]) cnt++;
    }
    cout<<cnt<<endl;



    return 0;
}


Measured memory_bytes: 256
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    N = int(input())
    As = list(map(int, input().split()))

    if 0 in As:
        return 0

    ans = 1
    for a in As:
        ans *= a
        if ans > 10 ** 18:
            return -1

    return ans


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 21784
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

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

  if(a%2 == 0 || b%2 == 0 || c%2 == 0){
    cout << 0 << endl;
  }else{
    if(a>=b && a>=c)
      cout << b*c << endl;
    else if(b>=a && b>=c)
      cout << a*c << endl;
    else if(c>=a && c>=b)
      cout << a*b << endl;
  }

  return 0;
}
  


Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define F first
#define S second

using namespace std;
using ll = long long;
using namespace __gnu_pbds;

template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 2e5 + 10 , inf = 2e9 + 7;
const ll INF = 1e18 , mod = 1e9+7;

void solve() {
    int n , ans = 0;
    double d , x , y;
    cin >> n >> d;
    for(int i = 1; i <= n; i ++)  {
        cin >> x >> y;
        x = sqrt(x*x + y*y);
        if(x <= d) ans ++;
    }
    cout << ans;
}
/*
*/
main() {
    ios;
    int tt = 1;
    //cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3860
//Bismillahir Rahman-ir Rahim
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000002
#define PI acos(-1)
#define debug(x) cout << '>' << #x << " : " << x << endl;
//#define m (pow(10, 9)+7)
typedef unsigned long long ull;
typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int N, M, n_way, m_way;
    cin >> N >> M;
    if(N < 2) n_way = 0;
    if(M < 2) m_way = 0;

    if(N >= 2){
        n_way = (N*(N-1))/2;
    }
    if(M >= 2){
        m_way = (M*(M-1))/2;
    }

    cout << n_way+m_way << endl;
    

    return 0;
}



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

long long solve(int n, int a[]){
    long long ans = 0;
    long long ans2 = 0;
    if(n%2==0) {
        for(int i=0;i<n;i++) {
            if(i<(n-2)/2)
                ans += -2*a[i];
            else if(i==(n-2)/2)
                ans += -a[i];
            else if(i==n/2)
                ans += a[i];
            else
                ans += 2*a[i];
        }
        return ans;
    }else{
        for(int i=0;i<n;i++) {
            if(i<n/2)
                ans += -2*a[i];
            else if(i==n/2)
                ans += a[i];
            else if(i==(n+2)/2)
                ans += a[i];
            else
                ans += 2*a[i];
        }
        for(int i=0;i<n;i++) {
            if(i<(n-2)/2)
                ans2 += -2*a[i];
            else if(i==(n-2)/2)
                ans2 += -a[i];
            else if(i==n/2)
                ans2 += -a[i];
            else
                ans2 += 2*a[i];
        }
        return max(ans, ans2);
    }
}

int main(){
    int n;
    long long ans;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
        cin >> a[i];
    sort(a, a+n);
    ans = solve(n, a);

    cout << ans << endl;

    return 0;
}


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

int main()
{
	int n, x;
	cin >> n >> x;
	int cnt = 0, d = 0;
	for(auto i = 0; i < n; ++i){
		int l;
		cin >> l;
		d += l;
		if(d <= x) ++cnt;
	}
	cout << cnt + 1 << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using ii = pair<int,int>;

#define ff first
#define ss second

const ll INF = 1e12+10;

int main(){
	ll n,k,min_ans=INF;
	cin >> n >> k;
	vector<ll> A(n),F(n);
	for(int i=0;i<n;++i){
		cin >> A[i];
	}
	for(int i=0;i<n;++i){
		cin >> F[i];
	}
	sort(A.begin(),A.end());
	sort(F.rbegin(),F.rend());
	ll lo = 0,hi = INF,mid;
	while(lo<hi){
		mid = (lo+hi)/2;
		ll s=0;
		for(int i=0;i<n;++i){
			if(A[i]-mid/F[i] >= 0)
				s+=A[i]-mid/F[i];
		}
		if(s <= k)
			hi = mid;
		else
			lo = mid+1;
	}
	cout << lo << '\n';
	return 0;
}

Measured memory_bytes: 3328
#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>


using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vi>;
const ll MOD = 1e9 + 7;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };




int main() {
    ll N, K;
    cin >> N >> K;
    vll A(N+1);
    repp(i, N) cin >> A[i];
    ll count = 0;
    ll cycle = 0;
    ll ima = 1;
    set<ll> visited;
    visited.insert(ima);
    rep(i, N) {
        count++;
        ima = A[ima];
        if (visited.count(ima)) break;
        visited.insert(ima);
    }
    set<ll> visited2;
    visited2.insert(ima);
    rep(i, N) {
        cycle++;
        ima = A[ima];
        if (visited2.count(ima)) break;
        visited2.insert(ima);
    }
    count = count - cycle;
    if (K > count) {
        ll r = (K - count) % cycle;
        rep(i, r) {
            ima = A[ima];
        }
        cout << ima << endl;
    }
    else {
        ima = 1;
        rep(i, K) {
            ima = A[ima];
        }
        cout << ima << endl;
    }
}

Measured memory_bytes: 21940
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int x[5];
    rep(i, 5) cin >> x[i];
    int ans = 0;
    rep(i, 5) {
        if (x[i] == 0) ans = i + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <queue>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
#define X first
#define Y second

void go() {
	int n,m;
	cin >> n >> m;
	double res = 0;
	double p = 1.0 / (1<<m);
	double q = 1-p;
	double qn = 1;
	for(int i = 1;;i++) {
		double t = (1900.0 * m + 100.0 * (n-m)) * i * qn * p;
		if(t<1e-9) break;
		qn *= (1-p);
		res += t;
	}
	printf("%.0f\n",res);
}

int main() {
	//int t; cin >> t; for(;t--;)
	go();
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

#define pi 3.1415926535

int main(void){
  double a, b, x;
  cin >> a >> b >> x;

  double num; //分子 : numerator
  double den; //分母 : denominator

  //水の体積が，容積の半分未満
  if(x < a*a*b/2){
    num = 2*x;
    den = a*b*b;
    cout << setprecision(10) << 90-atan(num/den)*180/pi<< endl;
  }
  else{
    num = 2*(a*a*b-x);
    den = a*a*a;
    cout << setprecision(10) << atan(num/den)*180/pi<< endl;
  }
  return 0;
}


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

int f(int n){   //各桁の数値の合計を計算する関数
    int ans = 0;
    while (n > 0){
        ans += n % 10;
        n /= 10;
    }
    return ans;
}

int main(){
    int n, a, b, ans = 0;
    cin >> n >> a >> b;
    rep(i, n+1){
        if(a <= f(i) && b >= f(i)) ans += i;
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int student[31],n;

  for( int i = 0 ; i < 31; i++ ) student[i] = 1;
  student[0] = 0;
  for( int i = 0 ; i < 28 ; i++ ){
    cin >> n;
    student[n] = 0;
  }

  for( int i = 0 ; i < 31 ; i++ ){
    if( student[i] == 1 ) cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
str = gets.chomp
out = 0

def get_abs(str, num)
  indexs = []
  offset = 0
  loop do
    index = str.index(num.to_s, offset)
    break unless index

    offset = index + 1
    indexs << index
  end

  abs = 753
  indexs.each do |index|
    substr = str[index, 3]
    next if substr.size != 3

    abs = (753 - substr.to_i).abs if abs > (753 - substr.to_i).abs
  end

  abs
end

(7..9).each do |i|
  out = 753
  abs = get_abs(str, i)
  break out = abs if abs != 753
end

(1..6).reverse_each do |i|
  abs = get_abs(str, i)
  if out > abs
    out = abs
  end
end
puts out


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
using ll = long long;
using namespace std;
vector<vector<ll>> gragh;
ll n,k;
ll mod =1e9+7;
ll dfs(ll now,ll from){
    int color=k;
    if(from==-1){
        color--;
    }else{
        color-=2;
    }
    if(k<gragh[now].size()){
        return 0;
    }else{
        ll case_num=1;
        for(int i=0;i<gragh[now].size();i++){
            if(gragh[now][i]==from){
                continue;
            }
            case_num  *= color;
            color--;
            case_num %= mod;
        }
        for(int i=0;i<gragh[now].size();i++){
            if(gragh[now][i]==from){
                continue;
            }
            case_num *= dfs(gragh[now][i],now);
            case_num %= mod;
        }
        return case_num;
    }
}

int main(){
    
    cin >> n >> k;
    gragh.resize(n);
    for(int i=0;i<n-1;i++){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        gragh[a].push_back(b);
        gragh[b].push_back(a);
    }
    ll ans = k*dfs(0,-1);
    ans %= mod;
    cout << ans <<endl;
}

Measured memory_bytes: 11520
A, B = map(int, input().split())

if A == 1 and B != 1:
  print("Alice")
elif A == 1 and B == 1:
  print("Draw")
elif B == 1 and A != 1:
  print("Bob")
elif A > B:
  print("Alice")
elif B > A:
  print("Bob")
else:
  print("Draw")

Measured memory_bytes: 3060
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        int m = n-1;
        int [] num  = new int[n-1];
        int last ;
        for (int i =0;i<m;i++){
            num[i]= in.nextInt();
        }
        int s =num[0];
        if (m>1){
            num[0]=Math.min(num[0],num[1]);
        }
        for (int i=0;i<=m-2;i++){
            num[i]=Math.min(num[i],num[i+1]);
            s+=num[i];
        }
        s+=num[m-1];
        System.out.println(s);

    }
}


Measured memory_bytes: 25044
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
int a[201010];
int dp[201010];
int pos[201010];
bool isall = true;
int main() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
		if (a[i] != i + 1)isall = false;
	}
	if (isall) {
		cout << 0 << endl;
		return 0;
	}
	REP(i, n) {
		pos[i] = -1;
	}
	pos[a[0]] = 0;
	dp[a[0]] = 1;
	for (int i = 1; i < n; i++) {
		if (pos[a[i] - 1] == -1) {
			dp[a[i]] = 1;
		}
		else {
			dp[a[i]] = dp[a[i] - 1] + 1;
		}
		pos[a[i]] = i;
	}
	int maxn = 0;
	REP(i, n) {
		maxn = max(maxn, dp[i]);
	}
	cout << n - maxn << endl;
}

Measured memory_bytes: 2560
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
using namespace std;
typedef pair<long long, long long>p;
typedef pair<p, long long> pai;
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
long long mod = 1e9 + 7;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<p>edge;
	if (n % 2 == 1) {
		for (int i = 1; i <= n - 1; i++) {
			edge.push_back(p(i, n));
		}
		for (int i = 1; i <= n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				if (i == j)continue;
				if (n % 2 == 0 && n / 2 == i) {
					if (j == 1)continue;
					if (j == n - i - 1)continue;
				}
				else {
					if (j == n - i)continue;
				}
				edge.push_back(p(i, j));
			}
		}
	}
	else {
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (n + 1 - i == j)continue;
				edge.push_back(p(i, j));
			}
		}
	}
	cout << edge.size()<<"\n";
	for (int i = 0; i < edge.size(); i++) {
		cout<<edge[i].first << " " << edge[i].second << "\n";
	}
}

Measured memory_bytes: 512
program test
implicit none
  integer,allocatable::a(:)
  integer :: N,i,ans
  read*,N
  allocate(a(N))
  read(*,*)(a(i),i=1,N-1)
  ans=a(1)
  do i=1,N-2
  	ans=ans+min(a(i),a(i+1))
  end do
  ans=ans+a(N-1)
 print*,ans
end program
  

Measured memory_bytes: 768
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<LL, LL> P;
struct edge { LL to, cost; };

const LL inf = 112345678901;

std::vector<LL>dist;
std::vector<std::vector<edge>>G;
void dijkstra(LL s)
{
	std::priority_queue<P, std::vector<P>, std::greater<P>>que;
	std::fill(dist.begin(), dist.end(), inf);
	dist[s] = 0;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		LL v = p.second;
		if (dist[v] < p.first) { continue; }
		rep(i, G[v].size())
		{
			edge e = G[v][i];
			if (dist[e.to] > dist[v] + e.cost)
			{
				dist[e.to] = dist[v] + e.cost;
				que.push(P(dist[e.to], e.to));
			}
		}
	}
}

int main()
{
	LL N, M, K, S, P, Q;
	in >> N >> M >> K >> S >> P >> Q;
	std::vector<LL>C(K), A(M), B(M);
	rep(i, K) in >> C[i];
	rep(i, M) in >> A[i] >> B[i];

	dist.resize(N + 1); G.resize(N + 1);
	rep(i, M)
	{
		G[A[i]].push_back({ B[i],1 });
		G[B[i]].push_back({ A[i],1 });
	}
	rep(i, K) G[0].push_back({ C[i],0 });
	dijkstra(0);

	G.clear(); G.resize(N + 1);
	std::map<LL, bool>flag;
	rep(i, K) flag[C[i]] = true;
	rep(i, M)
	{
		if (B[i] == N) G[A[i]].push_back({ B[i],0 });
		else
		{
			if (!flag[B[i]]) G[A[i]].push_back({ B[i],(dist[B[i]] <= S ? Q : P) });
			if (!flag[A[i]]) G[B[i]].push_back({ A[i],(dist[A[i]] <= S ? Q : P) });
		}
	}
	dijkstra(1);

	out << dist[N] << std::endl;
	return 0;
}



Measured memory_bytes: 29112
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int MAX = 200000;

int main(){
    int N,K;
    int A[MAX];

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

    for(int i = 0;i < N - K;i++){
        if(A[i] < A[K + i])cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3868
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main() {
  ll N;
  cin>>N;
  int a = N%1000;
  if(a==0){
    cout<<0<<endl;
    return 0;
  }
  cout<<1000-a<<"\n";

  return 0;
}


Measured memory_bytes: 3632
/* author:hellojim */
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
int a[200100];
int b[200100];
int numa[200100];
int numb[200100];
int n;
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	cin>>n;
	rep(i,n)cin>>a[i],numa[a[i]]++;
	rep(i,n)cin>>b[i],numb[b[i]]++;
	sort(a,a+n);
	sort(b,b+n);
	rep(i,200001)if(numa[i]+numb[i]>n)
	{
		cout<<"No\n";
		return 0;
	}
	reverse(b,b+n);
	int now=-1;
	rep(i,n)
	{
		if(a[i]==b[i])
		{
			for(int j=now+1;j<n;j++)
			{
				if(b[j]!=a[i]&&b[i]!=a[j])
				{
					swap(b[j],b[i]);
					now=j;
					break;
				}
			}
		}
	}
	cout<<"Yes\n";
	rep(i,n)cout<<b[i]<<" ";
	cout<<endl;
	return 0;
}



Measured memory_bytes: 6756
/**
 *	author:   fractal
 *	timus:    288481RF
 *	created: 08/22/20 18:46:21
**/

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

#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define szc(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound 
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 3e5 + 2;
const int M = 2e6;
const int mod = 0;
const int inf = 2e9 + 3;
const ll INF = 1e16;

int n, m, x, y, q;
vpii vec;
set <int> was[N];

struct tree {
	int t[M];
	void upd(int pos, int val, int v = 1, int tl = 1, int tr = m) {
		if (tl == tr) {
			t[v] += val;
			return;
		}
		int tm = tl + tr >> 1;
		if (pos <= tm)
			upd(pos, val, v * 2, tl, tm);
		else
			upd(pos, val, v * 2 + 1, tm + 1, tr);
		t[v] = max(t[v * 2], t[v * 2 + 1]);
	}
	
	int get(int l, int r, int v = 1, int tl = 1, int tr = m) {
		if (l <= tl && tr <= r)
			return t[v];
		if (r < tl || tr < l)
			return 0;
		int tm = tl + tr >> 1;
		return max(get(l, r, v * 2, tl, tm), get(l, r, v * 2 + 1, tm + 1, tr));
	}	
} t;

int main() {
	scanf("%d %d %d", &n, &m, &q);
	while (q--) {
		scanf("%d %d", &x, &y);
		vec.pb({x, y});
		was[x].insert(y);
		t.upd(y, 1);
	}
	int ans = 0;
	for (int i = 1; i <= n; ++i) {
		if (was[i].empty())
			continue;
		was[i].insert(m + 1);
		int last = 0;
		for (auto it : was[i]) {
			ans = max(ans, sz(was[i]) - 1 + t.get(last + 1, it - 1));
			ans = max(ans, sz(was[i]) - 1 + t.get(it, it) - 1);
			last = it;
		}
	}
	printf("%d", ans);
}


Measured memory_bytes: 52064
import java.util.Scanner;

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();

		int remnant = a - b;

		c -= remnant;
		c = c < 0 ? 0 : c;

		System.out.println(c);

	}
}


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

using namespace std;

class DSU {
private:
  std::vector<int> rank, p, size;
public:
  DSU(int n): rank(n, 0), p(n), size(n, 1) {
    std::iota(p.begin(), p.end(), 0);
  }

  int findRep(int x) {
    if (p[x] != x) {
      p[x] = findRep(p[x]);
    }
    return p[x];
  }

  void unite(int x, int y) {
    int p1 = findRep(x), p2 = findRep(y);
    if (p1 == p2) return;
    if (rank[p1] < rank[p2]) std::swap(p1, p2);
    
    if (rank[p1] == rank[p2]) rank[p1]++;
    p[p2] = p1;
    size[p1] += size[p2];
  }

  int getSize(int x) {
    int xRep = findRep(x);
    return size[xRep];
  }

  bool isSame(int x, int y) {
    return findRep(x) == findRep(y);
  }
};

int main() {
  int n, m;
  cin >> n >> m;
  DSU dsu(n);

  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    dsu.unite(a, b);
  }

  int ans = -1;
  for (int i = 0; i < n; ++i) {
    ans = max(ans, dsu.getSize(i));
  }

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



Measured memory_bytes: 5636
#include <stdio.h>

int main(void)
{
	int a, b, c, i, n;
	
	while (scanf("%d", &n), n != 0){
		for (i = 0; i < n; i++){
			scanf("%d %d %d", &a, &b, &c);
			
			if (a == 100 || b == 100 || c == 100){
				printf("A\n");
			}
			else if (a + b >= 180){
				printf("A\n");
			}
			else if (a + b + c >= 240){
				printf("A\n");
			}
			else if (a + b + c >= 210){
				printf("B\n");
			}
			else if (a + b + c >= 150 && (a >= 80 || b >= 80)){
				printf("B\n");
			}
			else {
				printf("C\n");
			}
		}
	}
	
	return (0);
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<a.size(); i++){
        cin >> a.at(i);
    }
    for(int i=0; i<a.size(); i++){
        if(i) cout << " ";
        cout << a.at(a.size()-i-1);
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3084
#include <stdio.h>

int main(){
	int a[10],b[10],i,j,c,asum=0,bsum=0;
	
	for(i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<10;i++){
		scanf("%d",&b[i]);
	}
	for(j=0;j<10;j++){
		for(i=0;i<9;i++){
			if(a[i]<=a[i+1]){
				c=a[i];
				a[i]=a[i+1];
				a[i+1]=c;
			}
			if(b[i]<=b[i+1]){
				c=b[i];
				b[i]=b[i+1];
				b[i+1]=c;
			}
		}
	}
	for(i=0;i<3;i++){
		asum+=a[i];
		bsum+=b[i];
	}
	printf("%d %d\n",asum,bsum);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]) cout <<"Bad"<<"\n";
    else cout <<"Good"<<"\n";
}

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

int main(void)
{
    ll a, b,v,w,t;
    cin >> a >> v >> b>>w>>t;

    cout <<(abs(a-b)<=(v-w)*t?"YES":"NO")<<endl;
    return 0;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if(a%2 == 0 && b%2 == 0)
        cout << (a+b)/2 << endl;
    else if(a%2 == 0 && b%2 != 0)
        cout << (a+b)/2+1 << endl;
    else if(a%2 != 0 && b%2 == 0)
        cout << (a+b)/2+1 << endl;
    else if(a%2 != 0 && b%2 != 0)
        cout << (a+b)/2 << endl;




    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define LL long long
#define M 400020
using namespace std;
int read(){
	int nm=0,fh=1; char cw=getchar();
	for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
	for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
	return nm*fh;
}
int n,m,col[M],vis[M],u,v,sum[M],cal[M];
int fs[M],nt[M],last[M],to[M],tmp,top,S[M];
void link(int x,int y){nt[tmp]=fs[x],fs[x]=tmp,to[tmp++]=y;}
void init(int x,int last){
	if(!vis[x]) col[x]=-col[last],vis[x]=1;
	sum[x]=col[x];
	for(int i=fs[x];i!=-1;i=nt[i]){
		if(to[i]==last) continue;
		if(x==v&&to[i]==u) continue;
		if(x==u&&to[i]==v) continue;
		if(vis[to[i]]==1&&!u&&m==n) u=x,v=to[i];
		else init(to[i],x),sum[x]+=sum[to[i]];
	}
}
void dfs(int x,int last){
	for(int i=fs[x];i!=-1;i=nt[i]){
		if(to[i]==last||(x==u&&to[i]==v)||(x==v&&to[i]==u)) continue;
		dfs(to[i],x),cal[x]+=cal[to[i]];
	}
}
int getans(){
	if(n&1) return -1;
	int res=0; col[0]=-1,u=v=0,init(1,0);
	if(m==n-1){
		if(sum[1]) return -1;
		for(int i=2;i<=n;i++) res+=abs(sum[i]);
		return res;
	}
	if(col[u]==col[v]){
		col[u]-=sum[1]/2,col[v]-=sum[1]/2,res+=abs(sum[1]/2),init(1,0);
		for(int i=1;i<=n;i++) res+=abs(sum[i]); return res;
	}
	else if(sum[1]) return -1;
	cal[u]=1,cal[v]=-1,dfs(1,0),S[top=1]=0;
	for(int i=1;i<=n;i++){
		if(!cal[i]) res+=abs(sum[i]);
		else S[++top]=cal[i]*sum[i];
	}
	nth_element(S+1,S+((top+1)>>1),S+top+1);
	for(int i=1;i<=top;i++) res+=abs(S[(top+1)>>1]-S[i]);
	return res;
}
int main(){
	n=read(),m=read(),memset(fs,-1,sizeof(fs));
	for(int i=1;i<=m;i++) u=read(),v=read(),link(u,v),link(v,u);
	printf("%d\n",getans()); return 0;
}

Measured memory_bytes: 16384
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    CSF = list(list(map(int, readline().split())) for _ in range(N-1))
    T = []
    for i in range(N-1):
        t = 0
        for c, s, f in CSF[i:]:
            t = max(math.ceil(t/f)*f, s) + c
        T.append(t)
    T.append(0)
    for t in T:
        print(t)


if __name__ == '__main__':
    main()


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

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
// #define int long long 

using namespace std;

int32_t main()
{
	fio;
	int n,m;
	cin>>n>>m;
	int *h=new int[n];
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}

	unordered_map<int,vector<int> > mp;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		mp[a].push_back(b);
		mp[b].push_back(a);
	}

	int cnt=0;
	for(int i=1;i<=n;i++)
	{
		if(!mp.count(i))
		{
			cnt++;
		}
		else
		{
			bool flag=true;
			for(auto itr:mp[i])
			{
				if(h[itr-1]>=h[i-1])
				{
					flag=false;
					break;
				}
			}
			if(flag)
			{
				cnt++;	
			}
		}
	}

	cout<<cnt<<endl;
	return 0;
}

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

int main() {
    int x,y;
    cin >> x >> y;
    int A[12] = {0,2,0,1,0,1,0,0,1,0,1,0};
    if(A[x-1] == A[y-1]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
    int A, B, M;
    cin >> A >> B >> M;

    vector<int> a(A);
    for (int i = 0; i < A; i++)
        cin >> a[i];
    
    vector<int> b(B);
    for (int i = 0; i < B; i++)
        cin >> b[i];

    vector<int> x(M), y(M), c(M);
    for (int i = 0; i < M; i++)
        cin >> x[i] >> y[i] >> c[i];

    for (int i = 0; i < M; i++) {
        x[i]--;
        y[i]--;
    }

    int ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
    for (int i = 0; i < M; i++) {
        int cost = a[x[i]] + b[y[i]] - c[i];
        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define nn 65536*16
#define ll long long
#define mod 1000000007
ll f[nn],rf[nn];
ll qpow(ll x,ll y)
{
	ll res=1;
	while(y)
	{
		if(y&1) res=res*x%mod;
		x=x*x%mod;y=y/2;
	}
	return res;
}
ll C(ll x,ll y)
{
	if(x<0) return 0;
	if(x>y) return 0;
	return f[y]*rf[x]%mod*rf[y-x]%mod;
}
ll g[nn];
int main()
{
	f[0]=1;for(int i=1;i<nn;i++) f[i]=f[i-1]*i%mod;
	rf[nn-1]=qpow(f[nn-1],mod-2);
	for(int i=nn-2;i>=0;i--) rf[i]=rf[i+1]*(i+1)%mod;
	ll n;cin>>n;
	ll ans=0;
	for(int i=(n+1)/2;i<n;i++) g[i]=C(n-1-i,i-1)*f[i]%mod*f[n-i-1]%mod;
	for(int i=(n+1)/2;i<n;i++) ans+=i*(g[i]-g[i-1]),ans%=mod;
	cout<<(ans+mod)%mod;
    return 0;
}

Measured memory_bytes: 22784
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << B + min(A + B + 1, C) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;

int main ()
{
  prep();
  int t;
  cin >> t;
  for (int z=0; z<t; z++){
      long long a, b, c, d;
      cin >> a >> b >> c >> d;
      if (a < b || b > d){
          cout << "No\n";
          continue;
      }
      if (c >= b-1){
          cout << "Yes\n";
          continue;
      }
      long long g = __gcd(b, d);
      long long l = (c+1)%g;
      long long r = (b-1)%g;
      if (b-c-1 >= g){
          cout << "No\n";
          continue;
      }
      long long amod = a%g;
      if (l <= amod && r >= amod || l >= amod && r <= amod){
          cout << "No\n";
          continue;
      }
      //cout << l << " " << r << endl;
      cout << "Yes\n";
  }
  return 0; 
}


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

using namespace std;



int main(){
    int x,y;
    cin>>x>>y;

    if(x==4||
    x==6||
    x==9||
    x==11){
        x = 1;
    }else if(x==2){
        x = 0;
    }else{
        x = 2;
    }

    if(y==4||
       y==6||
       y==9||
       y==11){
        y = 1;
    }else if(y==2){
        y = 0;
    }else{
        y = 2;
    }

    if(x==y){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }






}


Measured memory_bytes: 256
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a,b,x int
    fmt.Scan(&a,&b,&x)
    ans := "NO"
    if x>=a && x<=a+b{
        ans = "YES"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640