akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int main(){
   // freopen("file.in", "r", stdin);
    int n,m,a,b,cur=0;
    scanf("%d%d%d%d",&n,&m,&a,&b);
    for(int i=1;i<=n;i++){
    	if(!a)
    		cur^=1;
    	for(int j=1;j<=m;j++){
			printf("%d",cur);
			if(j==a)
				cur^=1;	
		}cur^=1;
		if(i==b)
			cur^=1;
		puts("");	
    }
	return 0;
}


Measured memory_bytes: 1280
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
typedef long long ll;
const ll MAX=510000;
const ll mod = 1e9 + 7;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L,G;
ll ans;
string S,T;
ll h[101010];
ll y[101010];
ll a[201010];
ll c[101010];
ll k[101010];
ll b[201010];
ll d[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll v[101010];
ll s[101010];
ll x[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main(){
    cin>>N>>K>>Q;
    ll count[101010];
    rep(i,0,N+1){
        count[i]=0;
    }
    rep(i,0,Q){
        cin>>a[i];
        count[a[i]]++;
    }
    rep(i,1,N+1){
        if(K-Q+count[i]>0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

signed main(void)
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    
    ll k = lcm(c,d);
    a--;
    ll r = (b -b/d -b/c +b/k) - (a -a/d -a/c +a/k);
    
    mes(r);
    
    
    
    
    
    
}

Measured memory_bytes: 3636
using System;

namespace ABC130
{
    class B
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int X = int.Parse(input[1]);

            input = Console.ReadLine().Split(' ');
            int d = 0;
            int count = 1;
            for (int i = 0; i < N; i++)
            {
                d = d + int.Parse(input[i]);

                if (X < d) break;

                count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int n,m;
char c[1010][1010];
long long f[1010][1010];
long long mod=1e9+7;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>c[i][j];
		}
	}
	f[0][1]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(c[i][j]!='#')
			{
				f[i][j]=f[i][j-1]+f[i-1][j];
				f[i][j]%=mod;
			}
		}
	}
	printf("%d",f[n][m]);
	return 0;
}


Measured memory_bytes: 9216
#include<stdio.h>
int main()
{ int j,i,A[101],d=0,c=0;
scanf("%d",&j);

for(i=1;i<=j;i++)
   {
    scanf("%d",&A[i]);
    if(A[i]%2==0){
    c=c+1;
    }
    }
 for(i=1;i<=j;i++)
 {
     if(A[i]%2==0&&(A[i]%3==0||A[i]%5==0))
    {
        d=d+1;
    }
 }
 if(c==d)
    printf("APPROVED");
else
    printf("DENIED");
return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()
 
int N, A[200000];
 
int main() {
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        A[i] -= i;
    }

    sort(A, A + N);
    int c1 = A[N / 2], c2 = A[(N + 1) / 2];
    REP(i, N) A[i] -= c1;
    ll ans1 = 0;
    REP(i, N) ans1 += abs(A[i]);

    REP(i, N) A[i] -= c2 - c1;
    ll ans2 = 0;
    REP(i, N) ans2 += abs(A[i]);

    cout << min(ans1, ans2) << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    vector<vector<int>> v(H, vector<int>(W, 0));
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < W; j++)
        {
            v[i][j] = 1;
        }
    }

    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < w; j++)
        {
            v[i][j] = 1;
        }
    }

    int ans = 0;
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            ans += 1 - v[i][j];
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
// 最長共通部分列 問題
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

#define MAX_N 100
// 無効な値の定義
const int INV = -1;

int main(void)
{
    int n, u, num, v_num;
    int ary_graph[MAX_N + 1][MAX_N + 1];

    for(int i = 0; i < MAX_N + 1; i++)
    {
        for(int j = 0; j < MAX_N + 1; j++)
        {
            // 配列の初期化
            ary_graph[i][j] = 0;
        }
    }

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> u;
        cin >> num;

        for(int j = 0; j < num; j++)
        {
            // 隣接点を記憶する
            cin >> v_num;
            // 0オリジンに変更する
            ary_graph[u - 1][v_num - 1] = 1;
        }
    }

    // 結果の表示をする
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if( j > 0 )
            {
                cout << " ";
            }

            cout << ary_graph[i][j];
        }

        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3116
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
 
