akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;
const int MAX_N = (int)(100 + 5);

ll n, w, weight[MAX_N], value[MAX_N];

map<ll, vector<ll>> cnt;
vector<vector<ll>> combs(0);
ll ans = 0;

void produce(auto itr, vector<ll> part) {
  if (itr != cnt.end()) {
    auto itrp = next(itr, 1);
    for (int i = 0; i <= itr->second.size(); ++i) {
      vector<ll> tmppart = part;
      tmppart.push_back(i);
      produce(itrp, tmppart);
    }
  }
  else {
    combs.push_back(part);
  }
}

int main(void) {
  // Here your code !
  scanf("%lld %lld", &n, &w);
  for (int i = 0; i < n; ++i) {scanf("%lld %lld", &weight[i], &value[i]);}
  for (int i = 0; i < n; ++i) {cnt[weight[i]].push_back(value[i]);}

  for (auto itr = cnt.begin(); itr != cnt.end(); ++itr) {
    sort(itr->second.begin(), itr->second.end(), greater<ll>());
  }

  auto itr = cnt.begin();
  vector<ll> tmp(0);
  produce(itr, tmp);

  for (int k = 0; k < combs.size(); ++k) {
    vector<ll> x = combs[k];
    ll candans = 0;
    ll candweight = 0;
    for (int j = 0; j < x.size(); ++j) {
      auto titr = next(itr, j);
      vector<ll> tmpvalue = titr->second;
      candweight += titr->first * x[j];
      for (int i = 0; i < x[j]; ++i) {
        candans += tmpvalue[i];
      }
    }

    if (candweight <= w) {
      ans = max(ans, candans);

    }
  }

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

  return 0;
}


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    map<string, unsigned long> m;
    unsigned long mx{0};
    for(unsigned long i{0}; i < N; ++i){
        string s;
        cin >> s;
        mx = max(mx, ++m[s]);
    }
    for(const auto& i : m){
        if(i.second == mx)cout << i.first << endl;
    }
    return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define debug(n1) cout << n1 << endl;
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)

using namespace std;

const string __sep = "\n";
const ll INF = 1000000000000000001ll;
const int MOD = 998244353;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int T;
  T = 1;
  //cin >> T;
  while (T-- > 0) {
    int a,b;
    cin >> a >> b;
    cout << (a * b) << endl;
  }

  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define ld long double
#define MOD 1000000007
#define u128 __int128
#define ff first
#define ss second
#define INTMAX 1000000009
#define N 100050

ll bmexp(ll a, ll b)
{
	ll res = 1;
	while(b)
	{
		if(b & 1)
			res = res * a % MOD;
		a = a * a % MOD;
		b >>= 1;
	}
	return res;
}

void solve()
{

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

ll seg[3 * N];
ll a[N], n;
void build(int node, int l, int r)
{
	if(l == r)
		seg[node] = a[l];
	else
	{
		int mid = l + r >> 1;
		build(2 * node + 1, l, mid);
		build(2 * node + 2, mid + 1, r);
		seg[node] = gcd(seg[2 * node + 1], seg[2 * node + 2]);
	}
}

ll q(int node, int l, int r, int x, int y)
{
	if(x <= l && y >= r)
		return seg[node];
	else
	{
		ll ans = 0;
		int mid = l + r >> 1;
		if(x <= mid)
			ans = (ans == 0 ? q(2 * node + 1, l, mid, x, y) : gcd(ans, q(2 * node + 1, l, mid, x, y)));
		if(y > mid)
			ans = (ans == 0 ? q(2 * node + 2, mid + 1, r, x, y) : gcd(ans, q(2 * node + 2, mid + 1, r, x, y)));
		return ans;
	}
}

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

	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	build(0, 0, n - 1);
	// for (int i = 0; i < 2 *n - 1; ++i)
	// {
	// 	cout << seg[i] << " ";
	// }
	ll gc = seg[0];
	// cout << gc << " " << q(0, 0, n - 1, 1, n - 1) << " ";
	gc = max(gc, q(0, 0, n - 1, 1, n - 1));
	for (int i = 1; i < n; ++i)
	{
		ll k = gcd(q(0, 0, n - 1, 0, i - 1), q(0, 0, n - 1, i + 1, n - 1));
		gc = max(gc, k);
	}
	cout << gc;
	return 0;	
}

Measured memory_bytes: 3072
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;
const int maxx=110;
const int infinity=(1<<30);

int A[maxx][maxx];
int d[maxx],p[maxx];//d[i]里面存的是V-T中的点，要加入到T中，选取的最小的权值；
					//d[i]=u;表示的是要把V-T中的点i加入到T中所需要的代价是u；
					//p[v]=u;表示的是V-T中的点v，要和T中的点u连接，即u是v的父节点；
