akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int dp[100000] = {1,1};

int fib(int n){
   for(int i = 2; i <= n; i++){
       dp[i] = dp[i-1] + dp[i-2];
   }
   return dp[n];
}

int main(){
    int x,y;
    cin >> x >> y;

    int x_min = 0;
    int x_max = 1;
    int y_min = 0;
    int y_max = 1;
    int c = 0;

    while(true){
        if(x_min <= x && x < x_max && y_min <= y && y < y_max){
            cout << c%3+1 << endl;
            return 0;
        }
        // 東 
        c++; 
        x_min = x_max; 
        x_max = x_min+fib(c); 
        y_min = y_min; 
        y_max = y_min+fib(c);

        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        // 北 
        c++; 
        x_max = x_max; 
        x_min = x_max-fib(c); 
        y_min = y_max; 
        y_max = y_min+fib(c);

        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        // 西 
        c++; 
        x_max = x_min; 
        x_min = x_max-fib(c); 
        y_max = y_max; 
        y_min = y_max-fib(c);

        if(x_min<=x && x<x_max && y_min<=y && y<y_max){ 
            cout << c%3+1 << endl;
            return 0; 
        }
        // 南 
        c++; 
        x_min = x_min; 
        x_max = x_min+fib(c); 
        y_max = y_min; 
        y_min = y_max-fib(c);
    }
    return 0;
}


Measured memory_bytes: 3184
#include <stdio.h>