using namespace std;
 
#define pai 3.14159265359
#define mod 1000000007

bool usengnum(int n, bool canuse[10])
{
    for(int i = 0; i < 5; i++){
        if(n < (int)pow(10, i)) break;
        int nownum = (n / (int)pow(10, i)) % 10;
        if(!canuse[nownum]) return false;
    }
    return true;
}

int main()
{
    int n, k;
    bool canuse[10];
    cin >> n >> k;
    for(int i = 0; i < 10; i++){
        canuse[i] = true;
    }
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        canuse[d] = false;
    }
    int ans = n;
    while(!usengnum(ans, canuse)) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#define MAX 500001

void maxHeapify(int [], int);
void buildMaxHeap(int []);
int left(int);
int right(int);
void swap(int *, int, int);

int H;

main()
{
  int A[MAX], i;

  scanf("%d", &H);
  for(i=1; i<=H; i++) scanf("%d", &A[i]);
  
  buildMaxHeap(A);
  
  for(i=1; i<=H; i++) printf(" %d", A[i]);
  printf("\n");
  
  return 0;
}

void buildMaxHeap(int A[])
{
  int i;
  
  for(i=H/2; i>0; i--) maxHeapify(A, i);
}

void maxHeapify(int A[], int i)
{
  int l, r, largest, temp;
  
  l = left(i);
  r = right(i);
  
  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  
  if(r <= H && A[r] > A[largest]) largest = r;

  if(largest != i)
    {
      /*
      temp = A[i];
      A[i] = A[largest];
      A[largest] = temp;
      */

      swap(A, i, largest);
      maxHeapify(A, largest);
    }
}

int left(int i)
{
  return 2*i;
}

int right(int i)
{
  return 2*i + 1;
}

void swap(int *A, int a, int b)
{
  int temp;
  
  temp = A[a];
  A[a] = A[b];
  A[b] = temp;
}

Measured memory_bytes: 2552
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n);
    for(auto &x : a){
        cin >> x;
    }
    ll sum = accumulate(ALL(a), 0LL);
    ll ans = LLONG_MAX;
    ll csum = 0;
    for(int i = 0; i < n - 1; i++){
        csum += a[i];
        ans = min(ans, abs(sum - csum - csum));
    }
    cout << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 1792
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e+9 + 7;

//マクロ
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  ll x2 = 0;
  rep(i, n)
  {
    if (i % 2)
      x2 -= a[i];
    else
      x2 += a[i];
  }
  vector<int> ans(n);
  ans[0] = x2 / 2;
  rep(i, n - 1)
  {
    ans[i + 1] = a[i] - ans[i];
  }
  rep(i, n) ans[i] *= 2;
  rep(i, n) printf("%d%c", ans[i], i == n - 1 ? '\n' : ' ');
  return 0;
}

Measured memory_bytes: 2048
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int i;
    int a1[b],a2[a];
    for(i=0;i<b;i++){
        a1[i]=a;
    }
    for(i=0;i<a;i++){
        a2[i]=b;
    }
    if(a>=b){
        for(i=0;i<a;i++){
            cout<<a2[i];
        }
    }
    else{
        for(i=0;i<b;i++){
            cout<<a1[i];
        }
    }
}

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

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=300+19;

int f[N],g[N],C[N][N];
int n,k,p;

