akhauriyash/Code-Regression huggingface dataset:
#ifdef ConanYu
#include "local.hpp"
#else
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

void Main() {
  int h, n; cin >> h >> n;
  for(int i = 0; i < n; i++) {
    int t; cin >> t;
    h -= t;
  }
  if(h <= 0) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    //Main
    public static void main(String args[]) throws Exception {

        Scanner Input = new Scanner(System.in);
        int N = Input.nextInt();
        long X = 1;

        for (int I = 1; I <= N; I++) {
            X = (X * I) % 1000000007;
        }
        System.out.println(X);
    }
}

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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define endl        '\n'
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

namespace InOp{
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
}
using namespace InOp;

namespace ModOp{
template<class x,class y,class z> z add(x a,y b,z m){return (a+b)%m;}
template<class x,class y,class z> z sub(x a,y b,z m){return (a-b+m)%m;}
template<class x,class y,class z> z mul(x a,y b,z m){return ((ll)a*b)%m;}
template<class y,class z> z expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class x,class z> z inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y,class z> z div(x a,y b,z m){ll c=inv(b,m);return mul(a,c,m);}
}
using namespace ModOp;

namespace Debug{
template<class x> void deb(x a){cerr<<"a"<<": "<<a<<endl;}
template<class x,class y> void deb(x a,y b){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<endl;}
template<class x,class y,class z> void deb(x a,y b,z c){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<endl;}
template<class x,class y,class z,class xy> void deb(x a,y b,z c,xy d){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<" | "<<"d"<<": "<<d<<endl;}
}
using namespace Debug;

#define N  1000005

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
    	ll i,j,k,l,r,x,y,m,n;
    	cin>>x>>y;
    	cout<<x*y;
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#define D first
#define T second
using namespace std;