int main(void){
  int i, j, h, w;

  while(1){
    scanf("%d%d", &h, &w);
    if(h == 0 && w == 0)  break;
    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
  int N; cin>>N;
  vector<int>A(N*2);
  rep(i,N*2)cin>>A[i];
  sort(A.begin(),A.end());
  int ans=0;
  rep(i,N)ans+=A[i*2];
  cout<<ans<<endl;
}

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

typedef long long int ll;
#define endl "\n"
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vpii vector<pair<int, int>>
#define mems(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define forn(i, s, e) for (int i = s; i < (e); ++i)
#define FASTIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define FILEIO                          \
    freopen("./input.txt", "r", stdin); \
    freopen("./output.txt", "w", stdout);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                               \
    for (                                                                       \
        auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \
        blockTime.second;                                                       \
        debug("%s : %lld ms\n ", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
const int M = 1e9 + 7;

template <class T>
T ABS(const T &x) { return x > 0 ? x : -x; }
ll gcd(ll n1, ll n2) { return n2 == 0 ? ABS(n1) : gcd(n2, n1 % n2); }
ll lcm(ll n1, ll n2) { return n1 == 0 && n2 == 0 ? 0 : ABS(n1 * n2) / gcd(n1, n2); }

const ll N = 1e18;

int main()
{
    FASTIO
#ifdef LOCAL
    FILEIO
#endif
    int n;
    cin >> n;
    ll prod = 1;
    ll a[n], zeros = 0;
    forn(i, 0, n)
    {
        cin >> a[i];
        if (a[i] == 0)
        {
            ++zeros;
        }
    }
    if (zeros > 0)
    {
        cout << 0 << endl;
        return 0;
    }
    forn(i, 0, n)
    {
        if (a[i] <= N / prod)
        {
            prod *= a[i];
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << prod << endl;

    return 0;
}

Measured memory_bytes: 4320
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }

LL oneCycle2(LL cur, LL col, vector<vector<LL>>& edge, vector<LL>& memo, vector<LL>& seq){
    if(memo[cur] == col) return cur;
    if(memo[cur] >= 0 || memo[cur] == -2) return -1;
    memo[cur] = col;
    for(LL next: edge[cur]){
        LL res = oneCycle2(next, col, edge, memo, seq);
        if(res == -1) continue;
        if(res == -2) return -2;
        seq.push_back(cur);
        if(res == cur){
            return -2;
        }else{
            return res;
        }
    }
    memo[cur] = -2;
    return -1;
}

vector<LL> oneCycle(LL n, vector<vector<LL>>& edge){
    vector<LL> memo(n, -1);
    for(LL node = 0; node < n; ++node){
        if(memo[node] >= 0) continue;
        vector<LL> res;
        oneCycle2(node, node, edge, memo, res);
        reverse(res.begin(), res.end());
        if(!res.empty()) return res;
    }
    return vector<LL>();
}

vector<LL> shotenCycle(vector<LL>& seq, vector<vector<LL>>& edge){
    LL n = edge.size();
    vector<LL> order(n, -1);
    for(LL i = 0; i < seq.size(); ++i){
        order[seq[i]] = i;
    }
    vector<LL> memo(n, -1);
    vector<LL> res;
    for(LL i = 0; i < seq.size(); ++i){
        LL cur = seq[i];
        res.push_back(cur);
        memo[cur] = 1;
        LL term = -1;
        for(LL next: edge[cur]){
            if(memo[next] == 1){
                term = max(term, order[next]);
            }
            i = max<LL>(i, order[next]-1);
        }
        //cerr << "i=" << i << "/" << seq.size() << ", term=" << term << endl;
        if(term >= 0){
            auto it = find(res.begin(), res.end(), seq[term]);
            res.erase(res.begin(), it);
            return res;
        }
    }
    return vector<LL>();
}

int main(){
    LL n, m;
    cin >> n >> m;
    vector<vector<LL>> edge(n);
    for(LL i = 0; i < m; ++i){
        LL a, b;
        cin >> a >> b;
        --a; --b;
        edge[a].push_back(b);
    }
    vector<LL> seq = oneCycle(n, edge);
    //cerr << "seq=" << seq << seq.size()<< endl;
    seq = shotenCycle(seq, edge);
    if(seq.empty()){
        cout << -1 << endl;
    }else{
        cout << seq.size() << endl;
        for(LL v: seq){
            cout << v+1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#define debug(x) cout << #x << "==" << x << endl;

const int INF = 1000000007;

using namespace std;

//入力
#define MAX_N 100000
int N;
int A[MAX_N];
int B[MAX_N+1];

// n ^ k mod m
long long powmod(int n, int k,int m) {

  if ( k == 0 ) {
    return 1;
  } else if( k % 2 != 0 ) {
    return ( n * powmod( n, k-1, m ) ) % m;
  } else {
    long long x =  powmod( n, k/2, m );
    return x * x % m;
  }

}

int main() {
  ios::sync_with_stdio(false);

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

  sort(A, A + N);


  bool correct = true;
  if( N % 2 == 0 ) {
    int num = 1, i = 0;
    while( i < N ) {
      if ( !(A[i] == num) || !(A[i+1] == num)  ) { correct = false; }
      i += 2;
      num += 2;
    }

  }

  if( N % 2 == 1) {

    if(A[0] != 0) { correct = false; }

    int i = 1, num = 2;
    while( i < N ) {
      if ( !(A[i] == num) || !(A[i+1] == num)  ) { correct = false; }
      i += 2;
      num += 2;
    }

  }



  if( !correct ) {
    cout << 0 << endl;
  } else {
  cout << powmod(2, N / 2, INF) << endl;
  }

  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <string>
#include <queue>
#include <cmath>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define rev(v) (v).rbegin(), (v).rend()
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> P;
typedef long long ll;


struct state{
	int lx, ly, rx, ry;
	int dist;
	state(int lx, int ly, int rx, int ry, int d):lx(lx), ly(ly), rx(rx), ry(ry), dist(d){}
};

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

int dist[50][50][50][50]; // Lx, Ly, Rx, Ry

int main(){
	//freopen("test.txt", "r", stdin);
	int w, h;
	while(cin >> w >> h, w|h){
		vector<string> L(h), R(h);
		rep(i, h){
			cin >> L[i] >> R[i];
			reverse(all(R[i]));
		}
		P ls, rs, lg, rg;
		rep(i, h){
			rep(j, w){
				if(L[i][j] == 'L') ls = MP(j, i);
				if(L[i][j] == '%') lg = MP(j, i);
				if(R[i][j] == 'R') rs = MP(j, i);
				if(R[i][j] == '%') rg = MP(j, i);
			}
		}

		memset(dist, -1, sizeof(dist));

		queue<state> q;
		q.push(state(ls.X, ls.Y, rs.X, rs.Y, 0));
		dist[ls.X][ls.Y][rs.X][rs.Y] = 0;

		while(!q.empty()){
			state s = q.front();
			q.pop();

			if(s.lx == lg.X && s.ly == lg.Y && s.rx == rg.X && s.ry == rg.Y){
				break;
			}

			rep(i, 4){
				int lx = s.lx+dx[i];
				int ly = s.ly+dy[i];
				int rx = s.rx+dx[i];
				int ry = s.ry+dy[i];
				if(lx < 0 || lx >= w) lx = s.lx;
				if(ly < 0 || ly >= h) ly = s.ly;
				if(rx < 0 || rx >= w) rx = s.rx;
				if(ry < 0 || ry >= h) ry = s.ry;
				if(L[ly][lx] == '#') lx = s.lx, ly = s.ly;
				if(R[ry][rx] == '#') rx = s.rx, ry = s.ry;
				if(L[ly][lx] == '%' || R[ry][rx] == '%'){
					if(L[ly][lx] != R[ry][rx]) continue;
				}
				if(dist[lx][ly][rx][ry] != -1) continue;
				dist[lx][ly][rx][ry] = s.dist + 1;
				q.push(state(lx, ly, rx, ry, s.dist+1));
			}
		}

		cout << (dist[lg.X][lg.Y][rg.X][rg.Y]!=-1?"Yes":"No") << endl;
	}

	return 0;
}

Measured memory_bytes: 26796
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int tnankai=0;
    int anankai=0;
    while(a>0){
        tnankai++;
        a-=d;
    }
    while(c>0){
        anankai++;
        c-=b;
    }
    if(tnankai>=anankai)cout << "Yes";
    else cout << "No";
}

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

using ll = long long int;
using P = pair<int, int>;
using P3 = pair<ll,P>;
using PP = pair<P, P>;
constexpr int INF = 1 << 30;
constexpr ll MOD = ll(1e9) + 7;
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr double EPS = 1e-8;


bool solve(){
    int ans = 0;
    for(int i=0;i<4;i++){
        int a;
        cin >> a;
        ans += a;
    }
    cout << ans << endl;
    return false;
}

int main(){
    solve();
    // int t; cin >> t; for(;t>0;t--) solve();
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,l,a=300,sum=0;
    cin>>n>>l;
    for(int i=1;i<=n;i++)
    {
        a=min(abs(l+i-1),a);
        sum+=l+i-1;
    }

    if(sum>=0)
    {
        cout<<sum-a<<endl;
    }
    else
    {
        cout<<sum+a<<endl;
    }

    exit(0);
}


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

int main() {
    int x, n;
    cin >> x >> n;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
    }
    int ans = 0;
    rep(i, 100) {
        int flag = 0;
        int tmp = 0;
        tmp = x - i;
        rep(i, n) {
            if (tmp == p[i]) flag = 1;
        }
        if (flag == 0) {
            ans = tmp;
            break;
        }
        flag = 0;
        tmp = x + i;
        rep(i, n){
            if (tmp == p[i]) flag = 1;
        }
        if (flag == 0) {
            ans = tmp;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3524
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())

i = 1
ab = set()
while i ** 2 <= n:
    if n % i == 0:
        ab.add((i, n // i))
    i += 1

def digit(n):
    ans = 0
    while n > 0:
        ans += 1
        n //= 10
    return ans

ans = 10 ** 10
for a, b in ab:
    ans = min(ans, max(digit(a), digit(b)))

print(ans)


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

signed main(){
  string s, t;
  cin >> s >> t;
  int n = sz(s), m = sz(t);

  vvi dp(n+1, vi(m+1));
  rep(i, 0, n+1){
    rep(j, 0, m+1){
      if(i+1 <= n) chmax(dp[i+1][j], dp[i][j]);
      if(j+1 <= m) chmax(dp[i][j+1], dp[i][j]);
      if(i < n and j < m and s[i] == t[j]){
        chmax(dp[i+1][j+1], dp[i][j]+1);
      }
    }
  }

//  cout << dp[n][m] << endl;

  string ans;
  while(n or m){
    if(dp[n][m] == 0) break;
    while(n > 0 and dp[n-1][m] == dp[n][m]) n--;
    while(m > 0 and dp[n][m-1] == dp[n][m]) m--;
    n--; m--;
    ans += s[n];
  }

  reverse(all(ans));
  cout << ans << endl;

  return 0;
}


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

	int n,d,x,b[100],a[100],sum=0;
	cin>>n>>d>>x;
	for(int i=1;i<=n;i++){
			cin>>a[i];
		sum+=(d-1)/a[i]+1;
	}
	sum+=x;
	cout<<sum<<endl;
}

Measured memory_bytes: 256
N,D = list(map(int,input().split()))
X = [0]*N

for i in range(N):
    X[i] = list(map(int,input().split()))
count=0

for i in range(N):
    for j in range(i+1,N):        
        length = 0      
        for k in range(D):          
            diff = abs(X[i][k]-X[j][k])
            length += diff**2           
        l = 0            
        while l < length+1:
            if l**2 == length:
                count+=1
                break
            l+=1
print(count)

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

int main(){
    int data[10000];
    
    for(int i = 1; i <= 10000; i++){
        cin >> data[i];
        if(data[i] == 0) break;
    }
    
    for(int i = 1; data[i] != 0; i++){
        cout << "Case" << " " << i << ":" << " " << data[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h1 , m1 , h2 , m2 , K;
	cin >> h1 >> m1 >> h2 >> m2 >> K;
	int a = h1 * 60 + m1;
	int b = h2 * 60 + m2;
	cout<<b-a-K<<endl;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.math.*;

public class Main {
    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

    private void solve() {
        try {

            int n = sc.nextInt();
            long[] A = new long[n];
            for (int i = 0; i < n; i++) {
                A[i] = sc.nextLong();
            }
            int count = 0;
            for (long l : A) {
                while (l % 2 == 0) {
                    l /= 2;
                    count++;
                }
            }
            System.out.println(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 27604
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  int answer;
  cin >> S;
  for(int i=0;i<S.size();i++){
    if(i % 2 == 0){
      if(S.at(i) == '0'){
        answer++;
      }
    }
    else{
      if(S.at(i) == '1'){
        answer++;
      }
    }
  }
  
  if(answer > S.size() / 2){
    answer = S.size() - answer;
  }
  cout << answer << endl;
}
  
      

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int ans = 1000;
  int num;
  string s;
  cin >> s;
  for(int i = 0; i < s.size() - 2; i++){
    num = (int)(s[i] - '0') * 100 + (int)(s[i + 1] - '0') * 10 + (int)(s[i + 2] - '0');
    ans = min(ans, (int)abs(num-753));
  }
  cout << ans << endl;
}

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

int main(){
    int a;
    cin >> a;
    int b1,b2,b3,b4;
    b1 = a/1000;
    b2 = (a%1000)/100;
    b3 = (a%100)/10;
    b4 = a%10;
    if ((b1 == b2 && b2 == b3) || (b2 == b3 && b3 == b4)){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;
const int MAX_N = 1e7 + 2, INF = 987654321;
bool visited[MAX_N] = { 0, };

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

	int now = 7, ret = 1;
	while (true)
	{
		if (visited[now]) {
			cout << -1;
			break;
		}
		visited[now] = true;
		if (now%K == 0) {
			cout << ret;
			break;
		}
		ret++;
		now %= K;
		now = now * 10 + 7;
	}

}

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

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

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

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

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll n,a,b;
  cin>>n>>a>>b;
  cout<<min(a,b)<<" "<<max(0LL,a+b-n)<<endl;
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <unordered_set>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

typedef long long ll;

using namespace std;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a+b+c >= 22 ? "bust" : "win") << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
  	public static void main(String[] args){
      //入力値の取得
      Scanner sc = new Scanner(System.in);
	  String[] line1 = new String[3];
	  String[] line2 = new String[3];
	  String[] line3 = new String[3];
	  for(int i=0; i < 3; i++) {
		  line1[i] = sc.next();
	  }
	  sc.nextLine();
	  for(int i=0; i < 3; i++) {
		  line2[i] = sc.next();
	  }
	  sc.nextLine();
	  for(int i=0; i < 3; i++) {
		  line3[i] = sc.next();
	  }
	  sc.nextLine();
	  int n = sc.nextInt();
	  List<String> input = new ArrayList<>();
	  for(int i=0; i <= n; i++) {
		  input.add(sc.nextLine());
	  }
	  sc.close();

	  if (input.contains(line1[0]) && input.contains(line1[1]) && input.contains(line1[2])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line2[0]) && input.contains(line2[1]) && input.contains(line2[2])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line3[0]) && input.contains(line3[1]) && input.contains(line3[2])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line1[0]) && input.contains(line2[1]) && input.contains(line3[2])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line1[2]) && input.contains(line2[1]) && input.contains(line3[0])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line1[0]) && input.contains(line2[0]) && input.contains(line3[0])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line1[1]) && input.contains(line2[1]) && input.contains(line3[1])) {
		  System.out.println("Yes");
		  return;
	  }
	  if (input.contains(line1[2]) && input.contains(line2[2]) && input.contains(line3[2])) {
		  System.out.println("Yes");
		  return;
	  }
	  System.out.println("No");
  	}
}

Measured memory_bytes: 23764
#include<stdio.h>

int main(){

int N,K;
while(1){
scanf("%d%d",&N,&K);if(N==0&&K==0)break;

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


for(int i=0;i<N;i++)
for(int j=0;j<K;j++)
scanf("%d",&n[i][j]);


bool f=true;
for(int i=0;i<K;i++){
int S=0;
for(int j=0;j<N;j++)
S+=n[j][i];

if(S>s[i])f=false;
}

if(f==false)printf("No\n");
else printf("Yes\n");
}
return 0;
}

Measured memory_bytes: 1060
#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()

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

    // start
    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;
    // end

    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	map<string,ll> M;
	REP(i,N){
		string s = in<string>();
		sort(ALL(s));
		M[s]++;
	}

	ll sum = 0;
	for(auto& x:M){
		sum += x.second*(x.second-1LL)/2LL;
	}
	out(sum);
	return 0;
}


Measured memory_bytes: 11264
#include <stdio.h>
#include <string.h>
#define MAX 100

int n,c,d=0;
int pre[1000],in[1000],post[1000];

int find(int x){
	int i;
	for(i=0; i<=n-1; i++){
		if(x == in[i]){
			return i;
		}
	}
	return 0;
}

void rec(int l,int r){
	int a,b;
	if(l >= r) return;
	a = pre[d++];
	b = find(a);
	rec(l,b);
	rec(b+1,r);
	post[c++] = a;
}

int main(void){
	int i;
	scanf("%d",&n);
	
	for(i = 0; i <= n-1; i++){
		scanf("%d",&pre[i]);
	}
	
	for(i = 0; i < n; i++){
		scanf("%d",&in[i]);
	}
	
	rec(0,n);
	
	for(i = 0; i < n; i++){
		if(i != n-1){
			printf("%d ",post[i]);
		}else {
			printf("%d\n",post[i]);
		}
	}
	
	return 0;
}




Measured memory_bytes: 2144
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        HashMap<Integer, Integer> map = new HashMap<>();
        int n = in.nextInt();
        for(int i = 0; i < n; i++) {
            int a = in.nextInt();
            if(map.containsKey(a)) {
                map.put(a, map.get(a) + 1);
            }else {
                map.put(a, 1);
            }
        }
        Object[] list = (Object[])(map.keySet().stream().filter(m -> map.get(m) > 1).toArray());
        Arrays.sort(list);
        if(list.length > 1) {
            int a = (Integer)(list[list.length - 1]);
            int b = (Integer)(list[list.length - 2]);
            if(map.get(list[list.length - 1]) > 3) {
                System.out.println((long)a * (long)a);
            } else {
                System.out.println((long)a * (long)b);
            }
        }else {
            System.out.println(0);
        }
    }
}


Measured memory_bytes: 63436
import random

def down_score(d, c, last_d, score):
    sum = 0
    for i in range(26):
        sum += c[i]*(d-last_d[i])
        
    return (score - sum)

def main():
    D = int(input())

    c = list(map(int, input().split()))

    s = [list(map(int, input().split())) for i in range(D)]

    #print(c)

    #print(s)

    last_d = [0 for i in range(26)]
    
    ans = []
    
    score = 0
    
    for i in range(D):
        max = 0
        idx = 0
        for j in range(26):
            if max < (s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2) and c[j] != 0:
                max = s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2
                idx = j
            elif max == (s[i][j] + c[j] * (i-last_d[j])*(i-last_d[j]+1)/2) and c[j] * (i-last_d[j])*(i-last_d[j]+1)/2 > c[idx]* (i-last_d[idx])*(i-last_d[idx]+1)/2:
                idx = j
        last_d[idx] = i+1
        score += s[i][j]
        down_score(i+1,c,last_d,score)
        
        ans.append(idx)

    for i in range(D):
        print(ans[i]+1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9704
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

vector<vector<int>>adj;
int ans[100005];
int vis[100005];
int cnt=0;
int dis[100005];

void bfs()
{
  queue<int>qq;
  qq.push(1);
  dis[1]=0;
  while(!qq.empty())
  {
  		int z=qq.front();
  		qq.pop();
  		for(auto i:adj[z])
  		{
  			if(dis[i]>dis[z]+1)
  			{
  				dis[i]=dis[z]+1;
  				ans[i]=z;
  				qq.push(i);
  			}
  		}
  }
}

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(0);   

  #ifndef ONLINE_JUDGE
      if(fopen("INPUT.txt","r"))
      {
      freopen ("INPUT.txt" , "r" , stdin);
      freopen ("OUTPUT.txt" , "w" , stdout);
      }
  #endif  

      int n,m;
      cin>>n>>m;
      adj.resize(n+1);
      int x,y;
      fill_n(dis,100005,1e17);
      for(int i=0;i<m;i++)
      {
      	cin>>x>>y;
      	adj[x].push_back(y);
      	adj[y].push_back(x);
      }
      bfs();
      for(int i=1;i<=n;i++)
      {
      	if(dis[i]>=1e17)
      	{
      		cout<<"No";
      		return 0;
      	}
      }
      cout<<"Yes\n";
      for(int i=2;i<=n;i++)
      		cout<<ans[i]<<'\n';
}


Measured memory_bytes: 13812
n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import Counter
ac=sorted(list(Counter(a).values()))
le=len(ac)
if le<=k:
  print(0)
else:
  count=0
  for i in range(le-k):
    count+=ac[i]
  print(count)
    

Measured memory_bytes: 34932
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=5+3*1e+4;
const ut INF=1<<30;
const ld eps=1e-6;
const LL mod=7+1e+9;

int N, M;
int pic[128][128], snip[64][64];

void rot(){
	int next_snip[64][64];
	
	REP(i,M)
		REP(j,M)
			next_snip[j][M - i - 1] = snip[i][j]; 
	
	REP(i,M)
		REP(j,M)
			snip[i][j] = next_snip[i][j];
}

int main(){
	while(cin >> N >> M && (N || M)){
		int p, s;
		memset(pic, 0, sizeof(pic));
		memset(snip, 0, sizeof(snip));
		Vpr ans;
		REP(i,N){
			REP(j,N){
				scanf("%d", &p);
				pic[i][j] = p;
			}
		}
		REP(i,M){
			REP(j,M){
				scanf("%d", &s);
				snip[i][j] = s;
			}
		}
		REP(l,4){
			REP(i,N-M+1)REP(j,N-M+1){
				bool ok = true;
				REP(a,M){
					REP(b,M){
						if(snip[a][b] == -1)
							continue;
						if(!(snip[a][b] == pic[i+a][j+b])){
							ok = false;
							break;
						}
					}
					if(!ok)
						break;
				}
				if(ok){
					REP(a,M){
						REP(b,M){
							if(snip[a][b] != -1){
								ans.PB(pr(a+i+1,b+j+1));
								goto end;
							}
						}
					}
				}
			}
			end:;
			rot();
		}
		if(!ans.empty()){
			sort(BE(ans));
			cout << ans[0].S << " " << ans[0].F << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
}

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

string S;

int main(){
    cin >> S;
    long int ans = 0;

    for(int i = 0; i < S.size(); i++){
        if(S[i] != S[i+1]) ans++;
    }
    cout << (ans-1);

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(LL i = (l)    ; i <  (r); ++i)
#define incII(i, l, r) for(LL i = (l)    ; i <= (r); ++i)
#define decID(i, l, r) for(LL i = (r) - 1; i >= (l); --i)
#define decII(i, l, r) for(LL i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC static_cast
#define SI(v) SC<int>(v.size())
#define SL(v) SC<LL >(v.size())
#define RF(e, v) for(auto & e: v)
#define ef else if
#define UR assert(false)

// ---- ----

template<typename T> vector<pair<T, LL>> cc(vector<T> v) {
	vector<pair<T, LL>> a;
	inc(i, v.size()) {
		if(i == 0 || v[i] != v[i - 1]) { a.EB(v[i], 1); } else { a.back().SE++; }
	}
	return a;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	inc(i, n) { cin >> a[i]; }
	sort(ALL(a));
	auto c = cc(a);
	
	bool ans = false;
	if(n % 3 == 0) {
		if(SI(c) == 3) { ans = ((c[0].FI ^ c[1].FI) == c[2].FI && c[0].SE == c[1].SE && c[1].SE == c[2].SE); }
		if(SI(c) == 2) { ans = (c[0].FI == 0 && c[0].SE * 2 == c[1].SE); }
		if(SI(c) == 1) { ans = (c[0].FI == 0); }
	} else {
		ans = (c[0].FI == 0 && c[0].SE == n);
	}
	
	cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3060
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let H = read::<usize>();
    let W = read::<usize>();

    let top = vec!['#'; W+2];
    let top = vecchar_to_String(top);
    let mut SS = Vec::new();
    SS.push(top.clone());

    for h in 0..H {
        let S = read::<String>();
        let S = "#".to_string() + &*S + "#";
        SS.push(S);
    }
    SS.push(top);
    for h in 0..H+2 {
        println!("{}", SS[h]);
    }


}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define ll long long int


ll gcd(ll a, ll b) { //最大公約数を求める関数
  if(b == 0) return a;
  return gcd(b, a % b);
}

ll A,B,C,D,lcm;
ll c=0,d=0,l=0;
int main(){
  cin>>A>>B>>C>>D;
  lcm = C*D/gcd(C,D);
  
  cout<<B-(B/C+B/D-B/lcm)-(A-1-((A-1)/C+(A-1)/D-(A-1)/lcm))<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define Test(tt) cout << "Case #" << tt << ": "

using namespace std;

const int SIGMA = 26;

struct Trie {
	Trie* son[SIGMA];

	int cnt, sz;

	int dp[SIGMA];

	Trie() {
		memset(son, NULL, sizeof(son));
		memset(dp, 0, sizeof(dp));
		cnt = sz = 0;
	}
};


void add(Trie* nod, const string& str, int pos) {
	if((int)str.size() == pos) {
		nod -> cnt++;
	}
	else {
		int ch = str[pos] - 'a';
		if(nod -> son[ch] == NULL)
			nod -> son[ch] = new Trie();
		add(nod -> son[ch], str, pos + 1);
	}
} 

void dfs(Trie* nod) {
	nod -> sz = nod -> cnt;

	for(int ch = 0; ch < SIGMA; ch++) {
		if(nod -> son[ch] != NULL) {

			dfs(nod -> son[ch]);

			nod -> sz += nod -> son[ch] -> sz;

			for(int cur = 0; cur < SIGMA; cur++) {
				if(cur == ch)
					nod -> dp[cur] += nod -> son[ch] -> sz;
				else
					nod -> dp[cur] += nod -> son[ch] -> dp[cur];
			}
		}
	}
}

ll solve(Trie* nod) {
	ll ans = 0;
	for(int ch = 0; ch < SIGMA; ch++) {
		if(nod -> son[ch] != NULL) {
			ans += solve(nod -> son[ch]);
			ans += 1LL * nod -> son[ch] -> cnt * nod -> dp[ch];
		}
	}
	return ans;
}


int main() {
#ifdef HOME
    ifstream cin("A.in");
    ofstream cout("A.out");
#endif
    int i, n;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
   	
    cin >> n;

    Trie* root = new Trie();

    for(i = 0; i < n; i++) {
    	string str;
    	cin >> str;
    	reverse(str.begin(), str.end());
    	add(root, str, 0);
    }

    dfs(root);

    cout << solve(root) - n << "\n";
   	
    return 0;
}

Measured memory_bytes: 373304
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
using  namespace std;
#define ll long long 
map<int,int> mp;
int main(){
	for(int i=1;i<=1000;i++){
		mp[i*i] = 1;
	}
	int a,b;
	cin>>a>>b;
	int c = b,d = a;
	int cnt = 1,cnt2 = 1;
	while(c){
		cnt *= 10;
		c /= 10;
	}
	while(d){
		cnt2 *= 10;
		d /= 10;
	}
	int e = a*cnt + b;
	int f = b*cnt2 + a;
	//cout<<e<<" "<<f<<endl;
	//cout<<a<<endl;
	if(mp[e] || mp[f]){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;
    int h[n], p[n];
    vector<P> v;
    rep(i,n){
        cin >> h[i] >> p[i];
        v.push_back(P(h[i]+p[i],i));
    } 
    sort(v.begin(), v.end());
    int dp[n+1] = {};
    int INF = 1001001001 * 2;
    srep(i,1,n+1)dp[i] = INF;
    
    rep(i,n){
        int id = v[i].second;
        drep(j,n){
            if(dp[j] <= h[id]){
                dp[j+1] = min(dp[j+1],dp[j]+p[id]);
            }
        }
    }

    int ans = 0;
    rep(i,n+1)if(dp[i]<INF)ans = max(ans,i);
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3800
////=====BIsmillahir Rahmanir Rahim =====////

/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
         Comilla University

*/
#include<bits/stdc++.h>
#define fi 2*acos(0.0)
#define ll  long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define ff first
#define ss second
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define edl "\n"
#define infinity 1e6
#define mod 1000000007
#define cn continue
using namespace std;
typedef pair<int, int> pi;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<pi> vpi;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a <<","<< spc;
    err(++it, args...);
    cout<<edl;
}
///Bit manipulation

bool checkbit(int mask,int bit){return mask & (1<<bit);}
int setbit(int mask,int bit){ return mask | (1<<bit) ; }
int clearbit(int mask,int bit){return mask & ~(1<<bit);}
int togglebit(int mask,int bit){return mask ^ (1<<bit);}
int bitno(int mask) {return (int)__builtin_popcount(mask);}

int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

/// KNIGHT MOVE

int x_move[] = {2, 1, -1, -2, -2, -1, 1, 2};
int y_move[] = {1, 2, 2, 1, -1, -2, -2, -1};

///=====================================///

const int maX=2000+5;
vector<int>Graph[maX];
///check n=1;
///check corner case;

int main()
{
    ll n;
    cin>>n;
    ll ac=0,wa=0,tle=0,re=0;
    while(n--){
        string str;cin>>str;
        if(str=="AC")ac++;
        else if(str=="TLE")tle++;
        else if(str=="WA")wa++;
        else re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3672
import math

n = int(input())
nroot = int(math.sqrt(n)) +1

result = {}

for i in range(2,nroot+1):
    while n%i==0:
        if i in result:
            result[i] +=1
        else:
            result[i] = 1
        
        n = n//i
if (n>nroot):
    result[n] = 1

ans = 0
for _, i in result.items():
    r = 1
    add = 0
    while  i >= r:
        i -=  r
        r +=1
        add +=1
    
        
    ans += add
if ans > 0:
    print(ans)
else:
    if n > 1:
        print(1)
    else:
        print(0)

Measured memory_bytes: 9216
#include <stdio.h>
void solve();
int main(){
  char str_s[256];
  char str_t[256];
  scanf("%s%s/n",str_s,str_t);
  bool f = true;
  for(int i=0;str_s[i]!='\0';i++){
    if(str_s[i]!=str_t[i]){
      f = false;
    }
  }
  if(f) puts("Yes");
  else puts("No");
  return 0;}


Measured memory_bytes: 3144
#include <stdio.h>
int a=0;
int b=0;
int c=0;
int m,i;
int main(){
	while(1){
		m = scanf("%d%d",&a,&b);
		if(m == EOF) return 0;
		c = a+b;
		i = 0;
		if(c==0){
			i=1;
			printf("0\n");
			continue;
		}
		while(1){
			if(c==0)break;
			c = c / 10;
			i++;
			
		}
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
#define int long long

using namespace std;

const int N = 1e5;

int readInt ()
{
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true)
    {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true;
    else result = ch-'0';
    while (true)
    {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}
string s[N + 1];
main() {
    int n = readInt();
    for (int i = 1; i <= n; i++) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s + 1, s + n + 1);
    int ans = 0, cnt = 1;
    for (int i = 2; i <= n; i++) {
        if (s[i] == s[i - 1]) {
            ++cnt;
        } else {
//            cout << s[i] << " " << cnt << " fuck \n";
            ans += cnt * (cnt - 1) / 2;
            cnt = 1;
        }
    }
    if (cnt) {
        ans += cnt * (cnt - 1) / 2;
    }
    cout << ans;
}


Measured memory_bytes: 7296
#include <iostream>

#define N (2000)
#define MOD (1000000007)

int dp[N+1][N+1];
int DP[N+1][N+1];

int main() {
  int S;
  std::cin >> S;
  dp[0][0] = DP[0][0] = 1;
  for (int j = 1; j <= S; j++) {
    dp[0][j] = 0;
    DP[0][j] = (DP[0][j-1]+dp[0][j])%MOD;
  }
  for (int i = 1; i <= S; i++) {
    dp[i][0] = DP[i][0] = 0;
    dp[i][1] = 0;
    DP[i][1] = (DP[i][0]+dp[i][1])%MOD;
    dp[i][2] = 0;
    DP[i][2] = (DP[i][1]+dp[i][2])%MOD;
    for (int j = 3; j <= S; j++) {
      dp[i][j] = DP[i-1][j-3];
      DP[i][j] = (DP[i][j-1]+dp[i][j])%MOD;
    }
  }
  int ans = 0;
  for (int i = 0; i <= S; i++) {
    ans += dp[i][S];
    ans %= MOD;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 34440
#include <bits/stdc++.h>
using namespace std;
    
int main() {
    int a;
    cin >> a;
    if ((a/1000) == (a%1000)/100 && (a%1000)/100 == (a%100)/10 || (a%1000)/100 == (a%100)/10 && (a%100)/10 == (a%10))
        cout << "Yes" << endl;
    else  
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;
using lli = long long int;

vector<lli> vec[10] = {};

lli p[10] = {};
lli swi[10] = {};

int main(void) {

	lli N, M;
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		lli K;
		cin >> K;
		for (int j = 0; j < K; j++) {
			lli s;
			cin >> s;
			vec[i].push_back(s);
		}
	}

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

	lli ans = 0;

	for (int i = 0; i < (int)pow(2, N); i++) {
		for (int j = 0; j < N; j++) {
			swi[j] = (i >> j) % 2;
		}

		lli light = 0;

		for (int j = 0; j < M; j++) {
			lli sum = 0;

			for (size_t k = 0; k < vec[j].size(); k++) {
				sum += swi[vec[j][k] - 1];
			}

			if (sum % 2 == p[j]) {
				light += 1;
			}

		}

		if (light == M) {
			ans++;
		}

	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
int main(void){
	int N=0,M=0,c=0;
	cin>>N>>M;
	int a[M]={0},b[N+1]={0};
	for(int i=0;i<M;i++){
		cin>>a[i];
	}
	for(int i=0;i<M;i++){
		for(int j=0;j<N;j++){
			cin>>c;
			if(c==a[i]){b[j+1]++;}
			else{b[a[i]]++;}
		}
	}
	for(int j=1;j<=N;j++){
		cout<<b[j]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ld;
const int MAXN = 2e5 + 5, MAXM = 2e3 + 5, BOUND = 2e5, MOD = 1e9 + 7, INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-3;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,m
#define rson o<<1|1,m+1,r
#define lc(x) ch[x][0]
#define pii pair<int,int>
#define rc(x) ch[x][1]
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int n;
char s[MAXN];
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> s;
	int a = 0, b = 0;
	rep(i, 0, strlen(s) - 1) {
		if (s[i] == 'R')a++;
		else b++;
	}
	if (a > b)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}

Measured memory_bytes: 256