akhauriyash/Code-Regression huggingface dataset:
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.S > b.S);
}


int main()
{

    fastread();

    ll i,j,n,m,p,a,sum=0,t,b,c,d,cnt=0,q,l,r;


    string str;

    cin>>t;


    ll to=0;
    ll te=0;

    vector<pll>open,close;
    while(t--)
    {
        cin>>str;

        ll o=0,e=0;

        for(auto  x : str)
        {
            if(x=='(')o++;

            else
            {
                if(o)o--;

                else e++;
            }
        }

        if(o>e)
            open.eb(o,e);

        else close.eb(o,e);

    }

    sort(vll(open),compare);

    sort(vll(close));

    ll ok=0;

    for(auto x : close)
    {
         if(ok<x.F)
           {

          ok=-1;
            break;

           }

         ok+=x.S;
         ok-=x.F;

    }
    if(ok>=0)
    {
        for(auto x : open)
        {
            if(ok<x.F)
            {
                ok=-1;
                break;
            }

         ok+=x.S;
         ok-=x.F;
        }

        if(ok==0)cout<<"Yes"<<endl;

        else cout<<"No"<<endl;
    }
    else cout<<"No"<<endl;



}



Measured memory_bytes: 19008
#include <bits/stdc++.h>
#define vi vector<int>
#define vs vector<string>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ull unsigned long long
#define ld long double
#define pll pair<unsigned long long,unsigned long long>
#define mod 1000000007
using namespace std;

signed main()
{
	vector<string> vec = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
	string s;
	cin>>s;
	int d = 6-(find(vec.begin(), vec.end(), s)-vec.begin());
	cout<<(d==0?7:d)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int n;
long long a[100001];
long long dp[100001][2];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    memset(dp,-127,sizeof(dp));
    dp[1][0]=0;
    for(int i=2;i<=n;i++){
        if(a[i-1]>=1 && a[i]>=1){
            dp[i][1]=max(dp[i-1][0]+(a[i-1]-1)/2+1,dp[i][1]);
            if(a[i-1]>=2) dp[i][1]=max(dp[i][1],dp[i-1][1]+(a[i-1]-2)/2+1);
        }
        dp[i][0]=max(dp[i-1][0]+a[i-1]/2,dp[i][0]);
        if(a[i-1]>=1) dp[i][0]=max(dp[i][0],dp[i-1][1]+(a[i-1]-1)/2);
    }
    cout<<max(dp[n][0]+a[n]/2,dp[n][1]+(a[n]-1)/2)<<endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define INF 1<<30
#define MAX 100005
#define ll long long
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
using namespace std;
bool isValid(ll x,ll y,ll H,ll W){
    if(x<0||x>=H||y<0||y>=W)
       return false;
    return true;
}
int main()
{
    speed;
    ll H,W;
    cin>>H>>W;
    ll dp[H+5][W+5];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(ll i=0;i<H;i++){
        string s;
        cin>>s;
        for(ll j=0;j<s.size();j++){
                if(s[j]!='#') {
                        if(isValid(i,j-1,H,W))
                            dp[i][j]+=dp[i][j-1]%MOD;
                        if(isValid(i-1,j,H,W))
                            dp[i][j]+=dp[i-1][j]%MOD;
                        dp[i][j]%=MOD;
                }
                else dp[i][j]=0;
        }
    }
    cout<<dp[H-1][W-1];
}


Measured memory_bytes: 8192
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def bfs(maze, H, W):
    visited = [[-1] * W for _ in range(H)]
    q = deque([])
    for h in range(H):
        for w in range(W):
            if maze[h][w] == "#":
                visited[h][w] = 0
                q.append((h, w))

    res = 0
    while q:
        h, w = q.popleft()

        for dh, dw in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            nh = h + dh
            nw = w + dw
            if 0 <= nh < H and 0 <= nw < W:
                if visited[nh][nw] == -1 and maze[nh][nw] == ".":
                    visited[nh][nw] = visited[h][w] + 1
                    if res < visited[nh][nw]:
                        res = visited[nh][nw]
                    q.append((nh, nw))

    return res


def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]
    ans = bfs(S, H, W)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 86364
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double lod;
const int N=4e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
struct P{ int x,y; inline bool operator < (const P &b) const { return y<b.y; } }p[N];
int x[N],c[N];
int mn[N];
int main()
{
	int x1=gi(),y1=gi(),x2=gi(),y2=gi(),i;
	int n=gi(),t,k,sum=0,s;
	const lod pi=3.14159265358979323846;
	for (i=1;i<=n;i++)
		p[i].x=gi(),p[i].y=gi();
	if (x1>x2) { x1*=-1; x2*=-1; for (i=1;i<=n;i++) p[i].x*=-1; }
	if (y1>y2) { y1*=-1; y2*=-1; for (i=1;i<=n;i++) p[i].y*=-1; }
	for (i=1;i<=n;i++)
		if (p[i].x<x1||x2<p[i].x||p[i].y<y1||y2<p[i].y) p[i--]=p[n--];

	for (i=1;i<=n;i++) x[i]=p[i].x;
	sort(x+1,x+1+n);
	sort(p+1,p+1+n);
	for (i=1;i<=n;i++) {
		k=lower_bound(x+1,x+1+n,p[i].x)-x;
		s=0;
		for (t=k;t;t^=t&-t) s=max(s,c[t]);
		sum=max(sum,++s);
		for (t=k;t<=n;t+=t&-t) c[t]=max(c[t],s);
	}
	printf("%.15lf\n",100LL*(x2-x1+y2-y1)+(sum==min(y2-y1,x2-x1)+1?-(sum-1)*(20-5*pi)+10*pi-20:-sum*(20-5*pi)));
	return 0;
}


