akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template <typename T> using order_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T1, typename T2> using order_map = tree <T1, T2, less <T1>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> bool MIN(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> bool MAX(T &a, T b) { return a < b ? (a = b, true) : false; }

#define ll              long long int
#define endl            '\n'
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define mk              make_pair
#define ff              first
#define ss              second
#define all(a)          (a).begin(), (a).end()
#define rall(a)         (a).rbegin(), (a).rend()
#define eb              emplace_back
#define pb              push_back
#define LINE            __LINE__

static const int maxn = 1e6 + 5;
static const int logn = 19;

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

     	string s;
	cin >> s;
	int n = s.size();
	int pos = 0;
	int len = 0;
	vector <int> ans(n + 1);
	for (int i = 1; i <= n; i++) {
		char ch = s[i - 1];
		if (ch == 'R') {
			pos = i; 
			len = 0;
		}
		else {
			len++;
			ans[pos + (len & 1)]++;
		}
	}
	pos = 0;
	len = 0;
	for (int i = n; i >= 1; i--) {
		char ch = s[i - 1];
		if (ch == 'L') {
			pos = i;
			len = 0;
		}
		else {
			len++;
			ans[pos - (len & 1)]++;
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << " \n"[i == n];
	}
      #ifndef ONLINE_JUDGE
            cerr << endl << "Time : " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
      #endif // ONLINE_JUDGE
}


Measured memory_bytes: 1104
#include<iostream>
using namespace std;
int main()
{
  int N,A;int max=0; int some_count=0;
  cin>>N;
  for(int i=0;i<N;i++)
  {
    cin>>A;
    if(A>=max){some_count++;max=A;}
  }
  cout<<some_count<<endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let mut ans = 0;

    for i in 0..s.len() {
        if s[i] == '+' {
            ans += 1;
        } else {
            ans -= 1;
        }
    }
    println!("{}", ans);
}


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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    set<string> S;
    
    ll n; cin >> n;
    rep(i,n){
        string s; cin >> s;
        S.insert(s);
    }

    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 19256
//In the name of ALLAH the most merciful the most beneficial

#include<cstdio>
#include<cstring>
#include<bits/stdc++.h>
#include<iostream>
#include<math.h>
#define sc(x) scanf("%d",&x)
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORd(i,a,b) for(int i=a;i>b;i--)
#define ff first
#define ss second
#define sz(x) x.size()
#define pb push_back

using namespace std;

typedef pair<int,int> pii;
typedef vector<pii> vii;
const int con = 1e8;
static const int INF = 0x3f3f3f3f;
static const int MOD = 998244353;



int main(){

    ll ans=0,H,W,A,B;
    int n;sc(n);
    cin >> H >> W;
    FOR(i,0,n){
        
        cin >> A >> B;
        ans += min((float)A/H,(float)B/W);
    }
    cout << ans;
}

Measured memory_bytes: 256
#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;
}
///////////////////////////////////////////////////////////////

vector<ll> h;

ll N,A,B;

bool f(ll x) {
  ll count = 0;
  rep(i,N) {
    ll k = max(0LL,h[i] - x * B);
    count += ((k + A - B - 1) / (A-B));
  }
  if (count <= x) return true;
  else return false;
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); //入出力高速化
  while (true) {
    int N,M; cin >> N >> M;
    if (N == 0 && M == 0)break;
    vector<ll> C(M),x(N);
    rep(i,M) cin >> C[i];
    rep(i,N) cin >> x[i];

    vector<vector<ll>> dp(N+1, vector<ll>(256,1e18));
    dp[0][128] = 0;
    rep(i,N) {
      rep(j,256) {
        if (dp[i][j] == 1e18) continue;
        rep(k,M) {
          int y = j + C[k];
          if (y < 0) y = 0;
          if (y > 255) y = 255;
          chmin(dp[i+1][y],dp[i][j] + (y - x[i]) * (y - x[i]));
        }
      }
    }
    ll ans = 1e18;
    rep(i,256) chmin(ans,dp[N][i]);

    cout << ans << endl;
  }
}


Measured memory_bytes: 43956
import itertools
import heapq
from heapq import heappush, heappop
global G, inp_x, inp_y

def input_graph(N):
  global G, inp_x, inp_y
  inp_x = []
  inp_y = []
  for i in range(N):
    x, y = map(int, input().split())
    inp_x.append((x, i))
    inp_y.append((y, i))
  inp_x.sort()
  inp_y.sort()
  for i in range(N-1):
    xa = inp_x[i][1]
    xb = inp_x[i+1][1]
    ya = inp_y[i][1]
    yb = inp_y[i+1][1]
    cost_x = abs(inp_x[i][0]-inp_x[i+1][0])
    cost_y = abs(inp_y[i][0]-inp_y[i+1][0])
    G[xa] += [(cost_x, xb)]
    G[xb] += [(cost_x, xa)]
    G[ya] += [(cost_y, yb)]
    G[yb] += [(cost_y, ya)]

  
