akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

int main() {
    int n, a, b; cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}



Measured memory_bytes: 256
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    a.sort!"a < b";
    auto g = a.group.array;

    bool ok;
    if (g.length == 3)
    {
        ok = (g[0][0] ^ g[1][0] ^ g[2][0]) == 0;
        ok &= g[0][1] == n / 3 && g[1][1] == n / 3 && g[2][1] == n / 3;
    }

    if (g.length == 2)
    {
        ok = g[0][0] == 0;
        ok &= g[0][1] == n / 3 && g[1][1] == n / 3 * 2;
    }

    if (g.length == 1)
    {
        ok = g[0][0] == 0;
    }

    writeln(ok ? "Yes" : "No");
}


enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

using namespace std;

long int nnu(int a){
	int ans,i;
	ans = 1;
	for(i = 1; i <= a;i++){
		ans = ans * i;
	}
	return ans;
}
void func(int p[],int i,int n){
	int j;
	for(j = i; j < n; j++){
		if(p[j] > p[i]){
			p[j]--;
		}
	}
}
int main(void)
{
	int n;
	cin>>n;
	int p[n],q[n];
	int i;
	for(i = 0; i < n;i++){
		cin>>p[i];
	}
	
	for(i = 0; i < n;i++){
		cin>>q[i];
	}
	
	long int a;
	a = 0;
	for(i = 0; i < n; i++){
		if(p[i] != 1){
			a = a + (p[i]- 1) * nnu(n-i-1);
		}
		func(p,i,n);
	}
	long int b;
	b = 0;
	for(i = 0; i < n; i++){
		if(q[i] != 1){
			b = b + (q[i]- 1) * nnu(n-i-1);
		}
		func(q,i,n);
	}
	long int tmp;
	long int ans;
	if(a < b){
		tmp = a;
		a = b;
		b = tmp;
	}
	ans = a - b;
	cout<<ans<<endl;
	
	return 0;
}




Measured memory_bytes: 256
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e17
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
ll dp[101][100001],n,W;
pair<ll,ll> p[100001];
ll solve(ll i,ll w)
{
	if(i==n)
	{
		return 0;
	}
	if(dp[i][w]!=-1) return dp[i][w];
	ll ans1=0,ans2=0;
	ans1 = solve(i+1,w);
	if(w+p[i].fi<=W)ans2 = p[i].se+solve(i+1,w+p[i].fi);
	return dp[i][w]=max(ans2,ans1);
}
int main()
{
	boost
	cin>>n>>W;
	memset(dp,-1,sizeof(dp));
	for(ll i=0;i<n;i++)
	{
		cin>>p[i].fi>>p[i].se;
	}
	for(ll i=0;i<=W;i++)
	{
		if(i+p[n-1].fi>W)dp[n-1][i]=0;
		else dp[n-1][i]=p[n-1].se;
	}
	for(ll i=n-2;i>=0;i--)
	{
		for(ll j=0;j<=W;j++)
		{
			if(p[i].fi+j<=W)dp[i][j]=max(dp[i+1][j],p[i].se+dp[i+1][j+p[i].fi]);
			else dp[i][j]=dp[i+1][j];
		}
	}
	ll maxi=0;
	for(ll i=0;i<=W;i++)
	{
		maxi=max(dp[0][i],maxi);
	}
	cout<<maxi<<endl;
	return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int a,b,c;
    cin>>a>>b>>c;
    int ans=c+b-a;
    if(ans<0) ans=0;
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#define int long long
#define INF 1000000007
using namespace std;
signed main(){
    int n;
    cin>>n;
    int a[114514];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    int memo=a[0];
    int count=1;
    int ans=0;
    for(int i=1;i<n;i++){
        if(memo!=a[i]){
            if(count<memo)ans+=count;
            else ans+=count-memo;
            memo=a[i];
            count=1;
        }else{
            count++;
        }
    }
    if(count<memo)ans+=count;
    else ans+=count-memo;
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;

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

    static class DivGame {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long num = in.nextLong();

            int ans = 0;
            HashMap<Long, Long> map = primeFactorize(num);
            if (map.isEmpty()) {
                out.append("0\n");
                return;
            }
            for (Long key : map.keySet()) {
                long v = map.get(key);
                for (long j = 1; j <= v; j++) {
                    if (v > 0) {
                        ans++;
                    }
                    v -= j;
                }
            }

            out.append(String.valueOf(ans));
        }

        static HashMap<Long, Long> primeFactorize(long x) {
            HashMap<Long, Long> result = new HashMap<>();
            for (long i = 2; i * i <= x; i++) {
                if (x % i != 0) {
                    continue;
                }
                long ex = 0;
                while (x % i == 0) {
                    ex++;
                    x /= i;
                }
                result.put(i, ex);
            }
            if (x != 1) {
                result.put(x, 1L);
            }
            return result;
        }

    }
}



