akhauriyash/Code-Regression huggingface dataset:
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 105
#define oo 2000000007
#define EPS 1e-9

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, a[2*maxN];

int main () {
    scanf("%d", &n);
    fto(i, 1, 2*n) scanf("%d", &a[i]);

    sort(a+1, a+2*n+1);
    int ans = 0;
    fto(i, 1, n) ans += a[2*i-1];
    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 256
def hantei(n):
    root_n = int(n**0.5 +0.5)
    
    if root_n**2 == n:
        return 0
    
    total = 0
    for i in range(1,root_n):
        if n % i == 0:
            total += 2
            
    return total
    
n = int(input())

total = 0
for i in range(1,n+1,2):
    if hantei(i) == 8:
        total += 1

print(total)
    

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const int INF=1e9;
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; }



int main(int argc, char const *argv[]) {
  int a,b,c,d,e,k;
  std::cin >> a >> b >> c >> d >> e >> k;
  if(e-a<=k && e-b<=k && e-c<=k && e-d<=k ) std::cout << "Yay!" << '\n';
  else std::cout << ":(" << '\n';
  return 0;
}


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

int main() {
    int n,k;
    cin>>n>>k;
    int a[n];
    int dp[k+1][n];
    int dp2[k]={0};
    memset(dp,-1,sizeof(dp));
    for(int i=0 ; i<n ; i++)
    cin>>a[i];
    dp2[0]=2;
    for(int i=0 ; i<k ; i++){
        int target;
        if(dp2[i]==0)
        dp2[i]=2;
        if(dp2[i]==2)target=1;
        else
        target=2;
        for(int j=0 ; j<n ; j++){
            if(i+a[j]<=k){
                dp[i+a[j]][j]=target;
                dp2[i+a[j]] = target==1?1:dp2[i+a[j]];
            }
        }
    }
    int flag=2;
    for(int i=0 ; i<n ; i++){
        if(dp[k][i]==1){
            flag=1;
            break;
        }
    }
    if(flag==1)
    cout<<"First"<<endl;
    else
    cout<<"Second"<<endl;
    return 0;
}