bool flag[maxx];	//用flag来标记这个节点是不是在MST中，true是在T里，false是在V-T里；

int main (){
		int n;
		cin>>n;
		for(int i =1;i<=n;i++){
			for(int j=1;j<=n;j++){
				int e;cin>>e;
				A[i][j]=(e==-1)?infinity:e;
			}
		}

		for(int i=0;i<maxx;i++) {
			flag[i]=false;
			d[i]=infinity;
			p[i]=-1;
		}
		int sum=0,minv,minj;
		flag[1]=true;
		while(1){
			minv=infinity;
			minj=-1;
			for(int i=1;i<=n;i++){
				if(flag[i]==true){
					for(int j=1;j<=n;j++){
						if(A[i][j]!=-1 && A[i][j]<minv && flag[j]==false) {
							minv=A[i][j];
							minj=j;
						} 
					}
				}
			}
//			cout<<minv<<endl;
//			cout<<minj<<endl;
			if(minv==infinity || minj==-1) break;
			flag[minj]=true;
			sum+=minv;
		}
		
		cout<<sum<<endl;
		return 0;
		
}


Measured memory_bytes: 3132
#include<stdio.h>

int main(){
  long a,b,k;
  scanf("%ld %ld %ld",&a,&b,&k);
  if(a>=k)
  {
    a-=k;
    k=0;
  }
  else 
  {
    k-=a;
    a=0;
  }
  if(b>=k)
  {
    b-=k;
    k=0;
  }
  else 
  {
    k-=b;
    b=0;
  }
  printf("%ld %ld",a,b);
  return 0;
}
    

Measured memory_bytes: 128
import sys

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    aa=LI()
    x=0
    for a in aa[2:]:x^=a
    t=aa[0]+aa[1]-x
    if t<0 or t&1:
        print(-1)
        exit()
    t>>=1
    #print(t)
    a0=a1=0
    for i in range(40,-1,-1):
        dt=t>>i&1
        dx=x>>i&1
        if (dt,dx)==(1,1):
            print(-1)
            exit()
        if (dt,dx)==(1,0):
            a0|=1<<i
            a1|=1<<i

    for i in range(40,-1,-1):
        dt=t>>i&1
        dx=x>>i&1
        if (dt,dx)==(0,1):
            if (a0|1<<i)<=aa[0]:a0|=1<<i
            else:a1|=1<<i

    #print(a0,a1)
    if a0>0 and a0<=aa[0]:print(aa[0]-a0)
    else:print(-1)

main()


Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 18500000
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    int n;
    cin >> n;
    cout << !n << endl;
    return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

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

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

    int m = 0;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int pi;
        cin >> pi;
        ans += pi;
        m = max(m, pi);
    }

    ans -= m;
    ans += m / 2;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 380
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val a = Array(n) { sc.nextInt() }
    val dic = mutableMapOf<Int, Int>()
    for (i in 0 until n) {
        dic[a[i]] = 1 + (dic[a[i]] ?: 0)
    }
    var sum = 0L
    for (x in dic.values) {
        sum += x.toLong() * (x - 1) / 2
    }
    val ans = mutableListOf<Long>()
    for (i in 0 until n) {
        val x = dic[a[i]]!!.toLong()
        ans.add(sum - x * (x - 1) / 2 + (x - 1) * (x - 2) / 2)
    }
    println(ans.joinToString("\n"))
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 86208
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n;
	cin >> n;
	if (n <= 500) {
		cout << n << endl;
		rep(i, n) {
			rep(j, n) {
				cout << i + 1 << ' ';
			}
			cout << endl;
		}
	}
	else {
		vector<vector<int>> ans(500, vector<int>(500));
		cout << 500 << endl;
		rep(i, 500) {
			rep(j, 500) {
				ans[i][j] = (i + j + 1) % 500;
				if (ans[i][j] == 0) ans[i][j] += 500;
				if (i % 2 == 1 && ans[i][j] + 500 <= n) ans[i][j] += 500;
			}
		}
		rep(i, 500) {
			rep(j, 500) {
				cout << ans[i][j] << ' ';
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 3200
#include "stdio.h"

int main(void) {
  /* code */
  int s,h;
  scanf("%d %d", &s, &h);
  if(s%h != 0){
    printf("%d\n",s/h+1 );
  }else{
    printf("%d\n",s/h );
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e9)
using namespace std;
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    vector<ll> dd;
    for(int i = 1; i*i <= M; i++){
        if(M % i == 0){
            dd.push_back(i);
            if(i * i != M){
                dd.push_back(M/i);
            }
        }
    }
    sort(dd.begin(), dd.end());
    ll ans = 0;
    rep(i,0,dd.size()){
        if(M/dd[i] >= N){
            ans = max(ans, dd[i]);
        }
    }
    print(ans);

}


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

def main():

    A, op , B = map(str, input().split())

    if op == '+':
        ans = int(A) + int(B)
    
    elif op == '-':
        ans = int(A) - int(B)

    print(ans)


if __name__ == "__main__":
    main()

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

int findsum(int i){
  int sum=0;
   while(i>0){
   sum += i%10;
   i /= 10;
 }
  return sum;
}
int main(){

  int sum=0;
  int sum2=0;
  int num;
  int a,b;
  int wa=0;
  
  cin >> num >> a >> b;
  
  for(int i=1; i<=num; i++){
    
	sum = findsum(i);
    
    if(a<=sum && sum<=b)
      sum2 +=i;
  }
  
  cout << sum2;
  
}
  

Measured memory_bytes: 256
//(・ω・)
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, atoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
#include <sstream> //istringstream
#include <stdlib.h>
#include <list>
#include <iterator>//std::advance()
using namespace std;

int main(){
   unsigned long long x;
   cin >> x;
   unsigned long long i=100,sum=0;
   while(i<x){
       i*=1.01;
       sum++;
   }
   cout << sum << endl;
}

Measured memory_bytes: 3636
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int N = in.i();
        int[] A = in.ii(N);
        Arrays.sort(A);
        int a = A[0];
        String ans = "YES";
        for(int i = 1; i < A.length; i++){
            if (A[i] == a) {
                ans = "NO";
                break;
            }
            a = A[i];
        }
        out.println(ans);
    }


    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        int i() {
            return Integer.parseInt(s());
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            int i = 0;
            String s = s();
            for (int j = 0; j < a.length; j++) {
                boolean minus = s.charAt(i) == '-';
                i += minus ? 1 : 0;
                int k = 0;
                while (true) {
                    try {
                        int h = s.charAt(i++) - '0';
                        if (h < 0 || 9 < h) break;
                        k = 10 * k + h;
                    } catch (Exception e) { break; }
                }
                a[j] = minus ? -k : k;
            }
            return a;
        }
    }
}