long long n, s;
pair<int, int> a[200005];
int main() {
	int i;
	cin >> n;
	for(i=0; i<n; i++) scanf("%d%d", &a[i].T, &a[i].D);
	sort(a, a+n);
	for(i=0; i<n; i++) {
		s += a[i].T;
		if(s > a[i].D) {puts("No"); return 0;}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
long long f(long long a) {
     long long res[] = {a,1,a+1,0};
     return res[a%4];
}
long long getXor(long long a, long long b) {
     return f(b)^f(a-1);
}
int main()
{
    long long a,b;
    cin>>a>>b;
  if(a==0 && b==0)
    {
        cout<<0;
        return 0;
    }
    if(a==0)
    a++;
    long long k=getXor(a,b);
    cout<<k;
    return 0;
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.txt", "r", stdin);
 //    	freopen("output.txt", "w", stdout);
	// #endif
	int k,n;
	cin>>n>>k;
	vi v(n);
	rep(i,n){
		cin>>v[i];
	}
	double best = 0;
	rep(i,k){
		best += (v[i]+1.0)/2.0;
	}
	double tmp = best;
	// cout<<tmp<<" ";
	repa(i,k,n){
		tmp -= (v[i-k]+1.0)/2.0;
		tmp += (v[i] + 1.0)/2.0;
		best = max(best,tmp);
		// cout<<tmp<<" ";
	}
	cout<<fixed<<setprecision(12)<<best;
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 312345;
struct BITMIN {
  int n;
  int vs[MAX_N + 1];
  BITMIN() {
    this->n = MAX_N;
    clear();
  }
  void clear() {
    REP(i, n+1) vs[i] = 1001001001;
  }
  void update(int idx, int val) {
    for (int x = idx + 1; x > 0; x -= x & -x) vs[x] = min(vs[x], val);
  }
  int get(int idx) {
    int val = 1001001001;
    for (int x = idx + 1; x <= n; x += x & -x)  val = min(val, vs[x]);
    return val;
  }
};

BITMIN rows, cols;

int main2() {
  ll N = nextLong();
  int Q = nextLong();

  rows.clear();
  cols.clear();

  rows.update(N-1, N-2);
  cols.update(N-1, N-2);

  ll min_row = N;
  ll min_col = N;

  ll erased = 0;
  REP(q, Q) {
    int type = nextLong();
    ll x = nextLong();
    if (type == 1) {
      erased += cols.get(x);
      if (x < min_col) {
        min_col = x;
        rows.update(min_row, x-2);
      }
    }
    if (type == 2) {
      erased += rows.get(x);
      if (x < min_row) {
        min_row = x;
        cols.update(min_col, x-2);
      }
    }
  }

  ll ans = (N-2) * (N-2) - erased;
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 6224
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
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() {
  int N;
  cin >> N;
  ll C[N];
  ll power_2[220000];
  power_2[0] = 1;
  for (int i = 1; i < 220000; i++) {
    power_2[i] = power_2[i-1] * 2LL;
    power_2[i] %= Mod;
  }
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  sort(C,C+N);
  reverse(C,C+N);
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    ll res = power_2[N-1];
    ll a = ((N+1) * power_2[N-2]);
    a %= Mod;
    a -= power_2[N-1];
    a %= Mod;
    a *= modinv(N-1,Mod);
    a %= Mod;
    a *= i;
    a %= Mod;
    res += a;
    res %= Mod;
    res *= C[i];
    res %= Mod;
    res *= power_2[N];
    res %= Mod;
    ans += res;
    ans %= Mod;
  }
  if (ans < 0) ans += Mod;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6892
#include <stdio.h>

int main()
{
	int a, b, c, d, e, k;
	int i, j;
	int count=0;

	int antena[5];

	scanf("%d %d %d %d %d %d", &antena[0], &antena[1], &antena[2], &antena[3], &antena[4], &k);

	for (i = 4; i >= 0; i--) {
		for (j = 0; j <= i; j++) {
			if (antena[i] - antena[j] > k) {
				count++;
			}

		}
	}

	if (count >= 1) {
		printf(":(\n");
	}
	else {
		printf("Yay!\n");
	}

	return 0;
	
}


Measured memory_bytes: 128
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static ArrayList<Integer>[] edge;
	static long mod=1000000007;
	static long[][] dp;
	static long ans;
	static boolean[] visited;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		edge=new ArrayList[n];
		dp=new long[n][2];
		visited=new boolean[n];
		for(int i=0; i<n; i++){
			Arrays.fill(dp[i],1);
		}
		for(int i=0; i<n; i++){
			edge[i]=new ArrayList<>();
		}
		for(int i=1; i<n; i++){
			int x=sc.nextInt()-1;
			int y=sc.nextInt()-1;
			edge[x].add(y);
			edge[y].add(x);
		}
		for(int i=0; i<n; i++){
			if(!visited[i]){
				dfs(i,i,0);
				dfs(i,i,1);
				ans=(dp[i][0]+dp[i][1])%mod;
			}
		}
		System.out.println(ans);
	}
	static void dfs(int now,int from,int black){
		if(visited[now]){
			return;
		}
		visited[now]=true;
		for(int i:edge[now]){
			if(i!=from){
				dfs(i,now,0);
				dfs(i,now,1);
				dp[now][0]=(dp[now][0]*(dp[i][0]+dp[i][1]))%mod;
				dp[now][1]=dp[now][1]*dp[i][0]%mod;
			}
		}
	}
}

Measured memory_bytes: 122448
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Main {
	private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws Exception {
		List<Integer> nk = Arrays.stream(br.readLine().split(" "))
				.map(Integer::parseInt)
				.collect(Collectors.toList());
		int n = nk.get(0);
		int k = nk.get(1);
		
		List<Integer> ws = new ArrayList<>();
		for(int i = 0; i < n; i++){
			ws.add(Integer.parseInt(br.readLine()));
		}
		
		int left = 0;
		int right = 10000 * 100000;
		int mid = 0;
		while(1 <= right - left){
			mid = (left + right) / 2;
			int v = check(mid, k, ws);
			if(v < n){
				left = mid + 1;
			}else{
				right = mid;
			}
		}
		
		System.out.println(right);
		
	}
	
	static int check(int p, int k, List<Integer> ws){
		int truck = 0;
		int t = 1;
		
		for(int i = 0; i < ws.size(); i++){
			if(p < ws.get(i)){
				return i;
			}
			if(truck + ws.get(i) <= p){
				truck += ws.get(i);
			}else{
				t++;
				if(k < t){
					return i;
				}else{
					truck = ws.get(i);
				}
			}
		}
		
		return ws.size();
	}
	
}


Measured memory_bytes: 41668
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert
#ifdef LOCAL
template <class S, class T>
ostream &operator<<(ostream &str, const pair<S, T> &p) {
  return (str << "{" << p.fi << ", " << p.se << "}");
}
template <template <class...> class Container, class... T>
ostream &operator<<(ostream &str, const Container<T...> &vec) {
  str << '[';
  for (auto it = vec.begin(); it != vec.end(); it++) {
    if (it != vec.begin())
      str << ", ";
    str << *it;
  }
  str << ']';
  return str;
}
#define var(x) "[" << #x << ": " << (x) << "] "
struct dbg {
  dbg() { cout << "  "; }
  ~dbg() { cout << endl; }
  template <class T> dbg &operator<<(T oth) {
    cout << oth;
    return *this;
  }
};
#else
#define var(x) 0
struct dbg {
  template <class T> dbg &operator<<(T oth) { return *this; }
};
#endif
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int main(int argc, char **argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  auto solve = [&]() {
    ll l, r, d;
    cin >> l >> r >> d;
    cout << r / d - (l - 1)/d << '\n';
  };
  int t;
  t = 1;
  while (t--)
    solve();
  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  string s;
  cin>>s;
  ll n=s.length(),ans=0,v=0,i=0;
  for(ll i=0;i<n;i++)
  {
    if(s[i]=='A')
    {
      v++;
    }
    else
    {
      int q=0;
      if(i<n-1&&s[i]=='B'&&s[i+1]=='C')
      {
        i++;
        ans=ans+v;
      }
      else
       v=0;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
#define lint long long
static const int INF = 1 << 22;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
/*******source code below********/
int main(void) {

	long long N; cin >> N;
	long long K; cin >> K;
	vector<long long> A(N);
	for (long long i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	if ((N - 1) % (K - 1) == 0) {
		cout << ((N - 1) / (K - 1)) << endl;
	}
	else {
		cout << ((N - 1) / (K - 1)) + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//gcdlcm, isPrime, eratos, divisor, modinv, bitSearch, bitList, dfs, bfs//
//dijkstra, UnionFind, COM, digitDP//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z;
ll MOD = 1000000007; ll INF = 9999999999999; ll ans = 0;
vl flag, color, D; vll path;
//***********//
int main() {
	cin >> K;
	ll N = 50;
	cout << N << endl;
	vl A(N);
	ll M = K;
	for (i = 0; i < N; i++) {
		A[i] = 49;
		ll k = M / (N - i);
		A[i] += (N * k) - (K - k);
		M -= k;
		//debug(i, k);
		cout << A[i] << " ";
	}
}

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

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

  map<int, int> m;
  map<int, int> m_mp;
  for(int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    {
      map<int, int>::iterator it = m.find(a);
      if(it == m.end()) m[a] = b;
      else it->second = min(it->second, b);
    }
    {
      map<int, int>::iterator it = m_mp.find(b);
      if(it == m_mp.end()) m_mp[b] = a;
      else it->second = max(it->second, a);
    }
  }

  vector<int> dp(h);
  for(int i = 1; i < h; ++i) {
    for(map<int, int>::iterator it = m.begin(); it != m.end(); ++it) {
      if(i < it->first) break;
      else if(i == it->first) {
        if(dp[i] == 0)  dp[i] = it->second;
        else            dp[i] = min(dp[i], it->second);
      } else { // i > it->first
        int base = dp[i - it->first];
        if(base > 0) {
          if(dp[i] == 0)  dp[i] = it->second + base;
          else            dp[i] = min(dp[i], it->second + base);
        }
      }
    }
  }

  int use_mp_min = INT_MAX;
  int before_ap = 0;
  for(map<int, int>::iterator it = m_mp.begin(); it != m_mp.end() && (before_ap < h); ++it) {
    if(it->second >= h) {
      use_mp_min = min(use_mp_min, it->first);
    } else {
      for(int i = before_ap + 1; (i <= it->second) && (i < h); ++i) {
        if(dp[h - i] == 0) continue;
        use_mp_min = min(use_mp_min, it->first + dp[h - i]);
      }
    }
    before_ap = it->second;
  }

  cout << use_mp_min << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#ifndef STOP_DEBUG
#define debug(...)\
    do { cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
  cerr << ' ' << head;
  debug_cerr(tail...);
}
void chmax(lint &a, lint b) { if (a < b) a = b; }
void chmin(lint &a, lint b) { if (a > b) a = b; }
struct IoSetup{
    IoSetup(){
      ios::sync_with_stdio(false);
      cin.tie(nullptr);
      cout << fixed << setprecision(20);
    }
} iosetup;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) cout << "bust" << '\n';
  else cout << "win" << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int a, b;

  while ( scanf ( "%d%d", &a, &b ) == 2 )
  {
    while ( b )
    {
      int t = a % b;
      a = b;
      b = t;
    }
    printf ( "%d\n", a );
  }

  return ( 0 );
}

Measured memory_bytes: 0
//itp1_6-a
#include <iostream>
#include <vector>
using namespace std;

int main(){
 int n;
 cin>>n;
 vector<int> a(n);
 for(int i=0;i<n;i++){
  cin>>a[i];
 }
 for(int i=n-1;i>0;i--){
  cout<<a[i]<<" ";
 }
 cout<<a[0]<<endl;
return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	int n,k;
	
	cin>>n>>k;
	int a[n+5];
	memset(a,0,sizeof(a));
	
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		a[x] = 1;
	}
	
	for(int i=n;i<=99999;i++){
		int f=0;
		string s = to_string(i);
		for(int i=0;i<s.length();i++){
			int x = s[i] - '0';
			if(a[x]){
				f=1;
				break;
			}
		}
		if(f == 0){
			cout<<i<<endl;
			break;
		}
	}
	
	return 0;
}

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,m;cin>>n>>m&&n|m;){
		vi ds(n);
		rep(i,m){
			int u,v; cin>>u>>v; u--,v--;
			ds[u]++; ds[v]++;
		}
		rep(i,n) cout<<ds[i]<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll n;
map<ll,ll> mp;
ll data[200005];
int main(){
	//freopen("input.txt","r",stdin);
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>data[i];
		mp[data[i]]++;
	}
	ll sum=0;
	for(auto p:mp){
		sum+=(p.second)*(p.second-1)/2;
	}
	for(ll i=0;i<n;i++){
		if(mp[data[i]]==1) cout<<sum<<endl;
		else cout<<sum-mp[data[i]]*(mp[data[i]]-1)/2+(mp[data[i]]-1)*(mp[data[i]]-2)/2<<endl;
	}
	return 0;
}

Measured memory_bytes: 11008
#include<vector>
#include<array>
#include<iostream>
#include<algorithm>

using namespace std;

void solve(void){
    size_t n;
    cin >> n;
    vector<long> v(n);
    for(auto &vi: v){
        cin >> vi;
    }
    constexpr size_t v_max = 1000000;
    vector<long> dist_odd(v_max);
    vector<long> dist_even(v_max);
    for(auto i = 0; i < n; i++){
        if(i % 2 == 0){
            dist_odd[v[i]]++;
        }else{
            dist_even[v[i]]++;
        }
    }
    auto max_odd = max_element(dist_odd.begin(), dist_odd.end());
    auto max_even = max_element(dist_even.begin(), dist_even.end());
    if(distance(max_odd, dist_odd.begin()) == distance(max_even, dist_even.begin())){
        auto max_odd_v = *max_odd;
        auto max_even_v = *max_even;
        *max_odd = 0;
        *max_even = 0;
         auto second_max_odd = max_element(dist_odd.begin(), dist_odd.end());
         auto second_max_even = max_element(dist_even.begin(), dist_even.end());
         cout << n - max(*second_max_odd + max_even_v, *second_max_even + max_odd_v) << endl;
         return;
    }
    cout << n - *max_element(dist_odd.begin(), dist_odd.end()) - *max_element(dist_even.begin(), dist_even.end()) << endl;
}

int main(void){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 16640
//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

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

const long long maxn = 2e5 + 5;
const long long INF = 1e18 + 1;
const long long M = 1e9 + 7;
const int lg = 21;

int n, mn = 1000000000;

int ans(int n){
	int sum = 0;
	while(n >= 1)
		sum += (n % 10), n /= 10;
	return sum;
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 1; i < n; i++)
		mn = min(mn, ans(i) + ans(n - i));
	cout << mn << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
ll d[400][400];
void floyd(int n){
    for (int k = 0; k < n; ++k) {
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]); 
            }
        }
    }
}
int main() {
    
    int n,m,l;
    cin>>n>>m>>l;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            d[i][j]=1e15;   
        }
    }
    for(int i=0;i<m;i++){
        int x,y,c;
        cin>>x>>y>>c;
        d[x-1][y-1]=c;
        d[y-1][x-1]=c;
        
    }
    floyd(n);
    
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if(d[i][j]<=l)
                d[i][j]=1;
            else    d[i][j]=1e9;
        }
    }
    floyd(n);
    int q;
    cin>>q; 
    while(q--){
        int x,y;
        cin>>x>>y;
        x--;
        y--;
        d[x][y] = (d[x][y] == 1e9) ? -1:d[x][y]-1;
        cout<<d[x][y]<<"\n";
    }
}