Measured memory_bytes: 43028
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<queue<int> > que(n);
    rep(i, n) {
        rep(j, n-1) {
            int q;
            cin >> q;
            que[i].push(--q);
        }
    }

    int ans = 0;
    bool flag = true;
    while(flag) {
        flag = false;
        vector<bool> check(n, false);
        rep(i, n) if(!check[i] and !que[i].empty()) {
            int now = que[i].front();
            if(!check[now] and !que[now].empty() and que[now].front() == i) {
                que[i].pop();
                que[now].pop();
                check[i] = check[now] = true;
                flag = true;
            }
        }
        if(flag) {
            ans++;
        } else {
            bool x = true;
            rep(i, n) {
                if(!que[i].empty()) x = false;
            }
            if(!x) ans = -1;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 8052
N,K = map(int,input().split())
mod = 10**9+7
def cmb(n, r):#コンビネーションの関数を設定する
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
 
    return result
for i in range(1,K+1):#1～K回まで
  if i<=N-K+1:
    p = cmb(N-K+1,i)#赤の間の場所をi箇所選ぶ通り
    q = cmb(K-1,i-1)#選んだ場所に青のボールをi箇所に分ける通り
    print((p*q)%mod)
  else:
    print('0')

Measured memory_bytes: 3444
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

a,b = I()
if a > b:
    print(a-1)
else:
    print(a)


Measured memory_bytes: 10424
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;


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

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

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1') ans++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
    int N; cin >> N;
    string S, T; cin >> S >> T;
    string U;
    F0R(i, N) {
        U += S[i]; U += T[i];
    }
    cout << U << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main(){
  int N, M; cin >> N >> M;
  
  vector <long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(A.begin(), A.end(), greater<long long>());

  vector <pair<long long, int> > CB(M);
  for (int i = 0; i < M; i++){
    long long C; int B;
    cin >> B >> C;
    CB[i].first = C;
    CB[i].second = B;
  }

  sort(CB.begin(), CB.end(), greater<pair<long long, int> >());

  vector <long long> C(N);
  int cnt = 0;
  for (int i = 0; i < M; i++){
    if (cnt + CB[i].second < N){
      for (int j = cnt; j < cnt + CB[i].second; j++){
        C[j] = CB[i].first;
      }
      cnt += CB[i].second;
    }else{
      for (int j = cnt; j < N; j++){
        C[j] = CB[i].first;
      }
      break;
    }
  }
  
  long long ans = 0;
  int a = 0, c = 0;
  for (int i = 0; i < N; i++){
    if (A[a] >= C[c]){
      ans += A[a];
      a++;
    }else{
      ans += C[c];
      c++;
    }
  }
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>

using namespace std;

vector<long long int> v[100004];

int main(void)

{
    long long int n, m, a, b, c, i, j;
    cin>>n>>m;
    long long int cost[n], counter = 0, flag;
    for(i = 0; i < n; i++){
        cin>>cost[i];
    }
    for(i = 0; i < m; i++){
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    for(i = 0; i < n; i++){
        a = v[i].size();
        flag = 0;
        for(j = 0; j < a; j++){
            b = v[i][j];
            if(cost[i] <= cost[b]){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            counter++;
        }
    }
    cout<<counter<<endl;
    return 0;
}


Measured memory_bytes: 9788
#include<iostream>
using namespace std;
int a,b,c,i;
int main()
{
	cin>>a>>b>>c;
	for(i=1;i<=1000;i++){
		if((i*a+c)%b==0){
			cout<<"YES";
			return 0;
		}
	}
	cout<<"NO";
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N;
  DV(G,int,N,0,0);
  map<pint,int>Cl;
  Vec(seen,bool,N,0);
  Vec(Eg,pint,N-1,pint(0,0));
  rep(i,0,N-1){
    cin >> A >> B;
    G[A-1].pb(B-1);
    G[B-1].pb(A-1);
    Eg[i]=pint(A-1,B-1);
  }
  rep(i,0,N)chmax(num,G[i].size());
  DV(ube,bool,N,num,0);
  queue<int>que;  
  que.push(0);
  seen[0]=true;
  while(!que.empty()){
    auto v=que.front();que.pop();
    for(auto nv:G[v]){
      if(seen[nv])continue;
      seen[nv]=true;
      rep(i,0,num)if(!ube[v][i]){
        Cl[pint(v,nv)]=i+1;
        ube[v][i]=true;
        ube[nv][i]=true;
        break;
      }
      que.push(nv);
    }
  }
  Out(num);
  for(auto v:Eg)Out(Cl[v]);
}




Measured memory_bytes: 320508
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = nextInt();

        int[] p = new int[n];
        p[0] = nextInt();
        p[1] = nextInt();
        int count = 0;
        for(int i=2; i<n; i++){
            p[i] = nextInt();
            if(p[i-2] <= p[i-1] && p[i-1] < p[i] || p[i] <= p[i-1] && p[i-1] < p[i-2]){
                count++;
            }
        }
        println(count);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 21588
#include<stdio.h>
int main()
{  long long s,b,r,c=0,k=0;
   scanf("%lld%lld%lld",&s,&b,&r);
   if(s>=(r+b)) 
   {  k=s/(r+b);
      c=b*k;
	  s=s%(r+b);
   }
   if(s<=b) c=c+s;
   else c=c+b;
   printf("%lld",c);
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
#define endl '\n'
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; }
using namespace std;

//power_mod
inline int Pow_mod(int x, int pow){
    if(pow==0) return 1;
    int a=Pow_mod(x, pow/2);
    a=a*a%mod;
    if(pow%2==1) a*=x;
    return a%mod;
}

//factorial_mod
int* fact_mod;
inline void init_fact_mod(int x){
    fact_mod = new int[x];
    fact_mod[0]=1;
    rep(i,x-1)fact_mod[i+1]=fact_mod[i]*(i+1)%mod;
}

//permutation_mod
inline int nPr_mod(int n, int r){
    return fact_mod[n]*Pow_mod(fact_mod[n-r]%mod, mod-2)%mod;
}

//combination_mod
inline int nCr_mod(int n, int r){
    return fact_mod[n]*Pow_mod(fact_mod[n-r]*fact_mod[r]%mod, mod-2)%mod;
}

//abc127
signed main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m,k; cin>>n>>m>>k;
    vector<vector<int>> grid(n*2,vector<int>(m*2,0));

    rep(i,n*2-1)rep(j,m*2-1){
        grid.at(i+1).at(j+1)=abs(n-1-i)+abs(m-1-j);
    }

    rep(i,n*2-1)rep(j,m*2-1){
        grid.at(i+1).at(j+1)=grid.at(i+1).at(j+1)+grid.at(i).at(j+1)+grid.at(i+1).at(j)-grid.at(i).at(j);
    }

    int ans=0;
    init_fact_mod(200100);
    rep(i,n)rep(j,m){
        int tmp=grid.at(n+i).at(m+j)-grid.at(i).at(m+j)-grid.at(n+i).at(j)+grid.at(i).at(j);
        tmp%=mod;
        //ans=(ans+(nCr_mod(n*m-1,k-1)*n%mod*m%mod)*tmp%mod)%mod;
        int tmp2=nCr_mod(n*m-1,k-1)*(k-1)%mod*Pow_mod(n*m-1,mod-2)%mod;
        ans=(ans+tmp*tmp2%mod)%mod;
    }
    cout<<ans*Pow_mod(2,mod-2)%mod<<endl;

}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
	int n;
  	string s;
  	cin >> n >> s;
  
  	vector<int> a(n);
  	rep(i,n) {
    	if(s[i] == 'R') a[i] = 0;
    	if(s[i] == 'G') a[i] = 1;
    	if(s[i] == 'B') a[i] = 2;
  	}
  
  	vector<ll> cnt(3);
  	rep(i,n) cnt[a[i]]++;
  	
  	ll ans = 1;
  	rep(i,3) ans *= cnt[i];
  
  	rep(j,n)rep(i,j) {
    	int k = j + (j-i);
    	if (k < n) {
      		if (a[i] == a[j]) continue;
      		if (a[i] == a[k]) continue;
      		if (a[k] == a[j]) continue;
      		ans--;
    	}
  	}
  
  	cout << ans << endl;
}

Measured memory_bytes: 3644
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
p1 = []
p2 = []
p3 = []

for i in p:
    if i <= a:
        p1.append(i)
    elif a < i <= b:
        p2.append(i)
    else:
        p3.append(i)

ans = min(len(p1), len(p2), len(p3))
print(ans)

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

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

long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}

int main() {
  long long A, B;
  cin >> A >> B;
  cout << lcm(A, B) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(V) V.begin(), V.end()
#define PB push_back
using namespace std;
typedef long long ll;

int main() {
    char c;
    cin >> c;
    cout << (char)(c+1) <<endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>num(n);
    for(int i=0;i<n;i++){
        cin>>num[i];
    }
    float sum=0;
    for(int i=0;i<num.size();i++){
        sum+=num[i];
    }
    int average=round((sum)/n);
    
    int result=0;
    for(int i=0;i<num.size();i++)
    {
        result+=((num[i]-average)*(num[i]-average));
    }
    cout<<result;
}

Measured memory_bytes: 3684
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	s := nextInt()
	check := map[int]bool{}
	check[s] = true
	prev := s
	for i := 2; i <= 1000000; i++ {
		if _, exist := check[f(prev)]; exist {
			fmt.Println(i)
			break
		}
		check[f(prev)] = true
		prev = f(prev)
	}
}

func f(n int) int {
	if n%2 == 0 {
		return n / 2
	} else {
		return 3*n + 1
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int,int>;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};
 
mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}
 
mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main(){
  int n, a, b; cin >> n >> a >> b;
  mint ans=f(n);
  ans-=1;
  ans-=choose(n,a);
  ans-=choose(n,b);
  cout << ans.x << endl;
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    double t, a;
    cin >> t >> a;
    vector<int> h(n+1);
    for (int i = 1; i <= n; i++) cin >> h[i];

    int ans = 0;
    double d = 1000;
    for (int i = 1; i <= n; i++) {
        double td = abs(a - (t - h[i] * 0.006));
        if (d > td) {
            ans = i;
            d = td;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
s=input()
t=input()
s_list=[s[i] for i in range(len(s))]
t_list=[t[j] for j in range(len(t))]
s_list.sort()
t_list.sort(reverse=True)
ss=""
for k in range(len(s_list)):
    ss+=s_list[k]
tt=""
for l in range(len(t_list)):
    tt+=t_list[l]
if ss<tt:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,a,b;
	cin>>n>>m;
	int h[100000];
	bool w[100000]={0};
	for(int i=0;i<n;i++)
    {
        cin>>h[i];
    }
    for(int i=0;i<m;i++)
    {
        cin>>a>>b;
        a--;b--;
        if(h[a]<h[b])
        {
            if(!w[a])
            {
                n--;
                w[a]=1;
            }
        }
        else if(h[a]>h[b])
        {
            if(!w[b])
            {
                n--;
                w[b]=1;
            }
        }
        else
        {
            if(!w[a])
            {
                n--;
                w[a]=1;
            }
            if(!w[b])
            {
                n--;
                w[b]=1;
            }
        }
    }
    cout<<n<<endl;
	return 0;
}


Measured memory_bytes: 4112
#include <stdio.h>
#include <stdlib.h>

#define rep(i, n) for (int i = 0; i < n; i = i + 1)
#define array(N, t) (t*)calloc(N, sizeof(t))
#define ll long long
#define INF ((1LL << 62) - (1LL << 31))
#define max(p, q)((p) > (q) ? (p) : (q))
#define min(p, q)((p) < (q) ? (p) : (q))

int main() {
  int N;
  scanf("%d", &N);

  int * A = array(N, int);
  rep(i, N) {
    scanf("%d", A + i);
  }

  ll ans = 0;
  for (int i = 1; i < N; i += 1) {
      /* printf("i: %d\n", i); */
      /* printf("A[i - 1]: %d\n", A[i - 1]); */
      /* printf("A[i]: %d\n", A[i]); */
    int diff = A[i - 1] - A[i];
    /* printf("diff: %d\n", diff); */
    if (diff > 0) {
      A[i] += diff;
      ans += diff;;
      /* printf("ans: %lld\n", ans); */
    }
  }

  printf("%lld\n", ans);

  free(A);
  return 0;
}


Measured memory_bytes: 2248
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int main() {

   int N;
   cin >> N;
   int A[N+2];
   A[0] = 0;
   A[N + 1] = 0;
   int S[N+2];
   S[0] = 0;
   for (int i = 1; i <= N; i++) {
      cin >> A[i];
      S[i] = S[i - 1] + abs(A[i] - A[i - 1]);
   }
   S[N + 1] = S[N] + abs(A[N] - A[N+1]); 
   for (int i = 1; i <= N; i++) {
      int ans = 0;
      ans += S[N + 1];
      ans += abs(A[i + 1] - A[i - 1]);
      ans -= abs(A[i] - A[i - 1]);
      ans -= abs(A[i + 1] - A[i]);
      cout << ans << endl;
   }
   
   return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <utility>
using namespace std;
int main()
{
    int a, b, k;
    cin >> a >> b;
    k = max((a*100+7)/8, (b*100+9)/10);
    cout << (k*8/100 != a || k*10/100 != b ? -1 : k) << endl;
}

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

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        bubbleSort(a);
    }

    private static void bubbleSort(int[] a) {
        int n = a.length;
        int swaps = 0;
        for (int i = 0; i < n; i++) {
            for (int j = n-1; j > i; j--) {
                if (a[j] < a[j-1]) {
                    int swap = a[j-1];
                    a[j-1] = a[j];
                    a[j] = swap;
                    swaps++;
                }
            }
        }
        System.out.println(printArray(a));
        System.out.println(swaps);
    }

    private static String printArray(int[] a) {
        int length = a.length;
        String arrayString = "";
        for (int i = 0; i < length - 1; i++) {
            arrayString = arrayString + a[i] + " ";
        }
        arrayString = arrayString + a[length - 1];
        return arrayString;
    }
}


Measured memory_bytes: 26476
l=[0 for i in range(52)]
letter = ['S','H','C','D']
n = int(input())
for i in range(n):
    a,b = input().split()
    for i in range(4):
        if a==letter[i]:
            l[13*i+(int(b)-1)]=1

for i in range(52):
    if l[i]==0:
        s = letter[int(i/13)]
        num = i%13+1
        print(s,num)


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

int main(){
    int n;
    cin>>n;
    map<int,int> mp;
    for(int i=2;i<=n;i++){
        int x=i;
        for(int j=2;j<=x;j++){
            while(x%j==0){
                x/=j;
                mp[j]++;
            }
        }
    }

    ll ans=1;
    for(auto x : mp){
        ans=((ans%MOD)*(x.second+1)%MOD)%MOD;
    }

    cout<<ans<<endl;
}

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

int x[8]={0,1,1,1,0,-1,-1,-1};
int y[8]={1,1,0,-1,-1,-1,0,1};

bool canmove(int x,int y){
  return (0 <= x && x <= 7 && 0 <= y && y <= 7);
}

int main(){
  char m[8][8];
  for(int i=0;i<8;i++) for(int j=0;j<8;j++) cin>>m[i][j];
  char my='o',opp='x';
  int turn = 0;
  int nochange=0;
  while(true){
    int _max=0;
    int ii=0,jj=0;
    int data=0;
    for(int i=0;i<8;i++){ 
      for(int j=0;j<8;j++){
	if(m[i][j]=='.'){
	  int temp=0;
	  int dd=0;
	  for(int k=0;k<8;k++){
	    int t=0;
	    for(int l=1;l<8;l++){
	      if(canmove(i+l*y[k],j+l*x[k])){
		char target=m[i+l*y[k]][j+l*x[k]];
		if(target==opp) t++;
		else if(target==my){
		  temp+=t;
		  dd += (1<<k);
		  break;
		}
		else break;
	      }else break;
	    }
	  }
	  if(!turn && _max < temp){
	    _max=temp;
	    ii=i;
	    jj=j;
	    data=dd;
	  }else if(turn && _max <= temp){
	    _max=temp;
	    ii=i;
	    jj=j;
	    data=dd;
	  }
	}
      }
    }
    if(_max==0){
      nochange++;
    }else{
      m[ii][jj]=my;
      for(int i=0;i<8;i++){
	for(int j=1;j<8;j++){
	  if(((data>>i)&1) && canmove(ii+j*y[i],jj+j*x[i]) && m[ii+j*y[i]][jj+j*x[i]]==opp){
	    m[ii+j*y[i]][jj+j*x[i]]=my;
	  }else break;
	}
      }
      nochange=0;
    }
    if(nochange >= 2) break;
    swap(my,opp);
    turn = 1-turn;
  }
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++){
      cout<<m[i][j];
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 1136
n=int(input())
a=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:[-x[1],x[0]])
b=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:[x[0],-x[1]])
c=0
i=j=0
while j<n:
    i=0
    while i<len(a):
        if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
            c+=1
            del a[i]
            break
        i+=1
    j+=1
print(c)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    while (in.hasNext()) {
      int A = in.nextInt();
      int B = in.nextInt();
      
      System.out.println(Math.max(A - B, Math.max(A + B, A * B)));
    }
  }
}