Measured memory_bytes: 43756
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
#define n	5
bool cmp(int a, int b){
	if(a%10==0) return a>b;
	if(b%10==0) return a<b;
	return a%10 > b%10;
	}
int main()
{
	int x[6];
	for0(i,n) cin>>x[i];
	sort(x,x+n,cmp);
	int t,s=0;
//	for0(i,n) cout<<x[i]<<nw;
	for0(i,n-1){
		t = (ceil((x[i]/10.0))) * 10;
		s += t;
		}
	s += x[n-1];
	cout<<s<<nw;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<climits>
#include<cstring>

using namespace std;

int main() {
	int n, W; cin >> n >> W;
	int w[n], v[n];

	for (int i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
	}
	long long int dp[n+1][W+1];
	memset(dp, 0, sizeof(dp));

	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= W; j++) {
			dp[i + 1][j] = dp[i][j];
			if (w[i] <= j) {
				dp[i+1][j] = max(dp[i + 1][j], dp[i][j-w[i]] + v[i]);
			}
		}
	}
	cout << dp[n][W] << endl;
}

Measured memory_bytes: 79104
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#ifdef LOCAL
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, K;
    cin >> N >> K;
    ll INF = 1LL << 60;

    vector<ll> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());

    ll t = INF;
    ll b = -INF;

    while(t - b > 1) {
        ll m = (t + b) / 2;
        ll c = 0;
        REP(i, A.size()) {
            if (A[i] * A[i] <= m) --c;
            if (A[i] < 0) {
                ll mn = (m / A[i]) - 5;
                while(mn * A[i] > m) ++mn;
                int pos = lower_bound(A.begin(), A.end(), mn) - A.begin();
                c += N - pos;
            } else if(A[i] > 0) {
                ll mx = (m / A[i]) + 5;
                while(mx * A[i] > m) --mx;
                int pos = upper_bound(A.begin(), A.end(), mx) - A.begin();
                c += pos;
            } else {
                if (m >= 0) {
                    c += N;
                }
            }
        }


        c /= 2;
        if (c >= K) {
            t = m;
        } else {
            b = m;
        }
    }

    cout << t << endl;




    
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   ll n,i,sum=0,f=0;
   cin>>n;
   for(i=1; i<=n/2; i++)
   {
       if(n%i==0)
       {
           f=1;
       }
     sum=sum+((n)/i)-f;
     f=0;

   }
   f=0;
   if(n%2==0)
   {
       f=1;
   }
   cout<<sum+(n/2)-f;
}



Measured memory_bytes: 3624
import sys
while True:
    (m, f, r) = [int(i) for i in sys.stdin.readline().split()]
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Measured memory_bytes: 6724
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B;
	string S, T;
	cin >> A >> B;

	rep(i, 0, B)
	{
		S += to_string(A);
	}
	rep(i, 0, A)
	{
		T += to_string(B);
	}

	cout << min(S, T) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