Measured memory_bytes: 4992
#include <stdio.h>
#define maxn 15

int main(){
    int n;
    char s[10];
    int u[maxn];
    double x[maxn];
    scanf("%d", &n);
    for(int i=0; i<n; i++){
        scanf("%lf%s", &x[i], s);
        if(s[0]=='J'){
            u[i] = 0;
        }else{
            u[i] = 1;
        }
    }
    double total=0;
    for(int i=0; i< n; i++){
        if(u[i]){
            total += x[i] * 380000.0;
        }else{
            total += x[i];
        }
    }
    printf("%lf\n", total);
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairInt;
typedef tuple<int, int, int> tuple3Int;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

ll pow(ll base, uint exp) {
  if (exp == 0) return 1;

  if (exp % 2 == 0) {
    return pow(base * base, exp / 2);
  } else {
    return base * pow(base * base, exp / 2);
  }
}

int main(int argc, char *argv[]) {
  int N, S;
  vector<vector<int>> vecs;

  scanf("%d%d", &N, &S);
  vecs.emplace_back(N);

  FOR(i, N) {
    scanf("%d", &vecs[0][i]);
    if (vecs[0][i] >= S) {
      printf("1\n");
      return 0;
    }
  }

  int step = 1;
  int k;
  for (k = 1; 2 * step <= N; k++) {
    vecs.emplace_back(N);
    FOR(j, N - 2 * step + 1) {
      vecs[k][j] = vecs[k - 1][j] + vecs[k - 1][j + step];
      if (vecs[k][j] >= S) {
        goto LOOP_END;
      }
    }
    step *= 2;
  }
LOOP_END:
  k -= 1;

  vector<int> vec(vecs[k]);
  for (k--; k >= 0; k--) {
    if (step + pow(2, k) <= N) {
      vector<int> tmp(N);
      FOR(i, N - step - pow(2,k) + 1) {
        tmp[i] = vec[i] + vecs[k][i + step];
        if (tmp[i] >= S) {
          goto CONTINUE;
        }
      }
      step += pow(2, k);
      vec.clear();
      copy(tmp.begin(), tmp.end(), back_inserter(vec));
    }
  CONTINUE:
    ;
  }

  if (step == N) {
    printf("0\n");
  } else {
    printf("%d\n", step + 1);
  }

// for (int i = step + 1; i <= MIN(2 * step, N); i++) {
//   FOR(j, N - i + 1) {
//     b[j] += a[j + i - 1];
//     if (b[j] >= S) {
//       printf("%d\n", i);
//       goto EXIT;
//     }
//   }
// }
// printf("0\n");

EXIT:
  return 0;
}

Measured memory_bytes: 10536
def find(x):
    '''
    xの根を求める
    O(α(N))
    '''
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]


def union(x, y):
    '''
    xとyの属する集合を併合する
    '''
    x = find(x)
    y = find(y)
    
    if x == y:
        return False

    if par[x] > par[y]:
        x, y = y, x

    par[x] += par[y]
    par[y] = x
    return True


def size(x):
    '''
    xが属する集合の個数を求める
    '''
    return -par[find(x)]


def same(x, y):
    '''
    xとyが同じ集合に属するかを判定する
    '''
    return find(x) == find(y)


n, m = map(int, input().split())

par = [-1] * n
for _ in range(m):
    a, b = map(int, input().split())
    if not same(a-1, b-1):
        union(a-1, b-1)

res = 0
for i in range(n):
    res = max(res, size(i))

print(res)

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll L;

struct node{
  node *nxt[2];
  bool end;
  int len;
  node(int len):len(len){
    nxt[0] = nxt[1] = NULL;
    end = len >= L;
  }
};

char s[125252];

int ilog(ll x){
  int ret = 0;
  while(x){
    x>>=1;
    ret++;
  }
  return ret-1;
}