Measured memory_bytes: 22612
/*
 * 2301.cc: Sleeping Time
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

typedef long long ll;

const int INF = 1 << 30;
const ll LINF = 1LL << 60;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

struct Range {
  int i;
  double p, r, l;
  Range() {}
  Range(int _i, double _p, double _r, double _l): i(_i), p(_p), r(_r), l(_l) {}
};

typedef queue<Range> qr;

/* global variables */

/* subroutines */

/* main */

int main() {
  int k;
  double r, l, p, e, t;
  cin >> k >> r >> l >> p >> e >> t;

  double tr = t - e, tl = t + e;
  double pp = 0.0;
  
  qr q;
  q.push(Range(0, 1.0, r, l));

  while (! q.empty()) {
    Range u = q.front(); q.pop();

    if (tr <= u.r && u.l <= tl) {
      pp += u.p;
      continue;
    }
    if (u.l < tr || tl < u.r) continue;

    double h = (u.r + u.l) / 2;

    if (u.i >= k) {
      if (tr <= h && h <= tl) pp += u.p;
    }
    else {
      double p0, p1;
      if (t <= h)  p0 = u.p * (1.0 - p), p1 = u.p * p;
      else p0 = u.p * p, p1 = u.p * (1.0 - p);
      q.push(Range(u.i + 1, p0, u.r, h));
      q.push(Range(u.i + 1, p1, h, u.l));
    }
  }

  printf("%.6lf\n", pp);
  return 0;
}