typedef long long LL;
using namespace std;

const int MAXN = 1e3 + 10;


int main() {
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	int ans1 = a * b;
	int ans2 = c * d;
	printf("%d\n", max(ans1, ans2));
	return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())
v = [list(map(int, input().split())) for i in range(n)]
ans = 0
op = [-1,1]
for i in range(2):
    for j in range(2):
        for k in range(2):
            sx, sy, sz = op[i], op[j], op[k]
            ans_tmp = sum(sorted([x*sx+y*sy+z*sz for x,y,z in v], reverse=True)[:m])
            ans = max(ans, ans_tmp)
print(ans)

Measured memory_bytes: 3316
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
namespace AtCoder.ABC056
{
    static class NarrowRectanglesEasy
    {
        static public void Main()
        {
            var wab = ReadLine().Trim().Split(' ').Select(i => int.Parse(i)).ToArray();
            var w = wab[0]; var a = wab[1]; var b = wab[2];
            var dist = Max(a, b) - Min(a, b) - w;
            WriteLine((dist >= 0) ? dist : 0);
        }
        static int Min(int a, int b)
        {
            return (a > b) ? b : a;
        }
        static int Max(int a, int b)
        {
            return (a > b) ? a : b;
        }
    }
}


Measured memory_bytes: 13268
/*input
9999 10
540 7550
691 9680
700 9790
510 7150
415 5818
551 7712
587 8227
619 8671
588 8228
176 2461
*/

#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>

using namespace std;

void run() {
	int h, n, i, j;
	cin >> h >> n;
	vector<int> points(n), cost(n);
	for(i=0; i<n; i++) 
		cin >> points[i] >> cost[i];
	const ll INF = (ll) 1e10;
	vector<ll> dp(n+h, INF); // // dp[points] = magic_cost - minimize magic_cost
	dp[0] = 0;
	for(i=0; i<max(n, h); i++) {
		for(j=0; j<n; j++) {
			ll p = min(h, i + points[j]);
			dp[p] = min(dp[p], dp[i] + cost[j]);
		}
	}
	cout << dp[h] << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);		
	int t = 1;
	// cin >> t;
	while(t--) {
		run();
	}
}


Measured memory_bytes: 384
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<limits>
using namespace std;
//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;

//grobal変数


int main() {
	int a, b, c, x, y;
	int ans,abcnt;
	cin >> a >> b >> c >> x >> y;
	if (a + b < 2 * c) {
		ans = a * x + b * y;
	}else if (x > y) {
		ans = min(c * y * 2 + a * (x - y), c*x * 2);
	}else{
		ans = min(c * x * 2 + b * (y - x), c*y * 2);
	}
	cout << ans << endl;
	
}



Measured memory_bytes: 256
bng = []
for i1 in range(3):
    row = list(map(int,input().rstrip().split()))
    bng.append(row)

#print(bng)

N = int(input())

for l1 in range(N):
    tmp = int(input())
    for l2 in range(3):
        for l3 in range(3):
            if tmp == bng[l2][l3]:
                bng[l2][l3] = 0

if bng[0][0] + bng[0][1] + bng[0][2] == 0:
    print('Yes')
elif bng[1][0] + bng[1][1] + bng[1][2] == 0:
    print('Yes')
elif bng[2][0] + bng[2][1] + bng[2][2] == 0:
    print('Yes')
elif bng[0][0] + bng[1][0] + bng[2][0] == 0:
    print('Yes')
elif bng[0][1] + bng[1][1] + bng[2][1] == 0:
    print('Yes')
elif bng[0][2] + bng[1][2] + bng[2][2] == 0:
    print('Yes')
elif bng[0][2] + bng[1][1] + bng[2][0] == 0:
    print('Yes')
