akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
double a,b,p,q,r;
signed main(){
    cin>>a>>b>>p>>q>>r;
    double bsq=(b-a)*q;
    double be=b*p;
    printf("%.12lf\n",b+(be-bsq)/(q+r));
    return 0;
}



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

typedef long long ll;

int main ()
{
	ll a, b, c;
  	cin >> a >> b >> c;
	
  	if(4 * a * b  < (c - a - b) * (c-a-b) && c - a - b > 0 )
    {
    	cout << "Yes" << endl;
    }
  	else
    {
    	cout << "No" << endl;
    }
}


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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int gcd3(int a, int b,int c){
    int ab =gcd(a,b);
    return gcd(ab,c);
}


int main(){
    int k;
    cin>>k;
    ll sum=0;
    rep2(1,i,k+1){
        rep2(1,j,k+1){
            rep2(1,w,k+1){
                sum+=gcd3(i,j,w);
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3632
x = int(input())
a,b = 0,0
#check = 0
for i in range(500):
    #if check==1:
        #break
    for j in range(500):
        if i**5 - j**5 == x:
            a,b = i,j
            #check = 1
            break
        elif i**5 + j**5 == x:
            a,b = i,-j
            #check = 1
            break
        
print(a,b)

Measured memory_bytes: 9180
import sys
from bisect import *

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    md = 10 ** 9 + 7

    def get_group(k):
        g = pd[k]
        if g < 0:
            return k
        gg = get_group(g)
        pd[k] = gg
        return gg

    def merge(j, k):
        g1 = get_group(j)
        g2 = get_group(k)
        if g1 != g2:
            d1 = -pd[g1]
            d2 = -pd[g2]
            if d2 > d1:
                g1, g2 = g2, g1
            pd[g2] = g1
            if d1 == d2:
                pd[g1] -= 1

    n, m = map(int, input().split())
    x = int(input())
    ee = []
    for _ in range(m):
        u, v, w = map(int, input().split())
        ee.append((w, u - 1, v - 1))
    ee.sort()
    # print(ee)

    # union find 準備
    n_nodes = n - 1
    pd = [-1] * (n_nodes + 1)
    # 無条件の最小全域木を作る
    dd = [-1] * m
    s = 0
    for i in range(m):
        w, u, v = ee[i]
        if get_group(u) == get_group(v): continue
        s += w
        merge(u, v)
        dd[i] = 0
    # 最小サイズがxを超えていたら終わり
    if s > x:
        print(0)
        exit()
    # 使った辺に最小サイズを記録
    for i in range(m):
        if dd[i] == 0: dd[i] = s
    # 使っていない辺を1つずつ試して、サイズを記録
    for si in range(m):
        if dd[si] != -1: continue
        pd = [-1] * (n_nodes + 1)
        w, u, v = ee[si]
        dd[si] = 0
        merge(u, v)
        s = w
        for i in range(m):
            w, u, v = ee[i]
            if get_group(u) == get_group(v): continue
            s += w
            merge(u, v)
            if dd[i] == -1:
                dd[i] = 0
        for i in range(m):
            if dd[i] == 0: dd[i] = s
    dd.sort()

    # print(dd)
    # print(xi, x1i)
    def cnt(k):
        idx = bisect_right(dd, k)
        res = pow(2, m - idx + 1, md) - 2
        if idx == 0:
            res = pow(2, m, md) - 2
        return res

    print((cnt(x - 1) - cnt(x)) % md)

main()


Measured memory_bytes: 101228
x = int(input())

lower_limit, upper_limit = -10**3, 10**3

for a in range(lower_limit, upper_limit):
    for b in range(lower_limit, upper_limit):
        d = a ** 5 - x
        if d == b ** 5:
            print("{} {}".format(a, b))
            exit(0)


Measured memory_bytes: 65776
d,g=map(int,input().split())

p=[]
c=[]

for i in range(d):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)
    
sum=[]
for i in range(d):
    sum.append((i+1)*100*p[i]+c[i])


def ans(g,t):
    if t<=0:
        return 100000000000
    n=min(int(g/(100*t)),p[t-1])
    s=100*t*n
    
    if n==p[t-1]:
        s=sum[t-1]
    if g>s:
        n+=ans(g-s,t-1)
    
    return min(n,ans(g,t-1))

print(ans(g,d))
    


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> t, x, y;
	t.push_back(0);
	x.push_back(0);
	y.push_back(0);

	for (int i = 0; i < N; i++) {
		int f, g, h;
		cin >>f>>g>>h;
		t.push_back(f);
		x.push_back(g);
		y.push_back(h);

	}

	for (int i = 0; i < N; i++) {
		int a = t[i + 1] - t[i];
		int b = abs(x[i + 1] - x[i]);
		int c = abs(y[i + 1] - y[i]);
		int d = a-b-c;
		if (d < 0) {
			cout << "No" << endl;
			return 0;
		}
		else if(d%2!=0){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1644
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  ll n,m;
  cin >>n>>m;
  ll x[m];
  for(ll i=0;i<m;i++) cin >>x[i];
  if(m<=n){
    cout <<0<<endl;
    return 0;
  }
  else{
    sort(x,x+m);
    ll c[m-1];
    for(ll i=0;i<m-1;i++){
      c[i]=x[i+1]-x[i];
    }
    sort(c,c+m-1);
    ll ans=0;
    for(ll i=0;i<m-n;i++) ans+=c[i];
    cout <<ans<<endl;
  }
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>
#include <limits>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


const int MAX_V = 110;
const int INF = 9999999;


typedef int w_t;
struct e_t { int from, to; w_t cost; };
bool operator>(const e_t & a, const e_t & b) { return a.cost > b.cost; };

pair<w_t, vector<e_t> > prim(int N, vector<e_t> adj[MAX_V]) {
	vector<e_t> es;
	priority_queue<e_t, vector<e_t>, greater<e_t> > que;
	que.push((e_t){-1, 0, 0});
	bool visited[MAX_V];
	memset(visited, 0, sizeof(visited));
	vector<e_t> tree;
	w_t wgh = 0;
	while (!que.empty()) {
		e_t e = que.top();
		que.pop();
		if (visited[e.to]) continue;
		visited[e.to] = true;
		if (e.from >= 0) {
			tree.pb(e);
			wgh += e.cost;
		}
		tr(i, adj[e.to]) que.push(*i);
	}
	
	return mp(wgh, tree);
}


int main() {
	for (int n, m; cin >> n, n != 0; ) {
		cin >> m;
		vector<e_t> adj[MAX_V];
		rep(i, m) {
			char c; int a, b, d; cin >> a >> c >> b >> c >> d;
			adj[a].pb((e_t){a, b, d});
			adj[b].pb((e_t){b, a, d});
		}
		vector<e_t> es = prim(n, adj).snd;
		int ans = 0;
		rep(i, es.size()) ans += es[i].cost / 100 - 1;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.*;
import java.util.*;

public class Main{

	
	static int MOD=(int)1e9+7;
	static int [][]memo;
	static ArrayList<Integer> []adj;
	static int dp(int u,int p,int col) {
		if(memo[col][u]!=-1)
			return memo[col][u];
		long ans=1;
//		boolean leaf=true;
		for(int v:adj[u])
			if(v!=p)
			{
				long x=dp(v,u,1-col);
				
//				leaf=false;
				
				
				if(col==0) {
					x=x+dp(v,u,col);
					if(x>=MOD)
						x-=MOD;
					
				}
				ans=ans*x%MOD;
			}
		
		return memo[col][u]=(int)ans;
	}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		memo=new int [2][n];
		Arrays.fill(memo[1],-1);
		Arrays.fill(memo[0],-1);
		adj=new ArrayList[n];
		for(int i=0;i<n;i++) {
			adj[i]=new ArrayList<>();
		}
		for(int i=1;i<n;i++) {
			int u=sc.nextInt()-1,v=sc.nextInt()-1;
			adj[u].add(v);
			adj[v].add(u);
		}
		int ans=dp(0,0,0)+dp(0,0,1);
		if(ans>=MOD)
			ans-=MOD;
		out.println(ans);
		out.close();
	}
	
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 72352
/* #                          */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
bool isPalin(const string& str) {
    int len = str.length();
    int half = (len % 2 == 1) ? (len - 1) / 2 : len / 2;
    for (int i = 0; i < half; i++) {
        int j = len - 1 - i;
        if (str[i] != str[j]) 
            return false;
    }
    return true;
}

void sol() {
    string s; cin >> s;
    if (!isPalin(s)) {
        cout << "No\n"; return;
    }

    int len = s.length();
    int half = (len - 1) / 2;
    string s1 = s.substr(0, half);
    string s2 = s.substr(half + 1, half);

    if (isPalin(s1) && isPalin(s2))
        cout << "Yes\n";
    else
        cout << "No\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);
    int T(1);
    while (T--)
        sol();


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 998244353
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 1000000000000000000
#define vll vector<ll>
using namespace std;
const int N=200005;

ll vis[N][4],dis[N][4];
vll adj[N];
void solve()
{
	ll n,m,u,v,i,s,t;
	queue<pair<ll,ll> >q;
	cin>>n>>m;
	while(m--)
	{
		cin>>u>>v;
		adj[u].pb(v);
	}
	cin>>s>>t;

	q.push(MP(s,0));
	vis[s][0]=1;
	dis[s][0]=0;
	while(!q.empty())
	{
		pair<ll,ll>p=q.front();
		q.pop();
		for(auto it:adj[p.F])
		{
			ll nd=(p.S+1)%3;
			if(!vis[it][nd])
			{
				q.push(MP(it,nd));
				dis[it][nd]=dis[p.F][p.S]+1;
				vis[it][nd]=1;
			}
		}
	}
	if(vis[t][0])
		cout<<dis[t][0]/3;
	else
		cout<<-1;


	
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

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

using namespace std;
struct h
{
    char m[100];
    int n;
    int sum;
}p[1000],tmp;
int main()
{
    int n,i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%s%d",p[i].m,&p[i].n);
        p[i].sum=i;
    }
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            if(strcmp(p[i].m,p[j].m)>0)
            {
                tmp=p[i];
                p[i]=p[j];
                p[j]=tmp;
            }
            if(strcmp(p[i].m,p[j].m)==0)
            {
                if(p[i].n<p[j].n)
                {
                    tmp=p[i];
                    p[i]=p[j];
                    p[j]=tmp;
                }
            }
        }
    }
    for(i=1;i<=n;i++)
    {
        printf("%d\n",p[i].sum);
    }
    return 0;
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;

int main() {
    int h, w, n;
    cin >> h >> w >> n;

    vector<int> a(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    vector<vector<int>> c(h, vector<int>(w));
    int p = 0;
    int r = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (r == 0) {
                p++;
                r = a[p];
            }
            if (i % 2 == 0) {
                c[i][j] = p;
            } else {
                c[i][w - 1 - j] = p;
            }
            r--;
        }
    }
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << c[i][j];
            if (j != w - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 384
var input_str = require('fs').readFileSync('/dev/stdin', 'UTF-8');
// console.log(input_str);
var ary = input_str.split('\n')
ary = ary.filter((item, i) => {
  return i !== 0
});
ary.pop()
// console.log(ary);
var t = {
  "S":[1,2,3,4,5,6,7,8,9,10,11,12,13],
  "H":[1,2,3,4,5,6,7,8,9,10,11,12,13],
  "C":[1,2,3,4,5,6,7,8,9,10,11,12,13],
  "D":[1,2,3,4,5,6,7,8,9,10,11,12,13]
}
// for (var i = 0; i < 13; i++){
//   console.log(t);
// }
// for (var j = 0; j < 4; j++){
//   console.log(t);
// }

for(var i=0;i<ary.length;i++){
  var line = ary[i];

  var values = line.split(" ")

  // console.log(values[0])
  // console.log(t[values[0]]);
  t[values[0]] = t[values[0]].filter((item) => {
    // console.log(values[1])
    return item !== Number.parseInt(values[1]);
  })
  // console.log(result)
}
// var value = ary;
// console.log(t);


for(var key in t){
  for(var c=0;c<t[key].length;c++){
  console.log(key + " " + t[key][c]);
}
}



Measured memory_bytes: 15400
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
	int n, i, cont=0;
	int vet[51];
	scanf("%d", &n);
	for(i=0; i<n; ++i){ 
		scanf("%d", &vet[i]);
	
		if(vet[i] != i+1)
			++cont;
	
	}
	if(cont==2|| cont==0)
		printf("YES");
	else
		printf("NO");
	printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string b;
	cin>>n>>b;
	int k=b.length();
	if(n>=k)
	{
		cout<<b<<endl;
	}
	else
	{
		for(int i=0;i<n;i++)
		{
			cout<<b[i];
		}
		cout<<"..."<<endl;
	}
	
}


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

int main(){
	string st1,st2,st;
	cin>>st1>>st2;
	int len=st1.length();
	st1 = st1+st1;
	for(int i=0;i<len;i++){
		st = st1.substr(i,len);
		if(st == st2){
			cout<<"Yes"<<endl;
			return 0;
		} 
	}
	cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M){
  if(N==M)
    std::cout << YES << std::endl;
  else
    std::cout << NO << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long M;
  scanf("%lld",&M);
  solve(N, M);
  return 0;
}



Measured memory_bytes: 256
import kotlin.system.exitProcess

fun main() {
    val x = readLine()!!.toLong()
    val set = mutableSetOf<String>()

    fun calc(a: Long, b: Long) = a * a * a * a * a - b * b * b * b * b
    fun dfp(a: Long, b: Long) {
        if (a == b) return
        if (x < (a - b)) return

        val key = "$a $b"
        if (set.contains(key)) return
        set.add(key)

        val calc = calc(a, b)
        if (x == calc) {
            println(key)
            exitProcess(0)
        } else if (calc > x) {
            dfp(a, b + 1)
            return
        }

        dfp(a + 1, b)
        if (b <= 0) {
            dfp(a, b - 1)
        }
        dfp(a, b + 1)
    }

    dfp(1L, 0L)
}

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

int main()
{
	int n, number;
	cin >> n;
	set<int> s;
	for(int i = 0; i < n; i++)
	{
		cin >> number;
		if(s.count(number) == 0)
		{
			s.insert(number);
		}
		else 
		{
			s.erase(number);
		}
	}
	cout << s.size() << endl;
	
	
	return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <string>
#include <queue>

using namespace std;

class Process {
public:
	string name;
	int time;
};

int main() {
	int n, quantum, elapsed = 0;
	Process temp;
	queue<Process> que;

	cin >> n >> quantum;
	for (int i = 0; i < n; i++) {
		cin >> temp.name >> temp.time;
		que.push(temp);
	}

	while (!que.empty()) {
		temp = que.front();
		if (temp.time - quantum <= 0) {
			cout << temp.name << " " << temp.time + elapsed << endl;
			elapsed += temp.time;
		}
		else {
			temp.time -= quantum;
			que.push(temp);
			elapsed += quantum;
		}
		que.pop();
	}

	return 0;
}

Measured memory_bytes: 4404
<?php
fscanf(STDIN, "%d %d %d", $N, $M, $C);
$B = explode(" ", trim(fgets(STDIN)));
$ans = 0;
for ($i = 0; $i < $N; $i++) {
    $A = explode(" ", trim(fgets(STDIN)));
    $t = 0;
    foreach ($A as $key => $val) {
        $t += $A[$key] * $B[$key];
    } 
    $t += $C;

    $ans += ($t > 0);
}
echo $ans;


Measured memory_bytes: 4856
N = int(input())
A = list(map(int,input().split()))
costs = []

for i in range(101):
  cost = 0
  for j in range(N):
    cost += (A[j]-i)**2
  costs.append(cost)
  cost = 0
  for j in range(N):
    cost += (A[j]+i)**2
  costs.append(cost)

print(min(costs))

Measured memory_bytes: 9032
#include <iostream>

using namespace std;

int main(){

    int a,b;
    cin >> a >> b;
    
    if(a == b){
        cout << "a == b" << endl;
    }else if (a < b) {
        cout << "a < b" << endl;
    }else{
        cout << "a > b" << endl;
    }
    
}

Measured memory_bytes: 3100
#include<stdio.h>
int main(){
char s[100];
int i,j,a[1010],ans=0,x=1,k,y[1010];
for(i=0;i<1005;i++){
a[i]=0,y[i]=0;
}
while(1){
fgets(s,90,stdin);
if(s[0]=='\n'){
break;
}
for(i=0;s[i]!=',';i++){
}
i--;
for(j=i;j>=0;j--){
k=s[j]-'0';
ans=ans+k*x;
x=x*10;
}
a[ans]++,y[ans]=1;
ans=0,x=1;
}
while(fgets(s,90,stdin)!=NULL){
for(i=0;s[i]!=',';i++){
}
i--;
for(j=i;j>=0;j--){
k=s[j]-'0';
ans=ans+k*x;
x=x*10;
}
if(y[ans]>0){
y[ans]=2;
a[ans]++;
}
ans=0,x=1;
}
for(i=0;i<1002;i++){
if(y[i]==2){
printf("%d %d\n",i,a[i]);
}
}
return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<string,int> list;
  list["SUN"] = 7;
  list["MON"] = 6;
  list["TUE"] = 5;
  list["WED"] = 4;
  list["THU"] = 3;
  list["FRI"] = 2;
  list["SAT"] = 1;
  cout << list.at(s) << endl;
}

Measured memory_bytes: 256
input = gets.chomp
word = input.split(" ")
for num in 0..(word.length - 1) do
	if word[num].include?("peach") then
		print word[num].gsub("peach", "apple")
	elsif word[num].include?("apple") then
		print word[num].gsub("apple", "peach")
	else
		print word[num]
	end
 
	if num != word.length - 1 then
		print " "
	else
		puts ""
	end
end

Measured memory_bytes: 8648
//“Do. Or do not. There is no try.” – Yoda
#include<iostream>
#include<limits.h>
#include<algorithm>
#include<cstring>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
#include<vector>
#include<stdio.h>
#include<string>
#include<utility>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<fstream>
#include<stack>
#include<unordered_map>
using namespace std;
#define PI 3.14159265
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define pid pair<int,double>
#define vi vector<int>
#define vl vector<ll>
#define ss second
#define ff first
#define ll long long
#define ld long double
#define ull unsigned long long
#define SIZE 100100
#define MOD 1000000007
#define BIG 999999937
#define pq priority_queue
#define maxpq priority_queue<int>
#define minpq priority_queue<int,vector<int>,greater<int> >
#define endl '\n'
#define FOI(i, a, n) for(int i = int(a); i <= int(n); i++)
#define FOD(i, a, n) for(int i = int(a); i >= int(n); i--)
#define ALL(t) t.begin(),t.end()
#define DBG(c) cout << #c << " = " << c << endl;
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))


bool compare(pii a,pii b) {
    return a.ss>b.ss;
}


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



    ll n,m;
    cin>>n>>m;
    pq<int> pq;
    for(int i=0;i<n;i++) {
        int a;
        cin>>a;
        pq.push(a);
    }
    vector<pii> arr;
    for(int i=0;i<m;i++) {
        ll b,c;
        cin>>b>>c;
        arr.pb(mp(b,c));
    }
    sort(ALL(arr),compare);
    vector<int> ans;
    ll sum=0;
    for(int i=0;i<m;i++) {
        pii cur = arr[i];
        if(ans.size()>n || pq.size()>2*n) {
            break;
        }
        else {
            while(!pq.empty() && pq.top()>cur.ss) {
                ans.pb(pq.top());
                pq.pop();
            }
            for(int i=0;i<cur.ff;i++) {
                pq.push(cur.ss);
            }
        }
    }
    while(ans.size()<n) {
        ans.pb(pq.top());
        pq.pop();
    }
    for(int i=0;i<n;i++) {
        // cout<<vec[i];
        sum+=ans[i];
    }
    cout<<sum<<endl;



    
}

Measured memory_bytes: 3312
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	string s;
	cin >> s;
	while(s.front() != 'A') s.erase(s.begin());
	while(s.back() != 'Z') s.pop_back();
	cout << s.size() << '\n';
}

Measured memory_bytes: 3792
package main

import (
	"fmt"
	"math"
)

func main() {
	a, b, c, d := SingleInt(), SingleInt(), SingleInt(), SingleInt()

	max, min := Max(a, c), Min(b, d)

	if max > min {
		fmt.Println(0)
		return
	}

	fmt.Println(min - max)
	return
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}
func Min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline

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

#AとBの偶奇が同じか？
if abs(a-b) % 2 == 0:
    #そのまま近づき合う
    ans = abs(a-b) // 2
    print(ans)
else:
    #近づき合うだけでは無理。
    #一旦どちらかが端にいき、
    #偶奇を調節する必要がある。
    
    #どちらかが1orNのいずれかに到達するのに必要なラウンド数 + 偶奇調節(+1)
    adj = min(a-1, n-b) + 1
    #調節後、二人が会うのに必要なラウンド数
    meet = (b-a-1)//2
    #合計する
    print(adj+meet)

Measured memory_bytes: 3060
// AtCoder ABC109: C - String Transformation
// 2019.9.12 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 0
int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

int ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	char *p = s--;
	do *++s = gc();
	while (*s > ' ');
	*s = 0;
	return s - p;
}

char S[200005], T[200005];
int a[26], b[26];

int cmp(const void *u, const void *v) { return *(int *)u - *(int *)v; }

int main()
{
	int i, w;
	
	w = ins(S), ins(T);
	for (i = 0; i < w; i++) a[S[i] - 'a']++;
	for (i = 0; i < w; i++) b[T[i] - 'a']++;
	qsort(a, 26, sizeof(int), cmp);
	qsort(b, 26, sizeof(int), cmp);
	for (i = 0; i < 26; i++) {
		if (a[i] != b[i]) { puts("No"); return 0; }
	}
	puts("Yes");
	return 0;
}



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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;
const ll INF = (1LL << 62);

ll N, M, X;

ll prices[20];
ll books[20][20];
ll progresses[20];

ll flags[20];

void subBin(vector<string>& out, string str, int n) {
  if (n == 0) {
    out.emplace_back(str);
  }

  if (n > 0) {
    subBin(out, str + "0", n - 1);
    subBin(out, str + "1", n - 1);
    // subBin(out, str + "2", n - 1);
  }
}

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  scanf("%lld %lld %lld", &N, &M, &X);

  for (ll i = 1; i <= N; i++) {
    ll c;
    scanf("%lld", &c);

    prices[i] = c;
    // cout << c << endl;

    for (ll j = 1; j <= M; j++) {
      ll a;
      scanf("%lld", &a);

      books[i][j] = a;
    }
  }

  // cout << "books[1][1]:" << books[1][1] << endl;
  // cout << "books[3][3]:" << books[3][3] << endl;

  vector<string> vec;
  subBin(vec, "", N);

  ll ans = INF;

  for (int i = 0; i < vec.size(); i++) {
    // cout << vec[i] << endl;
    string s = vec[i];

    ll spent = 0;
    ll learn[15];
    fill_n(learn, 15, 0);
    // cout << s << endl;
    for (ll i = 0; i < s.size(); i++) {
      ll index = i + 1;
      if (s[i] == '1') {
        spent += prices[index];
        for (ll m = 1; m <= M; m++) {
          learn[m] += books[index][m];
          // cout << "learn[m]:" << learn[m] << endl;
        }
      }
    }

    // cout << "learn:";
    // for (ll i = 1; i <= M; i++) {
    //   cout << " " << learn[i];
    // }
    // cout << "" << endl;

    bool ok = true;
    for (ll m = 1; m <= M; m++) {
      if (learn[m] < X) {
        ok = false;
        break;
      }
    }
    // cout << "spent:" << spent << endl;

    if (ok) {
      ans = min(ans, spent);
    }
  }

  if (ans == INF) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}

/*
3 3 10
60 2 2 4
70 8 7 9
50 2 3 9
*/


Measured memory_bytes: 3804
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
A = LIST()

ans = 1
for i in range(N):
    if A[i] == 0:
        print(0)
        exit()

for i in range(N):
    ans *= A[i]
    if ans > 10**18:
        ans = -1
        break
print(ans)

Measured memory_bytes: 84760
L=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i','j']
L_ind = [i for i in range(10)]
N=int(input())
K=[]
for i in range(N):
    if i==0:
        K.append(str(L_ind[0]))
    else:
        K_ = []
        for j in K:
            for m in range(int(max(set(j)))+2):
                K_.append(j + str(L_ind[m]))
        K = K_
    
for k in K:
    ans = ''
    for i in k:
        ans += L[int(i)]
    print(ans)


Measured memory_bytes: 12988
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using hset = unordered_set<T>;
template<class Key, class T> using hmap = unordered_map<Key, T>;

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

int days(int y, int m) {
    return (y % 3 == 0 || m % 2 == 1) ? 20 : 19;
}

int main() {
    int n, y, m, d, ans; cin >> n;
    for (int i=0; i<n; i++) {
        cin >> y >> m >> d;

        ans = days(y, m++) - d + 1;
        if (m > 10) { y++; m = 1; }

        while (y != 1000 || m != 1) {
            ans += days(y, m++);
            if (m > 10) { y++; m = 1; }
        }

        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3092
#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cmath>
#include<cstring>
#include <cstdio>
#include <stack>
#include<iomanip>
#include<queue>
#include<functional>
#include<iterator>
#include<new>
#include<cstdlib>
using namespace std;
#define INF 2000000000
#define scll(x) scanf("%lld",&x);
#define sci(x)  scanf("%d",&x);
#define scc(x)  scanf("%c", &c);
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pll;

int main()
{
	long long n;
	long long a, b, c = 0;
	cin >> n;
	cin >> a >> b;
	for (int i = 0; i < n - 2; i++) {
		long long x;
		cin >> x;
		c ^= x;
	}

	long long sum = a + b;
	long long XOR = c;
	long long AND = (sum - XOR) / 2;
	if ((sum - XOR) % 2 != 0 || sum < XOR) {
		cout << -1 << endl;
		return 0;
	}

	long long newA = AND;
	long long newB = AND;
	long long y = 1LL << 60;

	while (y > 0) {
		if ((newA ^ (y & XOR)) <= a && (y & XOR) > 0) {
			newA ^= (y & XOR);
		}
		else if ((y & XOR) > 0) {
			newB ^= (y & XOR);
		}
		y >>= 1;
	}

	if (newA > a || newA == 0 || sum != newA + newB) {
		cout << -1 << endl;
	}
	else {
		cout << a - newA << endl;
		/*cout << newA << ' ' << newB << endl;
		cout << (newA & newB) << endl;
		cout << sum << ' ' << newA + newB << endl;*/
	}




	return 0;
}

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

const ll inf = 1e18;
const int nax = 1e5 + 5;

// ll fact[nax], invfact[nax];

// void pre()
// {
// 	fact[0] = 1;
// 	forn(i, 1, nax)
// 	{
// 		fact[i] = mult(fact[i - 1], i);
// 	}

// 	invfact[nax - 1] = mypow(fact[nax - 1], mod - 2);

// 	ford(i, nax, 1)
// 	{
// 		invfact[i - 1] = mult(invfact[i], i);
// 	}
// }

// ll ncr(ll n, ll r)
// {
// 	if (r > n)
// 		return 0;

// 	ll ans = mult(fact[n], mult(invfact[n - r], invfact[r]));

// 	return ans;
// }

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		ll n;
		cin>>n;

		string s;
		map<string,ll>Cnt;
		forn(i,0,n)
		{
			cin>>s;
			Cnt[s]++;
		}

		ll maxi = 0;
		for(auto x:Cnt)
		{
			maxi = max(maxi,x.second);
		}

		set<string>ans;
		for(auto x:Cnt)
		{
			if(x.second == maxi)
			{
				ans.insert(x.first);
			}
		}

		for(auto x:ans)
		{
			cout<<x<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 33280
n,m = gets.split.map(&:to_i)
l = []
r = []
m.times do
  line = gets.split.map(&:to_i)
  l << line.shift
  r << line
end
r.flatten!
result = []
(l.max..r.min).each do |i|
  result << i
end

puts result.size

Measured memory_bytes: 22544
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def solve(N, H):
  for n in range(N-1):
    i = (N - 1) - n
    if H[i] < (H[i-1] - 1):
      return 'No'
    if H[i] == (H[i-1] - 1):
      H[i-1] -= 1
  return 'Yes'

def main():
  N = readInts()[0]
  H = readInts()
  print(solve(N, H))

if __name__ == "__main__":
  main()


Measured memory_bytes: 14396
#include<stdio.h>
int main(void){
	int n;
	int p[100100]={1};
	int i;
	int ans=0;
	scanf("%d\n",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&p[i]);
	}
	for(i=1;i<=n;i++){
		if(p[i]==i&&p[i-1]!=i-1) ans++;
		if(p[i]==i&&p[i-1]==i-1) p[i]=0;
	}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
  int S1S2S3;
  cin >> S1S2S3;
  cout << S1S2S3 / 100 + ( S1S2S3 - S1S2S3 / 100 * 100 ) / 10
    + ( ( S1S2S3 - S1S2S3 / 100 * 100 )
       - ( S1S2S3 - S1S2S3 / 100 * 100 ) / 10 * 10 ) << endl;
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
 
int main()
{
  int i,x;
  cin>>x;
  for(i=0;i<3;i++)
  {
    if(x%10==7)
    {
      cout<<"Yes";
      return 0;      
    }
    x=x/10;
  }
  cout<<"No";
  return 0;
}

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

using namespace std;


#define PI 3.14159265
#define int long long




main(){


	int n;

	cin >> n;


	vector <int> c(n), v(n);

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


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


	int record = 0;

	for(int i = 0; i < (1 << n); i++){
		bitset <20> is(i);

		int x = 0, y = 0;
		for(int j = 0; j < n; j++){
			if(is[j]){
				x += v[j];
				y += c[j];
			}
		}

		record = max(record, x - y);
	}
	

	cout << record << endl;


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define vll vector<ll>
#define fast ios:: sync_with_stdio(false),cin.tie(0);
#define COUT cout<<fixed<<setprecision(12)
#define SET set<ll,greater<ll>>gquiz
#define ITERATOR set<ll,greater<ll>> :: iterator itr
#define V vector<ll>vector
#define sz size()
//#define A vector<pair<ll,ll>>vect
ll N=100000,M=100000;
#define B vect.push_back(make_pair(N,M));
ll MOD=1000000007;
 
bool isprime(ll n){if(n==1 || (n!=2 && n%2==0))return false; if(n==2)return true; 
		for(ll i=3;i<=sqrt(n);i+=2)if(n%i==0)return false; return true; }
ll gcd(ll a,ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
/*
ll ncr(ll n,ll r)
{
	if(n==1 || r==0)
	return 1;
	if(r>n/2)
	r=n-r;
	ll ans=1;
	for(ll i=1;i<=r;i++)
	{
		ans=((ans * n )/i);
		n--;
	}
	return ans;
}
*/
ll pow1(ll n,ll k,ll mm){
    if(k==0)return 1;
    if(k%2==0)return (pow1((n%mm)*(n%mm),k/2,mm))%mm;
    return ((n%mm)*(pow1((n%mm)*(n%mm),k/2,mm)%mm))%mm;
}
ll pow(ll a,ll b,ll m)
{
	ll ans=1;
	while(b>0)
	{
		if(b&1)
			ans=(ans*a)%m;
		b=b/2;
		a=(a*a)%m;
	}
	return ans;
}
 
ll modinv(ll k)
{
	return pow(k,MOD-2,MOD);
}

ll ncr(ll n,ll c)
{
    ll t=1;
    c=min(c,n-c);
    for(ll i=1;i<=c;i++)
    {
     	t=(t*(n-i+1))%MOD;
        t=(t*modinv(i))%MOD;
	}
    return t;
}
int main()
{
	fast;
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	cout<<"Yes";
	else
	cout<<"No";
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
import copy

def main():
    N,M = map(int,input().split())
    MOD = 10**9+7
    
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        return arr
        
    cl = factorization(M)
    
    def combinations(x,y,N):
        fac = [0]*(N+1)
        fac[0],fac[1] = 1,1
        invfac = copy.deepcopy(fac)
        
        for i in range(2,N+1):
            fac[i] = (fac[i-1]*i)%MOD
            
        invfac[-1] = pow(fac[-1],MOD-2,MOD)
        
        for i in range(N,0,-1):
            invfac[i-1] = (invfac[i]*i)%MOD
            
        return (fac[x+y]*invfac[x]*invfac[y])%MOD
        
    ans = 1
    for pr,num in cl:
        ans *= combinations(N-1,num,N+num)
        ans %= MOD
    
    print(ans)
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 63744
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0 or a[2][0] == a[1][1] == a[0][2] == 0:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')


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

int main() {
	int A, B;
	cin >> A >> B;
	if (A==B)	cout << "Draw\n";
	else if (A>B) {
		if (B==1)	cout << "Bob\n";
		else	cout << "Alice\n";
	}
	else if (B>A) {
		if (A==1)	cout << "Alice\n";
		else	cout << "Bob\n";
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    ll q;
    pq v;
    pqg t;
    ll sum1=0,sum2=0;
    ll sum=0;
    cin>>q;
    rep(_,q){
        ll Q;
        cin>>Q;
        if(Q==1){
            ll a,b;
            cin>>a>>b;
            sum+=b;
            if(v.size()==0){
                v.push(a);
                sum1+=a;
            }
            else if(v.size()>t.size()){
                ll c=v.top();
                if(c<=a){
                    t.push(a);
                    sum2+=a;
                }
                else{
                    v.pop(),sum1-=c;
                    v.push(a),sum1+=a;
                    t.push(c),sum2+=c;                  
                }
            }
            else{
                ll d=t.top();
                if(a<=d){
                    v.push(a),sum1+=a;
                }
                else{
                    t.pop(),sum2-=d;
                    v.push(d),sum1+=d;
                    t.push(a),sum2+=a;
                }
            }
        }
        else{
            ll c=v.top();
            ll ans=-(sum1-c)+c*(v.size()-1)+sum2-c*t.size()+sum;
            cout<<c<<" "<<ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

int main(int argc, char const *argv[])
{
    int n, r;
    cin >> n >> r;
    if (n >= 10)
    {
        cout << r << endl;
    }
    else
    {
        cout << r + 100 * (10 - n) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,a,i,k,max=1;
	scanf("%d",&n);
	
	for(i=1;i<33;i++){
		a=i;
		for(k=1;k<10;k++){
			a=a*i;
			if(a>n)break;
			else if(a>max)max=a;
			}
		}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void)
{
  int b,c,e,f;
  char a[6];
  scanf("%s",a);
    if(a[2]==a[3]&&a[4]==a[5]){
      printf("Yes\n");
    }else{
      printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stack>
#include<cstdlib>
using namespace std;

int main()
{
	stack<int> S;
	int a, b, x;
	string s;
	
	while( cin >> s )
	{
		if(s[0] == '+')
		{
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a + b);  
		}
		else if( s[0] == '-' )
		{
			b = S.top(); S.pop();
			a = S.top(); S.pop();
			S.push(a - b);  
		}
		else if( s[0] == '*' )  
		{
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a * b);  			
		}
		else
		{
			S.push(atoi(s.c_str()));
		}
	}
	cout << S.top() << endl;
	return 0;
}



Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100
#define INF 1000000007
long long dp[105][1005];
int n,arr[MAXN+5];

long long rekur(int now, long long res){
    if(now==n){
        if(res%2==0)return 1;
        else return -INF;
    }

    long long &ret = dp[now][res];
    if(ret!=0)return ret;

    ret += max((long long)0,rekur(now+1,(res*(arr[now]-1))%2));
    ret += max((long long)0,rekur(now+1,(res*(arr[now]+1))%2));
    ret += max((long long)0,rekur(now+1,(res*(arr[now]))%2));
    return ret;
}

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &arr[i]);
    }
    printf("%lld\n", rekur(0,1));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mx = 100005;
long long n, x, mid, l = -1, r, d, ac[mx];
struct Test{
    long long b, l, u;
    long long s(long long t = x){return t < b ? t*l : b*l + (t-b)*u;}
} t[mx];
int main(){
    scanf("%lld%lld", &n, &x);
    for(int i = 0; i < n; i++){
        scanf("%lld%lld%lld", &t[i].b, &t[i].l, &t[i].u);
        d += t[i].b * t[i].l;
    }
    sort(t, t+n, [](Test a, Test b){return a.s() > b.s();});
    for(int i = 0; i < n; i++) ac[i+1] = ac[i] + t[i].s();
    r = x * n;
    while(l + 1 < r){
        mid = (r + l) / 2;
        long long xx = mid / x, yy = mid % x;
        bool ok = false;
        for(int i = 0; i < n; i++){
            if(d <= (i < xx ? ac[xx+1] - t[i].s() : ac[xx]) + t[i].s(yy)){
                ok = true; break;
            }
        }
        (ok ? r : l) = mid;
    }
    printf("%lld\n", r);
}

Measured memory_bytes: 3328
s=list(map(int,input()[::-1]))
t=[[0,0]for i in range(len(s)+1)]
t[0]=[0,9]
for i in range(len(s)):
    t[i+1][0]=min(t[i][0],t[i][1])+s[i]
    t[i+1][1]=min(11-s[i]+t[i][0],9-s[i]+t[i][1])
print(min(t[-1]))

Measured memory_bytes: 176876
import java.util.*;

class Main {
    public static void main (String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        try {
            if (a < b) {
                System.out.println("a < b");
            } else if(a > b) {
                System.out.println("a > b");
            } else {
                System.out.println("a == b");
            }
        }catch(InputMismatchException e) {
            e.printStackTrace();
        }
        
    }
}


Measured memory_bytes: 26176
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N):
    for y in range(x + 1, N+1):
        res.append(min(abs(x-y), 1 + abs(X-x) + abs(Y-y)))
resd = Counter(res)

for i in range(1, N):
    if i in resd.keys():
        print(resd[i])
    else:
        print(0)

Measured memory_bytes: 74456