def prim(V):
  global G, used
  edgelist = []
  for e in G[0]:
    heappush(edgelist, e)
  used[0] = True
  res = 0
  while edgelist:
    minedge = heappop(edgelist)
    if used[minedge[1]]:
      continue 
    v = minedge[1]
    used[v] = True 
    for e in G[v]:
      if not used[e[1]]:
        heappush(edgelist, e)
    res += minedge[0]
  return res

def main():
  global G, used
  N = int(input())
  G = [[] for _ in range(N)]
  used = [False for _ in range(N)]
  input_graph(N)
  print(prim(N))

if __name__ == "__main__":
  main()

Measured memory_bytes: 72552
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
a.sort()
b = 1
for i in a:
  b |= b<<i
  
b &= 2**(s+1)-2**((s-1)//2)
while True:
  t = b&(-b)
  #print(i,t,b)
  if (s+1)//2 <= t.bit_length()-1 <= s:
    print(t.bit_length()-1)
    break
  b ^= t

Measured memory_bytes: 218908
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC149C
{
    class Program
    {
        static void Main(string[] args)
        {
            int X = int.Parse(Console.ReadLine());
            int ans = X;
            while (true)
            {
                int m = 2;
                bool hantei = true;
                while (m * m <= ans)
                {
                    if (ans % m == 0)
                    {
                        hantei = false;
                        break;
                    }
                    m += 1;
                }
                if (hantei == true)
                {
                    break;
                }
                ans += 1;
                
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27476
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	int x1, y1, x2, y2, x3, y3, x4, y4;
	cin >> x1 >> y1 >> x2 >> y2;

	auto diffX = x1 - x2;
	auto diffY = y1 - y2;

	x3 = x2 + diffY;
	y3 = y2 - diffX;
	x4 = x1 + diffY;
	y4 = y1 - diffX;

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

	return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,j,k) for(int i=(int)j;i<=(int)k;i++)
#define per(i,j,k) for(int i=(int)j;i>=(int)k;i--)
using namespace std;
typedef long long LL;
const int N=2100;
char a[N][N];
int n,m,Q;
int f[N][N],gy[N][N],gx[N][N];
int Query(int sum[N][N],int x1,int x2,int y1,int y2){
	if(x1>x2)return 0;
	if(y1>y2)return 0;
	//printf("_%d\n",sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1]);
	return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
}
int main(){
	scanf("%d%d%d",&n,&m,&Q);
	rep(i,1,n)scanf("%s",a[i]+1);
	rep(i,1,n)rep(j,1,m){
		f[i][j]=f[i-1][j]+f[i][j-1]-f[i-1][j-1]+(a[i][j]=='1');
		gx[i][j]=gx[i-1][j]+gx[i][j-1]-gx[i-1][j-1];
		gy[i][j]=gy[i-1][j]+gy[i][j-1]-gy[i-1][j-1];
		if(i+1<=n&&a[i][j]=='1'&&a[i+1][j]=='1')gx[i][j]++;
		if(j+1<=m&&a[i][j]=='1'&&a[i][j+1]=='1')gy[i][j]++;
	}
	while(Q--){
		int x1,x2,y1,y2;
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		printf("%d\n",Query(f,x1,x2,y1,y2)-Query(gx,x1,x2-1,y1,y2)-Query(gy,x1,x2,y1,y2-1));
	}
	return 0;
}



Measured memory_bytes: 57600
from collections import defaultdict

s = input()
x, y = map(int, input().split())

d = [len(x) for x in s.split('T')]

dx = d[2::2]
n_dx = len(dx)
dp = {d[0]}
for i in range(n_dx):
    tmp = set()
    for j in dp:
        tmp.add(j - dx[i])
        tmp.add(j + dx[i])
    dp = tmp
x_flag = x in dp

dy = d[1::2]
n_dy = len(dy)
dp = {0}
for i in range(n_dy):
    tmp = set()
    for j in dp:
        tmp.add(j - dy[i])
        tmp.add(j + dy[i])
    dp = tmp
y_flag = y in dp

if x_flag and y_flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 48860
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    bool solve() {
        input();
        int m, nl, nu;
        cin >> m >> nl >> nu;
        if (m == 0) return false;
        vector<int> p(m);
        rep(i, 0, m) cin >> p[i];

        int bestn = 0;
        int diff = 0;

        for (int i = nl - 1; i < nu; ++i) {
            if (p[i] - p[i + 1] >= diff) {
                bestn = i + 1;
                diff = p[i] - p[i + 1];
            }
        }

        cout << bestn << endl;
        return true;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    while (Solve().solve()) {}


    return 0;
}



Measured memory_bytes: 3156
def bubble_sort_index(n, number_from_cards):
    flag = True
    index_lists = list(range(n))
    while flag:
        flag = False
        for i in range(n - 1, 0, -1):
            if number_from_cards[i] < number_from_cards[i - 1]:
                number_from_cards[i], number_from_cards[i - 1] = number_from_cards[i - 1], number_from_cards[i]
                index_lists[i], index_lists[i - 1] = index_lists[i - 1], index_lists[i]
                flag = True
    return index_lists


def selection_sort_index(n, number_from_cards):
    index_list = list(range(n))
    for i in range(n):
        min_j = i
        for j in range(i, n):
            if number_from_cards[min_j] > number_from_cards[j]:
                min_j = j
        if min_j == i:
            continue
        number_from_cards[i], number_from_cards[min_j] = number_from_cards[min_j], number_from_cards[i]
        index_list[i], index_list[min_j] = index_list[min_j], index_list[i]
    return index_list


def main():
    N = int(input())
    true_cards = input().split(' ')
    number_from_cards = [int(c[-1]) for c in true_cards]
    sorted_index_lists_for_bubble = bubble_sort_index(N, number_from_cards.copy())
    sorted_bubble = [true_cards[index] for index in sorted_index_lists_for_bubble]

    sorted_index_lists_for_selection = selection_sort_index(N, number_from_cards.copy())
    sorted_selection = [true_cards[index] for index in sorted_index_lists_for_selection]

    print(' '.join(sorted_bubble))
    print('Stable')
    print(' '.join(sorted_selection))
    if sorted_bubble == sorted_selection:
        print('Stable')
    else:
        print('Not stable')


if __name__ == '__main__':
    main()



Measured memory_bytes: 5612
// A - T or T

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int main(){
	int N, A, B;
	cin >> N >> A >> B;

	int ans = min(A * N, B);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr int MN = 1e6+5;

ii A[MN];
inline ii merge(ii a, ii b) {
	if (a.f < b.f) swap(a, b);
	return ii(a.f, max(a.s, b.f));
}

int main() {
	if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
	ios_base::sync_with_stdio(0), cin.tie(0);

	int N; cin >> N;
	for (int i = 0; i < (1<<N); ++i) {
		cin >> A[i].f;
		A[i].s = -1e9;
	}
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < (1<<N); ++j)
			if (j>>i&1) A[j] = merge(A[j], A[j^(1<<i)]);
	int ans = A[0].f+A[0].s;
	for (int i = 1; i < (1<<N); ++i) {
		ans = max(A[i].f+A[i].s, ans);
		cout << ans << '\n';
	}
}


Measured memory_bytes: 5680
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXIST2(s,e) (find(ALL(s),(e))!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);


int main(){
	string s;
	cin>>s;
	string ans;
	REP(i,s.size()){
		char c=s[i]-3;
		if(c<'A'){
			c+=('Z'-'A'+1);
		}
		ans+=c;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1180
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):

    result = 0
    for i, a_i in enumerate(A):
        result += B[a_i - 1]
        if i != 0:
            if a_i == (a_old + 1):
                result += C[a_i - 2]
        else:
            pass
        a_old = a_i

    print(result)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    B = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N - 1)]  # type: "List[int]"
    solve(N, A, B, C)


if __name__ == "__main__":
    main()


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

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

    unordered_map<int, int> ball;

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

        if (ball.find(a) == ball.end()) {
            ball[a] = 1;
        } else {
            ball[a]++;
        }
    }

    int a[ball.size()];
    int i = 0;
    for (auto b : ball) {
        a[i++] = b.second;
    }

    sort(a, a + i);

    int ans = 0;
    int j = 0;
    while (i - j > k) {
        ans += a[j++];
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int n;
  std::cin >> n;
  int l;
  int r;
  int ans =0;
  for (int i = 0; i < n; i++) {
    /* code */
    std::cin >> l >> r;
    ans += r - l + 1;
  }
  std::cout << ans << '\n';

}


Measured memory_bytes: 384
#include <iostream>
#include <cstring>
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;
const int maxn=100000;
int cv[maxn],n,m,fa[maxn],myindex,dfn[maxn],low[maxn];
stack <int> st;
vector <int> imap[maxn];
int ans=0;
int min(int a,int b)
{
    if(a<b) return a;
    else return b;
}
void tarjan(int u,int father)
{
    myindex++;
    dfn[u]=low[u]=myindex;
    fa[u]=father;
    for(int i=0;i<imap[u].size();i++)
    {
        int v=imap[u][i];
        if(!dfn[v])
        {
            tarjan(v,u);
            low[u]=min(low[u],low[v]);
        }
        else if(v!=father)
            low[u]=min(low[u],dfn[v]);
    }
}
void counti()
{
    int rootson=0;
    for(int i=2;i<=n;i++)
    {
        int v=fa[i];
        if(v==1) rootson++;
        else if(low[i]>=dfn[v]) cv[v]=1;
    }
    if(rootson>1) cv[1]=1;
    for(int i=2;i<=n;i++)
    {
        int v=fa[i];
        if(dfn[v]<low[i])
        {
            ans++;
        }
    }
}

void init()
{
    myindex=0;
    ans=0;
    while(!st.empty()) st.pop();
    memset(cv,0,sizeof(cv));
    memset(dfn,0,sizeof(dfn));
    memset(low,0,sizeof(low));
    memset(fa,0,sizeof(fa));
    for(int i=0;i<maxn;i++) imap[i].clear();
}
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        init();
        for(int i=1;i<=m;i++)
        {
            int u,v;
            scanf("%d%d",&u,&v);
            imap[u].push_back(v);
            imap[v].push_back(u);
        }
        tarjan(1,0);
        counti();
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define mod 1000000009
#define int long long
#define garou ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int pow(int p,int r){
	int ans=1;
	while(r>0){
     if(r&1){
		 ans=((ans%mod)*(p%mod))%mod;
	 }
	 r=r>>1;
     p=((p%mod)*(p%mod))%mod;
	}
}
signed main() {
garou;
int k;
string s;
cin>>k>>s;
int n=s.length();
if(k>=n)
cout<<s;
else{
	cout<<s.substr(0,k)<<"...";

}
}

Measured memory_bytes: 3640
// Problem : B - Comparing Strings
// Contest : AtCoder - AtCoder Beginner Contest 152
// URL : https://atcoder.jp/contests/abc152/tasks/abc152_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

//Macros

#define ll long long
#define db long double
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define mod 1000000007
#define EPS 1e-9
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define inf 1e10
#define PI acos(-1.0)
#define int long long
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 100005

//Solution

void solve(){
    int a,b;
    cin>>a>>b;
    if(a > b) swap(a,b);
    while(b--) cout<<a;
}

signed main(){
    io;
    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    int tests;
    //cin>>tests;
    tests = 1;
    while(tests--){
        solve();
    }
    return 0;
}

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


int main(){
  int N, M;
  cin >> N >> M;
  vector<int> H(N, 0);
  for(auto& h : H){
    cin >> h;
  }
  vector<int> check(N, 1);
  for(int ii=0; ii<M; ii++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if(H[a]<H[b]){
      check[a]=0;
    }else if(H[b]<H[a]){
      check[b]=0;
    }else{
      check[a]=0;
      check[b]=0;
    }
  }
  int ans=0;
  for(auto& c : check){
    if(c==1) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 1; i <= n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

bool isOK(int index, int key,vector<ll> &B) {
    if (B[index] > key) return true;
    else return false;
}
int binary_search(int key, vector<ll> &B) {
    int left = -1;
    int right = (int)B.size();
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        if (isOK(mid, key, B)) right = mid;
        else left = mid;
    }
    return right-1;
}

int main(){
    int i,N,M;
    ll K;
    cin >> N>>M>>K;
    vector<ll> A(N+1),B(M+1);
    A[0] = 0; B[0] = 0;
    ll a;
    int n,m;
    rep(i,N) {
        cin >> a;
        if(A[i-1]<=K){
            A[i] = a + A[i-1];
        }
        else{
            A[i] = A[i-1];
        }
    }
    rep(i,M) {
        cin >> a;
        if(B[i-1]<=K){
            B[i] = a + B[i-1];
        }
        else{
            B[i] = B[i-1];
        }
    }

    int ans = 0;
    int k;
    for(i=0;i<=N;i++){
        if(A[i]>K) break;
        k = binary_search(K - A[i], B);
        ans = max(ans,k+i);
    }
    AA(ans);
    return 0;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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 dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int ans=0;
    int a;
    REP(i,n){
        cin>>a;
        ans+=a-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,zx,xc,dp[2009][2009],ii,jj,kl[4009][2009][2],k[4009][2];
char ch;
pair <int, int> p[4009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(i=1; i<=2*a; i++){
		cin>>ch>>p[i].second;
		if(ch=='W') p[i].first=0; else p[i].first=1;
		k[p[i].second][p[i].first]=i;
	}
	for(i=1; i<=2*a; i++){
		for(j=1; j<=2000; j++){
			kl[i][j][0]=kl[i-1][j][0];
			kl[i][j][1]=kl[i-1][j][1];
			if(j>=p[i].second) kl[i][j][p[i].first]++;
		}
	}
	dp[0][0]=0;
	for(i=0; i<=a; i++){
		for(j=0; j<=a; j++){
			if(i==0&&j==0) continue;
			dp[i][j]=16000000;
			if(i!=0){
				zx=k[i][0]+kl[2*a][i][0]-kl[k[i][0]][i][0]+kl[2*a][j][1]-kl[k[i][0]][j][1];
				if(zx<i+j) zx=0; else zx-=i+j;
				if(dp[i][j]>dp[i-1][j]+zx) dp[i][j]=dp[i-1][j]+zx;
				//cout<<i<<" "<<j<<"  "<<dp[i][j]<<"   i   "<<zx<<endl;
			}
			if(j!=0){
				zx=k[j][1]+kl[2*a][i][0]-kl[k[j][1]][i][0]+kl[2*a][j][1]-kl[k[j][1]][j][1];
				if(zx<i+j) zx=0; else zx-=i+j;
				if(dp[i][j]>dp[i][j-1]+zx) dp[i][j]=dp[i][j-1]+zx;
				//cout<<i<<" "<<j<<"  "<<dp[i][j]<<"   j   "<<zx<<endl;
			}
		}
	}
	cout<<dp[a][a];
	return 0;
}

Measured memory_bytes: 78976
#include <bits/stdc++.h>
using namespace std;
void dfs(int node, vector<vector<int>>&arr, vector<int>&visited,vector<int>&dp) 
{ 
    
    visited[node] = 1; 
    for (int i = 0; i < arr[node].size(); i++) { 
  
       
        if (!visited[arr[node][i]]) 
            dfs(arr[node][i], arr, visited, dp); 
  
        
        dp[node] = max(dp[node], 1 + dp[arr[node][i]]); 
    } 
} 
int main() {	
	int t=1;
	//cin >> t;
	while (t--) {
	   
	   int v;
	   cin>>v;
	   int e;
	   cin>>e;
	   vector<vector<int>>arr(v+1);
	   vector<int>dp(v+1,0);
	   int a,b;
	   for(int i=0;i<e;i++)
	   {
	   	
	   	 cin>>a>>b;
	   	 arr[a].push_back(b);
	   }
	    vector<int>visited(v+1,0);
	    int p;
	    for(int i=1;i<=v;i++)
	    {    
	          
	        dfs(i,arr,visited,dp);
		}
		int ans=INT_MIN;
		for(int i=1;i<=v;i++)
		{
			ans=max(ans,dp[i]);
		}
		cout<<ans<<endl;
      }
	} 
	
	
	

Measured memory_bytes: 12800
using System;
using System.Collections.Generic;
public class ABC124B {
    public static void Main() {
        int N, ans = 0, Hmax;
        List<int> H = new List<int>();
        N = int.Parse(System.Console.ReadLine());
        string[] str = System.Console.ReadLine().Split(' ');
        foreach (string s in str) {
            H.Add(int.Parse(s));
        }

        Hmax = H[0];

        for (int i = 0; i < H.Count; i++) {
            if (Hmax <= H[i]) {
                Hmax = H[i];
                ans += 1;
            }
        }
        System.Console.WriteLine(ans);
    }
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())

using namespace std;

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

int m;

int get (const string& s) {
  int n = (int) s.size();
  vector <int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n and s[z[i]] == s[i + z[i]]) z[i]++;
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  vector <bool> vis(n, false);
  int ans = 0;
  for (int i = m; i < n; i++) {
    if (vis[i]) continue;
    vis[i] = true;
    if (z[i] >= m) {
      int cnt = 1;
      int j = i;
      while (j + m < n and z[j + m] >= m) {
        j += m;
        vis[j] = true;
        cnt++;
      }
      ans = max(ans, cnt);
    }
  }
  return ans;
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  string s, t;
  cin >> s >> t;
  m = sz(t);
  string S = s;
  while (sz(S) < sz(t)) S = S + S;
  string X = S + S;
  string Y = X + S;
  string Z = Y + S;
  int ans2 = get(t + Y);
  int ans3 = get(t + Z);
  if (ans2 != ans3) {
    cout << -1 << endl;
    return (0);
  } else {
    cout << ans2 << endl;
  }
  return (0);
}


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

int main(){
  int sx,sy,tx,ty;
  cin >>sx>>sy>>tx>>ty;
  
  tx -= sx;
  ty -= sy;

  
  rep(i, ty){
    cout << "U";
  }
  rep(i, tx){
    cout << "R";
  }
  rep(i, ty){
    cout << "D";
  }
  rep(i, tx+1){
    cout << "L";
  }
  rep(i, ty+1){
    cout << "U";
  }
  rep(i, tx+1){
    cout << "R";
  }
  cout << "D" << "R";
  rep(i, ty+1){
    cout << "D";
  }
  rep(i, tx+1){
    cout << "L";
  }
  cout << "U" << endl;
}
  
  

Measured memory_bytes: 256
#include<iostream>
#include<variant>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>

using namespace std;

int main(void) {
	int d, t, s;
	cin >> d >> t >> s;
	if (s*t >= d)cout << "Yes";
	else cout << "No";

	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
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; }
using namespace std;
using ll = long long;
using P = pair<int, int>;


int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];

    reverse(all(v));
    int mi = v[0];
    bool ok = true;
    rep(i, n){
        if(v[i] - mi >= 2) ok = false;
        mi = min(mi, v[i]);
    }

    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;

}

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

using namespace std;

int n;
int v[100010];
int main() {

    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> v[i];


    int last = -1;
    int c = 0;
    int ans = 0;
    for (int i = n - 1; i >= 0; i--) {
        if(v[i] >= last) c++;
        else c = 1;
        ans = max(ans, c - 1);
        last = v[i];
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <queue>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define all(x) x.begin(), x.end()
#define umap unordered_map
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last)
      out << ",";
  }
  out << "]";
  return out;
}