Measured memory_bytes: 1408
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int fib(int i,int n,int arr[])
{
    if(i==n-1)
    {
        return 0;
    }
    int p=INT_MAX,q=INT_MAX;
    if(a[i]!=-1)
    {
        return a[i];
    }
    if(i+2<=n-1)
    {
        p=fib(i+2,n,arr)+abs(arr[i]-arr[i+2]);
    }
    if(i+1<=n-1)
    {
        q=fib(i+1,n,arr)+abs(arr[i]-arr[i+1]);
    }
    a[i]=min(p,q);
    return a[i];
}
int main()
{
    int n;
    cin>>n;
    int arr[n];
    memset(a,-1,sizeof(a));
    a[n-1]=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    cout<<fib(0,n,arr)<<endl;


}



Measured memory_bytes: 4864
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scan = new Scanner(System.in);
				
		String s = scan.next();
		
		String[] s1 = s.split("");
		
		if(s1[s1.length-1].equals("s")) {
			System.out.print(s+"es");
		}else {
			System.out.print(s+"s");
		}
	}

}


Measured memory_bytes: 38576
<?php

define('S', array_reverse(array_map(function($numeric_string) {
    return (int)$numeric_string;
}, str_split(trim(fgets(STDIN))))));

define('COUNT', count(S));