elif bng[0][0] + bng[1][1] + bng[2][2] == 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        String s = in.next();
        out.printf("%s%d%s\n", s.charAt(0), s.length() - 2, s.charAt(s.length() - 1));
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 22996
#include<iostream>
#include<cstring>
#include<cassert>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<bitset>
#include<vector>
#include<time.h>
#include<algorithm>
using namespace std;
#define REP(i,x,y) for(int i=x;i<=y;i++)
#define rep(i,n) REP(i,1,n)
#define rep0(i,n) REP(i,0,n-1)
#define repG(i,x) for(int i=pos[x];~i;i=e[i].next)
#define ll long long
#define db double
const int N=6007;
const int INF=1e9+7;
int n;
char s[N];
int ad[N],bd[N],f[N][N],a[N],va[N],vb[N],g[N];
void solve(){
	g[0]=0;
	rep(i,n*2){
		g[i]=g[i-1];
		if(a[i]==1)g[i]=max(g[i],g[va[bd[i]]-1]+1);
	}
	rep(i,g[n*2])putchar('a'),putchar('b');
	puts("");
}
bool vis[N];
bool cp(int *a,int *b,int o1,int o2){
	rep(i,min(o1,o2)){
		if(a[i]>b[i])return 1;
		if(a[i]<b[i])return 0;
	}
	return o1>o2;
}
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	rep(i,2*n)a[i]=s[i]-'a';
	int c1=0,c2=0;
	rep(i,2*n){
		if(a[i]==1){
			vb[++c2]=i;
			bd[i]=c2;
		}
		else{
			va[++c1]=i;
			ad[i]=c1;
		}
	}
	bool fl=0;
	rep(i,n)if(va[i]>vb[i])fl=1;
	if(!fl){
		solve();
		return 0;
	}
	bool fls=0;
	for(int i=n;i;i--){
		if(va[i]<vb[i]){
			f[i][0]=f[i+1][0];
			rep(j,f[i][0])f[i][j]=f[i+1][j];
			if(fls)continue;
			if(!f[i][0]||f[i][1]==0){
				int md=n+1;
				for(int j=n;j;j--)if(va[j]>vb[i])md=j;
				if(f[i][0]<2+f[md][0]){
					f[i][0]=f[md][0];
					rep(j,f[md][0])f[i][j]=f[md][j];
					f[i][++f[i][0]]=0;
					f[i][++f[i][0]]=1;
				}
			}
			continue;
		}
		fls=1;
		int cnt=0,mx=va[i];
		rep(j,n*2)vis[j]=0;
		vis[va[i]]=1;
		REP(j,vb[i],mx){
			if(a[j]==1){
				g[++cnt]=1;
				vis[va[bd[j]]]=1;
				mx=max(mx,va[bd[j]]);
			}
			else if(vis[j])g[++cnt]=0;
		}
		int md=n+1;
		for(int j=n;j;j--)if(vb[j]>mx)md=j;
		rep(k,f[md][0])g[++cnt]=f[md][k];
		f[i][0]=f[i+1][0];
		rep(j,f[i][0])f[i][j]=f[i+1][j];
		if(cp(g,f[i],cnt,f[i][0])){
			f[i][0]=cnt;
			rep(j,cnt)f[i][j]=g[j];
		}
	}
	rep(i,f[1][0])putchar('a'+f[1][i]);
	puts("");
	return 0;
}

Measured memory_bytes: 45136
from heapq import heappush, heappop, heapify

N = int(input())
V = list(map(int, input().split()))

heapify(V)
while len(V) > 1:
    v1 = heappop(V)
    v2 = heappop(V)
    heappush(V, (v1 + v2) / 2)
ans = heappop(V)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define maxn 100010
using namespace std;
int a[maxn];
int main()
{
    cin.tie(0);ios_base::sync_with_stdio(false);
    int n;
    long long ans=0;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n+1;i++)ans+=abs(a[i]-a[i-1]);
    for(int i=1;i<=n;i++)
    {
        cout<<ans-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])+abs(a[i-1]-a[i+1])<<'\n';
    }
return 0;
}


Measured memory_bytes: 1664
import bisect


n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

max_books = 0

sum_a = []
sum_b = []

total = 0
for i in range(n):
    total += a[i]
    sum_a.append(total)

total = 0
for j in range(m):
    total += b[j]
    sum_b.append(total)

sum_a.insert(0, 0)
sum_b.insert(0, 0)

for i in range(n+1):
    r = k - sum_a[i]
    if r == 0:
        books = i
    elif r < 0:
        books = 0
    else:
        book_b = bisect.bisect_right(sum_b, r)
        books = i + book_b - 1
    if books >= max_books:
        max_books = books

print(max_books)



Measured memory_bytes: 47412
#include<cstdio>

int pa[10000];

int find(int x){

    if(pa[x]!=x) pa[x] = find(pa[x]);
    return pa[x];
}

void Init(int n){

    for(int i=0;i<n;i++) pa[i] = i;
    return ;
}

int Query(int a,int b){

    if(find(a)!=find(b)) return 0;
    return 1;
}

void Union(int a,int b){

    int x = find(a);
    int y = find(b);

    if(x!=y) pa[x] = y;
}

int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m)){

        Init(n);

        while(m--){

            int op;
            int x,y;

            scanf("%d%d%d",&op,&x,&y);

            if(op==1) printf("%d\n",Query(x,y));
            else Union(x,y);
        }
    }
    return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