int N, A, B;
const int MAXN = 50;
ull v[MAXN];
ull dp[MAXN + 1][MAXN + 1];

void enum_comb() {
  for (int i = 0; i <= MAXN; ++i) {
    for (int k = 0; k <= i; ++k) {
      if (i == 0 or k == 0)
        dp[i][k] = 1;
      else {
        dp[i][k] = dp[i - 1][k] + dp[i - 1][k - 1];
      }
    }
  }
}

int main() {
  cin >> N >> A >> B;
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
  }
  sort(v, v + N);
  reverse(v, v + N);
  ull sum = 0;
  for (int i = 0; i < A; ++i) {
    sum += v[i];
  }
  double maxave = sum / (double) A;
  //count
  ull cnt = 0;
  enum_comb();
  int x = 0, y = 0;
  for (int i = 0; i < N; ++i) {
    if (v[i] == v[A - 1]) {
      x++;
      if (i <= A - 1)
        y++;
    }
  }
  if (v[0] == v[A - 1]) { //3333.....3
    for (int i = A; i <= min(B, x); ++i) {
      cnt += dp[x][i];
    }
  } else { //433333....3
    cnt = dp[x][y];
  }
  cout.precision(20);
  cout << fixed << maxave << endl;
  cout << cnt << endl;
}



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

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

  if (N == M)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