Measured memory_bytes: 35812
class Integer
  @@my_factorial_memo = [1]
  def combination(k)
    return 1 if k.zero?

    self.factorial / ((self - k).factorial * k.factorial)
  end

  def factorial
    unless @@my_factorial_memo[self].nil?
      return @@my_factorial_memo[self]
    end

    ans = (1..self).inject(:*)
    @@my_factorial_memo[self] = ans
    ans
  end
end

TEISU = 1_000_000_007

N,K = gets.chomp.split.map(&:to_i)

1.upto(K) do |i|
  where = (N-K+1).combination(i) % TEISU
  how = (K-1).combination(i-1) % TEISU
  puts (where * how) % TEISU
end


Measured memory_bytes: 10496
#include <cstdio>
#include <cstring>

using namespace std;

bool prime(int x)
{
	for (int i = 2; i * i <= x; i++)
		if (x % i == 0) return (false);
	return (x != 1);
}

int main()
{
	int n, x;
	static bool dp[1000001];
	
	while (scanf("%d %d", &n, &x) && n){
		memset(dp, 0, sizeof(dp));
		dp[0] = 1;
		for (int i = 0; i < n; i++){
			int y;
			scanf("%d", &y);
			for (int r = 0; r + y <= x; r++){
				if (dp[r]) dp[r + y] = true;
			}
		}
		
		bool ng = true;
		for (int i = x; i >= 2; i--){
			if (dp[i] && prime(i)){
				printf("%d\n", i);
				ng = false;
				break;
			}
		}
		if (ng) printf("NA\n");
	}
	return (0);
}

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

const int maxV=51;
int dp[maxV][maxV][maxV*maxV];

signed main(){
	int n,a;cin>>n>>a;
	vector<int> x(n);
	for(auto&& w:x)cin>>w;

	fill(dp[0][0],dp[maxV][0],0);
	dp[0][0][0]=1;

	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			for(int s=0;s<maxV*maxV;s++){
   //           if(dp[i][j][s]==0)continue;
				dp[i+1][j][s]+=dp[i][j][s];
				dp[i+1][j+1][s+x[i]]+=dp[i][j][s];
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++)ans+=dp[n][i][i*a];
	cout<<ans<<endl;

}

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