const int N=100000+10;
int A,B,m;
int a[N],b[N];
int main() {
	scanf("%d%d%d",&A,&B,&m);
	for(int i=1;i<=A;i++) scanf("%d",&a[i]);
	for(int i=1;i<=B;i++) scanf("%d",&b[i]);
	int ans=1e9;
	while(m--){
		int x,y,c; scanf("%d%d%d",&x,&y,&c);
		ans=min(a[x]+b[y]-c,ans);
	}
	sort(a+1,a+1+A); sort(b+1,b+1+B);
	ans=min(ans,a[1]+b[1]);
	cout<<ans<<endl;
}	

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int dp[100100],vs[101];
int n,k;
int ds(int s) {
	if(s < 0) {return 1;}
	if(dp[s] != -1) {return dp[s];}
	int res = 1;
	for(int i=0;i<n;i++) {
		res &= ds(s-vs[i]);
	}
	return dp[s] = 1-res;
}
int main() {
	scanf("%d %d ",&n,&k);
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++) {
		int t;
		scanf("%d ",&t);
		vs[i] = t;
	}
	printf("%s\n",ds(k)?"First":"Second");
}


Measured memory_bytes: 5376
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 100005

using namespace std;
typedef long long int ll;

int A[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%d",&A[i]);
	sort(A,A+n);
	int nm=0;
	for(int i=0;i<n;)
	{
		int f=i,cnt=0;
		for(;i<n&&A[i]==A[f];i++) cnt++;
		cnt--;
		nm+=cnt;
	}
	if(nm%2==1) nm++;
	printf("%d\n",n-nm);
	return 0;
}


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

const int maxn = 20010;
int a[maxn], b[maxn], p[maxn];

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

Measured memory_bytes: 896
#include<stdio.h>
#include<string.h>
int main(void)
{
	int x,X,i;
	char c[1001];
	while(1){
		scanf("%s",c);
		if(c[0]=='0') break;
		X=0; x=0;
		for(i=1;i<strlen(c);i++){
			if(c[i]=='A'){
				x++;
			}
			else{
				X++;
			}
		}
		if(x<X){
			X++;
		}
		else{
			x++;
		}
		printf("%d %d\n",x,X);
	}
	return 0;
}

Measured memory_bytes: 964
#coding:utf-8
import itertools

# 入力
N = int(input())
TAKOYAKIS = [int(i) for i in input().split()]

combinations = list(itertools.combinations(TAKOYAKIS, 2))

healing_value = []
for c in combinations:
    healing_value.append(c[0] * c[1])
    

print(sum(healing_value))

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