using System;
class Program{
	static void Main(){
		int n=int.Parse(Console.ReadLine());
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long a=0;

		for(int i=0;i<n;i++){
			a+=s[i]-1;
		}
		
		Console.WriteLine(a);
	}
}

Measured memory_bytes: 11220
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#include <bitset>
#include <complex>
#include <cassert>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define GI(i) (scanf("%d",&i))
#define GLL(i) (scanf("%lld",&i))
#define GD(i)  (scanf("%lf",&i))
#define PB          push_back
#define MP          make_pair
#define MT          make_tuple
#define GET0(x)     (get<0>(x))
#define GET1(x)     (get<1>(x))
#define GET2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       (1LL<<60)
#define LLMIN       -(1LL<<60)
#define IMAX        (1<<30)
#define IMIN        -(1<<30)
typedef long long LL;
using namespace std;

int main(void){
    int H,W;
    GI(H);GI(W);
    vector<vector<int> > a(H,vector<int>(W,0));
    REP(i,H)REP(j,W)
        GI(a[i][j]);
    vector<vector<int> > op;
    REP(i,H)REP(j,W){
        if(j<W-1){
            if(a[i][j]%2==1){
                vector<int> b{i+1,j+1,i+1,j+2};
                a[i][j+1]++;
                op.PB(b);
            }
        }else{
            if(i<H-1 && a[i][j]%2==1){
                vector<int> b{i+1,j+1,i+2,j+1};
                a[i+1][j]++;
                op.PB(b);
            }
        }
    }
    printf("%d\n",SZ(op));
    REP(i,SZ(op))
        printf("%d %d %d %d\n",op[i][0],op[i][1],op[i][2],op[i][3]);
    return 0;
}

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

