akhauriyash/Code-Regression huggingface dataset:
#pragma region
#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 reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

template <int mod>
struct ModInt {
  int x;
  ModInt(): x(0) {}
  ModInt(long long a) { x = a % mod; if (x < 0) x += mod; }
  ModInt &operator+=(ModInt that) { x = (x + that.x) % mod; return *this; }
  ModInt &operator-=(ModInt that) { x = (x + mod - that.x) % mod; return *this; }
  ModInt &operator*=(ModInt that) { x = (long long) x * that.x % mod; return *this; }
  ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return ModInt(u);
  }
  #define op(o, p) ModInt operator o(ModInt that) { return ModInt(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  friend ostream& operator<<(ostream &os, ModInt m) { return os << m.x; }
};

using mint = ModInt<1000000007>;

void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  mint sum = exp((mint) 2, n) - 1;
  {
    mint r = 1;
    reps(i, a) {
      r *= (n - i + 1);
      r /= i;
    }
    sum -= r;
  }
  {
    mint r = 1;
    reps(i, b) {
      r *= (n - i + 1);
      r /= i;
    }
    sum -= r;
  }
  cout << sum << endl;
}


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

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

    int ml,mlnz;
    for (int l=1;l<10;l++) {
        if (use[l]==1) {
            mlnz=l;
            break;
        }
    }
    ml = mlnz;
    if (use[0]==1) ml=0;

    vector<int> digi; while (n>0) {digi.push_back(n%10); n/=10;}

    int d;
    vector<int> pay;
    for (int j=0;j<digi.size();j++) {
        d = digi[j];
        bool pab = false;
        for (int k=0;k<10;k++) {
            if (use[k]==1) {
                if (d==k) {
                    pay.push_back(k);
                    pab = true;
                    break;
                }
                else if (d<k) {
                    pay.clear();
                    for (int m=0;m<j;m++) pay.push_back(ml);
                    pay.push_back(k);
                    pab = true;
                    break;
                }
            }
        }
        if (!pab) {
            pay.clear();
            for (int m=0;m<j+1;m++) pay.push_back(ml);
            if (j==digi.size()-1) pay.push_back(mlnz);
            else digi[j+1] +=1;
        }
    }

    reverse(pay.begin(),pay.end());
    for (auto pp:pay) {cout << pp;}
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e6;