int main(){
	n=IN(),k=IN(),p=IN();
	For(i,0,N){
		C[i][0]=1;
		For(j,1,i+1) C[i][j]=(C[i-1][j-1]+C[i-1][j])%p;
	}
	f[0]=1;
	For(i,1,k+1){
		memset(g,0,sizeof(g));
		g[0]=1;
		For(j,1,n+1){
			For(u,0,j){
				g[j]=(g[j]+1ll*g[u]*f[j-1-u]%p*C[j-1][u])%p;
			}
		}
		for (int j=n;j;j--){
			For(u,1,j+1){
				f[j]=(f[j]+1ll*g[u]*f[j-u]%p*C[j][u])%p;
			}
		}
	}
	printf("%d\n",f[n]);
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(int argc, char **argv)
{
	int nLength, nRequests;

	cin >> nLength >> nRequests;

	vector<int> tmpRequests;
	tmpRequests.reserve(nRequests);

	for (int i = 0; i < nRequests; i++)
	{
		int query;
		cin >> query;
		tmpRequests.push_back(query);
	}

	vector<int> requestVec;
	set<int> requestSet;

	requestVec.reserve(nRequests);

	for (int i = 0; i < nRequests; i++)
	{
		int query = tmpRequests[nRequests - 1 - i];

		if (requestSet.find(query) == requestSet.end())
		{
			requestVec.push_back(query);
			requestSet.insert(query);
		}
	}

	for (int i = 0; i < requestVec.size(); i++)
		cout << requestVec[i] << endl;

	for (int i = 1; i <= nLength; i++)
	{
		if (requestSet.find(i) == requestSet.end())
			cout << i << endl;
	}

	return 0;
}

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

int main()
{
  using ll = long long;
  ll N, a, b, c;
  cin >> N;
  vector<vector<ll>> h;
  for (auto i = 0; i < N; ++i) {
    cin >> a >> b >> c;
    h.push_back({a, b, c});
  }
  ll ma = h[0][0], mb = h[0][1], mc = h[0][2];
  for (auto i = 1; i < N ; ++i) {
    ma = h[i][0] + max(h[i-1][1], h[i-1][2]);
    mb = h[i][1] + max(h[i-1][0], h[i-1][2]);
    mc = h[i][2] + max(h[i-1][0], h[i-1][1]);
    h[i] = {ma, mb, mc};
  }
  cout << max(ma, max(mb, mc));
}


Measured memory_bytes: 6708
import sys
import itertools


def resolve(in_):
    n = int(in_.readline())
    a = list(map(int, in_.readline().split()))
    assert len(a) == n
    a.sort(reverse=True)
    ans = a[0]
    ans += sum(itertools.islice(itertools.chain.from_iterable((x, x) for x in a[1:]), n - 2))

    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

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

#define rep(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a);i>(b);i--)
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

main(){
  int n,a,b; cin >> n >> a >> b;
  string s;
  int m;
  int ans=0;
  FOR(i,1,n+1){
    s=to_string(i);
    //cout << s << endl;
    m=0;
    rep(j,s.size()) m+=s[j] - '0';
    if(a<=m && m<=b) ans+=i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
void solve(){
	int a[3][3];
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
			cin >> a[i][j];
	int n;
	cin >> n;
		bool flag = false;
	while(n--){
		int c;
		cin >> c;
		for(int i = 0; i < 3; i++)
		{	for(int j= 0; j <3;  j++){
				if(a[i][j] == c){
						a[i][j] = -1;
					}
			}
		}
	}
	for(int i = 0; i<3; i++)
	{int count = 0;
		for(int j = 0; j <3; j++){
			if(a[i][j] == -1)
				count++;
		}
		if(count == 3)
			flag = true;
	}
	for(int i = 0; i<3; i++)
	{
		int count = 0;
		for(int j = 0; j <3; j++){
			if(a[j][i] == -1)
				count++;
		}
		if(count == 3)
			flag = true;
	}		
	int count = 0;

	for(int i= 0; i<3; i++)
	{
		if(a[i][i] == -1)
			count++;
	}
	if(count == 3)
		flag = true;
		
	count = 0;
	for(int i= 0; i<3; i++)
	{
		if(a[i][3-i-1] == -1)
			count++;
	}	if(count == 3)
		flag = true;
	
	if(flag)	
	cout <<"Yes";
	else
		cout <<"No";
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
int main(){
  int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int b;
  std::cin >> b;
  std::cout << a[b - 1];
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
#define endl "\n";
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define POSITIVE_INFINITY 9223372036854775807
#define NEGATIVE_INFINITY -9223372036854775807
const ll MOD = 1000000007;

int main()
{
  FASTER;
  ll a, b;
  cin >> a >> b;
  if (b % a == 0){
    cout << a + b << endl;
  }
  else{
    cout << b - a << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int N;
	scanf("%d", &N);
	int a[20];
	int max = 0;
	int count = 0;
	for (int i = 0; i < N; i++){
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < N; i++){
		if (a[i]>max){
			max = a[i];
		}

		if (a[i] >= max){
			count++;
		}

	}

	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 128
import collections
que = collections.deque()
n,q = map(int,input().split())
T = 0
for i in range(n):
    que.append(list(input().split()))
while len(que) > 0:
    A = que.popleft()
    if int(A[1]) > q:
        A[1] = str(int(A[1])-q)
        que.append(A)
        T += q
    else:
        T += int(A[1])
        print(A[0],T)       


Measured memory_bytes: 14588
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
#include<functional> 
using namespace std;
#define mp make_pair
#define pb push_back
#define pf push_front
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define rep0(i,n) for(register int (i)=0;(i)<(n);++(i))
#define rep(i,st,ed) for(register int (i)=(st);(i)<=(ed);++(i))
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T a,const T b) {return a<b?a:b;}
template<typename T> il T qmax(const T a,const T b) {return a>b?a:b;}
template<typename T> il void getmin(T &a,const T b) {if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T b) {if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=1e5+7,M=N<<1;

int v[M],nxt[M];
int head[N];
bool used[N];
int n,tot;

il void addedge(int p,int x,int y){
	v[p]=y,nxt[p]=head[x],head[x]=p;
}

il bool chk(int u,int p){
	for(int e=head[u];e;e=nxt[e]){
		if(v[e]==p) continue;
		if(!chk(v[e],u)) return false;
		if(!used[v[e]]){
			if(used[u]) return false;
			used[u]=used[v[e]]=true;
		}
	}
	return true;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<n;++i){
		int x,y;
		scanf("%d%d",&x,&y);
		addedge(lch(i),x,y);
		addedge(rch(i),y,x);
	}
	if(chk(1,0)&&used[1]) puts("Second");
	else puts("First");
	return 0;
} 

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#ifdef MY_DEBUG_FLAG
template<typename T> void debug(T a) { cerr << a << ' '; }
template<typename T, typename U> void debug(pair<T, U> a) { cerr << a.first << ' ' << a.second << ' '; }
template<typename T> void debug(vector<T> a) { for(auto it : a) debug(it);}
template<typename T> void debug(set<T> a) { for(auto it : a) debug(it);}
#define db(a) cerr << "DEBUG ( " << #a << " == "; debug(a); cerr << ")\n"
#else
#define db(...)
#endif

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()

constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 1e5 + 10;
constexpr int mod = 1000000007;

void add_self(int& a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}

struct mat {
	vector<vector<int>> m;
	mat(int n) {
		m.resize(n,vector<int>(n));
	}
	mat operator* (const mat& b) {
		int n = sz(m);
		mat c = mat(n);
		rep(i,0,n)
			rep(j,0,n)
				rep(k,0,n)
					add_self(c.m[i][j], 1ll*m[i][k]*b.m[k][j]%mod);
		return c;
	}
};

mat expo(mat a, ll e) {
	int n = sz(a.m);
	mat s = mat(n);
	rep(i,0,n) s.m[i][i] = 1;
	while(e) {
		if(e&1)
			s = s*a;
		a = a*a;
		e >>= 1; 
	}
	return s;
}

int main() {
	int n; ll e; scanf("%d %lld", &n, &e);

	mat a = mat(n);
	rep(i,0,n) rep(j,0,n) scanf("%d", &a.m[i][j]);

	mat c = expo(a,e);

	int ans = 0;
	rep(i,0,n) rep(j,0,n) add_self(ans, c.m[i][j]);
	printf("%d\n", ans);
}


Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    x=abs(x);
    ll ans = 0;
    if (x / d <= k)
    {
        ll e = x / d;
        k -= e;
        x -= e * d;
        if (k % 2 == 1)
            x = abs(x - d);
        ans = x;
    }
    else
    {
        ans = x - k * d;
    }
    cout << abs(ans) << endl;
    return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a < 1 || a > 9 || b < 1 || b > 9)
    {
        cout << "-1" << endl;
        return 0;
    }
    int c = a*b;
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
class fastio {
public:
    fastio() {
        ios_base::sync_with_stdio(false);
        cout.tie(nullptr);
        cin.tie(nullptr);
    }
} __fastio;
void solve() {
  int count = 0; string a, b;
  cin >> a >> b;
  if(a[0] == b[0]) count++;
  if(a[1] == b[1]) count++;
  if(a[2] == b[2]) count++;
  cout << count << endl;
}
int main() {
  __fastio;
  solve();
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

int a[307][307];
bool on[307][307];
int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            cin >> a[i][j];
            on[i][j] = true;
        }
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (a[i][j] > a[i][k] + a[k][j]) {
                    cout << -1 << endl;
                    return 0;
                }
            }
        }
   }
   for (int k = 1; k <= n; k++) {
       for (int i = 1; i <= n; i++) {
           for (int j = 1; j <= n; j++) {
               if (i == j || i == k || j == k) continue;
               if (on[i][j] && on[i][k] && on[k][j] && a[i][j] == a[i][k] + a[k][j]) {
                   on[i][j] = on[j][i] = false;
               }
           }
       }
   }
   ll res = 0;
   for (int i = 1; i <= n; i++) {
       for (int j = i; j <= n; j++) {
           if (on[i][j]) res += a[i][j];
       }
   }
   cout << res << endl;
}



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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


bool C[8][8];

int main() {
    ios::sync_with_stdio(false);

    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 8; j++) {
            C[i][j] = !(i % 2 == 0 && j % 2 == 1);
        }
    }

    int q;
    cin >> q;
    for(int i = 0 ; i < q ; i++){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        --a,--b;
        int ans = 0;
        for(int y = a ; y < c ; y++){
            for(int x = b ; x < d ; x++){
                ans += C[y][x];
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3188
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        t: usize,
        v: [[usize; 2]; n]
    }
    if let Some(r) = v.iter().filter(|x| x[1] <= t).min_by_key(|x| x[0]) {
        println!("{}", r[0]);
    } else {
        println!("TLE");
    }
}


Measured memory_bytes: 4352
from collections import Counter,defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = 0
n = inp()
a = [inp() for _ in range(n)]
d = defaultdict(int)

for key in a:
    d[key] += 1
for i in d:
    if d[i] % 2:
        ans += 1 
print(ans)

Measured memory_bytes: 17488
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
    ll sum = 0, min1 = INF, min2 = INF;
    ll a;
    rep(i, 4) {
        cin >> a;
        sum += a;
        min1 = min(min1, a);
    }
    rep(i, 2) {
        cin >> a;
        sum += a;
        min2 = min(min2, a);
    }
    cout << sum-min1-min2 << endl;
}