Measured memory_bytes: 1272
use std::cmp::max;
use std::io::Read;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: u64 = itr.next().unwrap().parse().unwrap();
    let a: Vec<u64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let mut dp_tight: Vec<i64> = vec![-1; 45];
    let mut dp_loose: Vec<i64> = vec![-1; 45];

    dp_tight[0] = 0;
    for i in 0..41 {
        let mut cnt: i64 = 0;
        for j in 0..n {
            if a[j] >> (40 - i) & 1 == 1 {
                cnt += 1;
            }
        }
        let x = k >> (40 - i) & 1;
        let power: i64 = 1i64 << (40 - i);
        if dp_loose[i] != -1 {
            dp_loose[i + 1] = max(dp_loose[i + 1], dp_loose[i] + power * cnt);
            dp_loose[i + 1] = max(dp_loose[i + 1], dp_loose[i] + power * (n as i64 - cnt));
        }
        if dp_tight[i] != -1 {
            if x == 0 {
                dp_tight[i + 1] = max(dp_tight[i + 1], dp_tight[i] + power * cnt);
            } else {
                dp_tight[i + 1] =
                    std::cmp::max(dp_tight[i + 1], dp_tight[i] + power * (n as i64 - cnt));
                dp_loose[i + 1] = max(dp_loose[i + 1], dp_tight[i] + power * cnt);
            }
        }
    }
    println!("{}", max(dp_loose[41], dp_tight[41]));
}

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

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

  vector<int> a(N + 1);

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

  int k = 0;
  for (int i = 1; i <= N; i++) {
    if (i == a[a[i]]) k++;
  }
  k /= 2;
  cout << k << endl;
}


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

