akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stdio.h>
#include<deque>
#include<map>
#include<queue>
#include<cmath>

typedef long long ll;

#define debug(x) cout << #x << '=' << x << endl;
#define debug_arr(a, n) for(ll i = 0; i < n; i++)cout << a[i] << ' '
#define inf 100000000000
#define loop(i,n) for(ll i = 0; i < n; i++)
#define graph vector<vector<ll>>
#define P pair<ll,ll>

using namespace std;

int main(){
    int a,b,q;
    cin >> a >> b >> q;
    
    vector<ll> s(a),t(b),x(q);
    loop(i,a) cin >> s[i];
    loop(i,b) cin >> t[i];
    loop(i,q) cin >> x[i];

    sort(s.begin(),s.end());
    sort(t.begin(),t.end());

    loop(i,q){
        ll tmpx = x[i];
        int startS = -1;
        int endS = a;
        while(startS + 1 < endS){
            int tmp = (startS + endS) / 2;
            if(s[tmp] < tmpx){
                startS = tmp;
            }else{
                endS = tmp;
            }
        }
        int startT = -1;
        int endT = b;
        while(startT + 1 < endT){
            int tmp = (startT + endT) / 2;
            if(t[tmp] < tmpx){
                startT = tmp;
            }else{
                endT = tmp;
            }
        }

        ll ans1,ans2,ans3;
        if(startS == -1 || startT == -1) ans1 = inf;
        else ans1 = tmpx - min(s[startS],t[startT]);

        if(endS == a || endT == b) ans2 = inf;
        else ans2 = max(s[endS],t[endT]) - tmpx;
        
        ll minS, minT;
        if(startS == -1)minS = s[endS] - tmpx;
        else if(endS == a) minS = tmpx - s[startS];
        else minS = min(tmpx - s[startS], s[endS] - tmpx);

        if(startT == -1)minT = t[endT] - tmpx;
        else if(endT == b) minT = tmpx - t[startT];
        else minT = min(tmpx - t[startT], t[endT] - tmpx);

        ans3 = minS + minT + min(minS,minT);

        cout << min(ans1,min(ans2,ans3)) << endl;
    }

    return 0;
}

Measured memory_bytes: 3712
#include<stdio.h>