Measured memory_bytes: 3104
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;

#define double      	long double
#define int         	long long
#define pb          	push_back
#define pii         	pair<int,int>
#define vi          	vector<int>
#define vii         	vector<pii>
#define mi          	map<int,int>
#define mii         	map<pii,int>
#define all(a)      	(a).begin(),(a).end()
#define sz(x)       	(int)x.size()
#define endl        	"\n"
#define repp(i,a,b) 	for(int i=a;i<b;i++)
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define brep(i,a,b)     for(int i=a;i>=b;i--)
#define deb1(x)      	cout << #x << "=" << x << endl
#define deb2(x, y)  	cout << #x << "=" << x << "," << #y << "=" << y << endl
#define deb3(x, y, z)  	cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define trace(v) 		for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
#define tracearr(a,l,r) for(int iii=l;iii<=r;iii++)cout << a[iii] << " ";cout << endl;
#define PI          	3.1415926535897932384626
#define F 				first
#define S 				second
#define clr(x,y) 		memset(x, y, sizeof(x))
#define IOS         	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
// *s.find_by_order(1) - gives the 2nd samllest element in set
// s.order_of_key(x)   - gives the number of elements in the set which are strictly smaller than x


const int N=1e5 + 5;
const int MOD=1e9 + 7;

int32_t main()
{
	IOS;
	int T=1;
	//cin >> T;
	// int numOfSetBits = __builtin_popcountll(n);
	std::cout << std::fixed << std::setprecision(12);
	while(T--)
	{
		string s,t;
		cin >> s >> t;
		map<char,int> mp;
		map<char,int> mp2;
		int n = s.size();
		int ans = 0;
		repp(i,0,n)
		{
			if(s[i]!=t[i])
				ans++;
		}
		cout << ans;
	}
}