int main()
{
    string s;
    cin>>s;
    int year=atoi(s.substr(0,4).c_str());
    int month=atoi(s.substr(5,2).c_str());
    int day=atoi(s.substr(8,2).c_str());
    if(year<2019)
    {
        cout<<"Heisei";
    }
    else if(year==2019)
    {
        if(month<5)
        {
            cout<<"Heisei";
        }
        else
        {
            cout<<"TBD";
        }
    }
    else
    {
        cout<<"TBD";
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	int n = Read();
	double a = Read(), d = Read(), ans = 0;
	while (n)
	{
		ans += a + (n - 0.5) * d;
		a += (a + 2.5 * d) / n;
		d += 2 * d / n;
		n --;
	}
	return printf("%.10lf\n", ans), 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>    
#define pb push_back
typedef long long ll;
const int inf = 2e9;
using namespace std;
ll MOD = 1000000007;
typedef pair<int,int> ii;
typedef struct {int a,b,c;}iii;

int a,b,d,n,q,t,k,m,res,suma,minimo,ans=0,maxi,indi;



int main(){
    int h,w;
    scanf("%d%d",&n,&m);
    scanf("%d%d",&h,&w);
    printf("%d\n", m*n - ((h*m + w*n) - (h*w)));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    int n; cin >> n;
    int a[n];
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    sort(a,a+sizeof(a)/sizeof(a[0]),greater<int>());
    
    bool x = false;
    bool y = false;
    int h = 0,w = 0;
    for(int i = 1;i < n;i++){
        
        if(!(x) && a[i] == a[i-1]){
            h = a[i];
            x = true;
            a[i] = 0;a[i-1] = 0;
            continue;
        }
        
        if(x && a[i] == a[i-1]){
            w = a[i];
            y = true;
            break;
        }
    }
    
    if(x && y){
        cout << (ll)h*w;
    }else{
        cout << 0;
    }
}




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

int main() {
  int A,B,C,D;
  cin >>A>>B>>C>>D;
  while(A>0 && C>0){
     C-=B;
       if (C<=0){ 
         cout << "Yes"<<endl;
         break;
       }
     A-=D;
       if (A<=0){
         cout<<"No"<<endl;
         break;
       }
  }
         
         
}



Measured memory_bytes: 3596
a = gets.chomp.split("")#.map(&:to_i)

t=0
s=0
maxdiff=0

for i in 0..a.size
  if a[i]=="T" 
  t+=1
  else
  s+=1
  end
  maxdiff = t - s if maxdiff < t-s
end
p maxdiff*2

=begin
k1 = a.take_while{|s| s == "T"}
k2 = a.reverse.take_while{|s| s == "S"}

if k1.size > k2.size
  #puts "T"*k1.size + "S"*k1.size
p k1.size*2
else
  #puts "T"*k2.size + "S"*k2.size
p k2.size*2
end
=end


Measured memory_bytes: 16764
package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}


Measured memory_bytes: 1104
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   

using namespace std;


int main() {

	int a, b;
	int  ans = 0;

	cin >> a >> b;
	
	if (a + b > 23) {
		cout << a + b - 24 << endl;
	}
	else {
		cout << a + b << endl;

	}
	
}



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

std::random_device rnd;
std::mt19937 mt(rnd());
std::uniform_int_distribution<> r(1, 26);

int D=365,c[26+1],last[26+1],M;

int main(){
    cin>>D;
    //input
    int s[D+1][26+1];
    for(int i=1;i<=26;i++)cin>>c[i];
    for(int i=1;i<=D;i++)for(int j=1;j<=26;j++)cin>>s[i][j];
    //output:random
    int t[D+1],v[D+1];
    for(int day=1;day<=D;day++){
        //greedy
        int max_type=0,max=-1000000000;
        for(int type=1;type<=26;type++){
            int score=0;

            for(int d=1;d<=day;d++){
                score=s[d][type];
                for(int i=1;i<=26;i++)score-=c[i]*(d-last[i]);
            }
            if(score>max)max=score,max_type=type;
        }
        last[max_type]=day;
        t[day]=max_type;
    }
    for(int i=1;i<=D;i++)cout<<t[i]<<endl;
    return 0;
}

Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
typedef long long ll;
 
struct edge{
  ll to,cost;
  edge(ll to,ll cost):to(to),cost(cost) {}
};
 
ll n;
vector< edge > G[MAX];
ll size[MAX];
ll par[MAX];
ll dep[MAX];
ll depth[MAX];
ll dist[MAX];
ll parent[MAX];
 
void idfs(int pos,int prev=-1){
  int m=-1;
  parent[pos]=prev;

  for(edge e:G[pos]){
    if(e.to==prev)continue;
    
    depth[e.to]=depth[pos]+1;
    dist[e.to]=dist[pos]+e.cost;
    
    idfs(e.to,pos);
    size[pos]+=size[e.to];
    if(m==-1||size[m]<size[e.to])m=e.to;
  }
  
  if(m!=-1)par[m]=pos;
}
 
int calc(int x){
  if(par[x]==x)return x;
  return par[x]=calc(par[x]);
}
 
void init(){
  for(int i=0;i<MAX;i++){
    parent[i]=-1;
    depth[i]=0;
    dist[i]=0;
    size[i]=1;
    par[i]=i;
    dep[i]=0;
  }
 
  for(int i=0;i<n-1;i++){
    ll a,b,c;
    cin>>a>>b>>c;
    a--,b--;
    G[a].push_back( edge(b,c) );
    G[b].push_back( edge(a,c) );
  }
  
  idfs(0,-1);
 
  for(int i=0;i<n;i++){
    int p=calc(i);
    dep[i]=0;
    while(p){
      p=calc(parent[p]);
      dep[i]++;
    }
  }
}

int lca(int a,int b){
  while(par[a]!=par[b]){
    if( dep[a] > dep[b] )swap(a,b);
    b=parent[ par[b] ];
  }
  if(depth[a]<depth[b])return a;
  return b;
}
 
ll Cal(int a,int b){
  int c=lca(a,b);
  return dist[a]+dist[b]-dist[c]*2LL;
}
 
int main(){
  cin>>n;
  init();
  ll q,K;
  cin>>q>>K;
  K--;
  while(q--){
    ll a,b;
    cin>>a>>b;
    a--,b--;
    cout<< Cal(a,K) + Cal(K,b) <<endl;
  }
  return 0;
}


Measured memory_bytes: 21376
#include <bits/stdc++.h>
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 5100000
#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(){
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  map<string,lli> P;
  rep(i,0,N){
    cin >> S;
    P[S]++;
  }
  Vec(Q,string,0,"");
  for(auto v:P)num=max(v.second,num);
  for(auto v:P)if(v.second==num)Q.pb(v.first);
  Sort(Q);
  for(auto v:Q)Out(v);
}

  

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