int main(void){
  int A,B;
  cin >> A >> B;
  int max = A+B;
  if(max < A-B){
    max = A-B;
  }
  if(max < A*B){
    max = A*B;
  }
  cout << max << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 200010
#define lim9 1000000010

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	string s, t;
	cin >> s >> t;
	rep(i, s.length()) {
		if (s[i] != t[i]) {
			out("No");
			return 0;
		}
	}
	out("Yes");
    return 0;
}


Measured memory_bytes: 3628
const solve = (input) => {
  const is = input.split("\n").map(Number)
  const m = is[4] - is[0]
  return is[5] >= m ? "Yay!" : ":("
}

if (process.env.NODE_ENV === "test") {
  // module.exports = (input) => solve(input.trim())
} else {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(solve(input.trim()))
}


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define fs first
#define sc second
#define pb push_back
#define sz size() 
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<string> vs;

const static int INF = 1e8;
const static D EPS = 1e-8;

int main(){
  string s[3];
  rep(i,3) cin >> s[i];

  int player = 0;
  size_t idx[3] = {};
  while(true){
    if(idx[player] == s[player].size()){
      cout << (char)('A'+player) << endl;
      return 0;
    }
    player = s[player][idx[player]++] - 'a';
  }
}


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

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

	string s, t;
	cin >> s >> t;
	int n = s.length(), m = t.length();
	vector<vector<int>> dp(n + 1, vector<int>(m + 1));
	for(int i = 0; i < n; i++)  {
		for(int j = 0; j < m; j++) {
			if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
			else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
		}
	}
	string ans;
	int cur = dp[n][m];
	for(int i = n; i >= 1; i--) {
		for(int j = m; j >= 1; j--) {
			if(dp[i - 1][j - 1] == cur - 1 && s[i - 1] == t[j - 1]) {
				ans += s[i - 1];
				cur--;
				break;
			}
		}
	}
	cout << string(ans.rbegin(), ans.rend()) << endl;
	return 0;	
}