Measured memory_bytes: 3788
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()
X, Y, H = [], [], []
Cx, Cy, Hc = 0, 0, 0
for i in range(N):
    x, y, h = zz()
    if (h != 0):
        x_t, y_t, h_t = x, y, h
    X.append(x)
    Y.append(y)
    H.append(h)
for Cx, Cy in itertools.product(range(0, 101), repeat=2):
    Hc = h_t + abs(Cx-x_t) + abs(Cy - y_t)
    # print(Cx, Cy, Hc)
    ok_count = 0
    for x, y, h in zip(X, Y, H):
        tmp = Hc - abs(Cx - x) - abs(Cy - y)
        if (h == max(tmp, 0)):
            ok_count += 1
        else:
            break
    if (ok_count == N):
        print(Cx, Cy, Hc)
        exit()


Measured memory_bytes: 27168
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

int N, A;
int x[50];
ll dp[51][10000];

int main() {

	cin >> N >> A;
	rep(i, N){ cin >> x[i]; }
	rep(i, N){ x[i] -= A; }

	for (int a = -2500; a <= 2500; a++){
		dp[0][a + 5000] = 0;
	}
	dp[0][0 + 5000] = 1;

	rep(i, N){
		for (int a = -2500; a <= 2500; a++){
			dp[i + 1][a + 5000] = dp[i][a + 5000] + dp[i][(a - x[i]) + 5000];
		}
	}

	cout << dp[N][0 + 5000] - 1 << endl;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

struct UnionFind {
  vector<int> d;
  UnionFind(int n) : d(n, -1) {}
  int root(int x) {
    if(d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return false;
    if(d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -d[root(x)]; }
};

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<set<int>> fr(n);
  UnionFind uf(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    fr[a].insert(b);
    fr[b].insert(a);
    uf.unite(a, b);
  }
  vi ans(n);
  rep(i, n) ans[i] = uf.size(i) - fr[i].size() - 1;
  rep(i, k) {
    int c, d;
    cin >> c >> d;
    c--;
    d--;
    if(uf.same(c, d)) {
      ans[c]--;
      ans[d]--;
    }
  }
  rep(i, n) cout << ans[i] << (i == n - 1 ? "\n" : " ");
}

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

using namespace std;

typedef long long int lli;

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

    int n, k, count = 1;
    string s;

    cin >> n >> k >> s;

    for (int i=1; i<s.length(); i++) {
        if (s[i] != s[i-1]) count++;
    }

    cout << n - max(1, count - k*2) << endl; 

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <iterator>

using namespace std;

int main() {
    string march = "MARCH";
    int N;
    cin >> N;
    map<char, long long int> mp;
    for(int i=0; i<5; i++) {
        mp[march[i]]=0;
    }
    
    for(int n=0; n<N; n++) {
        string str;
        cin >> str;
        
        if(mp.count(str[0])) mp[str[0]]++;
    }
    
    if(mp.size()<3) {
        cout << 0 << endl;
        return 0;
    }

    long long int ans=0;
    for(auto i=mp.begin(); i!=prev(mp.end(), 2); i++) {
        for(auto j=next(i, 1); j!=prev(mp.end(), 1); j++) {
            for(auto k=next(j, 1); k!=mp.end(); k++) {
                ans += i->second * j->second * k->second;
            }
        }
    }
    
    cout << ans << endl;

    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>

using namespace std;
typedef long long lint;

bool isPrime(int N) {
    if (N <= 1) return false;
    for (int i = 2; i * i <= N; i++) {
        if (N%i == 0) return false;
    }
    return true;
}

const int MAX = 100100;
int accum[MAX];

int main() {
    for (int i = 1; i < MAX; i++) {
        int num = i-1;
        accum[i] = accum[i-1] + (num % 2 == 1 && isPrime(num) && isPrime((num+1)/2) ? 1 : 0);
    }
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++) {
        int l, r;
        cin >> l >> r;
        cout << accum[r+1] - accum[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define deb(x) cout << #x << " " << x << endl;
#define rep(i, n) for (i = 0; i < n; i++)
#define Rep(i, k, n) for (i = k; i < n; i++)
#define write(x) cout << x << " ";
#define writeLine(x) cout << x << endl;
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ppi pair<int, int>
using namespace std;

int main()
{
    fast;

#ifndef ONLINE_JUDGE
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/input.txt", "r", stdin);
    freopen("/home/kalit/Desktop/Data Structures-Algo-Competitive/src/codeforces/output.txt", "w", stdout);
#endif
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    int ans = a[2] - a[1];
    a[0] = a[0] + ans;
    ans += (a[2] - a[0] + 1) / 2;
    if ((a[2] - a[0]) % 2 == 1)
    {
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define priority_queue pq 
typedef long long ll ;
typedef long double ld ;
typedef pair<ll, ll> pairs ;
ll mod = 1000000007 ;

ll dp[1234][1234] ; 
 
int main()
{
    //freopen("problem_name.out", "w", stdout) ;
    //freopen("problem_name.in", "r", stdin) ;
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
 
    //int t ; cin >> t ; while(t--){}
    int n , m ; cin >> n >> m ;
    dp[0][0] = 1 ;
    for ( int i = 0 ; i < n ; i++ )
    {
        string s ; cin >> s ;
        for ( int j = 0 ; j < m ; j++ )
        {
            if ( s[j] == '.' && i > 0 ) dp[i][j] += dp[i-1][j] ;
            if ( s[j] == '.' && j > 0 ) dp[i][j] += dp[i][j-1] ;
            if ( dp[i][j] >= mod  ) dp[i][j] -= mod ;
        }
    }
    cout << dp[n-1][m-1] ;
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    if(abs(A - B) % 2 == 0) {
        cout << (min(A, B) + max(A, B)) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int sx,sy,tx,ty;cin >> sx >> sy >> tx >> ty;
    int x = tx - sx;
    int y = ty - sy;
    cout << string(y,'U') << string(x,'R');
    cout << string(y,'D') << string(x,'L');
    cout << 'L' << string(y+1,'U') << string(x+1,'R') << 'D';
    cout << 'R' << string(y+1,'D') << string(x+1,'L') << 'U' << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<string,int>mp;
vector<string>v;
int main(){
	string s;
	int n;
	for(cin>>n;n--;){
		cin>>s;
		mp[s]++;
	}
	int mx=0;
	for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++){
		mx=max(mx,it->second);
	}
	for(map<string,int>::iterator it=mp.begin();it!=mp.end();it++)if(mx==it->second){
		v.push_back(it->first);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<(int)v.size();i++)cout<<v[i]<<endl;
	return 0;
}

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

int main()
{
    int a, b, c;

    cin >> a>> b >> c;
    int count = 0;
    for (a; a <= b; a++){
        if (c % a == 0){
            count++;
        }
    }
    cout << count << endl;
    return 0;

}


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

#下、右、上、左、右下、右上、左下、左上
dy=[1,0,-1,0,1,-1,1,-1]
dx=[0,1,0,-1,1,1,-1,-1]

H,W=map(int,input().split())
field=[]

for i in range(H):
  field.append(list(input()))

for y in range(H):
  for x in range(W):
    if field[y][x]=='#':
      continue
      
    cnt=0
      
    for n in range(8):
      nx=x+dx[n]
      ny=y+dy[n]
        
      if ny<0 or H<=ny or nx<0 or W<=nx:
        continue
        
      if field[ny][nx]=='#':
        cnt+=1
      
    field[y][x]=str(cnt)

for i in range(H):
  print(''.join(field[i]))

Measured memory_bytes: 3188
n = int(input())
n += 4
s = str(input())
s = "WR" + s + "WR"
lis = []
num = 1
for i in range(n-1):
    if s[i] != s[i+1]:
        lis.append(num)
        num = 1
    else:
        num += 1
lis.append(num)
  #print(lis)
W = 2
R = len(lis)-3

ans = 0
while W < R:
    if lis[W] > 0 and lis[R] > 0:
        lis[R] -= 1
        lis[W] -= 1
        ans += 1
    else:
        if lis[W] == 0:
            W += 2
        if lis[R] == 0:
            R -= 2
print(ans)

Measured memory_bytes: 10172
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,i,ans=0;
    cin>>a>>b>>c;
    int s[a];
    for(i=0;i<a;i++)
    {
        cin>>s[i];
        if(s[i]<b||s[i]>=c)
            ans++;
    }
    cout<<ans<<endl;
}

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

#4*a + 7*b == N ???

counter = 0
for a in range(N//4+1):
  for b in range(N//7+1):
    if 4*a + 7*b == N:
      counter += 1

if counter > 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
_n = gets.chomp
nums = gets.chomp.split.map(&:to_i)
freq = Array.new(100001){0}
nums.each do |a|
    freq[a] += 1
end
count = Array.new(100001){0}
100000.times do |i|
    count[i] = freq[i - 1] + freq[i] + freq[i + 1]
end
puts count.max


Measured memory_bytes: 10244
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string.h>
using namespace std;
string b[1000000];
bool cmp(string a, string b)
{
    return a < b;
}
int main()
{
    int n,l;
    cin >> n >> l;
    for(int i = 1;i <= n;++i)
        cin >> b[i];
    sort(b + 1,b + 1 + n,cmp); 
    for(int i = 1;i <= n;++i)
        cout << b[i];
    return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;n!=0;i++)
using namespace std;


int main(){
  int N,sum=0;cin>>N;int S=N;
  REP(i,N)sum+=N%10,N/=10;
  if(sum==1&&S>=10)sum=10;
  cout<<sum<<endl;
}

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

long long f[55];
long long p[55];

long long foo(int n, long long x) {
	if (n == 0) {
		return 1;
	}
	if (x == 1) {
		return 0;
	}
	if (x <= 1 + f[n - 1]) {
		return foo(n - 1, x - 1);
	}
	if (x == 1 + f[n - 1] + 1) {
		return 1 + p[n - 1];
	}
	if (x <= 1 + f[n - 1] + 1 + f[n - 1]) {
		return 1 + p[n - 1] + foo(n - 1, x - 2 - f[n - 1]);
	}
	return p[n];
}

int main () {
	f[0] = 1;
	p[0] = 1;
	for (int i = 1; i <= 50; ++i) {
		f[i] = 2 * f[i - 1] + 3;
		p[i] = 2 * p[i - 1] + 1;
	}
	int n;
	long long x;
	while (scanf("%d%lld", &n, &x) != EOF) {
		cout << foo(n, x) << endl;
	}
	return 0;
}

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


int main(){
    int n,a,b; cin >> n >> a >> b;
    int al = (b-a)/2;
    int bo = (b-a-1)/2;
    if((b-a-1)==0){
        cout << "Borys" << endl;
    }else if(al == bo){
        cout << "Borys" << endl;
    }
    else cout << "Alice" << endl;

}

Measured memory_bytes: 3588