int main() {
	int n, x, a[110], cnt = 0;
	cin >> n >> x;
	for (int i = 0; i < n; i++) cin >> a[i];

	sort (a, a + n);
	
	for (int i = 0; i < n; i++) {
		if (x >= a[i]) {
		cnt++;
		x -= a[i];
		}
	}

	if (cnt == n && x > 0) cnt--;

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int p, q, r;
    cin >> p >> q >> r;

    int t = max(max(p, q), r);

    cout << p + q + r - t << endl;

    return 0;
}

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

int main( )
{
  int N;
  cin >> N;
  
  if(N % 3 == 0 || N % 3 == 1 || N % 3 == 2){
    cout << N / 3 << endl;
  }else{
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
use proconio::*;

fn calc(mut a: Vec<(u32, i32)>, item: (u32, i32)) -> Vec<(u32, i32)> {
    let mut b = a.iter().map(|a| (a.0 + item.0, a.1 + item.1)).collect::<Vec<_>>();
    let mut c = Vec::with_capacity(a.len() * 2);
    while !(a.is_empty() || b.is_empty()) {
        if a.last().unwrap().1 >= b.last().unwrap().1 {
            c.push(a.pop().unwrap());
        } else {
            c.push(b.pop().unwrap());
        }
    }
    for p in a.into_iter().chain(b.into_iter()).rev() {
        c.push(p);
    }
    c.reverse();
    let mut val = 0;
    for c in c.iter_mut() {
        val = std::cmp::max(val, c.0);
        c.0 = val;
    }
    c
}

#[fastout]
fn run() {
    input! {
        n: usize,
        mut item: [(u32, i32); n],
        q: usize,
        ask: [(usize, i32); q],
    }
    item.insert(0, (0, 0));
    let mut memo = vec![vec![]; n + 1];
    memo[1] = vec![(0, 0), item[1]];
    let batch = 11;
    for i in 2..=std::cmp::min(n, 1 << batch) {
        memo[i] = calc(memo[i / 2].clone(), item[i]);
    }
    for (start, width) in ask {
        let ans = if start < (1 << batch) {
            memo[start].iter().filter(|p| p.1 <= width).max().unwrap().0
        } else {
            let mut dp = vec![(0, 0)];
            let mut pos = start;
            while pos >= (1 << batch) {
                dp = calc(dp, item[pos]);
                pos /= 2;
            }
            let mut ans = 0;
            for &(v, w) in memo[pos].iter() {
                while let Some(p) = dp.last() {
                    if p.1 + w > width {
                        dp.pop();
                    } else {
                        break;
                    }
                }
                if let Some(p) = dp.last() {
                    ans = std::cmp::max(ans, v + p.0);
                }
            }
            ans
        };
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 38168
#include <iostream>
#include <algorithm>

using namespace std;
int main(){
  int n,m,in,out;


  while(cin >> n){
  int f = 1;
  int Max = 0;
    cin >> m;
    while(n--){
      cin >> in >> out;
      m+=in;
      m -=out;
      if(Max < m)Max = m;
      if(m < 0)f = 0;
    }
    if(f)cout << Max << endl; 
    else cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
coupon = {}
values = []
for i in range(M):
  x,y,c = map(int,input().split())
  values.append(a[x-1]+b[y-1]-c)
Amin = min(a)
Bmin = min(b)
values.append(Amin+Bmin)
print(min(values))
      

Measured memory_bytes: 18736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	string n; cin >> n;
	ll ans = 0;
	REP(i, n.size()) ans += n[i] - '0';
	ll ans2 = n.front() - '0' - 1 + (n.size() - 1) * 9;
	cout << max(ans, ans2) << endl;

	return 0;
}


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();

            int maxLength = 0;
            int length = 0;
            var acgt = new[] { 'A', 'C', 'G', 'T' };
            foreach (var c in S)
            {
                if (acgt.Contains(c))
                {
                    length++;
                }
                else
                {
                    maxLength = Math.Max(maxLength, length);
                    length = 0;
                }
            }
            maxLength = Math.Max(maxLength, length);

            Console.Write(maxLength);
        }
    }
}


Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

int main() {
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24;
}

Measured memory_bytes: 256
ans = 'No'
A = []
for _ in range(3):
    A.append([int(n) for n in input().split()])
N = int(input())
B = []
for i in range(N):
    B.append(int(input()))
for n in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == n:
                A[i][j] = 0
for a,b,c in zip(A[0], A[1], A[2]):
    if sum([a,b,c]) == 0:
        ans = 'Yes'
for i in range(3):
    if sum(A[i]) == 0:
        ans = 'Yes'
if sum([A[0][0], A[1][1], A[2][2]]) == 0:
    ans = 'Yes'
if sum([A[0][2], A[1][1], A[2][0]]) == 0:
    ans = 'Yes'
print(ans)


Measured memory_bytes: 3064
/*
* @Author: Arextre
* @Date:   2020-05-02 20:01:32
* @Last Modified by:   Arextre
* @Last Modified time: 2020-05-02 20:16:26
*/
#include<cstdio>

#define rep(i,__l,__r) for(signed i=(__l),i##_end_=(__r);i<=i##_end_;++i)
#define fep(i,__l,__r) for(signed i=(__l),i##_end_=(__r);i>=i##_end_;--i)
#define writc(a,b) fwrit(a),putchar(b)
#define mp(a,b) make_pair(a,b)
#define ft first
#define sd second
#define LL long long
#define ull unsigned long long
#define uint unsigned int
#define pii pair< int,int >
#define Endl putchar('\n')
// #define FILEOI
// #define int long long
// #define int unsigned
// #define int unsigned long long

#ifdef FILEOI
# define MAXBUFFERSIZE 500000
inline char fgetc(){
    static char buf[MAXBUFFERSIZE+5],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXBUFFERSIZE,stdin),p1==p2)?EOF:*p1++;
}
# undef MAXBUFFERSIZE
# define cg (c=fgetc())
#else
# define cg (c=getchar())
#endif
template<class T>inline void qread(T& x){
    char c;bool f=0;
    while(cg<'0'||'9'<c)f|=(c=='-');
    for(x=(c^48);'0'<=cg&&c<='9';x=(x<<1)+(x<<3)+(c^48));
    if(f)x=-x;
}
inline int qread(){
    int x=0;char c;bool f=0;
    while(cg<'0'||'9'<c)f|=(c=='-');
    for(x=(c^48);'0'<=cg&&c<='9';x=(x<<1)+(x<<3)+(c^48));
    return f?-x:x;
}
template<class T,class... Args>inline void qread(T& x,Args&... args){qread(x),qread(args...);}
template<class T>inline T Max(const T x,const T y){return x>y?x:y;}
template<class T>inline T Min(const T x,const T y){return x<y?x:y;}
template<class T>inline T fab(const T x){return x>0?x:-x;}
inline int gcd(const int a,const int b){return b?gcd(b,a%b):a;}
inline void getInv(int inv[],const int lim,const int MOD){
    inv[0]=inv[1]=1;for(int i=2;i<=lim;++i)inv[i]=1ll*inv[MOD%i]*(MOD-MOD/i)%MOD;
}
template<class T>void fwrit(const T x){
    if(x<0)return (void)(putchar('-'),fwrit(-x));
    if(x>9)fwrit(x/10);
    putchar(x%10^48);
}
inline LL mulMod(const LL a,const LL b,const LL mod){//long long multiplie_mod
    return ((a*b-(LL)((long double)a/mod*b+1e-8)*mod)%mod+mod)%mod;
}

