akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
class DIJ{
	public:
	struct edge{
		int to,cost;
	};
	vector<vector<edge> >G;
	int n;
	vi d;//distance
	DIJ(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int a,int b,int c){
		edge e={b,c},ee={a,c};
		G[a].pb(e);
//		G[b].pb(ee);
	}
	void dij(int s){
		d=vi(n,inf);
		d[s]=0;
		priority_queue<pii>q;
		q.push(pii(0,s));
		while(!q.empty()){
			pii p=q.top();
			q.pop();
			int pos=p.second,cost=-p.first;
			if(cost>d[pos])continue;
			rep(i,G[pos].size()){
				edge e=G[pos][i];
				int to=e.to;
				int nowcost=cost+e.cost;
				if(nowcost<d[to]){
					d[to]=nowcost;
					q.push(pii(-d[to],to));
				}
			}
		}
	}
};
struct UnionFind{
    vector<int> data;
    UnionFind(int size) : data(size, -1) {}
    bool unionSet(int x,int y){
        x=root(x);y=root(y);
        if(x==y)return 0;
        if(data[y]<data[x])swap(x,y);
        data[x]+=data[y],data[y]=x;
        return 1;
    }
    bool findSet(int x,int y){
        return root(x)==root(y);
    }
    int root(int x){
        return data[x]<0 ? x : data[x]=root(data[x]);
    }
    int size(int x){
        return -data[root(x)];
    }
};
class KRK{
	public:
	struct edge{
		int from,to,cost;
	};
	vector<edge>G;
	int n;
	KRK(int size){
		n=size;
	}
	void add_edge(int a,int b,int c){
		edge e={a,b,c};
		G.pb(e);
	}
	void krk(){
		int sum=0;
		sort(all(G),[](edge a,edge b){
			return a.cost<b.cost;
		});
		UnionFind uf(n);
		rep(i,G.size()){
			edge e=G[i];
			if(!uf.findSet(e.from,e.to)){
				sum+=e.cost;
				uf.unionSet(e.from,e.to);
			}
		}
		cout<<sum<<endl;
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	KRK krk(n);
	while(m--){
		int a,b,c;
		cin>>a>>b>>c;
		krk.add_edge(a,b,c);
	}
	krk.krk();
}	

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

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

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

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}

string t = "ACGT";