int main(){
	
	int n;
	cin>>n;
	vector<int>a(n),b(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		cin>>b[i];
	}
	reverse(b.begin(),b.end());
	int lpt=0,rpt=n-1;
	for(int i=0;i<n;i++){
		
		if(a[i]==b[i]){
			
			if(b[lpt]!=b[i] && a[lpt]!=b[i]){
				swap(b[i],b[lpt]);
				++lpt;
			}
			else if(b[rpt]!=b[i] && a[rpt]!=b[i]){
				swap(b[i],b[rpt]);
				--rpt;
			}
			else{
				cout<<"No\n";
				return 0;
			}
		}
	}
	for(int i=0;i<n;i++){
		
		if(a[i]==b[i]){
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	for(auto x:b){
		cout<<x<<" ";
	}
		cout<<endl;
	return 0;
}


Measured memory_bytes: 4824
#include <iostream>
#define llint long long

using namespace std;

int N, M;

int parent[100005];
void init()
{
	for(int i = 1; i <= N; i++) parent[i] = i;
}
int root(int i)
{
	if(parent[i] == i) return i;
	return parent[i] = root(parent[i]);
}
bool same(int i, int j)
{
	return root(i) == root(j);
}
void unite(int i, int j)
{
	int root_i = root(i);
	int root_j = root(j);
	if(root_i == root_j) return;
	parent[root_i] = root_j;
}

int main(void)
{
	cin >> N >> M;
	init();
	
	int a, b;
	for(int i = 0; i < M; i++){
		cin >> a >> b;
		unite(a, b);
	}
	
	llint cnt1 = 0, cnt2 = 0;
	for(int i = 1; i <= N; i++){
		if(same(i, 1)) cnt1++;
		if(same(i, 2)) cnt2++;
	}
	
	if(cnt1 < cnt2) cnt2 = N - cnt1;
	else cnt1 = N - cnt2;
	
	llint ans = 0;
	ans = cnt1*(cnt1-1)/2 + cnt2*(cnt2-1)/2;
	ans -= M;
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2176
1x1=1
1x2=2
1x3=3
1x4=4
1x5=5
1x6=6
1x7=7
1x8=8
1x9=9
2x1=2
2x2=4
2x3=6
2x4=8
2x5=10
2x6=12
2x7=14
2x8=16
2x9=18
3x1=3
3x2=6
3x3=9
3x4=12
3x5=15
3x6=18
3x7=21
3x8=24
3x9=27
4x1=4
4x2=8
4x3=12
4x4=16
4x5=20
4x6=24
4x7=28
4x8=32
4x9=36
5x1=5
5x2=10
5x3=15
5x4=20
5x5=25
5x6=30
5x7=35
5x8=40
5x9=45
6x1=6
6x2=12
6x3=18
6x4=24
6x5=30
6x6=36
6x7=42
6x8=48
6x9=54
7x1=7
7x2=14
7x3=21
7x4=28
7x5=35
7x6=42
7x7=49
7x8=56
7x9=63
8x1=8
8x2=16
8x3=24
8x4=32
8x5=40
8x6=48
8x7=56
8x8=64
8x9=72
9x1=9
9x2=18
9x3=27
9x4=36
9x5=45
9x6=54
9x7=63
9x8=72
9x9=81

Measured memory_bytes: 6396
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int n = sc.nextInt();
                double[] x = new double[8];
                for(int i = 0; i < n; i++){
                        for(int j = 0; j < 8; j++){
                                x[j] = sc.nextDouble();
                        }   
                        boolean flag = false;
                        if(x[0] == x[2]){
                                flag = x[4] == x[6];
                        }else{
                                if(x[4] != x[6]){
                                        flag = (x[3]-x[1])*(x[6]-x[4]) == (x[7]-x[5])*(x[2]-x[0]); 
                                }   
                        }   
                        if(flag){
                                System.out.println("YES");
                        }else{
                                System.out.println("NO");
                        }   
                }   
                sc.close();
        }   
}

Measured memory_bytes: 12000
def main33():
    num = int(input())
    tumi = []
    tumi.append(0)
    result = 0
    for i in range(num):
        moti = int(input())
        hantei = True
        for j in tumi:
            if j == moti:
                hantei = False
                break
        if hantei:
            result = result + 1
            tumi.append(moti)
    print(result)

if __name__ == "__main__":
    main33()

Measured memory_bytes: 3064
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        if((a*b) % 2 == 0){
          // 正の整数a,bの積に対する剰余2が0であればEven
          System.out.println("Even");
        } else {
          System.out.println("Odd");
        }
	}
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	string cor = "CODEFESTIVAL2016";
	string str;
	cin >> str;
	int cnt = 0;
	for (int i = 0; i < str.size(); i++) {
		cnt += str[i] != cor[i];
	}
	cout << cnt << "\n";
}

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


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
using namespace std;

const int MAXN = 1e5 + 10;
int N;
int A[MAXN];
int p, t;