int k,a,b;

signed main(){
#ifdef FILEOI
    freopen("file.in","r",stdin);
    freopen("file.out","w",stdout);
#endif
    qread(k,a,b);
    for(int i=1;i*k<=b;++i)if(a<=k*i && k*i<=b)return puts("OK"),0;
    puts("NG");
    return 0;
}

Measured memory_bytes: 3036
from operator import itemgetter
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
l=[list(map(int,input().split())) for i in range(m)]
l=sorted(l,key=itemgetter(1))
l.reverse()

L=[]
ct=0
for i in range(m):
  for j in range(l[i][0]):
    if ct==n:
      break
    L.append(l[i][1])
    ct+=1
  else:
    continue
  break
L2=[0]
for i in range(1,len(L)+1):
  L2.append(L2[i-1]+L[i-1])
a2=[0]
for i in range(1,len(a)+1):
  a2.append(a2[i-1]+a[i-1])

ans=[]
for i in range(min(len(L),n)+1):
  ans.append(a2[n-i]+L2[i])
print(max(ans))

Measured memory_bytes: 46412
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
 
signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);

  int n;
  cin >> n;

  vector<string> w(n);
  REP(i, n) cin >> w[i];

  map<string, bool> m;
  char c = w[0][w[0].length() - 1];
  m[w[0]] = true;
  
  FOR(i, 1, n){
    if(!m[w[i]] && w[i][0] == c) {
      m[w[i]] = true;
      c = w[i][w[i].length() - 1];
    }
    else {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}

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

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

    static class APlusB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            while (in.hasNext()) {
                int a = in.nextInt();
                int b = in.nextInt();

                out.printf("%d\n", a + b);
            }
        }

    }
}