ll f(ll x){
  if(x==0)return 0;
  while(true){
    int l = ilog(x);
    if(x == 1ll<<l){
      return x;
    }else{
      x = (1ll<<(l+1)) - x;
    }
  }
}

ll dfs(node *p){
  if(p->end)return 0;
  ll ret = 0;
  if(p->nxt[0]==NULL){
    ll h = L - (p->len);
    ret ^= f(h);
  }else{
    ret ^= dfs(p->nxt[0]);
  }
  if(p->nxt[1]==NULL){
    ll h = L - (p->len);
    ret ^= f(h);
  }else{
    ret ^= dfs(p->nxt[1]);
  }
  return ret;
}

int main(){
  scanf("%d%lld",&n,&L);
  node *root = new node(0);
  REP(i,n){
    scanf("%s",s);
    int len = strlen(s);
    node *cur = root;
    REP(j,len){
      int to = s[j] - '0';
      if(cur->nxt[to]==NULL){
        cur->nxt[to] = new node(j+1);
      }
      cur = cur->nxt[to];
    }
    cur->end = true;
  }
  ll cnt = dfs(root);
  puts(cnt==0 ? "Bob" : "Alice");
  return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<map>
using namespace std;
typedef long long ll;

char grid[404][404];
bool is_checked[404][404];
int colored_grid[404][404];
int dh[4] = {0, -1, 0, 1}, dw[4] = {-1, 0, 1, 0};
int H, W;
map<int, ll> black_mp;
map<int, ll> count_mp;

void dfs(char color, int check_color, int h, int w) {
    colored_grid[h][w] = check_color;
    if (color == '#') black_mp[check_color]++;
    is_checked[h][w] = true;
    for (int i = 0; i < 4; i++) {
        int now_h = h + dh[i], now_w = w + dw[i];
        if (now_h >= 0 && now_h < H && now_w >= 0 && now_w < W && grid[now_h][now_w] != grid[h][w] && !is_checked[now_h][now_w]) {
            dfs(grid[now_h][now_w], check_color, now_h, now_w);
        }
    }
    return;
}

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) cin >> grid[i][j];
    }
    int now_number = 1;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (!is_checked[i][j]) {
                dfs(grid[i][j], now_number, i, j);
            }
            now_number++;
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) count_mp[colored_grid[i][j]]++;
    }
    ll ans = 0LL;
    for (int i = 1; i < now_number; i++) {
        ans += black_mp[i] * (count_mp[i] - black_mp[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 36224
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
#include <bitset>
#include <math.h>
#include <vector>
#include <set>

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; }
const long long INF = 1LL<<60;

using namespace std;

int main(){
    int x, y; cin >> x >> y;
    cout << x + (y / 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int main(void){
    long long int n,x,t,a,ans;
    cin>>n>>x>>t;
    if(n%x==0){a=n/x;}
    else{a=n/x+1;}
    cout<<a*t<<endl;
    
}


Measured memory_bytes: 3628
require 'pp'

N = readline.to_i
sum = 0.0
btc = 380000.0
N.times do |i|
  x,u = readline.chomp.split
  if u == 'BTC'
    sum += x.to_f * btc
  else
    sum += x.to_f
  end
end
puts sum




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

int main()
{

  long long a,b ;
  cin >> a >> b  ;

  for(int i=1;i<=b;i++){
      if(i*a%b==0){
         cout << a*i << endl;
          break ;
      }
  }


    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>

int field[51][51];
int w,h;

void land(int x,int y){
	field[x][y]=0;

	for(int yy=-1;yy<=1;yy++){
		for(int xx=-1;xx<=1;xx++){
			if(x+xx>=0&&x+xx<=w&&y+yy>=0&&y+yy<=h){
			   if(field[x+xx][y+yy]==1) land(x+xx,y+yy);
			}
		}
	}
	return;
}

int main(void){

	int kazu=0;

	while(1){

	scanf("%d %d",&w,&h);

	if(w==0&&h==0) break;

	kazu=0;

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			scanf("%d",&field[j][i]);
		}
	}

	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){

			if(field[j][i]==1){
				land(j,i);
				kazu++;
			}

		}
	}

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

	return 0;
}

Measured memory_bytes: 1336
# 数えていく おしまい
n = int(input())
used = [False for _ in range(n)]
arr = list(map(int, input().split()))
ans = 0
for i, a in enumerate(arr):
    if i + 1 == arr[a - 1]:
        if used[i] == False:
            ans += 1
            used[i] = True
            used[a - 1] = True
print(ans)


Measured memory_bytes: 14748
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		string ans = "No";
		if(str.IndexOf("a") >= 0 && str.IndexOf("b") >= 0 && str.IndexOf("c") >= 0){
			ans = "Yes";
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13280
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    ll N, A, B; cin >> N >> A >> B;
    ll C = N / (A+B);
    ll ans = C * A;
    N %= (A+B);
    ans += min(A, N);
    cout << ans << endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";


/*
  辺に属性がある場合
  struct edge {int to, cost; };
  vector<edge> G[MAX_V];
  */
const int MAX_N = 20000;
vector<vector<int> > G(MAX_N,vector<int>(0)); //0-indexed
vector<bool> used(MAX_N,false);
int ind = 0;
void roop(int nv, vector<int> c, vector<int> &ans){
    used.at(nv) = true;
    rep(i,G.at(nv).size()){
        int nextv = G.at(nv).at(i);
        //if(!used.at(nextv)) cout<<"roop"<<nv<<i<<nextv<<endl;
        if(!used.at(nextv)) roop(nextv, c, ans);
    }
    ans.at(nv) = c.at(ind);
    ind++;
    //cout<<ans.at(ind-1)<<ind<<endl;
    return;
}

int main() {
    cin>>N;
    int V=N,E=N-1;
    for(int i = 0; i < E; i++) {
        // sからtへの辺を張る
        int s,t;
        cin>>s>>t;
        G.at(s-1).push_back(t-1);
        G.at(t-1).push_back(s-1); 
    }
    /*rep(i,N){
        rep(j,G.at(i).size()){
            cout<<G.at(i).at(j) << endl;
        }
    }*/
    ll M = 0;
    vector<int> c(N,0);
    rep(i,N) {
        cin>>c.at(i);
    }
    sort(c.begin(),c.end());
    rep(i,N-1) M += c.at(i);
    vector<int> ans(N,0);
    roop(0,c,ans);
    cout<<M<<endl;
    rep(i,N) cout<<ans.at(i)<<' ';
    cout<<endl;    

    return 0;
}

Measured memory_bytes: 393088
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
using namespace std;

int main() {
    int n;
    cin >> n;
    cout << n*(n+1)/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main ()
{
    string s;
    map<char,int>mp;
    cin>>s;
    for(int i=0;i<s.length();i++)
        mp[s[i]]++;
    cout<<((mp.size()==2)?"Yes" : "No")<<endl;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	int w;
	int h;
	int count;
	short[][] map;
	int[][] dp;
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			w = scan.nextInt();
			h = scan.nextInt();
			if(w == 0 && h == 0){
				break;
			}
			map = new short[h][w];
			for(int i = 0;i < h;i++){
				for(int j = 0;j < w;j++){
					map[i][j] = scan.nextShort();
				}
			}
			dp = new int[h+1][w];
			for(int i = 0;i < w;i++){
				if(map[0][i] == 0){
					dp[0][i] = 1;
				}else{
					dp[0][i] = 0;
				}
			}
			for(int i = 1;i < h;i++){
				for(int j = 0;j < w;j++){
					if(map[i][j] == 1){
						dp[i][j] = 0;
					}else if(map[i][j] == 2){
						if(i < h-1){
							dp[i+2][j] += dp[i-1][j] + dp[i][j];
							dp[i][j] = 0;
						}else{
							dp[i][j] += dp[i-1][j];
						}
					}else{
						if(j != 0){
							dp[i][j] += dp[i-1][j-1];
						}
						if(j != w-1){
							dp[i][j] += dp[i-1][j+1];
						}
						dp[i][j] += dp[i-1][j];
					}
				}
			}
			count = 0;
			for(int i = 0;i < w;i++){
				count += dp[h-1][i] + dp[h][i];
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 23612
#define George_Plover
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define MAXN 101
#define MAXM
#define INF
using namespace std;
int n,m;
int a[MAXN];
int main()
{
    cin>>n;
    bool flag=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            if(a[i]%3!=0&&a[i]%5!=0)
            {
                flag=1;
            }
        }
    }
    
    if(flag)
    {
        cout<<"DENIED"<<endl;
    }
    else
    {
        cout<<"APPROVED"<<endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n, x, y; cin >> n >> x >> y;
	printf("%d %d\n", min(x, y), max(0, (x + y) - n));	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;
  for (ll i = 0; i < N; i++)
  {
    ll A;
    cin >> A;
    
    if (A % 2 == 0)
    {
      if (A % 3 != 0 && A % 5 != 0)
        FINALANS("DENIED");
    }
  }
  FINALANS("APPROVED");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define iiii pair<int,pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
    int x=0,p=1;char c=getchar();
    while (c<=32)c=getchar();
    if(c==45)p=-p,c=getchar();
    while (c>32)x=x*10+c-48,c=getchar();
    return x*p;
}
using namespace std;
//ruogu
const int N=1e5+5;
int n,m,a[N];
vector<int>v[N];
priority_queue<int>pq;
//
int main(){
	n=getint();m=getint()+1;
	rep(i,n){
		int x=getint();a[i]=getint();
		if(m-x>0)v[m-x].push_back(a[i]);
	}
	int res=0;
	for(int i=m;i>=1;i--){
		rep(j,v[i].size())pq.push(v[i][j]);
		if(pq.size()){
			res+=pq.top();
			pq.pop();
		}
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdlib.h>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main(void) {
	unsigned long int a[10], index = 0, min = 9, i=0, sum = 0;
	
	while(cin >> a[i]){
	    if(a[i] % 10 < min && a[i] % 10 != 0){
	        min = a[i] % 10;
	        index = i;
	    }
	    i++;
	}
	
	for(int i = 0 ; i < 5 ; i++){
	    if(i == index){
	        continue;
	    }else if(a[i] % 10 != 0){
	        a[i] += 10 - a[i] % 10;
	    }
	    sum += a[i];
	}
	sum += a[index];
	cout << sum << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import re
import math

n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

a = 0

for (i, j) in zip(v, c):
    d = i - j
    if d > 0:
        a += d

print(a)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << (a) << endl
#define all(v) v.begin(), v.end()
#define rsort(v) sort(v.rbegin(), v.rend())


int main() {
  int N,K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i,N) {
    cin >> A[i];
  }
  rep(i,N-K) {
    print((A[i]<A[i+K])?"Yes":"No");
  }
  return 0;
}

Measured memory_bytes: 4052
n = int(input())
alph = [chr(i) for i in range(97, 123)]
x = 26
for i in range(1, 50):
    if n > x:
        n -= x
        x *= 26
    else:
        n -= 1
        ans = [0] * i
        for j in range(i):
            ans[j] = alph[n % 26]
            n //= 26
        ans.reverse()
        print("".join(ans))
        exit()

Measured memory_bytes: 9128
N = int(input())
S = []
for _ in range(N):
    D = list(map(int, input().split()))
    S.append(D)

dp = [[0 for _ in range(3)] for _ in range(N+1)]

for i in range(1,N+1):
    for j in range(3):
        for k in range(3):
            if j != k:
                happy =  dp[i-1][k] + S[i-1][j]
                if dp[i][j] < happy:
                    dp[i][j] = happy

print(int(max(dp[N])))

Measured memory_bytes: 47328
N = int(input())
C = []
S = []
F = []
for i in range(N - 1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for n in range(N):
    if n != N - 1:
        # start n-th station
        t = S[n]
        for i in range(n, N - 1):
            # time to take a train i -> i+1
            t += C[i]
            # goto next station
            if i != N - 2:
                if t <= S[i + 1]:
                    t = S[i + 1]
                else:
                    if t % F[i + 1] != 0:
                        t += F[i+1] - (t % F[i+1])
        print(t)
    else:
        # start at final destination
        print(0)

Measured memory_bytes: 3188
n = int(input())
hoge = [0 for i in range(0,n)]
for i in range(0,n):
    hoge[i] = input()
    
AC_n = hoge.count('AC')
WA_n = hoge.count('WA')
TLE_n = hoge.count('TLE')
RE_n = hoge.count('RE')

result = {
	'AC': AC_n,
  	'WA': WA_n,
  	'TLE': TLE_n,
  	'RE': RE_n
}

for k, v in result.items():
  print('{} x {}'.format(k,v))
  

Measured memory_bytes: 16256
n = int(input())
nums = [n]
count = 1
flag = True

while flag :
    count += 1
    if (nums[-1] % 2):
        num = 3 * n + 1
        nums.append(num)
        if (nums.count(num) == 2):
            flag = False
    else :
        num = n / 2
        nums.append(num)
        if(nums.count(num) == 2):
            flag = False
    n = num

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  A=(A+12)%14,B=(B+12)%14;
  if(A>B)cout<<"Alice"<<endl;
  if(A<B)cout<<"Bob"<<endl;
  if(A==B)cout<<"Draw"<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin>>N;
	vector<vector<int> > fld(N,vector<int>(N));
	for(int r=0;r<N;++r){
		string str;
		cin>>str;
		for(int c=0;c<N;++c){
			fld[r][c] = str[c]-'a';
		}
	}
	int ans = 0;
	//スライド
	for(int s=0;s<N;++s){
		bool flag = true;
		for(int r=0;flag && r<N;++r){
			for(int c=0;flag && c<N;++c){
				if( fld[(r+s)%N][c]!=fld[(c+s)%N][r] ){
					flag = false;
				}
			}
		}
		if(flag ){
			ans += N;
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#define LL long long
using namespace std;
const int maxn=1e5+10;
struct node
{
    LL pos,val;
} a[maxn];
bool cmp(node a,node b)
{
    if(a.val==b.val)return a.pos<b.pos;
    return a.val>b.val;
}
int n;
LL ans[maxn];
int main()
{
  scanf("%d",&n);
        memset(ans,0,sizeof ans);
        for(int i=1; i<=n; i++)
        {
            scanf("%lld",&a[i].val);
            a[i].pos=i;
        }
        sort(a+1,a+n+1,cmp);
        a[n+1].val=0;
        LL tmp=1;
        int num=a[1].pos;
        for(int i=2; i<=n+1; i++)
        {
            if(a[i].val==a[i-1].val) tmp++;
            else ans[num]+=(a[i-1].val-a[i].val)*tmp,tmp++;
            if(a[i].pos<num) num=a[i].pos;
        }
        for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);
}

Measured memory_bytes: 3328
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

Measured memory_bytes: 13980
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt();
    System.out.println(A + B + C + Math.max(Math.max(A, B), C) * 9);
  }
}

Measured memory_bytes: 22736
#include <stdio.h>
int main(void){

  int N;
  scanf("%d",&N);

  for(int i=1;i<10;i++){
  	for(int j=1;j<10;j++){
    	if(N == i*j){
          	printf("Yes");
          return 0;
        }
    }
  }

  printf("No");

 return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<climits>
#include<set>
#define ll long long
using namespace std;
int main() {
	ll n, d;
	cin >> n >> d;
	cout << (n + 2 * d) / (2 * d + 1) << endl;;
}

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

template<class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main() {
    int N, M;
    cin >> N >> M;
    UnionFind<int> uf(N);
    for (int i = 0; i < M; ++i) {
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        if (uf.issame(l, r)) {
            int diff = uf.diff(l, r);
            if (diff != d) {
                cout << "No" << endl;
                return 0;
            }
        }
        else {
            uf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
}

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

int main() {
  int N;
  cin >> N;

  // ここにプログラムを追記
  int l, r, sum = 0;
  for(int i=0; i<N; i++) {
    cin >> r >> l;
    
    sum += l-r+1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3632
def resolve():
    hs, ms, he, me, k = [int(i) for i in input().split()]
    h = he - hs
    m = 0
    if me >= ms:
        m = me - ms
    else:
        h -= 1
        m = 60 + me - ms
    print(h * 60 + m - k)


resolve()


Measured memory_bytes: 9100
#include<stdio.h>

int main(void) {
  
  char s[3];
  scanf("%s", &s);
  
  int x = 0;
  int y = 0;
  int z = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == 'a') x++;
    if (s[i] == 'b') y++;
    if (s[i] == 'c') z++;
  }
  
  if (x == 1 && y == 1 && z == 1) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>

int64_t count(int64_t n) {
    int64_t sum = 0;
    int64_t b = 5;
    while (b <= n) {
        sum += n/b/2;
        b*=5;
    }
    return sum;
}

int main() {
    int64_t n;
    std::cin >> n;
    if (n%2 == 1) std::cout << 0 << std::endl;
    else std::cout << count(n) << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


N,M,L = map(int,input().split())

A = [list(map(int,input().split())) for i in range(N)] #N*M配列の取得
B = [list(map(int,input().split())) for i in range(M)] #M*L配列の取得
ANS = [[0]*L for i in range(N)] #N*L


for x in range(N):
    for y in range(L):
        for z in range(M):
            ANS[x][y] += B[z][y]*A[x][z]

for row in range(N):
    print("%d"%ANS[row][0],end = "")
    for col in range(1,L):
        print(" %d"%(ANS[row][col]),end = "")
    print()


Measured memory_bytes: 7072
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int n,x;
ll b[N],l[N],r[N];
bool f(ll mid){
	ll dist=0;
	for(int i=0;i<n;i++)dist+=l[i]*b[i];
	vector<pair<ll,ll> >v;
	for(int i=0;i<n;i++)v.push_back({(r[i]-l[i])*b[i]-1ll*x*r[i],i});
	sort(v.begin(),v.end());
	ll limt=mid/x;mid%=x;
	if(limt<n){
		ll sum=0,minn=1e18;
		for(int i=0;i<=limt;i++)sum+=v[i].first;
		for(int i=0;i<n;i++){
			ll tmp=0;
			if(mid>=b[v[i].second])tmp=(r[v[i].second]-l[v[i].second])*b[v[i].second]-mid*r[v[i].second];
			else tmp=-mid*l[v[i].second];
			if(i<=limt)minn=min(minn,sum-v[i].first+tmp);
			else minn=min(minn,sum-v[limt].first+tmp);
		}
		dist+=minn;
	}else for(int i=0;i<n;i++)dist+=v[i].first;
	return dist>0;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin>>n>>x;
	for(int i=0;i<n;i++)cin>>b[i]>>l[i]>>r[i];
	ll L=0,R=1e10;
	while(L<=R){
		ll mid=L+R>>1;
		if(f(mid))L=mid+1;
		else R=mid-1;
	}
	return o(L);
}

Measured memory_bytes: 13468
#include <stdio.h>
char color[8][8] = {
	"black",
	"blue",
	"lime",
	"aqua",
	"red",
	"fuchsia",
	"yellow",
	"white"
};
int main() {
	int r, g, b;
	char rgb[8];
	while(1) {
		scanf("%s", rgb);
		if(rgb[0] == '0') break;
		r = g = b = 0;
		r = 1 - ('0' <= rgb[1] && rgb[1] <= '7');
		g = 1 - ('0' <= rgb[3] && rgb[3] <= '7');
		b = 1 - ('0' <= rgb[5] && rgb[5] <= '7');
		printf("%s\n", color[4 * r + 2 * g + b]);
	}
	return 0;
}

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

int main(){
  int a,b,c,x,y,smaller,bigger,fewer,much,presume_a,presume_b;
  cin>>a>>b>>c>>x>>y;
  if(x<y){
  smaller=x;
  bigger=y;
  fewer=a;
  much=b;
  }else{
  smaller=y;
  bigger=x;
  fewer=b;
  much=a;
  }
  if(a+b<=c*2)cout<<a*x+b*y<<endl;
  if(a+b>c*2){
    presume_a=c*2*smaller+(bigger-smaller)*much;
    presume_b=c*2*bigger;
    cout<<min(presume_a,presume_b)<<endl;
  }
}

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

int main()
{
    int n;
    cin >> n;
    ll sum = 0;
    for (int i = 1; i <= n; ++i) {
        if (i % 3 != 0 && i % 5 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3624
using System;

 class Program
 {
     static void Main(string[] args)
     {
         double data1,data2;
         String nyuryoku,result;
         nyuryoku = Console.ReadLine();
         string[] data = nyuryoku.Split(' ');
         data1 = Double.Parse(data[0]); 
         data2 = Double.Parse(data[1]);
         if (data1 > data2)
             result = ">";
         else if (data1 < data2)
             result = "<";
         else
             result = "==";
                  
         Console.WriteLine("a {0} b",result);
     }
 }


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



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int k;
	cin >> k;
	for(auto i = 0; i < k; ++ i){
		cout << "ACL";
	}
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 3648
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] ans = new int[n+1];
    for (long i = 1; i < 101; i++) {
      for (long j = 1; j < 101; j++) {
        for (long k = 1; k < 101; k++) {
          long ret = i * i + j * j + k * k + i * j + j * k + k * i;
          if (ret > n) continue;
          ans[(int)ret]++;
        }
      }
    }
    for (int i = 1; i < n+1; i++) {
      System.out.println(ans[i]);
    }
  }
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define hash dhsjakhd
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;

ll n,m,T,k;
const ll big = 1000000007;
const ll big2 = 998244353;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);
    ll a,b,c,e;

    cin >> n >> m >> k;
    b = 0;
    c = 0;
    e = 0;

    for(int c1 = 0; c1 < n; c1++){
        cin >> a;
        if(a <= m)b++;
        if(a > m && a <= k)c++;
        if(a > k)e++;
    }
    cout << min(b,min(c,e)) << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-10;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}

int main(void) {
  int n,count,ans=0;
  cin>>n;
  for(int i=1; i<n+1; i++){
    if(i%2==1){
      count=0;
      for(int j=1; j<i+1; j++){
        if(i%j==0) count++;
      }
      if(count==8) ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
  var N, a int
  fmt.Scan(&N)
  A := make(map[int]int)
  for i := 1; i <= N; i++ {
    fmt.Scan(&a)
    A[a] = i
  }
  for i := 1; i <= N; i++ {
    fmt.Printf("%d ", A[i])
  }
}


Measured memory_bytes: 8576
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

int n;
int a[305][305];
bool b[305][305];

int main(){
	cin >> n;
	FORI(0, n) {
		FORJ(0, n) {
			cin >> a[i][j];
		}
	}
	bool flg = true;
	FORK(0, n) {
		FORI(0, n) {
			FORJ(0, n) {
				if (i == k || k == j)
					continue;
				if (a[i][j] > (a[i][k] + a[k][j])) {
					flg = false;
					goto _exit_func;
				}
				if (a[i][j] == (a[i][k] + a[k][j])) {
					b[i][j]=true;//
				}
			}
		}
	}

_exit_func:
	if (!flg)
		cout << "-1" << endl;
	else {
		ll ans = 0LL;
		FORI(0, n) {
			FORJ(0, n) {
				if(b[i][j]==false)
					ans += a[i][j];//
			}
		}

		cout << ans / 2 << endl;//

	}
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define pai 3.1415926535

int main(void) {
	int N;
	scanf("%d", &N);
	char S[10001];
	scanf("%s", &S);
	for (int i = 0; i < strlen(S); i++) {
		S[i] += N;
		if (S[i] >= 91) {
			S[i] -= 26;
		}
	}
	printf("%s", S);
	return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = input()
    if int(N[0] * len(N)) >= int(N):
        print(N[0] * len(N))
    else:
        print(str(int(N[0]) + 1) * len(N))


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        long H, W;
        H = sc.nextLong();
        W = sc.nextLong();
        final long even = W/2;
        final long odd = W-even;

        final long h2 = H/2;
        final long h_h2 = H - h2;
        long res = h2 * even + h_h2 * odd;
        if(H == 1 || W == 1){
            System.out.println("1");
        }else {
            System.out.println(res);
        }
    }

}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
const int N=5e3+10;
const int M=1e7+10;
const int mod=1e9+7;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int qpow(int a,int b) {
	int ret=1;
	while(b) {
		if(b&1) ret=1ll*ret*a%mod;
		a=1ll*a*a%mod;b>>=1;
	}
	return ret;
}

int n,fac[M],inv[M],ifac[M],C[N][N],A;

int cal(int a,int b,int c) {
	return 1ll*fac[a+b+c]*a%mod*inv[a+b]%mod;
}

int main() {
	cin>>n>>A;
	fac[0]=inv[1]=ifac[0]=1;
	for(int i=1;i<M;i++) {
		fac[i]=1ll*fac[i-1]*i%mod;
		if(i>1) inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
	}
	for(int i=0;i<N;i++) {
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	int ans=0;
	for(int i=1;i<=A+1;i++)
		for(int j=0;j<i;j++) ans=(ans+1ll*C[i-1][j]*((j&1)?mod-1:1)%mod*cal(i-1-j,n-A,max(0,A-i)))%mod;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 187684
s = input()
t = input()

alphabet_1 = [[] for _ in range(26)]
alphabet_2 = [[] for _ in range(26)]

for i in range(len(s)):
    if alphabet_1[ord(s[i])-97] == []:
        alphabet_1[ord(s[i])-97] = t[i]
    else:
        if alphabet_1[ord(s[i])-97] == t[i]:
            continue
        else:
            print('No')
            exit()

    if alphabet_2[ord(t[i])-97] == []:
        alphabet_2[ord(t[i])-97] = s[i]
    else:
        if alphabet_2[ord(t[i])-97] == s[i]:
            continue
        else:
            print('No')
            exit()

print('Yes')

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

ll dp[55][55][2550];

int main(){
    int N,A;
    cin >> N >> A;
    vector<int> x(N);
    rep(i,N)cin >> x[i];

    dp[0][0][0] = dp[0][1][x[0]] = 1;

    rep(i,N-1){
        rep(j,N+1){
            rep(k,2501){
                if(dp[i][j][k] == 0)continue;
                //i+1番目を選ぶ
                dp[i+1][j+1][k+x[i+1]] += dp[i][j][k];
                //選ばない
                dp[i+1][j][k] += dp[i][j][k];
            }
        }
    }

    ll res = 0;
    for(int i = 1; i <= N; i++){
        int a = i * A;
        if(a <= 2500 && dp[N-1][a] != 0){
            res += dp[N-1][i][a];
        }
    }
    cout << res << endl;
    return 0;
}


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

struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
//static const int INF = 2147483647;
//static const long long INf = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define itn int
#define scnaf scanf
#define reutnr return
#define scamf scanf
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll

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

    int sex = pow(2,b);

    int ans = (b*1900+(a-b)*100) * sex;

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

    return 0;
}

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

const int D = 80 * 170;
const int D2 = D * 2;

bitset<D2> dp[90][90];

int main(){
	int h,w; cin >> h >> w;
	
	int ma[90][90];
	int mb[90][90];
	int m[90][90];
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> ma[i][j];
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) cin >> mb[i][j];
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) m[i][j] = abs(ma[i][j] - mb[i][j]);
	
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) for(int k=0;k<D2;k++) dp[i][j][k] = 0;
	dp[0][0][D-m[0][0]] = 1;
	dp[0][0][D+m[0][0]] = 1;
	
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		if(i<h-1) dp[i+1][j] |= (dp[i][j]<<m[i+1][j] | dp[i][j]>>m[i+1][j]);
		if(j<w-1) dp[i][j+1] |= (dp[i][j]<<m[i][j+1] | dp[i][j]>>m[i][j+1]);
	}
	
	for(int i=0;i<D;i++){
		if(dp[h-1][w-1][D+i]){cout << i << endl; return 0;}
		if(dp[h-1][w-1][D-i]){cout << i << endl; return 0;}
	}
	return 0;
}

Measured memory_bytes: 24704