akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

int main()
{
	int N, n, maxn, count, maxcount;

	cin >> N;

	maxn = 1;
	maxcount = 0;
	for (int i = 2; i <= N; i++)
	{
		n = i;
		count = 0;
		while (n % 2 == 0)
		{
			n /= 2;
			++count;
		}
		if (count > maxcount)
		{
			maxn = i;
			maxcount = count;
		}
	}

	cout << maxn << endl;

	return 0; 
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	var sum int
	var tmp int

	fmt.Scanf("%d", &n)

	sum = 0
	for i := 1; i < n+1; i++ {
		tmp = int(n / i)
		sum = sum + i*tmp*(tmp+1)/2
	}

	fmt.Printf("%d\n", sum)
}

Measured memory_bytes: 1864
using System;

namespace B_Algae
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var r = int.Parse(input[0]);
            var d = int.Parse(input[1]);
            var x2000 = int.Parse(input[2]);
            for (var i = 1; i <= 10; i++)
            { 
                var x20xx = r * x2000 - d;
                x2000 = x20xx;
                Console.WriteLine(x20xx);
            }
        }
    }
}

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

int main(){
	int N;
	cin >> N;
	int H[N];
	for(int i = 0; i < N; i++) cin >> H[i];
	int res = 1;
	int j;
	for(int i = 1; i < N; i++){ 
		for(j = i - 1; j > 0; j--)
			if(H[j] > H[i]) break;
		if(j == 0 && H[0] <= H[i]) res++;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n, h;
    cin >> n >> h;
    vector<ll> a(n), b(n);
    rep(i, 0, n) cin >> a[i] >> b[i];
    sort(a.begin(), a.end(), greater<ll>());
    sort(b.begin(), b.end(), greater<ll>());

    ll ans = 0;
    rep(i, 0, n) {
        if (h > 0 && b[i] > a[0]) h -= b[i], ans++;
        else break;
    }
    if(h > 0) ans += (h+a[0]-1)/a[0];
    cout << ans << endl;
}

Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
#define pi acos(-1)
ld get_side(ld b, ld c, ld A){
    if(A == 180.0) return c + b;
    A *= pi / 180.0;
    return sqrt(b * b + c * c - 2 * b * c * cos(A));
}
ld a, b, h, m, va, vb;
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(18);
    cin >> a >> b >> h >> m;
    va = 360.0 / (60.0 * 12);
    vb = 360.0 / 60.0;
    ld da = va * (60 * h + m);
    ld db = vb * (60 * h + m);
    while(da > 360) da -= 360;
    while(db > 360) db -= 360;
    cout << get_side(a, b, min(abs(da - db), 360 - abs(da - db)));
    return 0;
}
	

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

struct Unionfind {
	vector<int> data;

	Unionfind(int n) { data.assign(n, -1); }

	int root(int n) {
		if (data[n] < 0) return (n);
		return (data[n] = root(data[n]));
	}

	int size(int n) { return (-data[root(n)]); };
	bool same(int x, int y) { return (root(x) == root(y)); }