Measured memory_bytes: 27176
/*
Hanit Banga
*/

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

int main()
{
	ll x;
	cin >> x;

	ll ans = x;
	for (ll i = 1; i <= x; ++i)
	{
		if (i * (i + 1) / 2 >= x)
		{
			ans = min(ans, i);
			break;
		}
	}

	cout << ans;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl codeforces
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)
using ll = std::int64_t;
using ull = std::uint64_t;
using pii = std::pair<int, int>;
using tii = std::tuple<int, int, int>;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, std::size_t s, Tail... tail) { auto v = std::move(make_v(init, tail...)); return vec<decltype(v)>(s, v); }
template <typename T, std::size_t Head, std::size_t ...Tail> struct multi_dem_array { using type = std::array<typename multi_dem_array<T, Tail...>::type, Head>; };
template <typename T, std::size_t Head> struct multi_dem_array<T, Head> { using type = std::array<T, Head>; };
template <typename T, std::size_t ...Args> using mdarray = typename multi_dem_array<T, Args...>::type;
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }

int main() {
    ll n, k, c;
    std::string s;
    std::cin >> n >> k >> c >> s;
    vec<ll> lv(n + 1), rv(n + 1);
    for (ll i = 0; i < n; i++) {
        lv[i + 1] = (s[i] == 'o');
        chmax(lv[i + 1], lv[i]);
        if (0 <= i + 1 - (c + 1)) chmax(lv[i + 1], lv[i + 1 - (c + 1)] + (s[i] == 'o'));
    }
    for (ll i = n - 1; 0 <= i; i--) {
        rv[i] = (s[i] == 'o');
        chmax(rv[i], rv[i + 1]);
        if (i + c + 1 <= n) chmax(rv[i], rv[i + c + 1] + (s[i] == 'o'));
    }

    for (ll i = 0; i < n; i++) {
        ll l = lv[i], r = rv[i + 1];
        if (l + r < k) std::cout << i + 1 << '\n';
    }

    return 0;
}


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

typedef long long int ll;
typedef vector<char> vc;

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

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n; cin >> n;
  if(n % 2 == 1) fYn(0);
  vc front(n / 2), back(n / 2); V(front), V(back);
  rep(i, n / 2)
  {
    if(front[i] != back[i]) fYn(0);
  }
  fYn(1);
}

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

int n,c[4];
char s[1010];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		if(s[0]=='A'&&s[1]=='C'&&strlen(s)==2) c[0]++;
		if(s[0]=='W'&&s[1]=='A'&&strlen(s)==2) c[1]++;
		if(s[0]=='T'&&s[1]=='L'&&s[2]=='E'&&strlen(s)==3) c[2]++;
		if(s[0]=='R'&&s[1]=='E'&&strlen(s)==2) c[3]++;
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",c[0],c[1],c[2],c[3]);
	return 0;
}

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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  int n, k;
  cin >> n >> k;

  double res = 0;

  for (int i = 1; i <= n; i++) {
    res += i < k ? pow(1.0 / 2, ceil(log2(k) - log2(i))) / n : 1.0 / n;
  }

  cout << res << endl;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);

  solve();
  return 0;
}


Measured memory_bytes: 256
let p = 1000000007

let pow a b =
  let rec f a b ret =
    if b = 0 then ret
    else if b mod 2 = 0 then f (a * a mod p) (b / 2) ret
    else f (a * a mod p) (b / 2) (ret * a mod p)
  in f a b 1