Measured memory_bytes: 35584
MOD = int(1e9 + 7)


def main():
    H, W = map(int, input().split())
    memo = [[0] * W for _ in range(H)]
    memo[0][0] = 1
    for i in range(H):
        row = input()
        for j in range(W):
            if row[j] == '.':
                if i > 0:
                    memo[i][j] += memo[i-1][j]
                if j > 0:
                    memo[i][j] += memo[i][j-1]
                memo[i][j] %= MOD
    print(memo[H-1][W-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 50792
def ints():
  return [int(x) for x in input().split()]
def readi():
  return int(input())

N = readi()
SYOUGEN = [[] for _ in range(N)]

for i in range(N):
  n = readi()
  for _ in range(n):
    x, y = ints()
    x -= 1

    SYOUGEN[i].append((x, y))
  
def num1(f):
  s = 0
  while f>0:
    s += f%2
    f //= 2
  return s

def success(f):
  shoujikimono = []
  for _ in range(N):
    shoujikimono.append(f%2)
    f //= 2

  for i in range(N):
    if shoujikimono[i]:
      for x, y in SYOUGEN[i]:
        if shoujikimono[x]!=y:
          return False
  return True

maxn = 0
for f in range(2**N):
  n = num1(f)
  if success(f):
    maxn = max(maxn, n)


print(maxn)


Measured memory_bytes: 3064
in_l = [a for a in input().split()]
stack = []

while len(in_l) > 0:
    i_e = in_l.pop(0)

    if not i_e in "+-*/":
        stack.append(int(i_e))

    else:
        tmp1 = stack.pop(len(stack)-1)
        tmp2 = stack.pop(len(stack)-1)
        if i_e == '+':
            stack.append(tmp2+tmp1)
        elif i_e == '-':
            stack.append(tmp2-tmp1)
        elif i_e == '*':
            stack.append(tmp2*tmp1)
        elif i_e == '/':
            stack.append(tmp2/tmp1)

print(stack.pop(0))

Measured memory_bytes: 7708
n=int(input())
l=list(map(int,input().split()))
ans=0
if n>=3:
  for i in range(0,n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and max(l[i],l[j],l[k])<l[i]+l[j]+l[k]-max(l[i],l[j],l[k]):
          ans=ans+1
print(ans)

Measured memory_bytes: 9156
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n;
const int mod = 998244353;
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}
const int maxN = (int)1e5 + 100;
int cnt[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (i == 1 && x != 0) {
            cout << 0;
            return 0;
        }
        if (i != 1 && x == 0) {
            cout << 0;
            return 0;
        }
        cnt[x]++;
    }
    int ways = 1;
    for (int i = 1; i <= n - 1; i++) {
        if (cnt[i] == 0) continue;
        for (int j = 1; j <= cnt[i]; j++) {
            ways = mult(ways, cnt[i - 1]);
        }
    }
    cout << ways;
    return 0;
}

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

int m;
int a[100000], b[100000], par[100001], s[100001];
long long n;
long long u[100001];

int find(int u) {
	if (u == par[u])
		return u;
	else
		return par[u] = find(par[u]);
}

void unite(int x, int y) {
	if (x == y)
		return;
	if (x > y) {
		par[x] = y;
		s[y] += s[x];
	}
	else {
		par[y] = x;
		s[x] += s[y];
	}
}

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

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

	for (int i = 0; i <= n; i++) {
		par[i] = i;
		s[i] = 1;
	}

	u[0] = n * (n - 1) / 2;

	for (int i = 0; i < m - 1; i++) {
		int v = find(a[m - 1 - i]);
		int	w = find(b[m - 1 - i]);

		u[i + 1] = u[i];

		if (v != w){
			u[i + 1] -= (long long)s[v] * (long long)s[w];
			unite(v, w);
		}
	}

	for (int i = 0; i < m; i++)
		cout << u[m - 1 - i] << endl;

	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

static const int N = 100;

int main() {

	int M[N][N] = { 0 };
	int n, u, k, v;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j)cout << " ";
			cout << M[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<string>
#include<stdio.h>
#include<cmath>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int x,y; cin>>x>>y;
    cout<<(x+y/2)<<endl;
}

Measured memory_bytes: 888
n=int(input())
X=list(map(int, input().split()))
goukei=sum(X)
heikin=int(goukei/n)
heikin2=heikin+1
ans1=0
ans2=0
for x in X:
    ans1+=(x-heikin)**2
    ans2+=(x-heikin2)**2
print(min(ans1,ans2))

Measured memory_bytes: 3060
S = list(input())
K = int(input())
N = len(S)

# print(S)

# dp[i][j][k]
dp = [[[0] * 2 for _ in range(K+2)] for _ in range(N+1)]

dp[0][0][0] = 1

# 上の桁から調べていく
for i in range(1, N + 1):
    for j in range(K + 1):
        for k in range(2):
            for num in range(10):
                if num == 0:
                    inc = 0
                else:
                    inc = 1
                # N未満が確定していれば0-9の全ての遷移が可能なので加える
                if k == 1:
                    dp[i][j+inc][k] += dp[i - 1][j][k]
                else:
                    if num < int(S[i-1]):
                        # k = 1が確定
                        dp[i][j + inc][1] += dp[i - 1][j][k]
                    elif num == int(S[i-1]):
                        # k = 0のまま
                        dp[i][j + inc][0] += dp[i - 1][j][k]

# print(dp)

print(dp[N][K][0] + dp[N][K][1])

Measured memory_bytes: 40816
using System;

namespace AtCoder.ABC099
{
    class b
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var spl = line.Split(' ');
            var A = int.Parse(spl[0]);
            var B = int.Parse(spl[1]);
            var div = B - A;
            var sum = 0;
            for(var i = 1; i < div; ++i)
            {
                sum += i;
            }
            Console.WriteLine(sum - A);
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String s = sc.next();
        if(a < 3200){
        	System.out.println("red");
        }else{
        	System.out.println(s);
        }
    }
}