	void unite(int x, int y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
};


void Main() {
	ll N, M; cin >> N >> M;
	vll A(M), B(M);
	vll ans(M);

	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i]; --A[i], --B[i];
	}

	ll all = N*(N-1)/2;	
	
	Unionfind tree(N);
	ans[M-1] = 0;
	for (int i = M-1; i > 0; i--) {
		if (!tree.same(A[i], B[i])) {
			ll sz1 = tree.size(A[i]);
			ll sz2 = tree.size(B[i]);
			tree.unite(A[i], B[i]);
			ll sz = tree.size(A[i]);
			ans[i-1] = ans[i] + sz*(sz-1)/2 - sz1*(sz1-1)/2 - sz2*(sz2-1)/2;
		} else {
			ans[i-1] = ans[i];
		}
	}

	for (int i = 0; i < M; i++) {
		cout << all-ans[i] << el;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r[n];
    int g[n];
    int b[n];
    if (s[0]=='R'){
        r[0] = 1;
        g[0] = 0;
        b[0] = 0;
    }
    if (s[0]=='B'){
        r[0] = 0;
        g[0] = 0;
        b[0] = 1;
    }
    if (s[0]=='G'){
        r[0] = 0;
        g[0] = 1;
        b[0] = 0;
    }

    for (int i = 1; i < n; ++i){
        if (s[i]=='R'){
            r[i] = r[i-1] + 1;
            g[i] = g[i-1];
            b[i] = b[i-1];
        }
        if (s[i]=='G'){
            r[i] = r[i-1];
            g[i] = g[i-1] + 1;
            b[i] = b[i-1];
        }
        if (s[i]=='B'){
            r[i] = r[i-1];
            g[i] = g[i-1];
            b[i] = b[i-1] + 1;
        }
    }
    //cout << r[n-1] << " " << g[n-1] << " " << b[n-1] << endl;

    long ans = 0;
    for (int i = 0; i < n-2; ++i){
        for (int k = i+1; k < n-1; ++k){
            if(s[i]=='R' && s[k]=='G'){
                if(s[k+(k-i)]=='B'){
                    ans+=b[n-1] - b[k] - 1;
                }else{
                    ans+=b[n-1] - b[k];
                }
            }
            if(s[i]=='G' && s[k]=='R'){
                if(s[k+(k-i)]=='B'){
                    ans+=b[n-1] - b[k] - 1;
                }else{
                    ans+=b[n-1] - b[k];
                }
            }

            if(s[i]=='R' && s[k]=='B'){
                if(s[k+(k-i)]=='G'){
                    ans+=g[n-1] - g[k] - 1;
                }else{
                    ans+=g[n-1] - g[k];
                }
            }
            if(s[i]=='B' && s[k]=='R'){
                if(s[k+(k-i)]=='G'){
                    ans+=g[n-1] - g[k] - 1;
                }else{
                    ans+=g[n-1] - g[k];
                }
            }

            if(s[i]=='B' && s[k]=='G'){
                if(s[k+(k-i)]=='R'){
                    ans+=r[n-1] - r[k] - 1;
                }else{
                    ans+=r[n-1] - r[k];
                }
            }
            if(s[i]=='G' && s[k]=='B'){
                if(s[k+(k-i)]=='R'){
                    ans+=r[n-1] - r[k] - 1;
                }else{
                    ans+=r[n-1] - r[k];
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	int ans1,ans2,ans3;
	ans1=max(x,y)*2*c;
	if(x>y){
		ans2=y*2*c;
		ans2=ans2+(x-y)*a;
	}
	else{
		ans2=x*2*c;
		ans2=ans2+(y-x)*b;
	}
	ans3=x*a+y*b;
	cout<<min(ans1,min(ans2,ans3));
}

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

struct town
{
    int ind, val;
} x[100005], y[100005];
struct edge
{
    int u, v, w;
} e[200005];
int i, n, dsu[1000005];
long long ans = 0;

inline bool operator < (const town &a, const town &b)
{
    return a.val < b.val;
}

inline bool operator < (const edge &a, const edge &b)
{
    return a.w < b.w;
}

int trace(int i)
{
    if (dsu[i] < 0)
        return i;
    dsu[i] = trace(dsu[i]);
    return dsu[i];
}

bool unity(int a, int b)
{
    int x = trace(a), y = trace(b);
    if (x == y)
        return 0;
    if (dsu[x] > dsu[y])
        swap(x, y);
    dsu[x] += dsu[y];
    dsu[y] = x;
    return 1;
}

int main()
{
    scanf("%d", &n);
    for (i = 1; i <= n; i++)
    {
        dsu[i] = -1;
        x[i].ind = y[i].ind = i;
        scanf("%d%d", &x[i].val, &y[i].val);
    }
    sort(x + 1, x + n + 1); sort(y + 1, y + n + 1);
    for (i = 1; i < n; i++)
    {
        e[2 * i - 1].u = x[i].ind; e[2 * i - 1].v = x[i + 1].ind; e[2 * i - 1].w = x[i + 1].val - x[i].val;
        e[2 * i].u = y[i].ind; e[2 * i].v = y[i + 1].ind; e[2 * i].w = y[i + 1].val - y[i].val;
    }
    sort(e + 1, e + 2 * n - 1);
    for (i = 1; i <= 2 * n - 2; i++)
        ans += (long long)e[i].w * (unity(e[i].u, e[i].v));
    printf("%lld", ans);
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n,p;
  cin >> n >> p;
  vll a(n);
  REP(i, n)
    cin >> a[i];

  bool odd = false;
  REP(i, n){
    if(a[i]%2 == 1)
      odd = true;
  }

  cout << fixed << setprecision(0);
  if(odd)
    cout << pow(2, n-1) << endl;
  else{
  if(p == 0)
    cout << pow(2, n) << endl;
  else
    cout << 0 << endl;
  }
}


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

int main()
{
    int a ,b,c ;
    scanf("%d %d %d",&a,&b,&c);

    if(a < b )
    {
        if(b < c)
            printf("Yes\n");
        else
            printf("No\n");
    }
    else
        printf("No\n");


    return 0;
}



Measured memory_bytes: 2100
n = int(input())
P =[]
s = 0
for _ in range(n):P += [[int(i) for i in input().split()]]
for j in range(n-1):s += P[j][0]*P[j+1][1] - P[j][1]*P[j+1][0]
s += P[-1][0]*P[0][1] - P[-1][1]*P[0][0]
print(s*0.5)

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

typedef long long ll;

const ll INF = 1000000000000000000;
//              123456789012345678

#define SMALLER 1
#define LARGER 2

vector<int> A;

ll get ( ll cnt ) {
  for ( auto x : A ) {
    cnt = cnt - ( cnt % x );
  }
  
  return cnt;
}

ll Find ( ll L , ll R , int Predicate ) {
  
  while ( L + 1 < R ) {
    
    ll med = ( L + R ) / 2;
    
    ll res = get ( med );
    
    if ( Predicate == SMALLER ) {
      if ( res < 2 ) L = med;
      else R = med;
    }
    else { // LARGER
      if ( res > 2 ) R = med;
      else L = med;
    }
    
  }
  
  if ( Predicate == SMALLER ) {
    return L;
  }
  else {
    return R;
  }
  
}

int main() {
  
  int k;
  scanf ( "%d" , &k );
  for ( int i = 0 ; i < k ; i++ ) {
    int tmp;
    scanf ( "%d" , &tmp );
    A.push_back ( tmp );
  }
  
  ll MaxSmaller = Find ( 0 , INF , SMALLER );
  ll MinLarger  = Find ( 0 , INF , LARGER );
  
  if ( MaxSmaller + 1 <= MinLarger - 1 ) {
    printf ( "%lld %lld\n" , MaxSmaller + 1 , MinLarger - 1 );
  }
  else {
    printf ( "-1\n" );
  }
  
  
  


  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > > 
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
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;}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a, b;
    cin >> a >> b ;
    
    if((a*b)%2==0) cout << "No" << endl ;
    else cout << "Yes" << endl;
    
    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}



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

int main()
{
    int l, w, c, r;
    while(true){
        cin >> l >> w >> c >> r;
        if(l == 0) break;
        cout << max(0, (c * w - l + r - 1) / r) << endl;
    }
}



Measured memory_bytes: 3120
#include <iostream>
#include <cassert>
//#define NDEBUG

/* 奇数行目 "#"始まり 1行出力 */
void OutOddLine(int w){
	using namespace std;
	for (int i = 1; i <= w; i++){	/* 横幅分の#.#. (左端: #) */
		switch(i % 2){
		case 0: cout << ".";		/* 左端から偶数個目 */
				break;
		case 1: cout << "#";		/* 左端から奇数個目 */
				break;
		}
	}
	cout << "\n";
}
/* 偶数行目 "."始まり 1行出力 */
void OutEvenLine(int w){
	using namespace std;
	for (int i = 1; i <= w; i++){	/* 横幅分の.#.# (左端: .) */
		switch(i % 2){
		case 0: cout << "#";		/* 左端から偶数個目 */
				break;		
		case 1: cout << ".";		/* 左端から奇数個目 */
				break;		
		}
	}
	cout << "\n";
}
/* 出力 */
void OutputChessboard(int h, int w){
	using namespace std;
	for (int i = 1; i <= h; i++){
		switch(i % 2){
		case 0: OutEvenLine(w);	/* 上から偶数行目 */
				break;
		case 1: OutOddLine(w);	/* 上から奇数行目 */
				break;
		default:						/* Do nothitng */
				break;
		}
	}
	cout << "\n";
}
int main(void){
	using namespace std;
	static const int INPUT_H_MIN = 1;	/* 前提は3以上だが、入力終了時は0 */
	static const int INPUT_H_MAX = 300;
	static const int INPUT_W_MIN = 1;	/* 前提は3以上だが、入力終了時は0 */
	static const int INPUT_W_MAX = 300;
	int input_h = 0;
	int input_w = 0;
	
	while(1){
		/* 高さHと横幅Wを入力 */
		cin >> input_h >> input_w;
		
		/* 入力値が、  両方0(入力終了時) or 前提条件 最大・最小の制限内の入力 */
		assert ((input_h == 0 && input_w == 0 ) || (INPUT_H_MIN <= input_h && input_h <= INPUT_H_MAX));
		assert ((input_h == 0 && input_w == 0 ) || (INPUT_W_MIN <= input_w && input_w <= INPUT_W_MAX));

		if(input_h == 0 && input_w == 0 ){
			break;
		}
		else{
			/* 出力 */
			OutputChessboard(input_h, input_w);
		}
	}
	
	return 0;
}


Measured memory_bytes: 3024
s = input()
abc = [0 for i in range(3)]

for i in range(3):
    if s[i]=="a" and abc[0]!=1:
        abc[0]=1
        continue
    elif s[i]=="b" and abc[1]!=1:
        abc[1]=1
        continue
    elif s[i]=="c" and abc[2]!=1:
        abc[2]=1
        continue
    else:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
#include <stdio.h>
int main(void)
{
    int a,b;
    
    scanf("%d %d",&a,&b);
    
    if(a < b)       printf("a < b\n");
    else if(a > b)  printf("a > b\n");
    else            printf("a == b\n");
    
    return 0;
}


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

def main():
    nyuuryoku = list(map(int, input().split()))
    k = nyuuryoku[0]
    x = nyuuryoku[1]
    num_list = []

    num_list.append(x)

    for i in range(k):
        if(x+i < 100000):
            num_list.append(x+i)

    for i in range(k):
        if(x-i > -100000):
            num_list.append(x-i)

    num_list_uniq = sorted(list(set(num_list)))
    print(*num_list_uniq)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int comp(const void* a,const void* b)
{
  return strcmp(a,b);
}

int main(void)
{
  char s[200000][11];
  long int n,i,c=1;

  scanf("%ld",&n);
  for(i=0;i<n;i++)
  {
    scanf("%s",s[i]);
  }

  qsort(s,n,sizeof(s[0]),comp);

  for(i=0;i<n-1;i++)
  {
    if(strcmp(s[i],s[i+1])!=0) c++;
  }

  printf("%ld\n",c);

  return 0;
}

Measured memory_bytes: 5700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=309;

int n,m,l;
ll dis[N][N],a[N][N];

int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m>>l;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
		if(i!=j)dis[i][j]=a[i][j]=1e18;
	}
	for(int i=1;i<=m;i++){
		int u,v,w;cin>>u>>v>>w;
		dis[u][v]=dis[v][u]=w;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]); 
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(dis[i][j]<=l&&i!=j)a[i][j]=1;
		}
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				a[i][j]=min(a[i][j],a[i][k]+a[k][j]); 
			}
		}
	}
	int qe;cin>>qe;
	while(qe--){
		int u,v;cin>>u>>v;
		if(a[u][v]==1e18)cout<<-1<<'\n';
		else cout<<a[u][v]-1<<'\n';
	}
	return 0;
} 