int main() {
	register int i;
	scanf( "%d", &N );
	for( i = 1; i <= N; ++i )
		scanf( "%d", A + i );
	sort( A + 1, A + N + 1 );
	while(A[N - p] >= p + 1) ++p;
	while(A[N - p - t + 1] >= p ) ++t;
	puts( (A[N - p + 1] - p + 1) & 1 && t & 1 ? "Second" : "First" );
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
typedef tree<string,null_type,less<string>,rb_tree_tag,tree_order_statistics_node_update> indexed_set2;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main()
{
	ll l,r,d;
	cin>>l>>r>>d;
	ll curr = d;
	ll ans = 0;
	while(curr <= 100){
		if(curr >=l && curr <= r){
			ans++;
		}
		curr = curr + d;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

const int NMAX = 1000;
const int SIGMA = 26;

int N;

int main()
{
    cin >> N;
    int cnt = 0;
    for( int i = 1; i <= N;  ++i ) {
        int x;
        cin >> x;
        cnt += x % 2;
    }
    if( cnt % 2 == 1 ) cout << "NO\n";
    else cout << "YES\n";
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = list(map(int, input().split()))
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    for i in range((N - M + 1) ** 2):
        y = i // (N - M + 1)
        x = i % (N - M + 1)
        for j in range(M):
            if B[j] != A[y + j][x:x + M]:
                break
        else:
            print('Yes')
            break
    else:
        print('No')


if __name__ == "__main__":
    main()


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n;
  cin >> n;
  vector<string> s(n);
  REP(i, n)
    cin >> s[i];
  
  set<vector<ll>> vSet;
  map<vector<ll>, ll> histMap;
  REP(i, n){
    vector<ll> hist(26, 0);
    REP(j, s[i].size())
      hist[s[i][j]-'a']++;
    
    vSet.insert(hist);
    histMap[hist]++;
  }
  
  ll ans = 0;
  set<vector<ll>>::iterator c = vSet.begin();
  while(c != vSet.end()){
    ans += histMap[*c] * (histMap[*c]-1) / 2;
    c++;
  }
  
  cout << ans << endl;
    
}

Measured memory_bytes: 63488
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;

ll A[100001];

int f(ll x){
	for(int i=30; i>=0; i--){
		if(x%(1<<i) == 0){
			return i;
		}
	}

}

void solve(){
	ll n,m;
	cin>>n>>m;
	for(int i=0; i<n; i++){
		cin>>A[i];
		A[i] /= 2;
	}
	for(int i=0; i<n-1; i++){
		if(f(A[i]) != f(A[i+1])){
			cout<<0;
			return;
		}
	}
	ll lcm = 1;
	for(int i=0; i<n; i++){
		lcm = (A[i]*lcm)/__gcd(A[i],lcm);
		if(lcm > m){
			cout<<0;
			return;
		}
	}
	ll r = m/lcm;
	cout<<(r+1)/2;

}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}




Measured memory_bytes: 1152
mod=10**9+7
def conbination(n,r):
    x=1
    y=1
    mod=10**9+7
    for i in range(r):
        x*=n-r+i+1
        y*=i+1
        x%=mod
        y%=mod
    z=(x*pow(y,mod-2,mod))%mod
    return z

N,a,b=map(int,input().split())

ans=pow(2,N,mod)-1
ans=(ans-conbination(N,a)-conbination(N,b))%mod
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define lli long long int

using namespace std;

int main()
{
    lli n,k;  cin>>n>>k;
    vector<lli> dp;
    dp.resize(100010, INT_MAX);
    vector<lli> stones(n);    
    for(auto &x: stones)
    {
        cin>>x;
    }
    dp[0] = 0;
    dp[1] = abs(stones[1] - stones[0]);

    for(int i = 2; i < n; i++)
    {
        for(int j = 1; j<=k; j++)
        {
            if( i - j >= 0)
            {
                dp[i] = min(  abs(stones[i] - stones[i-j]) + dp[i-j] , dp[i] );
            }
        }
    }
    
    cout<<dp[n-1]<<endl;


    return 0;
}

Measured memory_bytes: 1792
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;


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

#define rep(i,b) for(i=0;i<b;++i)
#define repp(i,a,b) for(i=a;i<b;++i)

int main() {
    ll n, sum = 0, mul,final;
    cin >> n;
    std::vector<ll> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            mul = v[i] * v[j];
            sum += mul;
        }
    }
    cout << sum;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll gcd(ll a, ll b){
	return ((b)?gcd(b,a%b):a);
}

ll rwpw(ll a, ll p){
	ll ret = 1ll;
	while(p){
		if(p%2){
			mul_mod(ret,a);
		}
		mul_mod(a,a);
		p /= 2;
	}
	return ret;
}

ll a[100100],cnt[1001001];

int main(void){
	int n,i;
	ll g = 0ll, j, ans = 0ll, c;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a[i];
		g = gcd(a[i],g);
	}
	for(i=0; i<n; ++i){
		a[i] /= g;
	}
	for(i=0; i<n; ++i){
		g = a[i];
		for(j=2ll; j*j<=g; ++j){
			c = 0ll;
			while(!(g%j)){
				++c;
				g /= j;
			}
			cnt[j] = max(cnt[j],c);
		}
		if(g>1ll){
			cnt[g] = max(cnt[g],1ll);
		}
	}
	g = 1ll;
	for(i=2ll; i<=1000000; ++i){
		mul_mod(g,rwpw((ll)i,cnt[i]));
	}
	for(i=0; i<n; ++i){
		a[i] = rwpw(a[i],MOD-2);
		mul_mod(a[i],g);
		add_mod(ans,a[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <utility>
using namespace std;

typedef unsigned long long ull;

// BASE: 29,53,131,257
// MOD: 636094623231363827,348051774975651917,140814840257324803,71777214294589669

int main() {
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<pair<string, int>> S(N);
  for(int i = 0; i < N; ++i) {
    cin >> S[i].first;
    S[i].second = i;
  }
  sort(S.begin(), S.end());
  vector<int> M(N);
  for(int i = 0; i < N; ++i) {
    M[S[i].second] = i;
  }
  vector<vector<ull>> hash(N);
  for(int i = 0; i < N; ++i) {
    ull h = 0ULL;
    for(int j = 0; j < (int)S[i].first.length(); ++j) {
      h *= 29;
      h += (S[i].first[j] - 'a');
      h %= 636094623231363827;
      hash[i].push_back(h);
    }
  }
  set<int> D;
  int Q; cin >> Q;
  for(int q = 0; q < Q; ++q) {
    int k, id; cin >> k >> id;
    --id;
    if(k == 1) {
      D.insert(M[id]);
    }
    else if(k == 2) {
      D.erase(M[id]);
    }
    else {
      bool ok = false;
      auto succ = D.lower_bound(M[id]);
      if(succ != D.end() && S[M[id]].first.size() <= S[*succ].first.size() && hash[M[id]][S[M[id]].first.size() - 1] == hash[*succ][S[M[id]].first.size() - 1]) ok = true;
      if(ok) {
        cout << S[*succ].second + 1 << endl;
      }
      else {
        cout << -1 << endl;
      }
    }
  }
}


Measured memory_bytes: 25744
N=int(input())
A=list(map(int,input().split()))
M=1000
S=0

for i in range(N-1):
  if A[i+1]>A[i]:
    S+=M//A[i]
    M-=A[i]*(M//A[i])
  else:
    M+=S*A[i]
    S=0
    
print(M+S*A[N-1])

Measured memory_bytes: 9084
from collections import Counter

def larger_nibeki(i):
	return 2 ** len(format(i, "b"))

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
c = Counter(a)

for i in range(n):
	if c[a[i]] == 0:
		continue
	else:
		c[a[i]] -= 1
		if c[larger_nibeki(a[i]) - a[i]] > 0:
			ans += 1
			c[larger_nibeki(a[i]) - a[i]] -= 1

print(ans)

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (int i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define for_each(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = __INT_MAX__;               // 2^31 - 1
const long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
const int MAX_N = 1e5 + 5;
const double PI = acos(-1);

int main() {
    string s;
    cin >> s;
    if (s == "AAA" || s == "BBB")
        CNO;
    else
        CYES;
    return 0;
}


Measured memory_bytes: 256
//Author: ZindagiMeBasAishHiChahiye
//WA/TLE
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define repp(i,a,b)	for(ll int i=b-1;i>=a;i--)
#define tr(container,it) for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define mpi         map<pair<ll int,ll int>,ll int>
#define vii         vector<pair<ll,pair<ll,ll> > >
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  100005
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define M_PI           3.14159265358979323846


ll par[N];
ll ran[N]={0};
 
void init(){
	rep(i,0,N)
	par[i]=i;
}
ll find(ll a){
	if(par[a]!=a) par[a]=find(par[a]);
	return par[a];
}
void merge(ll a,ll b){
	ll pa=find(a);
	ll pb=find(b);
	if(pa==pb) return;
	if(ran[pa]>ran[pb]) par[pb]=pa;
	else par[pa]=pb;
	if(ran[pa]==ran[pb]) ran[pb]++; 
}


void solve(){
	ll n,m,k;
	init();
	cin>>n>>m>>k;
	ll an[n]={0};
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		merge(a-1,b-1);
		an[a-1]--;
		an[b-1]--;
	}
	rep(i,0,k){
		ll a,b;
		cin>>a>>b;
		if(find(a-1)==find(b-1)){
			an[a-1]--;
			an[b-1]--;
		}	
	}
	mii m1;
	rep(i,0,n){
		m1[find(i)]++;
	}
	// cout<<find(0);
	rep(i,0,n) cout<<an[i]+m1[find(i)]-1<<" ";
}	
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll TESTS=1;
	// cin>>TESTS;
	
	while(TESTS--){
		solve();

	}
	return 0;
}


Measured memory_bytes: 8704
#include <bits/stdc++.h> 
#include<cmath>
#define pb push_back
#define nax (int)2e5+2
#define ll long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
using namespace std;
 



int main() 
{ 
	int n;
	cin>>n;
	long double a = n/3.0;
	a = a*a*a;
	cout<<fixed<<setprecision(7)<<a;
	
	
	return 0; 
} 


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	long long int n, k;
	cin >> n >> k;
	if(n == k || k == 1)
			cout << 0 << endl;
	else
	{
		if( n > k )
			n = n%k;
		n = min(n, abs(n-k)); 
		cout << n << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pii>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
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;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
#define irep(i, end_i, begin_i) for (ll i = (ll)(begin_i-1); i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int h,w; cin>>h>>w;
    string s[h];
    rep(i,0,h)cin>>s[i];
    vector<vi> l(h,vi(w,0));
    vector<vi> u(h,vi(w,0));
    vector<vi> d(h,vi(w,0));
    vector<vi> r(h,vi(w,0));
    rep(i,0,h){
        rep(j,0,w){
            if(j==0){
                if(s[i][j]=='.')l[i][j]++;
            }
            else{
                if(s[i][j]=='#')continue;
                else{
                    l[i][j]=l[i][j-1]+1;
                }
            }
        }
    }
    rep(i,0,h){
        irep(j,0,w){
            if(j==w-1){
                if(s[i][j]=='.')r[i][j]++;
            }
            else{
                if(s[i][j]=='#')continue;
                else{
                    r[i][j]=r[i][j+1]+1;
                }
            }
        }
    }
    rep(i,0,w){
        irep(j,0,h){
            if(j==h-1){
                if(s[j][i]=='.')d[j][i]++;
            }
            else{
                if(s[j][i]=='#')continue;
                else{
                    d[j][i]=d[j+1][i]+1;
                }
            }
        }
    }
    rep(i,0,w){
        rep(j,0,h){
            if(j==0){
                if(s[j][i]=='.')u[j][i]++;
            }
            else{
                if(s[j][i]=='#')continue;
                else{
                    u[j][i]=u[j-1][i]+1;
                }
            }
        }
    }
    int res=0;
    rep(i,0,h){
        rep(j,0,w){
            chmax(res,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3);
        }
    }
    cout<<res<<endl;
    return 0;
}




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

using namespace std;

int main(){
  int N;
  long long K;
  cin >> N >> K;
  
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  int ok = 1e9 + 1, ng = 0;
  while(ok - ng > 1){
    int mid = (ok + ng) >> 1;
    
    long long cut = 0;
    for(int i = 0; i < N; i++){
      cut += (A[i] + mid - 1) / mid - 1;
    }
    
    (cut <= K ? ok : ng) = mid;
  }
  
  cout << ok << endl;
  
  return 0;
}

Measured memory_bytes: 4048
n = int(input())
a = list(map(int, input().split()))

m = 0
c = 0

for i in range(n):
    m += a[i]

    if i % 2 == 0:
        if m <= 0:
            c += abs(m) + 1
            m += abs(m) + 1
    else:
        if m >= 0:
            c += m + 1
            m -= m + 1

m = 0
d = 0

for i in range(n):
    m += a[i]

    if i % 2 == 1:
        if m <= 0:
            d += abs(m) + 1
            m += abs(m) + 1
    else:
        if m >= 0:
            d += m + 1
            m -= m + 1

print(min(c, d))


Measured memory_bytes: 14468
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

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

        int n = sc.nextInt();

        Set<Point> redSet = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            redSet.add(new Point2(a,b));
        }

        Set<Point> blueSet = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            blueSet.add(new Point(a,b));
        }

        int ans = 0;
        for (Point blue: blueSet) {
            for (Point red: redSet) {
                if (red.isGood(blue)) {
                    ans++;
                    redSet.remove(red);
                    break;
                }
            }
        }
       System.out.println(ans);

        sc.close();
    }


    static class Point implements Comparable<Point> {
        int x;
        int y;
        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        boolean isGood(Point o) {
            return ((x < o.x) && (y < o.y));
        }

        @Override
        public String toString() {
            return "(" + x + "," + y + ")";
        }

        @Override
        public int compareTo(Point o) {
            return x - o.x;
        }
    }

    static class Point2 extends Point {
        Point2(int x, int y) {
            super(x, y);
        }
        @Override
        public int compareTo(Point o) {
            return o.y - y;
        }
    }

    static void printTime(String str){
        long now = System.currentTimeMillis();
        System.out.println(String.format("[%tH:%tM:%tS:%tL]%s", now, now, now, now, str));
    }
}


Measured memory_bytes: 20692
public class Hello {
    public static void Main(){
        // 1行に複数の入力値がある場合の例
        string [] inputs = System.Console.ReadLine().Split(' ');
        int a = int.Parse(inputs[0]);
        int b = int.Parse(inputs[1]);
        int c = (a * b);
        int d = (a + b) * 2;
        System.Console.WriteLine(c + " " + d);
    }
}



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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a.at(i);

	int res = 10000000;

	rep(i, n){
		int count = 0;

		while(a.at(i)%2 == 0){
			a.at(i) /= 2;
			count++;
		}
		res = min(res, count);
	}

	cout << res << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n== 0){
				break;
			}
			int [] data = new int[n];
			data[0] = sc.nextInt();
			for(int i=1; i < n; i++){
				data[i] = data[i-1] + sc.nextInt();
			}
			int ans = data[0];
			for(int i=0; i < n; i++){
				ans = Math.max(ans, data[i]);
			}
			for(int i=1; i < n; i++){
				for(int j=0; j + i < n; j ++){
					int temp = data[j+i] - data[j];
					ans = Math.max(temp, ans);
				}
			}
			System.out.println(ans);
			
		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();
	}
}

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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