int main(){
    string s;
    cin >> s;

    int cnt = 0, ans = 0;
    rep(i, s.size()) {
        bool flg = false;
        rep(j, t.size()) {
            if(s[i] == t[j]) flg = true;
        }
        if(flg) cnt++;
        else cnt = 0;
        ans = max(ans, cnt);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::collections::HashMap;

fn main() {
    let n: usize = read();
    let mut map: HashMap<char, usize> = HashMap::new();

    for _ in 0..n {
        let s: String = read();
        let sc: Vec<char> = s.chars().collect();
        match sc[0] {
            'M' | 'A' | 'R' | 'C' | 'H' => {
                let current = map.entry(sc[0]).or_insert(0);
                *current += 1;
            }
            _ => continue,
        }
    }
    let mut ans = 0;

    for i in &map {
        for j in &map {
            for k in &map {
                if i.0 > j.0 && j.0 > k.0 {
                    ans += i.1 * j.1 * k.1;
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <cmath>
#include <numeric>
#include <sstream>
#include <iomanip>
using ll = long long;
using namespace std;

int main()
{
    int N;
    vector<int> a;
    cin >> N;
    int tmp;
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> tmp;
        a.push_back(tmp);
        sum += tmp;
    }
    float ave = sum / (float)N;
    int ans = 0;
    float min = 9999999;
    for (int i = 0; i < N; i++)
    {
        if (min > fabs((float)a[i] - ave))
        {

            min = fabs((float)a[i] - ave);
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//AtCoder Beginner Contest 174
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll N = 1e6 + 5;
const double E = 1e-9;

//------------------------------------------------------------------------------
const int MAX = 1000001;

// structure to store queries
struct Query
{
	int l, r, idx;
};

// cmp function to sort queries according to r
bool cmp(Query x, Query y)
{
	return x.r < y.r;
}

// updating the bit array
void update(int idx, int val, int bit[], int n)
{
	for (; idx <= n; idx += idx & -idx)
		bit[idx] += val;
}

// querying the bit array
int query(int idx, int bit[], int n)
{
	int sum = 0;
	for (; idx > 0; idx -= idx & -idx)
		sum += bit[idx];
	return sum;
}

void answeringQueries(int arr[], int n, Query queries[], int q)
{
	// initialising bit array
	int bit[n + 1];
	memset(bit, 0, sizeof(bit));

	// holds the rightmost index of any number
	// as numbers of a[i] are less than or equal to 10^6
	int last_visit[MAX];
	memset(last_visit, -1, sizeof(last_visit));

	// answer for each query
	int ans[q];
	int query_counter = 0;
	for (int i = 0; i < n; i++)
	{
		// If last visit is not -1 update -1 at the
		// idx equal to last_visit[arr[i]]
		if (last_visit[arr[i]] != -1)
			update (last_visit[arr[i]] + 1, -1, bit, n);

		// Setting last_visit[arr[i]] as i and updating
		// the bit array accordingly
		last_visit[arr[i]] = i;
		update(i + 1, 1, bit, n);

		// If i is equal to r of any query  store answer
		// for that query in ans[]
		while (query_counter < q && queries[query_counter].r == i)
		{
			ans[queries[query_counter].idx] =
			    query(queries[query_counter].r + 1, bit, n) -
			    query(queries[query_counter].l, bit, n);
			query_counter++;
		}
	}

	// print answer for each query
	for (int i = 0; i < q; i++)
		cout << ans[i] << endl;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	/*ifstream cin("input.txt");
	ofstream cout("output.txt");*/
	int n, q;
	cin >> n >> q;
	int a[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	Query queries[q];
	for (int i = 0; i < q; i++)
	{
		int x, y;
		cin >> x >> y;
		queries[i].l = x - 1;
		queries[i].r = y - 1;
		queries[i].idx = i;
	}
	sort(queries, queries + q, cmp);
	answeringQueries(a, n, queries, q);
	return 0;
}
//02-08-2020 20:21:56
//------------------------------------------------------------------------------

Measured memory_bytes: 19332
N = int(input())
A = [0]
A = A + list(map(int,input().split()))
A = A + [0]

D = 0

for i in range(N + 1):
  D += abs(A[i + 1] - A[i])
  
for i in range(1,N + 1):
  ans = D + abs(A[i + 1] - A[i - 1]) - (abs(A[i] - A[i - 1]) + abs(A[i + 1] - A[i]))
  print(ans)

Measured memory_bytes: 13920
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var a = int.Parse(spl[0]);
        var b = int.Parse(spl[1]);

        return (a * b % 2 == 1) ? Yes : No;
    }
}


Measured memory_bytes: 13140
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX 100010
struct uftree
{
    int cnt;
    int rank;
    int parent;
} set[MAX];
int fr[100000+5];
void make_set(int n)
{
    int i;
    for(i=0; i<=n; i++)
    {
        set[i].cnt=1;
        set[i].rank=0;
        set[i].parent=i;
    }
}
int set_find(int x)
{
    if(set[x].parent==x)
        return x;
    else
        return set[x].parent=set_find(set[x].parent);
}
void set_join(int x,int y)
{
    int a=set_find(x);
    int b=set_find(y);
    if(set[a].rank>set[b].rank)
    {
        set[b].parent=a;
        if(a!=b)
        set[a].cnt+=set[b].cnt;
    }
    else
    {
        set[a].parent=b;
        if(a!=b)
        set[b].cnt+=set[a].cnt;
        if(set[a].rank==set[b].rank)
        {
            set[b].rank++;
        }
    }
}
int cmp(const void *a,const void *b)
{
    uftree *p1=(uftree *)a,*p2=(uftree *)b;
    return p2->cnt-p1->cnt;
}
int query(int n)
{

    return set[set_find(n)].cnt;
}
 int t,n,m,i,a,b,ans,k;
int main()
{

    scanf("%d %d %d",&n,&m,&k);
    make_set(n);
    for(i=0; i<m; i++)
    {
        scanf("%d%d",&a,&b);
        fr[a]++;fr[b]++;
        set_join(a,b);
    }
    for(int i=1;i<=n;i++)
        fr[i]=query(i)-fr[i]-1;
    for(int i=0;i<k;i++){
        scanf("%d%d",&a,&b);
        if(set_find(a)==set_find(b))
            fr[a]--,fr[b]--;
    }
    for(int i=1;i<=n;i++){
        if(i!=1)
            printf(" ");
        printf("%d",fr[i]);
    }





    printf("\n");


    return 0;
}


Measured memory_bytes: 2304
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,i,j,cc=0;
    cin>>n;
    while(1){
        j=n;
        i=j%10;
        while(j){
            ll rem=j%10;
            j/=10;
            cc=0;
            if(rem!=i){
                cc=1;
                break;
            }
        }
        if( !cc){
            cout<<n<<endl;
            return 0;
        }
        n++;
    }
return 0;
}


Measured memory_bytes: 4992
import math as m
C = input().split()
A = int(C[0])
B = int(C[1])

count = 0
for i in range(A, B+1):
    i2 = i
    change = 0
    keta = int(m.log(i, 10))
    for j in range(keta, -1, -1):
        change += int(i2/(10**j))*(10**(keta-j))
        i2 -= int(i2/(10**j))*(10**j)
    #print(change)
    if i == change:
        count += 1

print(count)

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

using namespace std;

int main()
{
    int n, x, a[100010];
    long long ans=0;
    cin>>n>>x;
    for (int i=0; i<n; i++) cin>>a[i];
    for (int i=1; i<n; i++)
    {
        if (i==1)
        {
            if (a[i]+a[i-1]>x)
            {
                ans+=a[i]+a[i-1]-x;
                a[i]-=min(a[i], a[i]+a[i-1]-x);
            }
        }
        else
        {
            if (a[i]+a[i-1]>x) { ans+=a[i]+a[i-1]-x; a[i]-=a[i]+a[i-1]-x; }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb emplace_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
#define N 31000000
// #define M 19
 
#define mod  100007
#define mod1 1000000007
#define mod2 1000000009
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 2000000000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef int ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii> tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> S_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
template<typename t> void fff(const char* x, t&& val1) { cout<<x<< " : "<<val1<<"\n";}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}

inline ll mul(ll a, ll b) { return (long long) a*b%mod;}
inline ll add(ll a, ll b) { return a+b < mod? a+b: a+b-mod;}
inline void Mul(ll &a, ll b) { a = (long long) a*b%mod;}
inline ll bpw(ll a, ll p){
	ll ret;
	for(ret = 1; p; p>>=1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
	return ret;
}

static inline void read(ll &result) {
    bool minus = false;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' and ch <= '9') break;
        ch = getchar();
    }
    (ch == '-')? minus = true: result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' or ch > '9') break;
        result = (result<<3)+ (result<<1) + (ch - '0');
    }
    if(minus) result=-result;
}

int main(){
  	ll n; read(n);
  cout<<sqr(n)*n<<"\n";
	return 0;
}

Measured memory_bytes: 3612
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	s := strings.Split(sc.Text(), "")
	//fmt.Println(s)

	sc.Scan()
	t := strings.Split(sc.Text(), "")
	//fmt.Println(t)

	minDist := 1000
	for i := 0; i <= len(s)-len(t); i++ {
		//fmt.Println(i)
		dist := 0
		for j := 0; j < len(t); j++ {
			//fmt.Println(j)
			if s[i+j] != t[j] {
				dist++
			}
		}
		if minDist > dist {
			minDist = dist
		}
	}

	fmt.Println(minDist)
}

Measured memory_bytes: 1808
#include<bits/stdc++.h>
using namespace std;
int main(){
	string n; cin>>n;
	bool flag=false;
	for(int i=0;i<3;i++){
		if(n[i]=='7')
			flag=true;
	}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    if(s.size() == 2){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    
}

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

#define fo(i, n) for(ll i = 0; i < n; i++)
#define endl "\n"
#define of(i, n) for(ll i = n - 1; i >= 0; i--)
#define ll long long
#define vec vector<ll>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)


ll mod= 1e9+7;

#define umap unordered_map

string sp,tp;


/*string st(string s, string t)
{
    ll n = s.length();
    ll m = t.length();
    if(s.length()==0 || t.length()==0) {dp[n][m]=0;return "";}
    if(dp[s.length()][t.length()]!=0) return  st(s,t);
    else if(s[0]==t[0])
    {
        dp[n][m]++;
        s.erase(s.begin());
        t.erase(t.begin());
        return st(s,t);
    }
}*/

ll ncr(ll n, ll r)
{
    long long p = 1, k = 1;
    if (n - r < r)
        r = n - r;

    if (r != 0) {
        while (r) {
            p *= n;
            k *= r;
            long long m = __gcd(p, k);
            p /= m;
            k /= m;

            n--;
            r--;
        }
    }

    else
        p = 1;
    return p;
}
ll dp[1001][1001];
int main() {
    fio;
    ll n,m;
    cin>>n>>m;
    char c[n+1][m+1];
    for (int i=1; i<=n; i++){
		for (int j=1; j<=m; j++) cin >> c[i][j];
	}
    ll sum=0;
    dp[1][1]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(c[i][j]=='.') dp[i][j] += dp[i][j-1] + dp[i-1][j];
            dp[i][j] = dp[i][j] % mod;
        }
    }
    cout<<dp[n][m];
}






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

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

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i,n) cin >> s[i];
  vector<int> num(5);
  rep(i,n){
    if(s[i][0]=='M'){
      num[0]++;
    }
    if(s[i][0]=='A'){
      num[1]++;
    }
    if(s[i][0]=='R'){
      num[2]++;
    }
    if(s[i][0]=='C'){
      num[3]++;
    }
    if(s[i][0]=='H'){
      num[4]++;
    }
  }
  ll ans = 0;
  for(int i=0; i<5; i++){
    for(int j=i+1; j<5; j++){
      for(int k=j+1; k<5; k++){
        ans += (ll)num[i]*num[j]*num[k];
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6144
n,y = map(int,input().split())
#N 枚のお札の合計金額が Y 円となることがありえない場合は、-1 -1 -1 と出力せよ。

for a in range(0,((y//10000)+1)):
  for b in range(0,((y//5000)+1)):
    if (n-a-b>=0)and((10000*a)+(5000*b)+(1000*(n-a-b))==y):
      print(a,b,n-a-b)
      exit()
print("-1 -1 -1")

Measured memory_bytes: 3064
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from decimal import Decimal
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
P = LI()
P.sort()

#print(N,K,P)
print(sum(P[:K]))

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

int n,A[50];

int solve(int i,int m){
  if(m==0) return 1;
  if(i>=n) return 0;
  int res=solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}


int main(){
  int q,m,i;
  cin>>n;
  for(int i=0;i<n;i++) cin>>A[i];
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>m;
    if(solve(0,m)) cout<<"yes"<<endl;
    else cout<<"no"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    int a,b;
    cin>>a>>b;
    if((a*b)&1) cout<<"Yes"<<endl;
    else  cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto S = readln.chomp;
    auto LR = M.iota.map!(_ => readln.split.map!(a => a.to!int - 1).array).array;

    auto zeros = new long[](N+1);
    foreach (i; 0..N) {
        zeros[i+1] = zeros[i] + (S[i] == '0');
    }

    auto dp = new long[][](N+1, N+1);
    dp[0][0] = 1;
    int rmax = 0;
    int q = 0;

    foreach (i; 0..N) {
        while (q < M && LR[q][0] <= i) {
            rmax = max(LR[q][1], rmax);
            q += 1;
        }
        rmax = max(rmax, i);
        long zero = zeros[rmax+1];
        long one = rmax + 1 - zero;

        foreach (j; 0..i+1) {
            long rest_zero = zero - j;
            long rest_one = one - (i - j);
            if (rest_zero < 0 || rest_one < 0) {
                continue;
            }
            if (rest_zero > 0) {
                dp[i+1][j+1] += dp[i][j];
                dp[i+1][j+1] %= MOD;
            }
            if (rest_one > 0) {
                dp[i+1][j] += dp[i][j];
                dp[i+1][j] %= MOD;
            }
        }
    }

    long ans = 0;
    foreach (a; dp[N]) {
        ans += a;
        ans %= MOD;
    }

    ans.writeln;
}


Measured memory_bytes: 74876
N, T = map(int, input().split())
t = list(map(int, input().split()))
res = 0
start = 0
for i in range(N):
    if t[i] - start > T:
        res += T
        start = t[i]
    else:
        res += t[i] - start
        start = t[i]
print(res+T)


Measured memory_bytes: 26836
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> bool max_self(T & a, const T & b){ 
  return b > a ? a = b, true : false; 
}
template<class T> bool min_self(T & a, const T & b){ 
  return b < a ? a = b, true : false;    
}
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

int main(){
  FAST_IO
  int N, least = INF, most = 0;

  cin >> N;
  for(int rep = 0, x; rep < N; ++rep){
    cin >> x;
    min_self(least, x);
    max_self(most, x);
  }

  assert(most >= least);
  cout << most - least << '\n';
  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int n, k, ans = 0;
	cin >> n >> k;
	while (n > 0){
		n /= k;
		ans++;
	}
	cout << ans << endl;
	return 0;
}




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

int main(){
ll test,i,j,xy,count,flag=0,n,o1=0,o2=0,x,y,m,l,z,max1,x1,y1,x2,y2,z1,k,sum,f,r,ans1,min1;

cin>>n;
if(n>=400 && n<=599){
	cout<<"8";
}else{
	if(n>=600 && n<=799){
		cout<<"7";
	}else{
			if(n>=800 && n<=999){
		cout<<"6";
	}else{
			if(n>=1000 && n<=1199){
		cout<<"5";
	}else{
			if(n>=1200 && n<=1399){
		cout<<"4";
	}else{
			if(n>=1400 && n<=1599){
		cout<<"3";
	}else{
			if(n>=1600 && n<=1799){
		cout<<"2";
	}else{
		cout<<"1";
	}
	}
	}
	}
	}
	}
}

return 0;
}

Measured memory_bytes: 3632
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();

	int n;

	scanf("%d",&n);
	std::vector<std::vector<int>> a(n,vector<int>(10));
	for(int i=0;i<n;i++){
		for(int j=0;j<10;j++)scanf("%d",&a[i][j]);
	}
	std::vector<vector<int>> p(n,vector<int>(11));
	for(int i=0;i<n;i++){
		for(int j=0;j<=10;j++){
			scanf("%d",&p[i][j]);
		}
	}
	int ans = -2e9;
	for(int i=1;i<(1<<10);i++){
		int curr = 0;
		for(int j=0;j<n;j++){
			int cnt = 0;
			for(int k=0;k<10;k++){
				if((i&(1<<k)) && a[j][k]){
					cnt++;
				}
			}
			curr+=p[j][cnt];
		}
		ans = max(ans,curr);
	}

	printf("%d\n",ans );
}


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

int main()
{
  int n; cin >> n;
  list<int> b;
  for (int i = 0; i < n; ++i) {
    int a; cin >> a;
    if (n%2 == i%2) {
      b.push_back(a);
    } else {
      b.push_front(a);
    }
  }

  for (auto v : b) cout << v << " ";
}

Measured memory_bytes: 8448
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}

module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV
import qualified Data.Vector.Mutable as MV
import Data.Ix
import Data.Ord (Down(Down))
import qualified Data.Sequence as Seq
import Data.Foldable (toList)
import Data.Fixed

debug = False

ts :: Show a => a -> a
ts a = if debug then traceShowId a else a


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)


readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

readIntV :: Int -> IO (UV.Vector Int)
readIntV n = GV.unfoldrN n (fmap (fmap BC.tail) . BC.readInt) <$> BC.getLine

readIntegersV :: Int -> IO (V.Vector Integer)
readIntegersV n = GV.unfoldrN n (fmap (fmap BC.tail) . BC.readInteger) <$> BC.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BC.readInteger) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las


main :: IO ()
main = do
  (a, v) <- readTuple2
  (b, w) <- readTuple2
  t <- readInt
  let
    distDiff = abs $ a - b
    spdDiff = v - w
  putStrLn $ if distDiff <= spdDiff * t then "YES" else "NO"


Measured memory_bytes: 4220
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  string s;
  cin >> s;

  vsort(s);
  if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
    cout << "Yes";
  else cout << "No";


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S;
    cin >> S;
    vector<pair<char,int>> res;
    vector<int> ans;
    int i = 0;
    while(i < S.size()) {
        int cnt = 1;
        char c = S[i];
        while(S[i] == S[i+cnt]) cnt++;
        i += cnt;
        res.push_back(pair<char,int>(c,cnt));
    }
    //for(auto x: res) cout << x.first << " "<< x.second << endl;
    for(int i = 0; i < res.size(); i += 2) {
        //cout << res[i].first << res[i].second << res[i+1].first << res[i+1].second << endl;
        REP(j,res[i].second-1) ans.push_back(0);
        if(res[i].second %2 == res[i+1].second%2) {
            ans.push_back((res[i].second+res[i+1].second)/2);
            ans.push_back((res[i].second+res[i+1].second)/2);
        } else {
            int mid = (res[i].second+res[i+1].second)/2;
            if(res[i].second > res[i+1].second) {
                if((res[i].second-1)%2 == 0) {
                    ans.push_back(mid+1);
                    ans.push_back(mid);
                } else {
                    ans.push_back(mid);
                    ans.push_back(mid+1);
                }
            } else {
                if((res[i+1].second-1)%2 == 0) {
                    ans.push_back(mid);
                    ans.push_back(mid+1);
                } else {
                    ans.push_back(mid+1);
                    ans.push_back(mid);
                }
            }
        }
        REP(j,res[i+1].second-1) ans.push_back(0);
    }
    REP(i,ans.size()) cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 2292
#include<iostream>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define MAX 10
pair<string, string> M[MAX];
int n;
string source, target;

string getNext(string str, string s, string t ){
    int i = 0;
    while( i+s.size()-1< str.size() ){
	if ( str.substr(i, s.size() ) == s ){
	    str.replace(i, s.size(), t);
	    i += t.size();
	} else i++;
    }
    return str;
}

int bfs(){
    queue<string> Q;
    map<string, int> D;
    map<string, bool> V;
    Q.push(source);
    D[source] = 0; V[source] = true;
    string u, v, s, t;
    while(!Q.empty() ){
	u = Q.front(); Q.pop();
	if ( u == target ) return D[u];
	for ( int i = 0; i < n; i++ ){
	    s = M[i].first; t = M[i].second;
	    v = getNext(u, s, t);
	    if ( !V[v] && v.size() <= target.size()){
		D[v] = D[u] + 1;
		V[v] = true;
		Q.push(v);
	    }
	}
    }
    return -1;
}

main(){
    while ( cin >> n && n ){
	for ( int i = 0; i < n; i++ ) cin >> M[i].first >> M[i].second;
	cin >> source >> target;
	cout << bfs() << endl;
    }
}

Measured memory_bytes: 1308
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

const int INF = 20000000;

void dfs(int v, int p, vector<int> &dist, vector<int> G[]) {
  if (dist[v] != INF) return;
  if (p != -1) dist[v] = dist[p] + 1;
  else dist[v] = 0;
  for (auto&u: G[v]) {
    if (dist[u] != INF) continue;
    dfs(u, v, dist, G);
  }
}


void bfs(int start, vector<int> &dist, vector<int> G[]) {
  queue<int> Q;
  Q.push(start);
  dist[start] = 0;
  while (Q.size()) {
    int v = Q.front(); Q.pop();
    for (auto &&u: G[v]) {
      if (dist[u] != INF) continue;
      dist[u] = dist[v] + 1;
      Q.push(u);
    }
  }
}

/*
 両者、とれるコマの中で最も相手に近いものから取るのが最善.
 それを実際にシミュレートする.
 優先度付きキューを用いて相手までの距離が短い方から埋めていく.
 先におけるコマが無くなったほうが負け.
*/
void solve(int n, int s, int t, vector<int> &fromS, vector<int> fromT, vector<int> G[]) {
  vector<bool> done(n, false);
  priority_queue<pair<int, int> > Qs, Qt;
  Qs.push({ fromT[s], s });
  Qt.push({ fromS[t], t });
  while (Qs.size() and Qt.size()) {
    auto qs = Qs.top(); Qs.pop();
    while (done[qs.second] and Qs.size()) {
      qs = Qs.top(); Qs.pop();
    }
    if (done[qs.second]) {
      print("Snuke");
      return;
    }
    done[qs.second] = true;
    
    auto qt = Qt.top(); Qt.pop();
    while (done[qt.second] and Qt.size()) {
      qt = Qt.top(); Qt.pop();
    }
    if (done[qt.second]) {
      print("Fennec");
      return;
    }
    done[qt.second] = true;
    
    // print("Fennec", " ");
    // print(qs.second+1);
    // print("Snuke", " ");
    // print(qt.second+1);
    {
      for (auto &&u: G[qs.second]) {
        if (done[u]) continue;
        Qs.push({ -fromT[u], u }); // Tに近い方から取る.
      }
    }
    {
      for (auto &&u: G[qt.second]) {
        if (done[u]) continue;
        Qt.push({ -fromS[u], u }); // Sに近い方から取る.
      }
    }
  }
  
  if (Qs.size()) print("Fennec");
  else print("Snuke");
}


/*
 Fennec、Snukeそれぞれにより近い点を数える.
 Fennecの方が真に大きければFennecの勝ち.
 等しい場合は、Fennec->Snukeという順番だとFennecが先に塗れなくなるのでSnukeの勝ち.
*/
void solve2(int n, int s, int t, vector<int> &fromS, vector<int> &fromT, vector<int> G[]) {
  int fennec = 0;
  loop(i,0,n) {
    // TよりもSに近いところはFennecが取れる.
    fennec += fromS[i] <= fromT[i];
  }
  int snuke = n-fennec;
  if (fennec > snuke) print("Fennec");
  else print("Snuke");
}

int main() {
  int n;in(n);
  vector<int> G[n];
  loop(i,0,n-1) {
    int a, b; in(a),in(b);
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  int s = 0, t = n-1;
  vector<int> fromS(n, INF), fromT(n, INF);
  // dfs(s, -1, fromS, G);
  // dfs(t, -1, fromT, G);
  bfs(s, fromS, G);
  bfs(t, fromT, G);
  
  solve2(n, s, t, fromS, fromT, G);
  return 0;
}


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

using namespace std;

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

const ll maxn =1e5+5;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

ll h , n , a[maxn];

int main(){
    migmig
    cin >> h >> n;
    for (int i = 0 ; i < n ; i ++){
        cin >> a[i];
        if(a[i] > 0) h-=a[i];
    }
    if(h <= 0 ){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
    return(0);
}


//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


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

typedef pair<int,int> P;

int nextInt() {
  int x; scanf("%d", &x); return x;
}

const int MAX_N = 100000 + 10;

map<P, vector<int> > g;
vector<P> es[MAX_N];

struct State {
  int pos;
  int pc;
  int cost; 
  State(int a, int b, int c) : pos(a), pc(b), cost(c) {}
};

struct L {
  int p, q, c;
  L (int p, int q, int c) : p(p), q(q), c(c) {}
  bool operator<(const L& o) const {
    return p < o.p;
  }
};

int main() {
  int N = nextInt();
  int M = nextInt();

  vector<L> vl;
  for (int i = 0; i < M; i++) {
    int p = nextInt() - 1;
    int q = nextInt() - 1;
    int c = nextInt();
    es[p].emplace_back(q, c);
    es[q].emplace_back(p, c);
    g[P(p,c)].push_back(q);
    g[P(q,c)].push_back(p);
  }

  int ans = -1;
  map<P, int> memo; // 0なら存在しないノード、最小値は 1 
  deque<State> pq;
  pq.emplace_back(0, 0, 1); // 今いる駅, 最後に使った会社, コスト
  memo[P(0,0)] = 1;
  while (!pq.empty()) {
    const State state = pq.front();
    pq.pop_front();
    // const int cost = memo[P(state.pos, state.pc)];
    // if (state.cost != cost) continue;
    const int cost = state.cost;
    if (state.pos == N - 1 && state.pc == -1) {
      ans = cost - 1;
      break;
    }


    if (state.pc != -1) for (int next_pos : g[P(state.pos, state.pc)]) {
      P e(next_pos, state.pc);
      int next_cost = cost;
      auto f = memo.find(e);
      if (f == memo.end() || f->second > next_cost) {
        memo[e] = next_cost;
        pq.emplace_front(e.first, e.second, next_cost);
      }
    }

    if (state.pc == -1) {
      for (P e : es[state.pos]) {
        int next_cost = cost + 1;
        auto f = memo.find(e);
        if (f == memo.end() || f->second > next_cost) {
          memo[e] = next_cost;
          pq.emplace_back(e.first, e.second, next_cost);
        }
      }
    }
    else
    {
      int next_pos = state.pos;
      int next_pc = -1;
      P e(next_pos, next_pc);
      int next_cost = cost ;
      auto f = memo.find(e);
      if (f == memo.end() || f->second > next_cost) {
        memo[e] = next_cost;
        pq.emplace_front(e.first, e.second, next_cost);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 75520
import sys
X = int(input())
D = X%10
X = (X - D)//10
C = X%10
X = (X - C)//10
B = X%10
A = (X - B)//10
sm = A+B+C+D
if sm == 7:
    print("%d+%d+%d+%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*D == 7:
    print("%d+%d+%d-%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*C == 7:
    print("%d+%d-%d+%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*B == 7:
    print("%d-%d+%d+%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*(B+C) == 7:
    print("%d-%d-%d+%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*(B+D) == 7:
    print("%d-%d+%d-%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*(C+D) == 7:
    print("%d+%d-%d-%d=7"%(A,B,C,D))
    sys.exit()
elif sm-2*(B+C+D) == 7:
    print("%d-%d-%d-%d=7"%(A,B,C,D))
    sys.exit()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

string s; int ans = 0;
int main(){
    cin >> s;
    int endi = s.size()-1;
    for (int i = 0; i < s.size(); i++) {
        if(endi < i) break;
        if(s[endi]!=s[i]) ans++;
        endi--;
    }
    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	string a;
	int n=0,k,h=0;
	cin>>k;
	cin>>a;
	for(int i=0;i<=k-1;i++)
	{
		if(a[i]=='I')
			n++;
		if(a[i]=='D')
			n--;
		if(n>h)
			h=n;
	}
	cout<<h<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = 1; i <= n; ++i)

using namespace std;
const int N = 500 + 5, INF = 0x3f3f3f3f;

int n;
int a[N][N];
int c[N], d[N], inq[N];
char s[N][N];

queue<int> Q;

int main() {
	cin >> n;
	REP(i, 1, n) scanf("%s", s[i] + 1);
	int mx = 0;
	REP(i, 1, n) REP(j, 1, n){
		a[i][j] = (s[i][j] == '#');
		c[i] += a[i][j];
		mx = max(mx, c[i]);
	}
	if (mx == 0) {printf("-1\n"); return 0;}
	REP(i, 1, n) d[i] = INF;
	REP(i, 1, n) REP(j, 1, n) if (a[i][j]) d[j] = 0;

	REP(i, 1, n) if (d[i] == 0){
		Q.push(i); inq[i] = 1;
	}

	while (!Q.empty()){
		int h = Q.front(); Q.pop(); inq[h] = 0;
		REP(i, 1, n) if (d[i] > d[h] + 1){
			d[i] = d[h] + 1;
			if (!inq[i]){
				Q.push(i); inq[i] = 1;
			}
		}
	}

	int ans = INF;
	for (int i = 1; i <= n; i++)
		if (d[i] != INF && n - c[i] < ans)
			ans = min(ans, n - c[i] + d[i]);
	
	REP(j, 1, n) REP(i, 1, n){
			if (!a[i][j]) {
				++ans;
				break;
			}
		}
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 1536
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextLine() ) {

	    final int[] cross = new int[ 101 ];
	    while ( true ) {
		final String[] input = stdin.nextLine().split( " " );
		final int from = Integer.parseInt( input[ 0 ] );
		final int to = Integer.parseInt( input[ 1 ] );

		if ( from == 0 && to == 0 ) {
		    break;
		}
		cross[ from ]++;
		cross[ to ]++;
	    }

	    //System.err.println( Arrays.toString( cross ) );

	    if ( canWallAround( cross ) ) {
		System.out.println(  "OK" );
	    } else {
		System.out.println(  "NG" );
	    }	    
	}
    }

    static boolean canWallAround( final int[] cross ) {
	for ( int i = 3; i <= 100; i++ ) {
	    if ( cross[ i ] % 2 == 1 ) {
		return false;
	    }
	}
	return ( cross[ 1 ] % 2 == 1 && cross[ 2 ] % 2 == 1 );	
    }    
}

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

char s[200010];
int main(){
    scanf("%s",s);
    int len=strlen(s);
    int sum=0;
    for(int i=0;i<len;i++)sum+=s[i]-'0';
    if(sum%9==0){
        puts("Yes");
    }else{
        puts("No");
    }
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll n;
  cin >> n;
  vector<ll> vec(4,0);
  string str;
  rep(i,n){
    cin >> str;
    if(str == "AC"){
      vec[0]++;
    }else if(str == "WA"){
      vec[1]++;
    }else if(str == "TLE"){
      vec[2]++;
    }else{
      vec[3]++;
    }
  }
  cout << "AC x " << vec[0] << endl;
  cout << "WA x " << vec[1] << endl;
  cout << "TLE x " << vec[2] << endl;
  cout << "RE x " << vec[3] << endl;
}


Measured memory_bytes: 3632
#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;
    ll ma=0,mi=LINF;
    rep(i,n){
        cin>>a;
        ma=max(ma,a);
        mi=min(mi,a);
    }
    Cout(ma-mi);
    return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/exawizards2019/tasks/exawizards2019_a

import itertools
import collections
import bisect

def main():
    A, B, C = map(int, input().split())
    print("Yes" if A == B and B == C else "No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = int(s[2])
ans = "No"
if a>b:
    if b>c:
        ans="No"
    elif b<c:
        if a>c:
            ans="Yes"
        else:
            ans="No"
else:
    if b<c:
        ans="No"
    elif b>c:
        if a<c:
            ans="Yes"
        else:
            ans="No"
    
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int N,M;cin>> N >> M;
    vector<ll> A(N);
    vector<pii> CB(M);
    rep(i,N){
        cin >> A[i];
    }
    rep(i,M){
        int b,c;
        cin >> b >> c;
        CB[i]=make_pair(c,b);
    }

    sort(All(CB));
    reverse(All(CB));
    vector<ll> D;
    int i = 0;
    while(i<M){
        int flag = 0;
        for(int j=0;j<CB[i].second;j++){
            if(D.size()<N)D.push_back(CB[i].first);
            else{
                flag = 1;
                break;
            }
        }
        i++;
        if(flag)break;
    }
    sort(All(A));
    int x = 0;
    ll res = 0;
    for(int i=0;i<D.size();i++){
        if(D[i]>A[i]){
            res += D[i];
            x++;
        }else break;
    }
    for(int i=x;i<N;i++){
        res+=A[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2936
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        scanner.close();

        int THRESHOLD = 111;

        for(int i = 0; i < 9; i++) {
            if(N > THRESHOLD * i && N <= THRESHOLD * (i + 1)) {
                System.out.println(THRESHOLD * (i + 1));
                break;
            }
        }
    }
}

Measured memory_bytes: 21844