echo 
array_sum(
    array_map(
        function($number) {
            $bits = str_split(str_pad(decbin((string)$number), COUNT - 1, '0', STR_PAD_LEFT));
            $sum = S[0];
            $pow = 0;
            for ($i = 1; $i < COUNT; $i++) {
                if ($bits[$i - 1] === '0') {
                    $pow++;
                } else if ($bits[$i - 1] === '1') {
                    $pow = 0;
                } else {
                    throw new Exception;
                }
                $sum += S[$i] * pow(10, $pow);

            }
            return $sum;
        },
        array_reverse(range(0, pow(2, COUNT - 1) - 1))
    )
) . "\n";

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

int main(){

	int n, m, row[100], column[100];

	while(cin >> n){
		if(n == 0) break;
		
		fill(row, row+n, 0);
		fill(column, column+n, 10000);
		
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				cin >> m;
				row[j] = max(row[j], m);
				column[i] = min(column[i], m);
			}
		}

		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				if(row[i] == column[j]){
					cout << row[i] << endl;
					i = n;
					break;
				}
			}
			if(i == n-1) cout << 0 << endl;
		}
	}
	
	return 0;

}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, K;
    cin >> n >> K;
    vector<ll> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    sort(h.begin(), h.end());

    ll ans = 0;
    for (int i = 0; i < n - K; ++i) {
        ans += h[i];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
using namespace std;
long long n,k;
long long gcd(long long a,long long b)
{
	if(b==0)return a;
	return gcd(b,a%b);
}
int main()
{
	scanf("%lld%lld",&n,&k);
	printf("%lld",3*(n-gcd(n,k)));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll x, y; cin >> x >> y;
	
	rep(i, 0, x){
		if(2 * i + 4 * (x - i) == y){
			print("Yes")
			return 0;
		}
	}
	print("No")
	
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main()
{
    string s, ys("CODEFESTIVAL2016");
    cin >> s;

    int ans = 0;
    for (int i = 0; i < 16; i++)
    {
        if (s[i] == ys[i]) ans++;
    }

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


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

using namespace std;

#define fi first
#define se second


const int INF = 1e9 + 10;

int n, m, p, a, b;

typedef pair<int, int> P;

struct State {
  int v;
  double cost;
  int ticket;
  State(int v, double c, int t): v(v), cost(c), ticket(t) { }
  bool operator<(const State& s) const {
    return cost < s.cost;
  }
  bool operator>(const State& s) const {
    return cost > s.cost;
  }
};

int main() {

  while (true) {
    cin >> n >> m >> p >> a >> b;
    if (n + m + p + a + b == 0) {
      break;
    }

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

    vector<P> G[32];

    for (int i = 0; i < p; i++) {
      int x, y, z;
      cin >> x >> y >> z;
      G[x].push_back(P(y, z));
      G[y].push_back(P(x, z));
    }

    static double dists[0b100000000][32];
    for (int i = 0; i < 0b100000000; i++) {
      for (int j = 0; j < 32; j++) {
        dists[i][j] = INF;
      }
    }

    dists[0][a] = 0;

    priority_queue<State, vector<State>, greater<State>> que;

    que.push(State(a, 0, 0));

    while (!que.empty()) {
      State s = que.top(); que.pop();

      for (auto e: G[s.v]) {
        for (int j = 0; j < n; j++) {
          if (s.ticket & (1 << j)) {
            continue;
          }
          int to = e.fi;
          double cost = s.cost + e.se / (double)t[j]; 

          if (cost < dists[s.ticket | (1 << j)][to]) {
            dists[s.ticket | (1 << j)][to] = cost;
            que.push(State(to, cost, s.ticket | (1 << j)));
          }
        }
      }
    }

    double ans = INF;
    for (int i = 0; i < (1 << n); i++) {
      ans = min(ans, dists[i][b]);
    }

    if (ans == INF) {
      cout << "Impossible" << endl;
    } else {
      printf("%.15f\n", ans);
    }
    
  }

  return 0;
}

Measured memory_bytes: 5328
import java.io.IOException;
import java.util.Scanner;

/**
 * Created on 2017/09/29 7:07.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int ans = 0;
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                ans += Math.min(x, k - x);
            }
            System.out.println(ans * 2);
        }
    }
}

Measured memory_bytes: 21716
# coding: utf-8
# Your code here!

import itertools

N = int(input())
ta = [list(map(int,input().split())) for _ in range(N)]
for Cx, Cy in itertools.product(range(101),range(101)):
    # もしcx,cyが決まっていた場合矛盾が起こらないか
    # H = abs(x-cx)+abs(y-cy) + h
    H = None
    for [x,y,h] in ta:
        if h == 0:
            pass
        else:
            if H is None:
                H = h + abs(x-Cx)+abs(y-Cy)
            else:
                if H != h + abs(x-Cx)+abs(y-Cy):
                    break
    for [x,y,h] in ta:
        if h != max(H - abs(x-Cx) - abs(y-Cy),0):
            break
    else:
        break
print(Cx,Cy,H)


Measured memory_bytes: 3064
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = 0;
        int aa = in.nextInt();
        for (int i = 1; i <= aa; i++) {
            a+=i;
        }
        System.out.println(a);
    }
}


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b;
char op;

int main() {
	cin >> a >> op >> b;
	if (op=='+') cout << a+b << ln;
	else cout << a-b << ln;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#include<string.h>
int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);                    
    cout.tie(NULL);
   	string s,t;
   	cin>>s;
   	cin>>t;
   	ll cnt=0;
   	for(int i=0;i<s.length();i++){
   		if(s[i]!=t[i]) cnt++;
   	}
   	cout<<cnt;
   	return 0;
}

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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r ;
    if(r<=x && x<=W-r && r<=y && y<=H-r) cout << "Yes" << endl;
    else cout << "No" << endl;
    
  return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
    int a, b;
    cin >> a >> b;
    int x = 1;
    while(1) {
        int aa = x * 0.08;
        int bb = x * 0.1;
        if(aa == a && bb == b)
            break;
        if(aa > a && bb > b){
            x = -1;
            break;
        }
        x++;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::VecDeque;

fn main() {
    input! {
        N: usize,
        S: String,
    }

    let mut x: i64 = 0;
    let mut ans: i64 = 0;

    for i in 0..N {
        let s: &str = &S[i..=i];
        if s == "I" {
            x += 1;
        } else {
            x -= 1;
        }

        ans = max(ans, x);
    }

    println!("{}", ans);
}


Measured memory_bytes: 2180
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;

using namespace std;

int main(void){
    vector< pair<ll, ll> > A, B;
    ll Ao[100005];
    ll N, Ain, Bin;
    cin>>N;
    rep(i, N){
        cin>>Ain;
        A.push_back({Ain, i});
    }
    rep(i, N){
        cin>>Bin;
        B.push_back({Bin, i});
    }
    bool n_pat=false, who_pat=true;
    sort(all(A)); sort(all(B));
    rep(i, N){
        Ao[A[i].second]=i;
    }
    rep(i, N){
        //cout<<A[i].first<<" "<<B[i].first<<endl;
        if(A[i].first>B[i].first) who_pat=false;
        if(i != 0){
            if(A[i].first<=B[i-1].first) n_pat=true;
        }
    }
    ll thisv=0, count=0;
    if(n_pat==false){
        while(true){
            thisv=B[Ao[thisv]].second;
            count++;
            //cout<<thisv << " "<<count<<endl;
            if(thisv==0) break;
        }
        if(count<N) n_pat=true;
    }
    if(n_pat && who_pat) cout<<"Yes"<<endl;
    else cout << "No" <<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a+3);

    int sum = 0;
    if (a[0]%2 == a[1]%2) {
        sum += (a[1]-a[0])/2;
        sum += a[2]-a[1];
    }
    else {
        a[0]++, a[2]++;
        sum++;
        sum += (a[1]-a[0])/2;
        sum += a[2]-a[1];
    }

    cout << sum << endl;

    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); 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 OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, m;
    cin >> n >> m;
    int cost[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int num[m];
    rep(i, m) cin >> num[i];
    string dp[n + 1];
    dp[0] = "";

    for (int i = 1; i <= n; i++)
    {
        dp[i] = "";
        rep(j, m)
        {
            int t = i - cost[num[j]];
            if (t < 0 || (t != 0 && dp[t] == ""))
                continue;
            if (dp[i].size() < dp[t].size() + 1)
                dp[i] = dp[t] + to_string(num[j]);
            else if (dp[i].size() == dp[t].size() + 1)
                dp[i] = max(dp[i], dp[t] + to_string(num[j]));
        }
    }

    OP(dp[n]);

    return 0;
}


Measured memory_bytes: 31872
'use strict'

const main = (input) => {
    input = input.split('\n')
    const T = input[1].split(' ').map(v => parseInt(v))
    const M = parseInt(input[2])
    const P = input.slice(3, 3 + M)
    P.forEach(v => {
        let index = parseInt(v.split(' ')[0]) - 1
        let num = parseInt(v.split(' ')[1])
        let sum = 0
        T.forEach((v, i) => {
            if(i === index){
                sum += num
            }else{
                sum += v
            }
        })
        console.log(sum)
    })
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

/* # : 黒
 * . : 白
 * * : 塗った
 */

bool checker(std::vector<string> str, int x, int y){
	int xx[] = {1,0,-1,0};
	int yy[] = {0,1,0,-1};

	bool flag = true;

	for (size_t i = 0; i < 4; i++) {
		if (0 <= x+xx[i] && x+xx[i] < str.size() && 0<= y+yy[i] && y+yy[i] < str[0].size()) {
			if (str[x+xx[i]][y+yy[i]] == '#' || str[x+xx[i]][y+yy[i]] == '*') {
				str[x][y] = '*';
				str[x+xx[i]][y+yy[i]] = '*';
				flag = false;
			}
		}
	}

	if (flag) {
		return false;
	}

	flag = true;
	for (size_t i = 0; i < str.size(); i++) {
		for (size_t j = 0; j < str[i].size(); j++) {
			if (str[i][j] == '#') {
				flag = false;
				return checker(str,i,j);
			}
		}
	}

	if (flag) {
		return true;
	}
}

int main(int argc, char const *argv[]) {
	int h,w;
	std::cin >> h >> w;
	std::vector<string> str(h);
	int x,y;
	x = y = -1;
	for (size_t i = 0; i < h; i++) {
		std::cin >> str[i];
		for (size_t j = 0; j < str[i].size(); j++) {
			if (str[i][j] == '#') {
				x = i;
				y = j;
			}
		}
	}

	if (x == -1 && y == -1) {
		std::cout << "Yes" << '\n';
		return 0;
	}

	bool flag = checker(str,x,y);

	if (flag) {
		std::cout << "Yes" << '\n';
	}
	else {
		std::cout << "No" << '\n';
	}

	return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

const int MAX_A = 100000;
const int MAX_B = 100000;
const int MAX_Q = 100000;

//int p_in[MAX_N+1];
long long s[MAX_A+2], t[MAX_B+2];
long long X[MAX_Q+1];
int A, B, Q;

const long long lim = (long long)100000000000;

//bool tmp[MAX_N+1];

long long distance(const long long x, int ls, int lt) {
    assert(s[ls] <= x);
    assert(t[lt] <= x);
    long long ret = lim;
    long long tmp = 0;
    // 最初左
    if (t[lt] <= s[ls]) {
        tmp += x - s[ls];
        tmp += std::min(s[ls] - t[lt], t[lt + 1] - s[ls]);
    } else {
        tmp += x - t[lt];
        tmp += std::min(t[lt] - s[ls], s[ls + 1] - t[lt]);
    }
    ret = std::min(tmp, ret);

    // 最初右
    tmp = 0;
    if (s[ls+1] <= t[lt+1]) {
        tmp += s[ls+1] - x;
        tmp += std::min(t[lt+1] - s[ls+1], s[ls+1] - t[lt]);
    } else {
        tmp += t[lt+1] - x;
        tmp += std::min(s[ls+1] - t[lt+1], t[lt+1] - s[ls]);
    }
    ret = std::min(tmp, ret);

    return ret;
}

int get_lidx(long long x, long long* loc, int num) {
    int lb = 0;
    int ub = num;
    while (lb + 1 < ub) {
        assert(loc[lb] <= x && x < loc[ub]);
        int mid = (lb + ub) / 2;
        if (loc[mid] <= x) {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    return lb;
}

int main(int argc, char **argv) {
    std::cin >> A >> B >> Q;
    for (int i = 1; i <= A; i++) {
        std::cin >> s[i];
    }
    for (int i = 1; i <= B; i++) {
        std::cin >> t[i];
    }
    s[0] = -lim; t[0] = -lim; s[A+1] = lim; t[B+1] = lim;
    for (int i = 1; i <= Q; i++) {
        std::cin >> X[i];
    }

    for (int i = 1; i <= Q; i++) {
        int ls = get_lidx(X[i], s, A+1);
        int lt = get_lidx(X[i], t, B+1);
        //std::cout << ls << " " << lt << std::endl; 
        std::cout << distance(X[i], ls, lt) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 3712
N,M = map(int,input().split())
H = list(map(int,input().split()))
ans = [True for _ in range(N)]

for i in range(M):
    A,B = map(int,input().split())
    if H[A-1] > H[B-1]:
        ans[B-1] = False
    elif H[A-1] < H[B-1]:
        ans[A-1] = False
    else:
        ans[A-1] = False
        ans[B-1] = False

print(ans.count(True))

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

using namespace std;

int main(void)
{
  int a[3];
  int sum=0;
  for(int i=0;i<3;i++){cin>>a[i]; sum+=a[i];}
  int max_value=max({a[0],a[1],a[2]});
  int min_value=min({a[0],a[1],a[2]});
  int cen_value=sum-max_value-min_value;
  
  cout<<(cen_value-min_value)+(max_value-cen_value)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <string>
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
string s[200002];
bool cmp(int i,int j){
	int x=s[i].size();
	int y=s[j].size();
	if (x==y){
		for (int p=0;p<x;p++)if (s[i][p]!=s[j][p])return s[i][p]<s[j][p];
		return i<j;
	}
	int len=min(x,y);
	for (int p=0;p<len;p++)if (s[i][p]!=s[j][p])return s[i][p]<s[j][p];
	return len==x;
}
int r[200002];
bool cmp2(int i,int j){
	int x=s[i].size();
	int y=s[j].size();
	if (x!=y)return 0;
	for (int p=0;p<x;p++)if (s[i][p]!=s[j][p])return 0;
	return 1;
}
int a[200002],top,temp;
int main(){
	int n;
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>s[i];
		r[i]=i;
	}
	sort(r+1,r+1+n,cmp);
	/*
	cout<<endl;
	for (int i=1;i<=n;i++){
		cout<<s[r[i]]<<endl;
	}
	cout<<endl;
	cout<<"test"<<endl;
	*/
	if (n==1)cout<<s[1]<<endl;
	if (n==1)return 0;
	int cnt;
//	cnt=1,top=1,temp=1,a[1]=r[1];
	temp=1;cnt=0;
	for (int i=2;i<=n;i++){
		if (cmp2(r[i-1],r[i]))temp++;
		else{
			
//			cout<<temp<<" "<<s[r[i-1 ]]<<endl;
			
			if (top==temp)a[++cnt]=r[i-1];
			if (temp>top)cnt=1,a[cnt]=r[i-1],top=temp;
			temp=1;
		}
	}
	
	if (cmp2(r[n-1],r[n])){
		if (top==temp)a[++cnt]=r[n-1];
		if (top<temp)cnt=1,a[cnt]=r[n-1],top=temp;
	}else{
		if (top!=1);
		else{
			a[++cnt]=r[n];
		}
	}
	
	for (int i=1;i<=cnt;i++){
		cout<<s[a[i]]<<endl;
	}
	return 0;
}




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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int k;

signed main()
{
    cin >> k;
    unordered_map<int, vector<int>> index;

    vector<int> init0 = {1, 2, 3, 4, 5, 6, 7, 8, 9};

    if (k <= 9)
    {
        cout << init0[k - 1] << endl;
        return 0;
    }

    index[1] = init0;

    int cnt = 9;
    int cnt2 = 0;
    int t = 1;

    while (1)
    {
        vector<int> temp;
        cnt2 = 0;
        vector<int> tempvec = index[t];
        for (auto x : tempvec)
        {
            int x10 = x * 10;
            int x_10 = x % 10;
            if (x_10 == 0)
            {
                temp.pb(x10 + x_10);
                temp.pb(x10 + x_10 + 1);
                cnt += 2;
                cnt2 += 2;
            }
            else if (x % 10 == 9)
            {
                temp.pb(x10 + x_10 - 1);
                temp.pb(x10 + x_10);
                cnt += 2;
                cnt2 += 2;
            }
            else
            {
                temp.pb(x10 + x_10 - 1);
                temp.pb(x10 + x_10);
                temp.pb(x10 + x_10 + 1);
                cnt += 3;
                cnt2 += 3;
            }

            if (k <= cnt)
            {
                int y = cnt - k;
                cout << temp[temp.size() - 1 - y] << endl;
                return 0;
            }
        }
        index[t + 1] = temp;
        t++;
    }

    return 0;
}


Measured memory_bytes: 1692
#include <stdio.h>
#include <cmath>
#include <algorithm>

int main(){
	int n,tmp,count = 0,limit;
	scanf("%d",&n);

	for(int i = 0; i < n; i++)
	{
		scanf("%d",&tmp);
		limit = sqrt(tmp);
		for(int j = 2; j <= limit; j++){
			if(tmp%j==0){
				count++;
				break;
			}
		}
	}
	printf("%d\n",n-count);
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  if(A + B > C + D) {
    cout << "Left" << endl;
  }
  
  if(A + B < C + D) {
    cout << "Right" << endl;
  }
  
  if(A + B == C + D) {
    cout << "Balanced" << endl;
  }
}





Measured memory_bytes: 256