int main()
{
    _upgrade
    LL a, b, c;
    cin >> a >> b >> c;
    cout << ((a ^ b) ^ c) << "\n";
	return 0;
}


Measured memory_bytes: 256
N=int(input())
costC=4
costD=7
Flag=False
for i in range(0,100):
    if Flag:
        break

    for j in range(0,100):
     
        costSum=i*costC+j*costD
        if N==costSum:
            Flag=True

if Flag:
    print("Yes")
else :
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

class UnionFind
{
  public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> Parent;

    //作るときはParentの値を全て-1にする
    //こうすると全てバラバラになる
    UnionFind(int N)
    {
        Parent = vector<int>(N, -1);
    }

    //Aがどのグループに属しているか調べる
    int root(int A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = root(Parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A)
    {
        return -Parent[root(A)]; //親をとってきたい]
    }

    //AとBをくっ付ける
    bool connect(int A, int B)
    {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B)
        {
            //すでにくっついてるからくっ付けない
            return false;
        }

        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらひっくり返しちゃう。
        if (size(A) < size(B))
            swap(A, B);

        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;

        return true;
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    vector<pair<int, int>> xy(m);
    for (int i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        p[i] = tmp - 1; // 順列pも0-indexに直す
    }
    for (int i = 0; i < m; i++)
        cin >> xy[i].first >> xy[i].second;

    UnionFind uf(n);
    // まず交換可能なindexをグループ分けする(同時に0-indexに直す)
    for (int i = 0; i < m; i++)
    {
        uf.connect(xy[i].first - 1, xy[i].second - 1);
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (p[i] == i) // 一緒ならそのまま
            ans++;
        else if (uf.root(p[i]) == uf.root(i)) // p[i]とiが同じグループかどうか調べる
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
N = int(input())

A = list(map(int, input().split()))

for i, a in enumerate(A):
    j = i - 1
    while j >= 0 and A[j] > a:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = a
    print(' '.join(map(str,A)))


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

using namespace std;

int a[11111];
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		scanf("%d", a + i);
	long s = 0, r = 0;
	for (int i = 0; i < n; i++) {
		int b;
		scanf("%d", &b);
		s += b - a[i];
		r += a[i] > b ? a[i] - b : (b - a[i]) % 2;
	}
	cout << (s < r ? "No" : "Yes") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int A,B;cin>>A>>B;
    if(A<=9 && B<=9){
        cout<<A*B<<endl;
    }else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 3588
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    int H, A;
    cin >> H >> A;
    int ans = H / A;
    if (H % A == 0) cout << ans << endl;
    else cout << ans+1 << endl;


	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


int main(){
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    if(K%2==1){cout<<(N/K)*(N/K)*(N/K)<<endl;
    }
    else{
        ll k=K/2;
        ll l=N/k;
        if(l%2==0){cout<<2LL*(l/2)*(l/2)*(l/2)<<endl;}
        else{cout<<(ll)((l/2)*(l/2)*(l/2)+(l/2+1)*(l/2+1)*(l/2+1))<<endl;}
    }

return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<int>> happy(3, vector<int>(n + 1));
    for (int i = 1; i <= n; ++i)
        cin >> happy[0][i] >> happy[1][i] >> happy[2][i];

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

    int max_val = dp[0][n];
    for (int i = 1; i < 3; ++i)
        max_val = max(max_val, dp[i][n]);
    cout << max_val << '\n';
}


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const long long INFLL = 1LL<<60;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;  // 階乗と階乗の逆元
  combination(int n):fact(n+1),ifact(n+1) {  // 階乗と階乗の逆元を n まで求める
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

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

  ll n, k;
  cin >> n >> k;

  combination comb(n-1);
  mint ans = comb(n-1, k-1);

  cout << ans.x << endl;

  return 0;
}



Measured memory_bytes: 3180
N , M = map(int,input().split())
Height = [h_i for h_i in map(int,input().split())]
Roots = []
counter = [0 for i in range(N)]
for j in range(M):
    root = [c_i -1 for c_i in map(int,input().split())]
    #print(root)
    if Height[root[0]]<Height[root[1]]:
        counter[root[0]] += 1
    elif Height[root[0]]==Height[root[1]]:
        counter[root[0]] += 1
        counter[root[1]] += 1
    else:
        counter[root[1]] += 1

counter2 = 0
for i in range(N):
    if counter[i]==0:
        counter2+=1
print(counter2)

Measured memory_bytes: 20140
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
   
        while(true) {
            int referee = Integer.valueOf(sc.nextLine());

            if(referee == 0) {
                return;
            }

            Integer min = null;
            Integer max = null;
            int score = 0;
            for (int i = 0; i < referee; i++) {
                int tempScore = Integer.valueOf(sc.nextLine());
                score += tempScore;
                if(min == null || tempScore < min) {
                    min = tempScore;
                }

                if (max == null || tempScore > max) {
                    max = tempScore;
                }
            }

            System.out.println("" + (score - min - max) / (referee - 2));
        }


    }
}



Measured memory_bytes: 29260
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;

namespace AtCoder.Question
{
    public class QuestionC
    {
        public static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var (n, m) = (int.Parse(input[0]), int.Parse(input[1]));
            var hights = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var lower = new HashSet<int>();
            for (int i = 0; i < m; i++)
            {
                var root = Console.ReadLine().Split(' ');
                var (x, y) = (int.Parse(root[0]), int.Parse(root[1]));
                if (hights[x - 1] < hights[y - 1])
                {
                    lower.Add(x);
                }
                else if (hights[y - 1] < hights[x - 1])
                {
                    lower.Add(y);
                }
                else
                {
                    lower.Add(x);
                    lower.Add(y);
                }
            }
            Console.WriteLine(n - lower.Count);
        }
    }
}


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