Measured memory_bytes: 35708
W,H,x,y = list(map(float,input().split()))
#横にラインを引く

if float(x) == W/2.0 and float(y) == H/2.0:
    print('{:9e}'.format(W*H/2.0),'1')
else:
    print('{:9e}'.format(W*H/2.0),'0')

Measured memory_bytes: 3060
import math
import copy

neko = 0
nuko = 0
s = input()
a = ["0","1"]
for i in range(len(s)):
    if s[i] == a[i%2]:
        neko += 1
    if s[i] == a[(i+1)%2]:
        nuko += 1
if neko > nuko:
    neko = nuko
print(neko)

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  ll n,a,b;
  cin>>n>>a>>b;
  if(abs(a-b)%2==0){
    cout<<(abs(a-b)/2)<<endl;
  }else{
    if(n-a>b-1){
      ll t=a-1;
      b-=t;
      cout<<(t+(b/2))<<endl;
    }else{
      ll t=n-b;
      a+=t;
      cout<<(t+(abs(n-a)-1)/2+1)<<endl;
    }
  }

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
 
int n;
vector<int> g[202020];
bool fav[202020];
int far[202020];
int second_farthest[202020];
int closest[202020];
bool in_fav[202020];
long long ans = 0;
 
static const int INF = 0x3f3f3f3f;
 