ll modPow(ll a, ll n) {
  if (n == 0) return 1; // 0乗にも対応する場合
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  ll t = modPow(a, n / 2);
  return (t * t) % MOD;
}
vector<ll> Prime(10000,0);
void sosu(ll n){
  Prime.at(0)=2;
  ll t=1;
  for(ll i=3;i<n;i++){
    rep(j,t){
      if(i%Prime.at(j)==0){
        break;
      }
      if(j==t-1){
        Prime.at(t)=i;
        t++;
        
      }
    }
  }
}
    

int main(){
  ll N,K,M=0;
  cin >> N >> K;
  vector<ll> ans(K,0);
  sosu(N);
  for(ll i=K;i>0;i--){
    ans.at(i-1)=modPow(K/i,N);
    ll t=2;
    while(i*t<=K){
      ans.at(i-1)+=MOD;
      ans.at(i-1)-=ans.at(i*t-1);
      ans.at(i-1)%=MOD;
      t++;
    }
  }
  rep(i,K){
    M+=(i+1)*ans.at(i);
    M%=MOD;
  }
  cout << M << endl;
                     
                     
    
 
      
}


Measured memory_bytes: 3996
using System;
namespace ConsoleTest {
  class Program {
    static void Main(string[] args) {
      string a = Console.ReadLine();
      int b = int.Parse(Console.ReadLine());
      string answer = a.Substring(0, 1);
      for(int i = b; i < a.Length; i += b) {
        answer += a.Substring(i, 1);
      }
      Console.WriteLine(answer);
    }
  }
}

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