int main() {
	int cnt = 0;
	string s, t;
	cin >> s >> t;
	rep(i, s.size()) {
		if (s[i] != t[i]) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

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

typedef long long int   ll;
#define int             ll
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
#define scan(n)         scanf("%lld",&n)
#define pb              push_back
#define PI              3.1415926535897932384626433832795
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]
#define showar0(ar)     for(int i=0;i<n;i++)cout<<ar[i]<<" "
#define showar1(ar)     for(int i=1;i<=n;i++)cout<<ar[i]<<" "
int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mul(int a,int b){return ((a%mod)*(b%mod))%mod;}

signed main(){
    int t=1;
//    scan(t);
    while(t--){
        int n;cin>>n;
        int ar[n+1];
        inputar1(ar);
        int cnt=0;
        for(int i=1;i<=n;i+=2){
            if(ar[i]%2)cnt++;
        }
        cout<<cnt;
    }
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int, int>;
const int MX = 200005;
int n, k, p, b, e, b2, e2, ans;
bool s;
P deq[MX], deq2[MX];
int main(){
	scanf("%d%d", &n, &k);
	ans = n-k+1;
	rep(i,n){
		bool ok = true;
		scanf("%d", &p);
		
		while(b2 < e2 && deq2[e2-1].second < p) e2--;
		if(e2 > b2) ok = false;
		deq2[e2++] = P(i,p);
		if(deq2[b2].first + k == i) b2++;
		
		while(b < e && deq[e-1].second > p) e--;
		deq[e++] = P(i,p);
		if(deq[b].first + k == i) b++;
		else ok = false;
		
		if(ok || (s && e-b == k)) ans--;
		if(e-b == k) s = true;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct node
{
	double x,y;
	bool operator < (const node b)
	{
		return atan2(y,x)<atan2(b.y,b.x);
	}
}a[105];
int main()
{
	int n;
	double ans = 0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lf %lf",&a[i].x,&a[i].y);
	}
	sort(a,a+n);
	for(int i=0;i<n;i++)
	{
	   double x=0,y=0;
	   int j = i;
	   do
	   {
	   	 x+=a[j].x;
	   	 y+=a[j].y;
	   	 ans=max(ans,sqrt(x*x+y*y));
	   	 j++;
	   	 j%=n;
	   }while(j!=i);
	}
	printf("%.15lf\n",ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    ll N,T,A;cin>>N>>T>>A;
    ll diff=99999999999;
    ll index=0;
    for(int i=1;i<=N;i++){
        ll H;cin>>H;
        ll d=abs((T*1000-H*6)-A*1000);
        if(d<diff){
            diff=d;
            index=i;
        }
    }
    cout<<index<<endl;
}

Measured memory_bytes: 3616
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

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

for d in div:
  if d <= m/n:
    ans = d
print(ans)

Measured memory_bytes: 63864
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++ )

int main()
{
  double n, k;
  cin >> n >> k;
  vector<pair<double, double> > v;
  REP(i, n) {
    double a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  sort(v.begin(), v.end());
  int cnt = 0;
  while(k > 0) {
    k -= v[cnt].second;
    cnt++;
  }
  cout << v[cnt - 1].first << endl;
}


Measured memory_bytes: 2420
S = input()
a = 0
b = 0
if S[0] == 0:
    a = int(S[1])
else:
    a = int(S[0:2])
if S[2] == 0:
    b = int(S[3])
else:
    b = int(S[2:])
    
fa = ''
fb = ''
    
if a == 0:
    fa = 'n'
elif a <= 12:
    fa = 'm'
else:
    fa = 'y'
    
if b == 0:
    fb = 'n'
elif b <= 12:
    fb = 'm'
else:
    fb = 'y'
    
if (fa == 'm' and fb == 'y') or (fa == 'm' and fb == 'n'):
    print('MMYY')
elif (fb == 'm' and fa == 'y') or (fb == 'm' and fa == 'n'):
    print('YYMM')
elif fa == 'm' and fb == 'm':
    print('AMBIGUOUS')
else:
    print('NA')
    

Measured memory_bytes: 38384
#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int rot[24][7] = {
	{ 0,1,2,3,4,5,6 },{ 0,1,3,5,2,4,6 },{ 0,1,4,2,5,3,6 },{ 0,1,5,4,3,2,6 },
	{ 0,2,6,3,4,1,5 },{ 0,2,3,1,6,4,5 },{ 0,2,1,4,3,6,5 },{ 0,2,4,6,1,3,5 },
	{ 0,3,1,2,5,6,4 },{ 0,3,2,6,1,5,4 },{ 0,3,5,1,6,2,4 },{ 0,3,6,5,2,1,4 },
	{ 0,4,1,5,2,6,3 },{ 0,4,2,1,6,5,3 },{ 0,4,5,6,1,2,3 },{ 0,4,6,2,5,1,3 },
	{ 0,5,1,3,4,6,2 },{ 0,5,3,6,1,4,2 },{ 0,5,4,1,6,3,2 },{ 0,5,6,4,3,1,2 },
	{ 0,6,2,4,3,5,1 },{ 0,6,3,2,5,4,1 },{ 0,6,5,3,4,2,1 },{ 0,6,4,5,2,3,1 } };

int  a[102][7];
char f[102];

int identical(int *a, int *b)
{
	int i, j;
	memset(f, 0, sizeof(f));
	for (i = 1; i <= 6; i++) f[a[i]]++;
	for (i = 1; i <= 6; i++) f[b[i]]--;
	for (i = 1; i <= 6; i++) if (f[b[i]]) return 0;

	for (j = 0; j < 24; j++) {
		if (b[1] == a[rot[j][1]]) {
			for (i = 2; ; i++) {
				if (i > 6) return 1;
				if (b[i] != a[rot[j][i]]) break;
			}
		}
	}
	return 0;
}

int main()
{
	int n, i, j, f;

	n = in();
	for (i = 0; i < n; i++) {
		for (j = 1; j <= 6; j++) a[i][j] = in();
	}
	f = 1;
	for (i = 0; i < n; i++) for (j = i+1; j < n; j++) {
		if (identical(a[i], a[j])) { f = 0; goto done; }
	}
done:
	puts(f? "Yes": "No");
	return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) cout << s << endl;
    else cout << "red" << endl;
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    
    let mut iter = buf.split_whitespace();
    
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let c: usize = iter.next().unwrap().parse().unwrap();
    
    println!("{}", min(b/a, c));
}

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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, 0, N) cin >> A[i];
  vector<ll> S(N+1);
  rep(i, 0, N) S[i+1] = S[i] + A[i];
  ll ans = 1e18;
  rep(i, 2, N) {
    // left side
    int left = 0;
    int right = i;
    while(right - left > 1) {
      int mid = (left + right) / 2;
      ll L = S[mid];
      ll R = S[i] - S[mid];
      if(L >= R) right = mid;
      else left = mid;
    }
    ll B = S[right], C = S[i] - S[right];
    ll B2 = S[left], C2 = S[i] - S[left];
    ll l_mn = min(B, C), l_mx = max(B, C);
    if(abs(B2 - C2) < abs(B - C)) l_mn = min(B2, C2), l_mx = max(B2, C2);
    // right side
    left = i;
    right = N;
    while(right - left > 1) {
      int mid = (left + right) / 2;
      ll L = S[mid] - S[i];
      ll R = S[N] - S[mid];
      if(L >= R) right = mid;
      else left = mid;
    }
    ll D = S[right] - S[i], E = S[N] - S[right];
    ll D2 = S[left] - S[i], E2 = S[N] - S[left];
    ll r_mn = min(D, E), r_mx = max(D, E);
    if(abs(D2 - E2) < abs(D - E)) r_mn = min(D2, E2), r_mx = max(D2, E2);
    ans = min(ans, max(l_mx, r_mx) - min(l_mn, r_mn));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  ll a, b, c;
  cin >> a >> b >> c;
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0)
    cout << 0 << endl;
  else
    cout << min({a * b, b * c, a * c}) << endl;
}


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