let mul s e =
  let rec f i ret =
    if i <= e then
      f (i+1) (ret * i mod p)
    else
      ret
  in f s 1

let fact n = mul 1 n

let nCr n r = mul (n-r+1) n * pow (fact r) (p-2) mod p

let ans n a b = (pow 2 n - 1 + p - nCr n a + p - nCr n b) mod p;;

Scanf.scanf "%d %d %d" (fun n a b -> print_int (ans n a b))


Measured memory_bytes: 384
n, k = map(int, input().split())
h = []
for i in range(n):
    t, d = map(int, input().split())
    h.append((t,d))
h.sort(key=lambda x: -x[1])

taste = 0
typen = 0
typecnt = {}
bad = []


for i in range(k):
    typecnt[h[i][0]] = typecnt.get(h[i][0], 0) + 1
    if(typecnt[h[i][0]] == 1):
        typen += 1
    else:
        bad.append(h[i][1])
    taste += h[i][1]

# print(h)
# print(typecnt)
# print(bad)

ans = taste + typen**2

for i in range(k, n):
    if(len(bad) == 0):
        break
    cnt = typecnt.get(h[i][0], 0)
    if(cnt != 0):
        continue
    else:
        typecnt[h[i][0]] = cnt + 1
    typen += 1
    taste -= bad.pop()
    taste += h[i][1]
    ans = max(ans, taste + typen**2)

print(ans)

Measured memory_bytes: 21664
#include<stdio.h>

/*  */
void trace(int A[], int N) {
    int i;
    for ( i = 0; i < N; i++ ) {
        if( i > 0 ) printf(" "); /*  */
        printf("%d", A[i]);
    }
    printf("\n");
}

/*  */
void insertionSort(int A[], int N) {
    int j, i, v;
    for ( i = 1; i < N; i++ ) {
        v = A[i];
        j = i - 1;
        while ( j >= 0&& A[j] > v ) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        trace(A, N);
    }
}

int main() {
    int N, i, j;
    int A[100];

    scanf("%d", &N);
    for( i = 0; i < N; i++ ) scanf("%d", &A[i]);

    trace(A, N);
    insertionSort(A, N);

    return 0;
}


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

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

sum = B[A[0]-1]
x = A[0]

for i in A[1:]:
  sum += B[i-1]
  if i - x == 1:
    sum += C[x-1]
  x = i
  
print(sum) 

Measured memory_bytes: 3064
city = [0 for i in range(4)]
for i in range(3):
    a, b = map(int, input().split(' '))
    city[a-1] += 1
    city[b-1] += 1

count = 0
for i in range(4):
    if city[i] % 2 == 1:
        count += 1
if count <= 2:
    print('YES')
else:
    print('NO')


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

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