Measured memory_bytes: 2048
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ


int main()
{
    int n;
    int a;
    int b;
    cin >> n;
    cin >> a;
    cin >> b;
    int min = a * n;
    if (min > b) {
        min = b;
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void file(){
#ifndef ONLINE_JUDGE
	freopen("a_input.txt", "r", stdin);
	freopen("a_output.txt", "w", stdout);
#endif
}
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int dx[] = { 0, 0, 1, -1, 1, 1, -1, -1 };
int dy[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int main(){
	//file();
	fast();
	int n, a, s;
	cin >> n >> a >> s;
	int sum1 = 0, sum2 = 0, sum3 = 0;
	while (n--){
		int x;
		cin >> x;
		if (x <= a)
			sum1++;
		else if (x <= s)
			sum2++;
		else sum3++;
	}
	cout << min({ sum1, sum2, sum3 });
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int H,W,A,B;
    cin>>H>>W>>B>>A;
    int ans[H][W]={};
    for(int i=0;i<A;i++){
        for(int j=B;j<W;j++){
            ans[i][j]=1;
        }
    }
    for(int i=A;i<H;i++){
        for(int j=0;j<B;j++){
            ans[i][j]=1;
        }
    }
    rep(i,H){
        rep(j,W){
            cout << ans[i][j];
        }
        cout << endl;
    }



}

Measured memory_bytes: 11404
#include <stdio.h>

int A[1000000],n;

int binarySearch(int key){
  int left=0;
  int right=n;
  int mid;

  while(left<right){
    mid=(left+right)/2;
    if(key==A[mid]) return 1;
    if(key>A[mid]) left=mid+1;
    else if(key<A[mid]) right=mid;
  }
  return 0;
}

int main(){
  int i,q,k,sum=0;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&k);
    if(binarySearch(k)) sum++;
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2108
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());

using ll = long long int;
const ll MOD = 1000000007;

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

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

ll mod_add(ll a, ll b) {
    return (a + b) % MOD;
}

ll mod_sub(ll a, ll b) {
    return (a + MOD - b) % MOD;
}

ll mod_mul(ll a, ll b){
    return (a * b) % MOD;
}

ll mod_pow(ll base, ll po) {
    if(po == 0)
        return 1;
    else if(po == 1)
        return base;
    ll new_base = mod_pow(base, po / 2);
    return mod_mul(mod_mul(new_base, new_base), po % 2 == 0 ? 1 : base);
}

ll mod_div(ll a, ll b){
    return mod_mul(a, mod_pow(b, MOD - 2));
}

int main(){
    int x, k;
    cin >> k >> x;
    for(int i = x - k + 1; i < x + k; ++i) {
        cout << i;
        if(i != x + k - 1) {
            cout << ' ';
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
count = 10**9
for i in range(n):
    tmp = 0
    if a[i] % 2 == 0:
        for j in range(count):
            if a[i] % 2 == 0:
                a[i] = int(a[i]/2)
                tmp += 1
            else:
                count = tmp
                break
    else:
        count = 0
        break
print(count)


Measured memory_bytes: 3060
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<int> v;
typedef v::iterator vi;
int c = 0;

void ms(vi l, vi r)
{
	if (l + 1 < r) {
		int d = r - l;
		vi m = l + d / 2;
		c += d;
		ms(l, m);
		ms(m, r);
		inplace_merge(l, m, r);
	}
}

int main()
{
	int n;
	scanf("%d", &n);
	v S(n);
	for (int &x :S)
		scanf("%d", &x);

	ms(S.begin(), S.end());

	for (int &x: S)
		printf("%s%d", &x == &S[0] ? "": " ", x);
	puts("");
	printf("%d\n", c);
}


Measured memory_bytes: 5736
def binary_search(n, arr, target, lower=True):
    flg = True
    cnt = 0
    while flg:
        if n >> cnt:
            cnt += 1
        else:
            flg = False
    if lower:
        if target < arr[0]:
            return -1
        if target >= arr[n-1]:
            return n
        l, r = 0, n
        d = (l + r) // 2
        for i in range(cnt+1):
            if arr[d] <= target:
                l = d
                d = (l + r) // 2
            else:
                r = d
                d = (l + r) // 2
        return d

A, B, Q = map(int, input().split())
S = [-int(1e13)] + [int(input()) for _ in range(A)] + [int(1e13)]
T = [-int(1e13)] + [int(input()) for _ in range(B)] + [int(1e13)]
for i in range(Q):
    x = int(input())
    sl = binary_search(A+2, S, x)
    tl = binary_search(B+2, T, x)
    ll = max(x - S[sl], x - T[tl])
    lr = min(T[tl+1] - x + 2 * (x - S[sl]), 2 * (T[tl+1] - x) + x - S[sl])
    rl = min(S[sl+1] - x + 2 * (x - T[tl]), 2 * (S[sl+1] - x) + x - T[tl])
    rr = max(S[sl+1] - x, T[tl+1] - x)
    print(min(ll, lr, rl, rr))

Measured memory_bytes: 98500
n,k=map(int, input().split())
h=list(map(int,input().split()))
dp=[0]*(n)
if k+1<=n:
  max=k+1
else:
  max=n
  
for i in range(1,max):
  dp[i]=abs(h[0]-h[i])
 
for i in range(k,n):
  li=[abs(h[i]-h[ik])+dp[ik] for ik in range(i-1,i-k-1,-1) ]
  dp[i]=min(li)
  
print(dp[-1])

Measured memory_bytes: 20164
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();


// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

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


Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
int needleX[4] = { -1,0,1,0 };
int needleY[4] = { 0,1,0,-1 };

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string ans = "";



    while (N!=0) {
        ll a = N % 26;

        switch (a)
        {
        case 0:
            ans = 'z' + ans;
            break;
        case 1:
            ans = 'a' + ans;
            break;
        case 2:
            ans = 'b' + ans;
            break;
        case 3:
            ans = 'c' + ans;
            break;
        case 4:
            ans = 'd' + ans;
            break;
        case 5:
            ans = 'e' + ans;
            break;
        case 6:
            ans = 'f' + ans;
            break;
        case 7:
            ans = 'g' + ans;
            break;
        case 8:
            ans = 'h' + ans;
            break;
        case 9:
            ans = 'i' + ans;
            break;
        case 10:
            ans = 'j' + ans;
            break;
        case 11:
            ans = 'k' + ans;
            break;
        case 12:
            ans = 'l' + ans;
            break;
        case 13:
            ans = 'm' + ans;
            break;
        case 14:
            ans = 'n' + ans;
            break;
        case 15:
            ans = 'o' + ans;
            break;
        case 16:
            ans = 'p' + ans;
            break;
        case 17:
            ans = 'q' + ans;
            break;
        case 18:
            ans = 'r' + ans;
            break;
        case 19:
            ans = 's' + ans;
            break;
        case 20:
            ans = 't' + ans;
            break;
        case 21:
            ans = 'u' + ans;
            break;
        case 22:
            ans = 'v' + ans;
            break;
        case 23:
            ans = 'w' + ans;
            break;
        case 24:
            ans = 'x' + ans;
            break;
        case 25:
            ans = 'y' + ans;
            break;

        }
        //if (N / 26 == 0)break;
        if (N % 26 == 0) {
            N /= 26;
            N--;
        }
        else {
            N /= 26;
        }
        //cout << N << endl;
        
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define INF (INT64_MAX /2)
























const int mod = 998244353;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> L(K+1), R(K+1);
    for (int i = 1; i <= K ; i++) {
        cin >> L[i] >> R[i];
    }
    vector<long long> ans (N+1, 0), sum(N+1, 0);
    ans[1] = sum[1] = 1;
    for (int i = 2; i <= N; i++) {
        for (int j = 1; j <= K; j++) {
            if (i - L[j] <= 0) continue;
            ans[i] += sum[i - L[j]] - sum[max(0, i - R[j] - 1)];
            ans[i] %= mod;
        }
        sum[i] = sum[i - 1] + ans[i];
        sum[i] %= mod;
    }
    while(ans[N] < 0) ans[N] += mod;
    cout << ans[N] << endl;
}

Measured memory_bytes: 6400
#include<iostream>
#include<string>
using namespace std;
int main(){
  string S;
  int n;
  cin>>n;
  cin>>S;
  if(S.length()>n){
    for(int i=0;i<n;i++){
      cout<<S[i];
    }
    cout<<"..."<<endl;
  }
  else{
cout<<S<<endl;
  }
  
 return 0; 
}

Measured memory_bytes: 3596
#include <iostream>
#include <climits>

int main(){
long long max = LLONG_MIN , min = LLONG_MAX, sum = 0;
long long n, m;
std :: cin >> n;
while(n--){
std :: cin >> m;
max = max > m ? max : m;
min = min < m ? min : m;
sum += m;
}

std :: cout << min << ' ' << max << ' ' << sum << std :: endl;
}


Measured memory_bytes: 3120
S = input().strip()

odd_set = set(["R", "U", "D"])
even_set = set(["L", "U", "D"])

flag = True
for i,s in enumerate(S):
  if((i+1)%2 == 1):
    if(s not in odd_set):
      flag = False
      break
  else:
    if(s not in even_set):
      flag = False
      break
if(flag):
  print("Yes")
else:
  print("No")
      

Measured memory_bytes: 3060
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define loop(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;

using namespace std;
using LL = long long;
using ULL = unsigned long long;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) {
        par.assign(n, -1);
    }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    bool is_same(int x, int y) {
        return root(x) == root(y);
    }
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    int size(int x) {
        return -par[root(x)];
    }
};

int main() {
    int n, k, l; cin >> n >> k >> l;

    UnionFind uf_road(n), uf_railway(n);

    rep(i, k) {
        int p, q; cin >> p >> q;
        --p; --q;
        uf_road.merge(p, q);
    }
    rep(i, l) {
        int p, q; cin >> p >> q;
        --p; --q;
        uf_railway.merge(p, q);
    }

    map<pair<int, int>, int> ma;
    rep(i, n) {
        auto p = make_pair(uf_road.root(i), uf_railway.root(i));
        ma[p]++;
    }
    rep(i, n) {
        auto p = make_pair(uf_road.root(i), uf_railway.root(i));
        cout << ma[p] << " " ;
    }
    cout << endl;
}


Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

const ll MOD = 1e9+7;

template<int MOD> struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) v += MOD;
  }
  constexpr int getmod() { return MOD; }
  constexpr Fp operator - () const noexcept {
    return val ? MOD - val : 0;
  }
  constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
  constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
  constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
  constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
  constexpr Fp& operator += (const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator -= (const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator *= (const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator /= (const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator == (const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator != (const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
    return is >> x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
  friend constexpr Fp<MOD> modinv(const Fp<MOD> &a) noexcept {
    return modpow(a, MOD - 2);
  }
};

using mint = Fp<MOD>;

int main () {
  string S;
  cin >> S;
  int N = S.size();
  vector<vector<mint>> dp(N+1, vector<mint>(13, 0));
  dp[0][0] = 1;

  int r = 1;
  rep(i,N) {
    if(S[N-1-i] == '?') {
      rep(k,10) {
        int d = (k * r) % 13;
        rep(j,13) {
          dp[i+1][(j+d)%13] += dp[i][j];
        }
      }
    } else {
      int d = ((S[N-1-i] - '0') * r) % 13;
      rep(j,13) {
        dp[i+1][(j+d)%13] += dp[i][j];
      }
    }
    r *= 10;
    r %= 13;
  }

  cout << dp[N][5] << endl;

  return 0;
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    if(N==1){cout<<1<<endl;exit(0);}
    long long a=1,b=2,c;
    for(int i=1;i<N;i++){
        c=a+b;
        b=a;
        a=c;
    }
    cout<<c<<endl;

}

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

int main(){
	string s;
	cin >> s;
	
	int memo_A=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'){
			memo_A=i+1;
			break;
		}
	}
	
	int memo_Z=0;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='Z'){
			memo_Z=i+1;
			break;
		}
	}
	
	int ans=memo_Z - memo_A + 1;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
#include <unordered_map>
typedef long long ll;
 
 
#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    string tmp;
    unordered_map<string,ll> mp;
    ll ans = 0;

    for(ll i = 0; i < N; i++){
        cin >> tmp;
        sort(tmp.begin(),tmp.end());
        ans += mp[tmp];
        mp[tmp]++;
    }
    cout << ans << endl;

    return 0;
}

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

int n,k;
ll a[200005];
vector<ll> b[2];

int main(void){
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		if(a[i]>=0){
			b[0].push_back(a[i]);
		}else{
			b[1].push_back(-a[i]);
		}
	}
	sort(b[0].begin(),b[0].end());
	sort(b[1].begin(),b[1].end());
	ll ans=1;
	if(n==k){
		for(int i=0;i<b[0].size();i++){
			ans=ans*b[0][i]%MOD;
		}
		for(int i=0;i<b[1].size();i++){
			ans=ans*b[1][i]%MOD;
		}
		if(b[1].size()%2==1){
			ans=MOD-ans;
			ans%=MOD;
		}
	}else if(b[0].size()==0){
		if(k%2==1){
			for(int i=0;i<k;i++){
				ans=ans*b[1][i]%MOD;
			}
			ans=MOD-ans;
			ans%=MOD;
		}else{
			for(int i=b[1].size()-k;i<b[1].size();i++){
				ans=ans*b[1][i]%MOD;
			}
		}
	}else{
		int pos0=(int)b[0].size()-1;
		int pos1=(int)b[1].size()-1;
		if(k%2==1){
			ans=ans*b[0][pos0--]%MOD;
			k--;
		}
		for(int i=0;i<k/2;i++){
			bool flag=false;
			if(pos0-1>=0 && pos1-1>=0){
				ll v0=b[0][pos0]*b[0][pos0-1];
				ll v1=b[1][pos1]*b[1][pos1-1];
				if(v0<v1){
					flag=true;
				}
			}else if(pos0-1<0){
				flag=true;
			}
			if(!flag){
				ll val=b[0][pos0]*b[0][pos0-1]%MOD;
				ans=ans*val%MOD;
				pos0-=2;
			}else{
				ll val=b[1][pos1]*b[1][pos1-1]%MOD;
				ans=ans*val%MOD;
				pos1-=2;
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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

using namespace std;

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

    while(1){
        int m,nmin,nmax;
        cin>>m>>nmin>>nmax;

        if(m==0)break;

        vector<int> p(m);
        for(int i=0;i<m;i++)cin>>p[i];

        int ans=0,point=0;

        for(int i=nmin;i<=nmax;i++){
            int gap=p[i-1]-p[i];
            if(point<=gap){
                ans=i;
                point=gap;
            }
        }

        cout<<ans<<endl;

    }

}


Measured memory_bytes: 3132
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

signed main() {
    int n;
    int l[10];
    int max = 0;
    int ans = 0;
    cin >> n;
    rep (i, n) {
        cin >> l[i];
        if (max < l[i]) {
            max = l[i];
        }
        ans += l[i];
    }
    
    if (max * 2 < ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
h, w, m = map(int, input().split())
b = []
for i in range(m):
    hh, ww = map(int,input().split())
    hh -= 1
    ww -= 1
    b.append([hh, ww])
    
cnth = [0] * h
cntw = [0] * w
          
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    cnth[hh] += 1
    cntw[ww] += 1
    
mh = max(cnth)
mw = max(cntw)

cnt_mh = 0
for i in range(h):
    if cnth[i] == mh:
        cnt_mh += 1
cnt_mw = 0
for i in range(w):
    if cntw[i] == mw:
        cnt_mw += 1

cnt_m = 0
for i in range(m):
    hh, ww = b[i][0], b[i][1]
    if cnth[hh] == mh and cntw[ww] == mw:
        cnt_m += 1
print(mh+mw) if cnt_mh*cnt_mw > cnt_m else print(mh+mw-1)


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

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

const int N = 1e5 + 11;
const int M = 1e6 + 11;
const int MOD = 1e9 + 7;

int a[] = {0, 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 main(int argc, char **args){
    int k;
    cin >>k;
     cout << a[k] <<"\n";
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

ll n,m;
bool graph[55][55];
bool visited[55];
void bfs(){
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    int v=q.front();q.pop();
    visited[v]=true;
    rep(v2,n){
      if(graph[v][v2]==false)continue;
      if(visited[v2]==true)continue;
      q.push(v2);
    }
  }
}

int main(){
  cin>>n>>m;
  vector<ll> a(m),b(m);
  ll ans=0;
  fill(graph[0],graph[54],false);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--;
    b[i]--;
    graph[a[i]][b[i]]=true;
    graph[b[i]][a[i]]=true;
  }
  rep(i,m){
    fill_n(visited,55,false);
    graph[a[i]][b[i]]=false;
    graph[b[i]][a[i]]=false;
    bfs();
    rep(j,n){
      if(visited[j]==false){
        ans++;
        break;
      }
    }
    graph[a[i]][b[i]]=true;
    graph[b[i]][a[i]]=true;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int int64_t
#define p(f,...) //printf(f,##__VA_ARGS__)
using namespace std;
int N,M,xyz[1000][3],values[1000];
void solve(){
  int n_max=-1;
  for(int i=0;i<8;++i){
    int signs[3];
    for(int j=0;j<3;++j){
      signs[j]=i>>j&1?-1:1;
    }
    p("signs=%ld,%ld,%ld\n",signs[0],signs[1],signs[2]);
    for(int i=0;i<N;++i){
      values[i]=0;
      for(int j=0;j<3;++j){
        int value=signs[j]*xyz[i][j];
        values[i]+=value;
      }
    }
    sort(values,values+N);
    reverse(values,values+N);
    int value=0;
    for(int i=0;i<M;++i)value+=values[i];
    p("value=%ld\n",value);
    n_max=max(n_max,value);
  }
  cout<<n_max<<endl;
}
main(){
  cin>>N>>M;
  for(int i=0;i<N;++i)cin>>xyz[i][0]>>xyz[i][1]>>xyz[i][2];
  solve();
}


Measured memory_bytes: 256
class Dice():

    def __init__(self, label):
        self.label = label

    def north(self):
        self.change([2, 6, 3, 4, 1, 5])

    def west(self):
        self.change([3, 2, 6, 1, 5, 4])

    def east(self):
        self.change([4, 2, 1, 6, 5, 3])

    def south(self):
        self.change([5, 1, 3, 4, 6, 2])

    def rotate(self):
        self.change([1, 4, 2, 5, 3, 6])

    def change(self, convert):
        num = []
        for i in range(6):
            num.append(self.label[convert[i] - 1])
        self.label = num

    def is_same_dice(self, another_dice):
        for i in range(6):
            if i % 2 == 0:
                self.north()
            else:
                self.west()
            for j in range(4):
                self.rotate()
                if self.label == another_dice:
                    return True
        return False


def main():
    dices = []
    n = int(input())
    for i in range(n):
        dices.append(Dice([int(x) for x in input().split()]))

    flag = False
    for i in range(n):
        j = i + 1
        while j < n:
            if dices[i].is_same_dice(dices[j].label):
                flag = True
                break
            j += 1

    if flag:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Measured memory_bytes: 7804
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	
		int dx = tx - sx;
		int dy = ty - sy;
		//往復１
		int j = 0;
		while (j < 2) {
			if (j > 0) {
				dy *= -1;
				dx *= -1;
			}
			if (dy < 0) {
				rep(i, abs(dy)) {
					cout << "D";
				}
			}
			else {
				rep(i, dy) {
					cout << "U";
				}
			}
			if (dx < 0) {
				rep(i, abs(dx)) {
					cout << "L";
				}
			}
			else {
				rep(i, dx) {
					cout << "R";
				}
			}
			j++;
		}
		
		//往復2
		int i = 0;
		while (i < 2) {
			dy *= -1;
			dx *= -1;
			if (dy>0) {
				cout << "D" ;
			}
			else {
				cout << "U";
			}
			
			if (dx > 0) {
				rep(i, dx + 1) {
					cout << "R";
				}
			}
			else {
				rep(i, abs(dx)+ 1) {
					cout << "L";
				}
			}
			if (dy> 0) {
				rep(i, dy + 1) {
					cout << "U";
				}
			}
			else  {
				rep(i, abs(dy) + 1) {
					cout << "D";
				}
			}
			if (dx>0) {
				cout << "L";
			}
			else {
				cout << "R";
			}
			i++;
		}
	
}


Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
maze = [input() for _ in range(h)]
dist = [[99999] * w for _ in range(h)]
kuromasu_count = 0
for i in maze:
    kuromasu_count += i.count("#")

def bfs(x, y):
    q = deque()
    q.append((x, y))
    while q:
        x, y = q.popleft()    
        for dx, dy in [(0,1),(1,0),(0,-1),(-1,0)]:
            nx = x + dx
            ny = y + dy 
            if not 0 <= nx < h or not 0 <= ny < w:
                continue
            if maze[nx][ny] == "#":
                continue
            if dist[nx][ny] != 99999:
                continue      
            dist[nx][ny] = dist[x][y] + 1            
            q.append((nx, ny))



dist[0][0] = 0
goal_x, goal_y = h-1, w-1
bfs(0, 0)
shiromasu = dist[goal_x][goal_y]
if shiromasu == 99999:
    print("-1")
else:
    answer = h * w - (shiromasu + 1) - kuromasu_count
    print(answer)

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

int main() {
    string s, t, u;
    cin >> s >> t;
    int a, b;
    cin >> a >> b >> u;
    if(s == u) a--;
    if(t == u) b--;
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256