void solve(){
  int n;
  cin >> n;
  vector<int> h; 
  for(int i=0; i<n; i++){
    int k;
    cin >> k;
    h.push_back(k);
  }
  int count=0;
  for(int i=0; i<n; i++){
    bool b=true;
    for(int j=0; j<i; j++){
      if (h[j]>h[i]) {b=false;}
    }
    if(b) {count++;}
  }
  cout << count << endl;

}

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


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

int main(){
	int n;
	cin >> n;
	
	double ans;
	if(n%2==0) ans = 0.5;
	else ans = (double)(n+1)/2/n;
	printf("%.10f", ans);
	return 0;
}

Measured memory_bytes: 256
N=int(input())
ans=0
for j in range(1,N+1):
    if j%2==1:
        cnt=0
        for i in range(1,j+1):
            if j%i==0:
                cnt+=1
        if cnt==8:
            ans+=1
            #cnt=0
            #cnt=0

    else:
        cnt=0
        continue
print(ans)


Measured memory_bytes: 2940
#include"bits/stdc++.h"
using namespace std;

int main() {
  vector<char> vec;
  string s;
  int q;
  cin >> s;
  cin >> q;

  int reverseCount = 0;
  for(int i = 0; i < s.length(); i++) {
    vec.push_back(s[i]);
  }

  for(int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if(t == 1) {
      reverseCount++;
    } else {
      int f;
      string c;
      cin >> f >> c;
      if(reverseCount % 2 == 1) {
        if(f == 1) {
          f = 2;
        } else {
          f = 1;
        }
      }
      if(f == 1) {
        vec.insert(vec.begin(), c[0]);
      } else {
        vec.push_back(c[0]);
      }
    }
  }

  if(reverseCount % 2 == 1) {
    reverse(vec.begin(), vec.end());
  }

  for (auto c : vec) {
    cout << c;
  }
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);


int main(){
	int n,k;
	cin >> n >> k;
	string s;
	cin >> s;
	int ans = 0,sum = 0,l = 0;
	for(int r = 0; r < n; r++){
		if(s[r] == '0'){
			while(r < n && s[r] == '0') r++;
			r--;
			sum++;
		}
		if(sum > k){
			for(; l < n; l++){
				if(s[l] == '0'){
					while(l < n && s[l] == '0') l++;
					break;
				}
			}
			sum--;
		}
		ans = max(ans,r-l+1);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int r,g,b,k,a,c,d;
    cin>>r>>g>>b>>k;
    if((r>g) && (r>b)){
       a= r*pow(2,k);
        cout<<g+b+a<<endl;
    }
    else if((g>r) && (g>b)){
        c=g*pow(2,k);
        cout<<r+b+c<<endl;
    }
    else {
        d=b*pow(2,k);
    cout<<r+g+d<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
const int nmax=100005;
vector<int> v[nmax];
int viz[15][nmax];
int c[nmax],nod[nmax],dist[nmax],tip[nmax];
int n,m,q,i,x,y;
void memo(int col,int d,int x)
{
    if(viz[d][x]) return;
    viz[d][x]=1;
    if(d==0)
    {
        c[x]=col;
        return;
    }
    memo(col,d-1,x);
    for(int i=0;i<v[x].size();i++)
        memo(col,d-1,v[x][i]);
}
int main()
{
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    cin>>q;
    for(i=1;i<=q;i++)
    {
        cin>>nod[i]>>dist[i]>>tip[i];
    }
    for(i=q;i>=1;i--)
    {
        memo(tip[i],dist[i],nod[i]);
    }
    for(i=1;i<=n;i++)
        cout<<c[i]<<'\n';
    return 0;
}


Measured memory_bytes: 13944
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;



int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  int ans = 0;
  sort(ALL(a));
  rep(i, 2){
    while(a[i] <= a[2] - 2){
      a[i] += 2;
      ans++;
    }
  }
  sort(ALL(a));
  if (a[0] == a[1] && a[1] == a[2])
    cout << ans << endl;
  else {
    a[0]++; a[1]++; ans++;
    sort(ALL(a));
    if (a[0] == a[1] && a[1] == a[2]) cout << ans << endl;
    else cout << ans + 1 << endl;
  }

}


Measured memory_bytes: 256