string solve() {
    string S, T;
    cin >> S >> T;
    ll ns = S.size(), nt = T.size();
    vector<vector<ll>> dp(ns+1, vector<ll>(nt+1));
    vector<vector<pii>> prev(ns+1, vector<pii>(nt+1, pii(-1,-1)));
    for ( int i = 0; i < ns; i++ ) {
        for ( int j = 0; j < nt; j++ ) {
            if ( S[i] == T[j] ) {
                if ( chmax(dp[i+1][j+1], dp[i][j] + 1) ) {
                    prev[i+1][j+1] = pii(i,j);
                }
            }
            if ( chmax(dp[i+1][j+1], dp[i+1][j]) ) {
                prev[i+1][j+1] = prev[i+1][j];
            }
            if ( chmax(dp[i+1][j+1], dp[i][j+1]) ) {
                prev[i+1][j+1] = prev[i][j+1];
            }
        }
    }
    string ans = "";
    auto p = prev[ns][nt];
    while ( p.first >= 0 ) {
        ans.push_back(S[p.first]);
        p = prev[p.first][p.second];
    }
    reverse(ans.begin(), ans.end());
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 141184
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   string S;
   cin >> S;
   int ans = 0;
   FOR(i,S.size()){
      if(S[i] == '+')ans++;
      else ans--;
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}


int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    if ((a-b)%2==0){
        cout << "Alice" << endl;
    }else{
        cout << "Borys" << endl;
    }
    return 0;
}


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