int main(int argc, char **argv) {
	ll n, x, y1, y2;
	cin >> n >> x >> y1;
	y1 = abs(y1 - x);
	REP(i, n-1) {
		cin >> y2;
		y2 = abs(y2 - x);
		y1 = gcd(y1, y2);
	}
	cout << y1 << endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# 

i = input().split(' ')
n = int(i[0])
m = int(i[1])
pys = [] # (pi, yi)
for j in range(m):
  i = input().split(' ')
  pys.append((j+1, int(i[0]), int(i[1])))
#print(pys)
pys.sort(key=lambda py: py[2])
pys.sort(key=lambda py: py[1])
#print(pys)
yno = 1
pbef = pys[0][1]
cityids = []
for cityno, p, y in pys:
  if p != pbef:
    pbef = p
    yno = 1
  cityid = "{0:06d}{1:06d}".format(p, yno)
  cityids.append((cityno, cityid))
  yno += 1
cityids.sort(key=lambda cityid:cityid[0]) 
for cityid in cityids:
  print(cityid[1])

Measured memory_bytes: 35484
#include<iostream>
 using namespace std ;
 int main()
{
 int A,B,C;
 cin>>A;
 cin>>B;
 cin>>C;
 if ((A+B)>=C)
 {
 cout << "Yes"<< endl;
 }
 else {
 cout <<"No" << endl;
 }
 
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


int main(void)
{
    ll n,m;
    cin >> n >> m;
    ll ans = 0;
    if(n >= 1){
        ans += n * (n - 1) / 2;

    }
    if(m>=1){
        ans += m * (m - 1) / 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

N = int(input())

a = int(N / 2)
if N % 2 == 1:
    a +=1
print(a)


Measured memory_bytes: 5048
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	VS S;
	VL ans(5, 0); // march
	cin >> N;
	FOR(i, 0, N) {
		string t = IN<string>();
		S.push_back(t);
		if (t[0] == 'M')ans[0]++;
		else if (t[0] == 'A')ans[1]++;
		else if (t[0] == 'R')ans[2]++;
		else if (t[0] == 'C')ans[3]++;
		else if (t[0] == 'H')ans[4]++;
	}
	LL out = 0;
	FOR(i, 0, 5) {
		FOR(j, i+1, 5) {
			FOR(k, j+1, 5) {
				out += ans[i] * ans[j] * ans[k];
			}
		}
	}
	O(out);

	return 0;
}

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

ll return_gcd(ll a, ll b) {
  if (b == 0) return a;
  return return_gcd(b, a % b);
}
ll return_lcm(ll a, ll b){
  ll gcd = return_gcd(a, b);
  return a / gcd * b;
}

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

  ll gcd = return_lcm(c,d);
  ll tot = b - a + 1;
  ll subB = b/c + b/d - b/gcd;
  ll subA = a/c + a/d - a/gcd;
  ll sub = subB - subA;
  if(a % c == 0 || a % d == 0) sub++;

  cout << tot - sub << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,h,w;

int main(void){
    scanf("%d%d%d",&n,&h,&w);
    printf("%d\n",(n-h+1)*(n-w+1));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(void)
{
	using namespace std;

	int n,m,l;

	cin >> n;
	cin >> m;
	cin >> l;

	long long int MatA[n][m], MatB[m][l], MatC[n][l];

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

	for(int i=0; i<m; i++){
		for(int j=0; j<l; j++){
			cin >> MatB[i][j];
		}
	}

	for(int i=0; i<n; i++){
		for(int j=0; j<l; j++){
			MatC[i][j] = 0;
			for(int k=0; k<m; k++){
				MatC[i][j] += MatA[i][k] * MatB[k][j];
			}
			cout << MatC[i][j];
			if(j != l-1) cout << " ";
		}
		cout << endl;
	}

	return 0;
}

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

int main(){
  int a,b=0;
  for(int i=0;i<12;i++){
    cin>>a;
    b^=a;
  }
  if(b==0)cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  return 0;
}

Measured memory_bytes: 3064
input = readlines.map &:chomp
 
limit = input[5].to_i
 
number_list = []
 
[*(0..4)].each do |number|
  number_list.push(input[number].to_i)
end 

max= number_list.max
min = number_list.min
 
if (max - min) > limit 
  puts ':('
else 
  puts 'Yay!'
end 

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

count = 0
cand = []
denom = 0

for i in range(1, min(A, B)+1):
    denom += 1
    if A % denom == 0 and B % denom == 0:
        cand.append(denom)

print(cand[-K])

Measured memory_bytes: 2940
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
 
 
public class Main{
	
	public static class Train implements Comparable<Train> {
		String name;
		int come;
		int go;
		
		public Train(String name, int come, int go) {
			super();
			this.name = name;
			this.come = come;
			this.go = go;
		}
		
		@Override
		public int compareTo(Train o) {
			// TODO Auto-generated method stub
			return this.come - o.come;
		}
		
		public boolean test(final int T){
			if(this.go - this.come >= T){
				return true;
			}else{
				return false;
			}
		}
	}
	
	public static int get_time(Scanner sc){
		String[] input = sc.next().split(":");
		
		int hour = Integer.parseInt(input[0]);
		int minute = Integer.parseInt(input[1]);
		
		return hour * 60 + minute;
	}
	
    public static void main(String[] args) throws IOException {
    	Scanner sc = new Scanner(System.in);
    	
    	final int N = sc.nextInt();
    	final int T = sc.nextInt();
    	
    	ArrayList<Train> list = new ArrayList<Train>();
    	
    	get_time(sc); sc.next();
    	for(int i = 0; i < N; i++){
    		int ar_time = get_time(sc);
    		String ar_name = sc.next();
    		
    		if(i == N - 1){
    			continue;
    		}
    		
    		int st_time = get_time(sc);
    		String st_name = sc.next();
    		
    		list.add(new Train(ar_name, ar_time, st_time));	
    	}
    	
    	for(Iterator<Train> iter = list.iterator(); iter.hasNext(); ){
    		Train train = iter.next();
    		
    		if(!train.test(T)){
    			iter.remove();
    		}
    	}
    	
    	Collections.sort(list);
    	
    	System.out.println(list.size());
    	for(Train train : list){
    		System.out.println(train.name + " " + (train.go - train.come));
    	}
    	
    }
     
}

Measured memory_bytes: 17356
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#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 repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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 (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;

template <class Monoid>
class SegmentTree
{
public:
  using Func = function<Monoid(Monoid, Monoid)>;
  const Func F;
  const Monoid M1;
  int sz;
  vector<Monoid> seg;

  SegmentTree(int n,const Func fu, const Monoid &m1): F(fu) , M1(m1) {init(n);}
  void init(int n)
  {
      sz= 1;
      while (sz < n) sz *= 2;
      seg.assign(sz * 2, M1);
  }
  void update(int k,const Monoid &x)
  {
    k+=sz;
    seg[k]=x;
    while(k>>=1)
    {
      seg[k]=F(seg[k*2],seg[k*2+1]);
    }
  }
  Monoid query(int l,int r)
  {
    Monoid L=M1,R=M1;
    l+=sz;r+=sz;
    for(;l<r;l>>=1,r>>=1)
    {
      if(l&1)L=F(L,seg[l++]);
      if(r&1)R=F(seg[--r],R);
    }
    return F(L,R);
  }
};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  ll ng=0,ok=1e9;
  auto check=[&](ll num){
    auto b=a;
    rep(i,n){
      if(a[i]<=num)b[i]=1;
      else b[i]=-1;
    }
    vector<ll>sb(n+1,0);
    sb[0]=n;
    rep(i,n)sb[i+1]=sb[i]+b[i];
    SegmentTree<ll> st(2*n,[](ll a,ll b){return a+b;},0LL);
    ll su=0;
    repi(i,0,n+1){
      //cout<<"sb "<<sb[i]<<endl;
      su+=st.query(0,sb[i]);
      st.update(sb[i],1+st.query(sb[i],sb[i]+1));
      //cout<<"su "<<su<<endl;

    }
  //  cout<<num<<endl;
  //  cout<<su<<" "<<n*(n+1)/4<<endl;
    return su>n*(n+1)/4;

  };
  while(ok-ng>1){
    ll nn=(ok+ng)/2;
    if(check(nn))ok=nn;
    else ng=nn;
  }
  cout<<ok<<endl;
  return 0;

}


Measured memory_bytes: 6780
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>s>>k;
    char cc=s[k-1];
    rep(i,n){
        if(s[i]!=cc)cout<<"*";
        else cout<<cc;
    }
    cout<<"\n";
    return 0;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
const int maxn=200001;
int head[maxn],col[maxn],kl,dfn[maxn],val[maxn],low[maxn];
int anss,a[maxn],stac[maxn],num,b[maxn],sz[maxn],cnt[maxn];
int indec,sqr,n,m,x,y,top,ans,k;
struct line{int fr,to,next;}q[maxn*2];
void pushline(int f,int t)
{
    q[++kl].next=head[f];head[f]=kl;q[kl].to=t;q[kl].fr=f;
}
int check(){int ans=0;for(int i=1;i<=n;i++)ans+=b[i];return ans;}
void dfs(int x,int fa,int dis)
{
    b[x]=1;if(dis==0)return;
    for(int p=head[x];int v=q[p].to;p=q[p].next)
    {
        if(v==fa)continue;
        dfs(v,x,dis-1);
    }
}
int main()
{
    cin>>n>>k;
    for(int i=1;i<n;i++)cin>>x>>y,pushline(y,x),pushline(x,y);
    if(k%2==0)
    {
        for(int i=1;i<=n;i++)
        {
            memset(b,0,sizeof(b));
            dfs(i,0,k/2);
            ans=max(ans,check());
        }
    }
    else
    {
        for(int i=1;i<=kl;i+=2)
        {
            memset(b,0,sizeof(b));
            dfs(q[i].fr,q[i].to,(k-1)/2);
            dfs(q[i].to,q[i].fr,(k-1)/2);
            ans=max(ans,check());
        }
    }
    cout<<n-ans;
}

Measured memory_bytes: 4456
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int a,b;
    cin >> a >> b;
    cout << ((a*b)%2?"Odd":"Even") << endl;
    return 0;
}

Measured memory_bytes: 256