int main(void){
	int a[4],b[4];
	int i,j;
	int hit,blow;

	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF){
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		hit=0;
		blow=0;
		for(i=0;i<=3;i++){
			for(j=3;j>=0;j--){
				if(a[i]==b[j]){
					if(i==j)
						hit++;
					else
						blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <ctype.h>
#include <string.h>

int main()
{
  char seq_word[10];
  char input_sen[1000];
  int counter_i = 0;
  int counter_j = 0;

  scanf("%s", seq_word);
  for( ; ; )
  {
    scanf("%s", input_sen);
    if(strcmp(input_sen, "END_OF_TEXT") == 0)
      break;

    for(counter_i = 0 ; input_sen[counter_i] != '\0' ; counter_i++)
      input_sen[counter_i] = tolower(input_sen[counter_i]);

    if(strcmp(input_sen, seq_word) == 0)
      counter_j += 1;
  }
  printf("%d\n", counter_j);
}



Measured memory_bytes: 2068
#include<stdio.h>
int main(void){
	char s[4];
	scanf("%s",s);
	if(s[0]==s[1] && s[1]==s[2]){
		printf("Yes");
	}else if(s[1]==s[2] && s[2]==s[3]){
		printf("Yes");
	}else{
		printf("No");
	}
	return 0;
}	 


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

#define MAX_V 105

#define MAX_N 100
#define MAX_M 100

int main(){
    ll n, m;
    cin >> n >> m;
    vector<ll> a(m);
    REP(i, m) cin >> a[i];

    REP(i, m) {
        n -= a[i];
    } 

    if(n < 0) {
        cout << "-1" << endl;
    } else {
        cout << n << endl;
    }
    return 0;
}

Measured memory_bytes: 3704
#include<stdio.h>

int main(void)
{
  int i,in_cnt,flg=1;
  int r_cnt=0;
  int num[200];
  
  scanf("%d",&in_cnt);

  for(i=0;i<in_cnt;i++)
  {
    scanf("%d",&num[i]);
  }
  
  do
  {
    for(i=0;i<in_cnt;i++)
    {
      if(num[i] % 2 != 0)
      {
        flg = 0;
        break;
      }
      if(num[i] == 0)
      {
        flg = 0;
        break;
      }
      
      num[i] = num[i] / 2;

    }
    
    r_cnt++;

  }while(flg);
  
  printf("%d\n",r_cnt-1);
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>

#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
class P{
public:
	int first;
	char second;
	int index;
	bool operator<=(P x){
		return first <= x.first;
	}
};

int partition(P *A,int p,int r){
   P x = A[r];
   int i = p-1;
   for (int j = p ;j < r ;j++){
     if (A[j] <= x){
       i = i+1;
       swap(A[i],A[j]);
     }
   }
   swap(A[i+1],A[r]);
   return i+1;
}

void Qsort(P *A,int p,int r){
	if(p<r){
		int q=partition(A,p,r);
		Qsort(A,p,q-1);
		Qsort(A,q+1,r);
	}
}

int main(){
	int n;
	P A[100000];
	cin >> n;
	REP(i,n){
		cin >> A[i].second >> A[i].first;
		A[i].index=i;
	}
	Qsort(A,0,n-1);
	bool flag=true;
	REP(i,n-1){
		if(A[i].first == A[i+1].first && A[i].index > A[i+1].index){
			flag = false;break;
		}
	}
	cout << (flag?"Stable":"Not stable") << endl;
	REP(i,n){
		cout << A[i].second << " " << A[i].first << endl;
	}
}

Measured memory_bytes: 4152
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

// 0 から a までの 0 xor 1 xor ... xor a を求める
ll foo(ll a) {
  if (a % 2 != 0) {
    if (((a+1) / 2) % 2 == 0) return 0;
    else return 1;
  }
  if ((a+1) / 2 % 2 == 0) return a;
  else return 1 ^ a;
}

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

  ll a, b;
  cin >> a >> b;;
  ll ans = foo(b) ^ foo(a-1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

ll A, B, C, X, Y, ans = INF;
int main(){
  cin >> A >> B >> C >> X >> Y;

  for (ll i = 0; i <= 2 * max(X, Y); i+=2){
    ll now = C * i;
    now += A * max(X - i / 2, 0ll) + B * max(Y - i / 2, 0ll);
    ans = min(ans, now);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main(){
  int N; cin >> N;
  map<string, int> mp;
  vector<string> W(N);
  rep(i,N){
    cin >> W[i];
    mp[W[i]]++;
  }
  
  rep2(i,1,N){
    if(W[i][0] != W[i-1][W[i-1].size()-1]) {cout << "No" << endl; return 0;}
  }
  
  for (auto itr : mp){
    if(itr.second > 1)  {cout << "No" << endl; return 0;}
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3636
/*||>>>> Praveen Ojha <<<<>>>> 07 July 2019 <<<<>>>> 17:35:59 <<<<||*/
// #pragma GCC optimize("Ofast") //(Very Fast but Inaccurate)
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //(Small operations in many loops)
// #pragma GCC optimize("unroll-loops")
// #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define mod 1000000007
#define inf (int)1e18+5
#define sz(x) (int)x.size()
#define PI 3.141592653589793238510
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define __ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vi vector<int>
#define vpii vector<pair<int,int> > 
#define vvi vector<vector<int> >
#define PRINT_TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s." <<endl;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename   enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long double ld;
typedef pair<int,int> pii;
//Read Problems Carefully & Check for corner cases N=0,1 ?
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
bool ispw(int xx){
	int x=sqrt(xx);
	if(x*x==xx)
		return true;
	else
		return false;
}
int32_t main(){__
	int n,m;
	cin>>n>>m;
	int tt[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++)
			cin>>tt[i][j];
	}
	int ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			int sumi=0;
			for(int k=0;k<m;k++){
				sumi+=((tt[i][k]-tt[j][k])*(tt[i][k]-tt[j][k]));
			}
			if(ispw(sumi))
				ans++;
		}
	}
	cout<<ans<<"\n";
return 0;
}

Measured memory_bytes: 256
def getlist():
	return list(map(int, input().split()))

R, G, B, N = getlist()
ans = 0
for i in range(3001):
	for j in range(3001 - i):
		x = R * i + G * j
		if N >= x and (N - x) % B == 0:
			ans += 1

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define pb push_back
#define fi first
#define se second
#define Mod 1000000007


int main(){
    ll i,j;

    ll n;
    cin>>n;
    double p[n];
    for(i=0;i<n;i++) cin>>p[i];

    double dp[n+1][n+1];

    dp[0][0]=1;
    dp[0][1]=p[0];
    dp[1][0]=1;
    for(i=2;i<=n;i++)  {
        dp[0][i]=0;
        dp[i][0]=1;
    }

    for(i=1;i<n;i++){
        for(j=1;j<=n;j++){
            dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
        }

    }

   printf("%.11lf\n",dp[n-1][n/2 +1]);
}



Measured memory_bytes: 70528
import java.util.*;

public class Main {
  public static void main(String[] srgs) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    long ans = 1;
    final long mod = 1_000_000_007;
    if(n - m <= -2 || 2 <= n - m) {
      ans = 0;
    } else if(n - m == 1 || n - m == -1) {
      ans = modFact(n, mod) * modFact(m, mod) % mod;
    } else {
      ans = 2 * (modFact(n, mod) * modFact(m, mod) % mod) % mod;
    }
    System.out.println(ans);
  }

  public static long modFact(int a, long p) {
    long factorial = 1;
    for(int i = 2; i <= a; i++) {
      factorial = factorial * i % p;
    }
    return factorial;
  }
}


Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <sstream>
#include <complex>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <limits>
#include <numeric>

using namespace std;
#define all(a) begin(a), end(a)

using ll = long long;
using ull = unsigned long long;
template <typename T>
using vec = vector<T>;
template <typename T>
using vec2 = vector<vec<T>>;

template <typename V, typename H>
void resize(vector<V> &vec, const H h)
{
    vec.resize(h);
}

template <typename V, typename H, typename... T>
void resize(vector<V> &vec, const H &h, const T... t)
{
    vec.resize(h);
    for (auto &v : vec)
    {
        resize(v, t...);
    }
}

template <typename V, typename T>
void fill(V &x, const T &val)
{
    x = val;
}

template <typename V, typename T>
void fill(vector<V> &vec, const T &val)
{
    for (auto &v : vec)
    {
        fill(v, val);
    }
}

struct pre_
{
    pre_()
    {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(6);
    }
} pre__;

int main(void)
{
    while (1)
    {

        int n, l, r;

        int answer = 0;

        cin >> n >> l >> r;
        vector<int> get_input(n);
        if (n == 0 && l == 0 && r == 0)
        {
            break;
        }
        for (int i = 0; i < n; i++)
        {
            cin >> get_input[i];
        }
        for (int x = l; x <= r; x++)
        {
            int tmp = -1;
            for (int i = 0; i < n; i++)
            {
                if (x % get_input[i] == 0)
                {
                    tmp = i;
                    break;
                }
            }
            if (tmp == -1)
            {
                if (n % 2 == 0)
                {
                    answer++;
                }
            }
            else
            {
                if ((tmp + 1) % 2 == 0)
                {
                }
                else
                {
                    answer++;
                }
            }
        }
        cout << answer << endl;
        
    }

    return 0;
}



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

import fractions
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

count = 0
for i in range(N):
    count += ans // a[i]

print(count % (10**9+7))

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

int main()
{

    int n, m;
    char ara[101][101];
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++)scanf("%s", ara[i]);
    for(int i = 1; i <= n+2; i++)
    {
        for(int j = 1; j <= m+2; j++)
        {
            if(i>1 && j>1 && i<=n+1 && j<=m+1)printf("%c", ara[i-2][j-2]);
            else printf("#");
        }
        printf("\n");
    }
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

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

const int INF = 1001001001;

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

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

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

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

	sort(groups.begin(), groups.end());

	vector<int> sums(n + 1);
	for (int i = 0; i < n; i++) {
		sums[i + 1] = sums[i] + groups[i];
	}

	int times = n;
	int i = n;
	for (int k = 1; k <= n; ++k) {
		while (times > 0) {
			while (i > 0 && groups[i - 1] >= times) {
				i--;
			}

			if (times * (n - i) + sums[i] >= k * times) {
				break;
			}

			times--;
		}

		cout << times << endl;
	}

	return 0;
}


Measured memory_bytes: 3200
def z_arr(s):

    Z = [0] * len(s)
    Z[0] = len(s)

    rt = 0
    lt = 0

    for k in range(1, len(s)):
        if k > rt:
            n = 0
            while k + n < len(s) and s[n] == s[k + n]:
                n += 1

            Z[k] = n
            if n > 0:
                lt = k
                rt = k + n - 1
        else:

            p = k - lt
            right_part_len = rt - k + 1

            if Z[p] < right_part_len:
                Z[k] = Z[p]
            else:
                i = rt + 1
                while i < len(s) and s[i] == s[i - k]:
                    i += 1
                Z[k] = i - k

                lt = k
                rt = i - 1
    return Z

N = int(input())
S = input()
answer = 0
for i in range(N-1):
    ZZ = z_arr(S[i:])
    temp_max = 0
    for j in range(len(ZZ)):
        if min(ZZ[j], j) > temp_max:
            temp_max = min(ZZ[j], j)

    if answer < temp_max:
        answer = temp_max
print(answer)

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

int main() {
    ll S;
    cin >> S;

    if (S == (ll)1e18) {
        cout << "0 0 1000000000 0 0 1000000000" << endl;
        return 0;
    }

    ll x1 = 0, y1 = 0, x2 = 1e9, y2 = 1, x3 = 0, y3 = 0;

    if (S <= 1e9) {
        y3 = 1;
        x3 = x2 - S;
    }
    else {
        x3 = 1e9 - S % ((ll)1e9);
        y3 = (S + x2) / (ll)1e9;
    }

    cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << ' ' << x3 << ' ' << y3 << endl;

    //cout << x2*y3 - x3*y2 << endl;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> likes(n);

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

    int cnt = 0;
    for (int j = 0; j < n; j++) {
        int like = likes[j];
        if (likes[like-1] == j+1) cnt++;
    }
    cout << cnt/2 << endl;

    return 0;
}

Measured memory_bytes: 640
import sys
readline = sys.stdin.readline
def mergeup(Av, Aw, vw):
    v, w = vw
    rv, rw = [], []
    N = len(Av)
    idx = 0
    jdx = 0
    for _ in range(2*N):
        if idx == N or Aw[idx] > Aw[jdx] + w:
            if Aw[jdx] + w > limit:
                break
            rw.append(Aw[jdx]+w)
            rv.append(Av[jdx]+v)
            jdx += 1
        else:
            rw.append(Aw[idx])
            rv.append(Av[idx])
            idx += 1

    return rv, rw

def mergedown(Av, Aw, vw):
    v, w = vw
    resv, resw = [], []
    N = len(Av)
    idx = 0
    jdx = 0
    for _ in range(2*N):
        if jdx == N or Aw[idx] <= Aw[jdx] - w:
            resv.append(Av[idx])
            resw.append(Aw[idx])
            idx += 1
        else:
            if Aw[jdx] - w < 0:
                jdx += 1
                continue
            resv.append(Av[jdx] + v)
            resw.append(Aw[jdx] - w)
            jdx += 1
    return resv, resw


limit = 10**5
N = int(readline())
VW = [None] + [tuple(map(int, readline().split())) for _ in range(N)]
BS = min(N, 1<<11)
Q = int(readline())
VL = [None] + [tuple(map(int, readline().split())) for _ in range(Q)]


Rv = [[0] for _ in range(BS+1)]
Rw = [[0] for _ in range(BS+1)]
for i in range(1, BS):
    for vm, wm in zip(*mergeup(Rv[i//2], Rw[i//2], VW[i])):
        if Rv[i][-1] < vm:
            Rv[i].append(vm)
            Rw[i].append(wm)
    
ans = [0]*(Q+1)
for i in range(1, Q+1):
    v, l = VL[i]
    Kv, Kw = [0], [l]
    while v >= BS:
        Kv, Kw = mergedown(Kv, Kw, VW[v])
        v >>= 1
    cnt = len(Rv[v])-1
    ctr = 0
    for j in range(len(Kv)-1, -1, -1):
        kv, kw = Kv[j], Kw[j]
        while kw < Rw[v][cnt]:
            cnt -= 1
        ctr = max(ctr, kv+Rv[v][cnt])
    ans[i] = ctr

print('\n'.join(map(str, ans[1:])))


Measured memory_bytes: 179272
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second
#define MP make_pair
#define PB push_back

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;


int main()
{
  string s ;
  cin >> s ;
  int n = s.size() ;
  reverse(ALL(s)) ;
  
  int i = 0 ;
  while(true){
    if(s.substr(i,5)=="maerd" || s.substr(i,5)=="esare"){
      i += 5 ;
    }
    else if(s.substr(i,7)=="remaerd"){
      i += 7 ;
    }
    else if(s.substr(i,6)=="resare"){
      i += 6 ;
    }
    else{
      cout << "NO"<<endl ;
      return 0 ;
    }
    if(i==n){
      cout << "YES"<<endl;
      break ;
    }
  }
    


  return 0 ;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include "unistd.h"
using namespace std;
#define WA cout<<"char134217728";exit(0)
#define RE throw
#define TLE sleep(1000)
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end());
#define bit(n) (1<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n, a, b, c[17];
bool z[17];
void rec(int d, bool p){
  if(d==n){
    printf("%d ", a^b);
    return;
  }
  int i=0;
  while(z[i] || p&&((a&c[i])==0)) i++;
  z[i] = true;
  rec(d+1, false);
  a ^= c[i];
  rec(d+1, p);
  z[i] = false;
}
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b;
  FOR(i, 0, n) c[i]=bit(i);
  a ^= b;
  if(__builtin_parity(a)){
    printf("YES\n");
    rec(0, true);
    printf("\n");
  }else{
    printf("NO\n");
  }
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstring>
#define reg register
#define EN std::puts("")
#define LL long long
inline int read(){
	register int x=0;register int y=1;
	register char c=std::getchar();
	while(c<'0'||c>'9'){if(c=='-') y=0;c=std::getchar();}
	while(c>='0'&&c<='9'){x=x*10+(c^48);c=std::getchar();}
	return y?x:-x;
}
int main(){
	int x=read(),y=read(),z=read();
	std::swap(x,y);std::swap(x,z);
	std::printf("%d %d %d",x,y,z);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B;
  if(A!=1&&B!=1){
    cout<<1<<endl;
  }
  else if(A!=2&&B!=2){
    cout<<2<<endl;
  }
  else{
    cout<<3<<endl;
  }
}

Measured memory_bytes: 256
from functools import reduce
import math

def main():
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    # 1e10

    # 初期値用:十分小さい数(-100億)
    # -1e10
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    a,b = (_ for _ in input().split())
    if a == b:
        print('H')
    else:
        print('D')
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<30;
const int MOD = 1000000007;

ll N, A, B;
vector <ll> hps;

bool check(ll mid){
    ll magic = 0LL;
    rep(hps.size(), m) {
        magic += max(0LL, (hps[m]-mid*B+A-B-1)/(A-B));
    }
    return magic <= mid;
}

void solve(void){
    //input
    cin >> N >> A >> B;
    rep(N, i) {
        ll h; scanf("%lld\n", &h);
        hps.pb(h);
    }

    //nibtan
    ll ok = INF, ng = -1;
    while(abs(ok-ng) > 1) {
        ll mid = (ok + ng)/2;
        if (check(mid)) {
            ok = mid;
        }
        else ng = mid;
        //cout << mid << endl;
    }
    cout << ok << endl;
}

int main(void){
  solve();
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
struct LowestCommonAncestor{
  int n,h;
  vector<vector<int> > G,par;
  vector<int> dep;
  LowestCommonAncestor(){}
  LowestCommonAncestor(int n):n(n),G(n),dep(n){
    h=1;
    while((1<<h)<=n) h++;
    par.assign(h,vector<int>(n,-1));
  }

  void add_edge(int u,int v){
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  
  void dfs(int v,int p,int d){
    par[0][v]=p;
    dep[v]=d;
    for(int u:G[v])
      if(u!=p) dfs(u,v,d+1);
  }
  
  void build(int r=0){
    dfs(r,-1,0);
    for(int k=0;k+1<h;k++){
      for(int v=0;v<n;v++){
	if(par[k][v]<0) par[k+1][v]=-1;
	else par[k+1][v]=par[k][par[k][v]];
      }
    }
  }
  
  int lca(int u,int v){
    if(dep[u]>dep[v]) swap(u,v);
    for(int k=0;k<h;k++){
      if((dep[v]-dep[u])>>k&1){
	v=par[k][v];
      }
    }
    if(u==v) return u;
    for(int k=h-1;k>=0;k--){
      if(par[k][u]!=par[k][v]){
	u=par[k][u];
	v=par[k][v];
      }
    }
    return par[0][u];
  }

  int distance(int u,int v){
    return dep[u]+dep[v]-dep[lca(u,v)]*2;
  }
};
//END CUT HERE

signed main(){
  int n;
  cin>>n;
  LowestCommonAncestor lca(n);
  for(int i=0;i<n;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int c;
      cin>>c;
      lca.add_edge(i,c);
    }
  }
  lca.build();
  int q;
  cin>>q;
  while(q--){
    int u,v;
    cin>>u>>v;
    cout<<lca.lca(u,v)<<endl;
  }
  return 0;
}
/*
  verified on 2018/05/16
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C&lang=jp
*/



Measured memory_bytes: 18284
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////


int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	string S; cin >> S;
	ll N = S.size();

	vector<ll> A(26);
    rep(i,N) A[S[i] - 'a']++;
	ll ans = N*(N-1)/2 + 1LL;
	rep(i,26) {
		ans -= (A[i]*(A[i]-1LL)/2LL);
	}

	cout << ans << endl;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll res[101];

void prime_factor(int n){
	res[0]=-1;
	for(int i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1)res[n]++;
	return;
}


int main(){
	int n,ans=0,hist[5];
	memset(res,0,sizeof(res));
	memset(hist,0,sizeof(hist));
	cin>>n;
	for(int i=n;i>=2;i--)prime_factor(i);
	for(int i=2;i<101;i++){
		if(res[i]>=2)hist[0]++;
		if(res[i]>=4)hist[1]++;
		if(res[i]>=14)hist[2]++;
		if(res[i]>=24)hist[3]++;
		if(res[i]>=74)hist[4]++;
	}
	ans += (hist[0]-1)*hist[3] + (hist[1]-1)*hist[2] + hist[4] + (hist[0]-2)*(hist[1])*(hist[1]-1)/2;
	cout<<ans<<endl;
}


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

def calc(al, n):
    res = 0
    r = 0
    tmpsum = 0
    tmpxor = 0
    for l in range(n):
        while r<n and tmpsum+al[r]==tmpxor^al[r]:
            tmpsum += al[r]
            tmpxor ^= al[r]
            r += 1

        res += (r-l)

        if r==l:
            r += 1
        else:
            tmpsum -= al[l]
            tmpxor ^= al[l]

    return res


n = int(input())
al = list(map(int, input().split()))

print(calc(al,n))


Measured memory_bytes: 24424
'''
Created on Mar 21, 2013

@author: wukc
'''

from sys import stdin

n=int(stdin.readline())
for i in range(n):
    a,b=[stdin.readline().strip().lstrip("0") for k in range(2)]
    if len(a)>80 or len(b)>80:
        print("overflow")
        continue
    a,b=a.rjust(len(b),'0'),b.rjust(len(a),'0')
    ans=[]
    c=0
    for x,y in zip(a[::-1],b[::-1]):
        t=int(x)+int(y)+c
        c=t//10
        ans+=[t%10]
    ans+=[c]
    ans="".join(map(str,ans[::-1])).lstrip("0")
    if len(ans)>80:
        print("overflow")
        continue
    print(ans.rjust(1,'0'))
    

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

int main() {
    int n; cin >> n;
    vector<int64_t> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        if (a.at(i) == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    int64_t ans = 1;
    for (int i = 0; i < n; i++) {
        int64_t nextans = ans * a.at(i);
        if (nextans > 1000000000000000000 || nextans < ans) {
            cout << -1 << endl;
            return 0;
        }
        ans = nextans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3996
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    cout << ((N + 1) / 2 >= K ? "YES" : "NO") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef set<int>        si;
typedef set<ii>         sii;

#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define clr(x,v) memset(x,v,sizeof x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define re return

template<typename T> T sgn (T x)      {re x<0? -1:(x>0? 1:0); }
template<typename T> T gcd (T a, T b) {re a ? gcd (b % a, a) : b; }
template<typename T> T abs (T x)      {re x < 0 ? -x : x; }
template<typename T> T sqr (T x)      {re x*x;}

#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define popcount __builtin_popcount
#define mp make_pair
#define eb emplace_back
#define emp emplace
#define ss second
#define ff first
#define endl "\n"
#define PI 3.14159265359
#define MOD ((int)1e9+7)
#define N ((int)2e5+123)

void reads(string& x){
    char kk[N];
    scanf("%s",kk);
    x = kk;
}
int n;
int ans;
int v[N];
string s;
void solve(){
    
    reads(s);
    char *c;
    if(s=="ABC")c="ARC";
    else c= "ABC";
    printf("%s\n",c);
}
int main(){_
    int t=1; //scanf("%d",&t);
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3792
N = int(input())
Ps = list(map(int, input().split()))

iPs = [0] * (N+1)
for iP, A in enumerate(Ps):
    iPs[A] = iP

ans = 0
iLs = list(range(N+1))
iRs = list(range(N+1))
for P in range(1, N+1):
    i = iPs[P]
    iL, iR = iLs[i], iRs[i]
    if iL <= 1:
        iL2 = 0
    else:
        iL2 = iLs[iL-1]
    if iR >= N-2:
        iR2 = N-1
    else:
        iR2 = iRs[iR+1]
    num = 0
    if iL != 0:
        num += (iL-iL2)*(iR-i+1)
    if iR != N-1:
        num += (i-iL+1)*(iR2-iR)
    ans += P * num
    iLs[iR+1] = iL
    iRs[iL-1] = iR

print(ans)


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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
#define        optimize    ios_base::sync_with_stdio(false);cin.tie(NULL);
#define        sqr(a)       ((a)*(a))
string s;
int n;
ll po[200000];
#define MOD 1000000007
ll dp[200000][20];
ll sol(int i,int rem)
{
    ll ans = 0;
    if(i>=n)
    {
         //cout << i << " " << rem << endl;
        if(rem == 5)return 1;
        else return 0;
    }
    if(dp[i][rem] != -1)return dp[i][rem];
    if(s[i] == '?')
    {
        for(int j=0; j<10; j++)
        {
            ans = (ans+sol(i+1,((po[i]*j)%13+rem)%13))%MOD;
        }
    }
    else
    {
        ans = (ans+sol(i+1,((po[i]*(s[i]-'0'))%13 + rem)%13))%MOD;
    }

    return dp[i][rem] = ans;
}
int main()
{
    cin >> s;

    n = s.size();
    po[0] = 1;
    for(int i=1; i<n; i++)
    {
        po[i] = (10*po[i-1])%13;
    }
    reverse(po,po+n);
    memset(dp,-1,sizeof dp);
    ll fin = 0;
    if(s[0] == '?')
    {
        for(int i=0; i<10; i++)
        {
            fin = (fin+sol(1,(po[0]*i)%13))%MOD;
        }
    }
    else fin = sol(1,(po[0]*(s[0]-'0'))%13);

    cout << fin << endl;
}


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

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll inf = 1ll << 60;
int jmax = 100100;



int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    rp(i, 0, n) scanf("%d", &a.at(i));
    sort(a.begin(), a.end());
    int res1 = a.back();
    int res2;
    int div = 1e9;
    rp(i, 0, n-1) {
        if(div >= abs(a.at(i) - (res1/2))) {
            res2 = a.at(i);
            div = abs(a.at(i) - (res1/2));
        }
    }
    printf("%d %d", res1, res2);
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;
map<long long, long long> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
signed main() {
    ll n;
    cin >> n;
    vector<ll> as(n);
    REP(i, n) { cin >> as[i]; }
    sort(as.rbegin(), as.rend());
    ll sum = as[0];
    ll k = 1;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    n--;
    n--;
    REP(i, 1000000) {
        if (n <= 0) {
            break;
        }
        n--;
        // cout << sum;
        sum += as[k];
        if (n <= 0) {
            break;
        }
        // cout << sum << endl;
        // cout << n << endl;
        sum += as[k];
        n--;
        k++;
        if (n <= 0) {
            break;
        }
        // cout << sum << endl;
        // cout << n << endl;
    }
    cout << sum << endl;
}

Measured memory_bytes: 4808
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define    vi       vector<int>
#define    vd       vector<double>
#define    vvi      vector< vector<int> >
#define    vvll      vector< vector<long long> >
#define    vvpi     vector< vector< pair<int,int> > >
#define    vvpll     vector< vector< pair<long long,long long> > >
#define    vvd      vector< vector<double> >
#define    vs       vector<string>
#define    vvs      vector< vector<string> >
#define     vpi        vector< pair<int ,int> >
#define      pi        pair<int ,int>
#define      pll       pair<long long ,long long>
#define     vpd        vector< pair<double ,double> >
#define     vpll        vector< pair<long long ,long long> >
#define    vll       vector<long long>
#define    dqi        deque< int >
#define     si         set<int>
#define     spi        set< pair<int ,int > >
#define     row          vector< ll >
#define     matrix            vector< row >
#define     si         set<int>
#define    oo         900000000000000000
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<double>
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-10);
using namespace std;
int dcmp(double a,double b){   return fabs(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
int setBit0(int num, int idx) {return num & ~(1<<idx);}
int flipBit(int num, int idx) {return num ^ (1<<idx);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}

int main()
{
    int n,a,b;
    cin>>n>>a>>b;

    cout<< min(a*n,b) <<endl;

}




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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

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*b / GCD(a,b) ;}

int dx[4] = {1,0,-1,0};
int dy[4] = {0,-1,0,1};

int main() {
    int n,m;cin >> n >> m;
    if(n == m)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int N, M, K;
    std::cin >> N >> M >> K;
    std::vector<int> A(N);
    REP(i, N) {
        std::cin >> A[i];
    }
    std::vector<int> B(M);
    REP(i, M) {
        std::cin >> B[i];
    }
    std::vector<ll> A_sum(N + 1, 0);
    REP(acc_i, N) {
        A_sum[acc_i + 1] = A_sum[acc_i] + A[acc_i];
    }
    std::vector<ll> B_sum(M + 1, 0);
    REP(acc_i, M) {
        B_sum[acc_i + 1] = B_sum[acc_i] + B[acc_i];
    }

    int ans = 0;
    REP(ai, N + 1) {
        auto v = K - A_sum[ai];
        if(0 <= v) {
            auto itr = upper_bound(ALL(B_sum), v) - 1;
            chmax(ans, ai + (int)distance(B_sum.begin(), itr));
        }
    }
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 7960
# -*- coding: utf-8 -*-
"""
Permutation - Sorting Pairs
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_5_A&lang=jp

"""
n = int(input())
for p in sorted([[int(a) for a in input().split()] for _ in range(n)]):
    print(*p)



Measured memory_bytes: 23408
package main

import (
	"fmt"
)

func main() {
	var k int
	var anntenas [5]int
	for i := 0; i < 5; i++ {
		fmt.Scan(&anntenas[i])
	}
	fmt.Scan(&k)
	if anntenas[4]-anntenas[0] <= k {
		fmt.Println("Yay!")
	} else {
		fmt.Println(":(")
	}
}


Measured memory_bytes: 512
n_str = input()
n = int(n_str)
n_digit = len(n_str)
k = int(input())

#割り算のやーつ
MOD = 1000000007

# 二項係数関連.
class COM():
    def __init__(self, MAX, MOD):
        self.MOD = MOD
        self.MAX = MAX
        self.fac = [1] * MAX
        self.finv = [1] * MAX
        inv = [1] * MAX
        for i in range(2, MAX):
            self.fac[i] = self.fac[i - 1] * i % MOD
            inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
            self.finv[i] = self.finv[i - 1] * inv[i] % MOD
    def calc_COM(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        if self.MAX <= n:
            return 0
        return self.fac[n] * (self.finv[k] * self.finv[n - k] % self.MOD) % self.MOD
    def calc_PER(self, n, k):
        if n < k:
            return 0
        if n < 0 or k < 0:
            return 0
        if self.MAX <= n:
            return 0
        return self.fac[n] * self.finv[n - k] % self.MOD
    def calc_FAC(self, n):
        if self.MAX <= n:
            return 0
        return self.fac[n]

com = COM(100, MOD)

ans = 0
if(n_digit < k):
    # 満たす物は無い.
    print(0)
else:
    # 最大桁数-1の桁の数について、何が入っても問題ないので、3箇所選んで1-9をそれぞれ選ぶ.
    ans += com.calc_COM(n_digit-1, k) * (9 ** k)
    # 最大桁の桁の数について.
    n_top = int(n_str[0])
    if(k-1 <= 0):
        # これで終わりだから自由
        ans += n_top
    else:
        # 最大桁がn_top未満なら残りは自由
        ans += (n_top - 1) * com.calc_COM(n_digit-1, k-1) * (9 ** (k-1))
        # 最大桁がn_topなら、残りは自由じゃない……
        n_sec = 0
        count = n_digit
        i = 1
        for nc in n_str[1:]:
            i += 1
            count -= 1
            n_sec = int(nc)
            if(n_sec > 0):
                break
        if(count >= k-1):
            # まだ可能性がある！
            # 次に来る1以上の数字がcountよりも先だったら二つとも自由
            ans += 1 * com.calc_COM(count-1, k-1) * (9 ** (k-1))
            # 次の1以上の数字がcountの位置に来る.
            if(k-2 <= 0):
                ans += 1 * n_sec # これで終わりだからその下は考えないでいいのじゃ.
            else:
                # 次に来る1以上の数字がn_sec未満なら残りは自由
                ans += 1 * (n_sec - 1) * com.calc_COM(count-1, k-2) * (9 ** (k-2))
                # 次に来る1以上の数字がn_secと同じなら、残りは自由じゃない……
                n_third = 0
                sec_count = count
                for nd in n_str[i:]:
                    sec_count -= 1
                    n_third = int(nd)
                    if(n_third > 0):
                        break
                if(sec_count >= k-2):
                    # まだ可能性がある！
                    # 最後の数字がsec_countよりも下の位置
                    ans += 1 * 1 * (sec_count-1) * 9
                    # 最後の数字がsec_countの位置
                    ans += 1 * 1 * n_third

    print(ans)


Measured memory_bytes: 3192
#include <iostream>
#include <cmath>
#include <string>
#include<algorithm>
using namespace std;
int main(){

    
    int n;
    cin>>n;
    string siri[n];
    for(int i=0;i<n;i++){
        cin>>siri[i];
    }
    //cout<<siri[0].size();
    
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(siri[i]==siri[j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    
    char pre;
    pre=siri[0][siri[0].size()-1];

    for(int i=1;i<n;i++){
        int slen=siri[i].size();
        
        if(siri[i][0]!=pre){
            cout<<"No";
            return 0;
        }
        pre=siri[i][slen-1];
        
    }
    cout<<"Yes";
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
struct Time {
	long long a;
	long long b;
	bool operator <(const Time& c)const {
		return b < c.b;
	}
};

int main()
{
	Time t[200000];
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld%lld", &t[i].a, &t[i].b);
	}
	sort(t, t + N);
	long long now = 0;
	for (int i = 0; i < N; i++) {
		now += t[i].a;
		if (t[i].b < now) {
			printf("No");
			return 0;
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 3328