bool prime_factorise(int n,set<int>& used)
{
    for(int i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            if(used.count(i))
            {
                return false;
            }
            used.insert(i);
            while(n%i==0)
            {
                n/=i;
            }
        }
    }

    if(n>1)
    {
        if(used.count(n))
        {
            return false;
        }
        used.insert(n);
    }

    return true;

}

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

    int ar[n];
    int g=0;
    set<int> used;
    bool c=true;
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        g=__gcd(ar[i],g);
        c=c&&prime_factorise(ar[i],used);
    }

    if(g>1)
    {
        cout<<"not coprime";
    }
    else
    {
        if(c)
        {
            cout<<"pairwise coprime";
        }
        else
        {
            cout<<"setwise coprime";
        }
    }
}

Measured memory_bytes: 7704
#include<iostream>
#include<cmath>
#include<string>
#include<vector>
#include<numeric>
 
#include <algorithm>
#include <functional>
using namespace std;
 
 
int main(){
 	long a,b;
	cin >> a >> b;
 
	vector<long> vec;
	vec.push_back((a+b));
	vec.push_back((a-b));
	vec.push_back((a*b));
 
 
	long max  = *max_element(vec.begin(),vec.end());
 
	cout << max;
 
	return 0;
}

Measured memory_bytes: 256