void selectionsort(int *p ,int n);

int main(void){

  int *a;

  a =(int *)malloc(3*sizeof(int));
  // int p, q, r;
  scanf("%d %d %d", &a[0], &a[1], &a[2]);

  selectionsort(a, 3);

  printf("%d\n", a[0]+a[1]);

  free(a);
  return 0;
}

void selectionsort(int *p ,int n){
  int i, j;
  int t;//交換時の一時的に保持する用
  int min;
  int mem;//memory

  for(i=0; i<n-1; i++){
    //p[i]からp[n-1]のなかの最小値を探す
    //最小値をp[i]と仮定
    min=p[i];
    //p[i+1],p[i+2],...,p[n-1]から最小値を求める
    for(j=i+1; j<=n-1; j++){
      //最小値の更新
      if(min>p[j]){
        min=p[j];
        //交換相手のindexを記憶しておく
        mem=j;
      }
    }

    //最小値がp[i]でなければ、入れ替えを行う
    //最小値がp[i]でない⇒memの値は存在する
    if(min!=p[i]){
      t=p[i];
      p[i]=p[mem];
      p[mem]=t;
    }
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

const int INF = 1001001001;

int a[12][12];

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  rep(i, n) {
    cin >> c[i];
    rep(j, m) { cin >> a[i][j]; }
  }

  int ans = INF;

  rep(s, 1 << n) {
    int cost = 0;
    vector<int> d(m);
    rep(i, n) {
      if (s & (1 << i)) {
        cost += c[i];
        rep(j, m) d[j] += a[i][j];
      }
    }
    bool ok = true;
    rep(j, m) if (d[j] < x) ok = false;
    if (ok) ans = min(ans, cost);
  }

  if (ans == INF)
    cout << -1;
  else
    cout << ans;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
    ll equa;
    int n;
    cin>>n;
    int arr[n+1];
    for(int i=1;i<=n;i++){
        arr[i]=0;
    }
    for(int i=1;i*i<=n;i++){
        for(int j=1;j*j<=n;j++){
            for(int z=1;z*z<=n;z++){
              equa = i*i + j*j + z*z + i*j + i*z + j*z;
              if(equa>0 && equa<=n){
                  arr[equa]++;
              }
              else if(equa>n){
                  break;
              }   
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<arr[i]<<endl;
    }
    return 0;

}

Measured memory_bytes: 3436
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;

signed main() {
  string S;
  cin >> S; 
  int cnt = 0;
  int ans = 0;
  for( int i = S.size()-1; i >= 0; i-- ){
    if( i > 0 && S.at(i) == 'C' && S.at(i-1) == 'B' ){
      cnt++;
      i--;
    }else if( S.at(i) == 'A' ) ans += cnt;
    else cnt = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
N = int(raw_input())
As = [(int(i), 2) for i in raw_input().split(" ")]
Bs = [(int(i), 1) for i in raw_input().split(" ")]
Cs = [(int(i), 0) for i in raw_input().split(" ")]

l = sorted(As + Bs + Cs)

ac = 0
bc = 0
cc = 0

for i in l:
    if i[1] == 2:
        ac += 1
    elif i[1] == 1:
        bc += ac
    elif i[1] == 0:
        cc += bc
print cc

Measured memory_bytes: 42388
Sd_ = input()
T_ = input()
Sd = []
T = []
S = []
for i in range(len(Sd_)):
    Sd.append(Sd_[i])
for i in range(len(T_)):
    T.append(T_[i])


def check(s, t, n):
    for i in range(len(t)):
        if s[n + i] is not t[i] and s[n + i] is not '?':
            return False
    return True


m = len(Sd) - len(T)
while m >= 0:
    if check(Sd[:], T[:], m):
        for j in range(len(T)):
            Sd[m + j] = T[j]
        for a in range(len(Sd)):
            if Sd[a] is '?':
                S.append('a')
            else:
                S.append(Sd[a])
        print(''.join(S))
        exit()
    m -= 1
print('UNRESTORABLE')


Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
	
	int a,b,c,i,count;
	
	scanf("%d %d %d",&a,&b,&c);
	count = 0;
	
	for(i=a;i<=b;i++){
		if(c%i==0){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

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


int main() {
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(a-x) > abs(b-x))cout << "B\n";
    else cout << "A\n";
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
import sys
s = int(input())

def f(num):
	if num%2==0:
		return num//2
	else:
		return 3*num+1

count=0
exist=[s]
while True:
	count+=1
	#print(s,count,exist)
	tmp = f(s)
	if tmp in exist:
		print(count+1)
		sys.exit(0)
	
	exist.append(tmp)
	s=tmp

Measured memory_bytes: 2940
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll d[8];
string fes="FESTIVAL";
int main()
{
	d[0]=1;
	vector<int>dat;
	int now=1;
	int sum=0;
	vector<ll>ans;
	for(int i=1;i<=50;i++)
	{
		for(;;)
		{
			ll e[8];
			e[0]=d[0];
			for(int j=1;j<8;j++)e[j]=e[j-1]*now+d[j];
			if(e[7]<d[7]*(now*7))now++;
			else
			{
				for(int j=0;j<8;j++)d[j]=e[j];
				dat.push_back(now);
				sum+=now;
				break;
			}
		}
		ans.push_back(d[7]);
		//printf("%d %d %lld\n",i,now,d[7]);
		if(d[7]>1000000000000000000LL/(now*7))break;
	}
	int sc=0;
	for(int i=1;i<dat.size();i++)
	{
		sc+=ans[i]/ans[i-1];
	}
	//printf("%d %d\n",sum,sc);
	ll mok;
	scanf("%lld",&mok);
	vector<int>pls;
	for(int i=ans.size()-1;i>=0;i--)
	{
		pls.push_back(mok/ans[i]);
		mok%=ans[i];
	}
	reverse(pls.begin(),pls.end());
	string ret;
	for(int i=0;i<ans.size();i++)
	{
		for(int j=0;j<7;j++)
		{
			for(int k=0;k<dat[i];k++)ret.push_back(fes[j]);
		}
		for(int j=0;j<pls[i];j++)ret.push_back('L');
	}
	cout<<ret<<endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll h,w,n;cin>>h>>w>>n;
  vector<ll> a(n),b(n);
  for(i=0;i<n;i++){cin>>a[i]>>b[i];a[i]--;b[i]--;}
  set<pair<ll,ll>>c;
  for(i=0;i<n;i++){
    c.insert({a[i],b[i]});
  }
  map<pair<ll,ll>,ll> x;
  for(i=0;i<n;i++){
    for(j=-1;j<=1;j++){
      for(o=-1;o<=1;o++){
        if(a[i]+j<1||a[i]+j>=h-1||b[i]+o<1||b[i]+o>=w-1)continue;
        buf=0;
        for(ll p=-1;p<=1;p++){
          for(ll q=-1;q<=1;q++){
            buf+=c.find({a[i]+j+p,b[i]+o+q})!=c.end();
          }
        }
        //cout<<a[i]+j spa b[i]+o spa buf<<endl;
        x.insert({{a[i]+j,b[i]+o},buf});
      }
    }
  }
  vector<ll>m(10);
  for(auto y:x){
    m[y.second]++;
  }
  cout<<(h-2)*(w-2)-x.size()<<endl;
  for(i=1;i<=9;i++)cout<<m[i]<<endl;

  return 0;
}

Measured memory_bytes: 64384
#include <stdio.h>
 
using namespace std;
 
int main(){
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    int A[n][m],B[m][l];
    long long int C[n][l];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            C[i][j] = 0;
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            scanf("%d",&A[i][j]);
        }
    }
    for(int i = 0; i < m; i++){
        for(int j = 0; j < l; j++){
            scanf("%d",&B[i][j]);
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int k = 0; k < l; k++){
            for(int j = 0; j < m; j++){
                C[i][k] += A[i][j]*B[j][k];
            }
        }
    }
 
    for(int i = 0; i < n; i++){
        for(int j = 0; j < l-1; j++){
            printf("%lld ",C[i][j]);
        }
        printf("%lld\n",C[i][l-1]);
    }
}




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

int main(void) {
  int A, B, cnt = 0;
  cin >> A >> B;
  for (int i = A; i <= B; i++) {
    string s = to_string(i);
    string s_r = s;
    reverse(s_r.begin(), s_r.end());
    if (s == s_r) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

using namespace std;

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

	int n;

	cin >> n;

	for(int i=111;i<=999;i+=111)
	{
		if(i>=n)
		{
			cout << i << '\n';
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256