void dfs1(int v, int prev) {
        if (fav[v]) in_fav[v] = true;
        for (auto u : g[v]) if (u != prev) {
                dfs1(u, v);
                in_fav[v] |= in_fav[u];
                far[v] = max(far[v], far[u] + 1);
        }
}
 
void dfs2(int v, int ma, bool par_fav, int prev) {
        vector<pair<pii, bool>> children;
        children.push_back(mp(mp(0, -1), false));
        for (auto u : g[v]) {
                if (u == prev) children.push_back(mp(mp(ma + 1, u), par_fav));
                else children.push_back(mp(mp(far[u] + 1, u), in_fav[u]));
        }
        vector<int> fav_children;
        for (auto c : children) if (c.second) fav_children.push_back(c.first.first);
        closest[v] = INF;
        for (int i = 0; i < fav_children.size(); i ++) closest[v] = min(closest[v], fav_children[i]);
        int one = -1, two = -1, onei, onenode;
        for (int i = 0; i < children.size(); i ++) if (one < children[i].first.first) {
                one = children[i].first.first;
                onei = i;
                onenode = children[i].first.second;
        }
        for (int i = 0; i < children.size(); i ++) if (i != onei) if (two < children[i].first.first) {
                two = children[i].first.first;
        }
        second_farthest[v] = two;
        for (auto u : g[v]) if (u != prev) { 
                int maa = (u == onenode ? two : one);
                bool par_f = fav[v] || par_fav;
                if (!in_fav[u]) par_f |= !fav_children.empty();
                else par_f |= fav_children.size() > 1;
                ans += (maa < far[u] && par_f) || (maa > far[u] && in_fav[u]) || (maa == far[u] && (par_f || in_fav[u]));
                dfs2(u, maa, par_f, v);
        }
}
 
int main() {
        cin >> n;
        for (int i = 0; i < n - 1; i ++) {
                int a, b;
                cin >> a >> b;
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
        }
        string s;
        cin >> s;                                            
        for (int i = 0; i < n; i ++) fav[i] = s[i] == '1' ? true : false;
        dfs1(0, -1);
        dfs2(0, 0, fav[0], -1); for (int i = 0; i < n; i ++) {
                if (fav[i]) ans += 1 + second_farthest[i];
                else ans += max(0, 1 + (second_farthest[i] - closest[i]));
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 54660