akhauriyash/Code-Regression huggingface dataset:
class _in{struct my_iterator{int it;const bool rev;explicit constexpr my_iterator(int it_, bool rev=false):it(it_),rev(rev){}constexpr int operator*(){return it;}constexpr bool operator!=(my_iterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const my_iterator i,n;public:explicit constexpr _in(int n):i(0),n(n){}explicit constexpr _in(int i,int n):i(i,n<i),n(n){}constexpr const my_iterator& begin(){return i;}constexpr const my_iterator& end(){return n;}};
 
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
 
using i64 = long long;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    for(int& x : a) cin >> x;

    int dia = *max_element(a.begin(), a.end());
    bool ok = true;
    ok &= dia >= (N == 2 ? 1 : 2);
    vector<int> cnt(N, 0);
    for(int x : a) cnt[x]++;

    for(int i : _in(dia + 1))
        ok &= --cnt[dia - i / 2] >= 0;
    for(int i : _in(N))
        if(cnt[i] > 0)
            ok &= i >= (dia + 1) / 2 + 1;

    cout << (ok ? "Possible" : "Impossible") << endl;
    
                         
}


Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;

namespace Template
{
    public static class Scan
    {
        public static string NextLine => Console.ReadLine();
        public static int NextInt => int.Parse(NextLine);
        public static long NextLong => long.Parse(NextLine);
        public static double NextDouble => double.Parse(NextLine);

        public static string[] StrAry(char separator = ' ') => Console.ReadLine().Split(separator);
        public static int[] IntAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), int.Parse);
        public static long[] LongAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), long.Parse);
        public static double[] DoubleAry(char separator = ' ') => Array.ConvertAll(StrAry(separator), double.Parse);
    }

    internal class Template
    {
        public static void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
        private static void Fill<T>(T[] src, T value, int len) { for (int i = 0; i < len; i++) { src[i] = value; } }

        static void Solve() 
        {
            var line = Scan.StrAry();
            var str = line[0][0].ToString() + line[1][0].ToString() + line[2][0].ToString();
            Console.WriteLine(str);
            
        }
        private static void Main()
        {
            Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 11092
#![allow(unused_variables)]
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io;
use std::str::FromStr;
use std::iter::FromIterator;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::mem::{replace, swap};


// abcde
fn read_string() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line
}

// -3.2
fn read_as_primitive<T: FromStr>() -> T {
    let s = read_string();
    s.trim().parse().ok().expect("failed to parse input")
}

// 1 -3 0 999
fn read_as_collection<U: FromStr, T: FromIterator<U>>() -> T {
    let s = read_string();
    s.trim().split_whitespace().map(|s| s.parse().ok().expect("failed to parse")).collect()
}

// #.#.###..
fn read_as_chars<T: FromIterator<char>>() -> T {
    let s = read_string();
    s.trim().chars().collect()
}

// 1 abc
fn read_as_pair<T: FromStr, U: FromStr>() -> (T, U) {
    let s = read_string();
    let elems: Vec<_> = s.trim().split_whitespace().collect();    
    (
        elems[0].parse().ok().expect("failed to parse"), 
        elems[1].parse().ok().expect("failed to parse"),
    )
}

// 1.5 -2 abc
fn read_as_triple<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let s = read_string();
    let elems: Vec<_> = s.trim().split_whitespace().collect();
    (
        elems[0].parse().ok().expect("failed to parse"), 
        elems[1].parse().ok().expect("failed to parse"),
        elems[2].parse().ok().expect("failed to parse"),
    )
}

fn main() {
    let (t, x): (f64, f64) = read_as_pair();
    println!("{:.10}", t/x);
}

Measured memory_bytes: 4352
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll X;
  cin>>X;
  ll ans = 0;
  ans += X/500*1000;
  X %= 500;
  ans += X/5*5;
  X %= 5;
  cout<<ans<<endl;
}



Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <ctime>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 1LL << 62
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

vector<vector<int>> G;
vector<int> depth;

void dfs(int cur, vector<double> &DD) {
    if(cur == G.size() - 1) {
        DD[cur] = 0;
        return;
    }
    double ret = 0;
    for(int v: G[cur]) {
        if(DD[v] < 0) dfs(v, DD);
        ret += DD[v];
    }
    ret /= G[cur].size();
    DD[cur] = ret + 1;
}

void dfs2(int cur, vector<double> &DD, int from, int to) {
    if(cur == G.size() - 1) {
        DD[cur] = 0;
        return;
    }
    double ret = 0;
    int cnt = 0;
    for(int v: G[cur]) {
        if(cur == from && to == v) continue;
        if(DD[v] < 0) dfs2(v, DD, from, to);
        ret += DD[v];
        cnt++;
    }
    ret /= cnt;
    DD[cur] = ret + 1;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, M;
    cin >> N >> M;
    G.resize(N);
    depth.resize(N, -1);
    vector<vector<int>> RG(N);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].pb(b);
        RG[b].pb(a);
    }
    vector<double> D(N, -1);
    depth[0] = 0;
    dfs(0, D);
    
    double ans = D[0];
//    output(ans, 10);
    rep(i, N) {
        if(G[i].size() <= 1) continue;
        double d = 0;
        int ind = -1;
        for(int v: G[i]) {
            if(D[v] > d) {
                d = D[v];
                ind = v;
            }
        }
        vector<double> E(N, -1);
        dfs2(0, E, i, ind);
//        cout << i << ":" << "from,to:" << i << "," << ind << ";";
//        output(E[0], 10);
        ans = min(ans, E[0]);
    }
    output(ans, 10);
    
    
    return 0;
}




Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iterator>
#include <string>
#include <cmath>

# define PI 3.14159265358979323846

using namespace std;

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

    multiset<int, greater<int> > cards;
    while (n--) {
        int c;
        cin >> c;
        cards.insert(c);
    }

    int alice = 0;
    int bob = 0;
    int turn = 0;
    while (cards.size() > 0) {
        if (turn == 0) {
            alice += *cards.begin();
            turn = 1;
        } else {
            bob += *cards.begin();
            turn = 0;
        }
        cards.erase(cards.begin());
    }
    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int a, b;
	vector<int>aa;
	vector<int>bb;
	while (cin >> a >> b) {
		if (a == 0 && b == 0)break;
		aa.push_back(a);
		bb.push_back(b);
	}
	for (int i = 0; i != aa.size(); i++){
		bool b = false;
		for (int j = aa[i]; j <= bb[i]; j++){
		if (j % 4 == 0) 
			if (j % 100 == 0) {
				if (j % 400 == 0) {
					b = true;
					cout << j << endl;
				}
			}
			else {
				b = true;
				cout << j << endl; 
			}
		}
		if (b == false)cout << "NA\n";
		if (i != aa.size() - 1)cout << endl;
	}
	char c;
	cin >> c;
}

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

int main() {
	long long N, MOD = 1000000007;
	static long long C[200000], DP[200010] = {}, X[200010] = {};
	cin >> N;
	for (int i = 0; i < N; i++) cin >> C[i];
	DP[0] = 1;
	X[C[0]] = 1;
	for (int i = 1; i < N; i++) {
		if (C[i] == C[i - 1]) DP[i] = DP[i - 1];
		else DP[i] = (DP[i - 1] + X[C[i]]) % MOD;
		X[C[i]] = DP[i];
	}
	cout << DP[N - 1] << endl;
}

Measured memory_bytes: 4992
#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define DEBUG(X) cerr<<"  "<<#X<<" = "<<X<<endl;
#define DUMP(A, n) for (auto x=begin(A); x!=begin(A)+n;x++){cout <<*x<< ' ';} cout<<endl;
#define DUMPP(A, n, m) for (auto x=begin(A); x != begin(A)+n;x++) {for (auto y=begin(*x); y != begin(*x)+m;)cout <<*y++<< ' '; cout<<endl;};
#define DUMPM(M) for (auto itr=mp.begin(); itr!=mp.end(); itr++) {cout<<itr->first<<" -> "<<itr->second<<endl;}
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define FORP(i,x,y) for(int i=(x);i<=(int)(y);i++)
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)

ll n,s;

ll f(ll b, ll n)
{
  if (n >= b)
    return (n%b) + f(b, (ll)(n/b));
  else
    return n;
}

int main() {
  cin >> n >> s;
  ll nr = sqrt(n);
  for(ll b=2;b<=nr;b++)
  {
    ll sum = f(b, n);
    if (sum==s) {
      cout << b << endl;
      return 0;
    }
  }

  if (s==n)
  {
    cout << n+1 << endl;
    return 0;
  }
  if (n<s)
  {
    cout << "-1" << endl;
    return 0;
  }

  ll mn=1e17;
  for(ll p=1;p<=nr;p++)
  {
    ll q = s-p;
    if ((n-q)%p==0&&q>=0) {
      ll b = (n-q)/p;
      if (f(b,n)==s) chmin(mn, b);
    }
  }
  if (mn==1e17)
    cout << "-1" << endl;
  else
    cout << mn << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n, k;
        n = sc.nextLong();
        k = sc.nextLong();
        int[] to = new int[(int)n];
        for(int i = 0; i < n; i++){
            to[i] = sc.nextInt() - 1;
        }
        Vector<Integer> path = new Vector<>();
        boolean[] se = new boolean[(int)n];
        se[0] = true;
        path.add(0);
        int cur = 0;
        int lostt = 0;
        while(true){
            cur = to[cur];
            if(se[cur]){
                lostt = cur;
                break;
            }else{
                se[cur] = true;
                path.add(cur);
            }
        }
        /*for(int i = 0; i < path.size(); i++){
            System.out.println(path.get(i) + " ");
        }*/
        //System.out.println(lostt + " ");
        for(int i = 0; i < path.size(); i++){
            if(path.get(i) == lostt) {lostt = i; break;}
        }
        //System.out.println(lostt + " ");
        if(k < path.size()){
            System.out.println(path.get((int)k) + 1);
        }else{
            k -= lostt;
            k %= (path.size() - lostt);
            System.out.println(path.get((int)k + lostt) + 1);
        }
    }
}

Measured memory_bytes: 60996
function Main(input){
  var R = input.trim();
  R = parseInt(R,10);

  if(R<1200){
    console.log("ABC");
  }else if(R>=1200&&R<2800){
    console.log("ARC");
  }else{
    console.log("AGC");
  }
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));



Measured memory_bytes: 21064
N, M = map(int, input().split())
switchss = []
for _ in range(M):
    k, *sws = map(int, input().split())
    switchss.append([sw-1 for sw in sws])
ps = list(map(int, input().split()))

ans = 0
for S in range(1<<N):
    for i in range(M):
        num = 0
        for sw in switchss[i]:
            if (S>>sw) & 1:
                num += 1
        if num%2 != ps[i]:
            break
    else:
        ans += 1

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
# define ll long long int
#define M 1000000007
#define ff first
#define ss second
#define pb push_back
#define inf 10000000000

							
									//nestedcode

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll a,b;
    cin>>a>>b;
    cout<<a*b;
}

Measured memory_bytes: 3636
sx, sy, tx, ty = map(int, input().split(' '))
dy = ty - sy
dx = tx - sx
res = 'U' * dy + 'R' * dx + 'D' * dy + 'L' * (dx + 1) + 'U' * (dy + 1) + 'R' * (dx + 1) + 'DR' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'
print(res)

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

int main() {
	long long N, K;
	cin >> N >> K;
	long long A[N]={0};
	
	long long n;
	for(long long i=0; i<N; i++){	
		cin >> n;
		A[n-1]++;
	}
	
	sort(A, A+N);
	long long zero=0;
	while(A[zero]==0){
		zero++;
	}			//0の個数がzero種類
				//i.e.たまがN-zero種類ある
	
	K=N-zero-K;
	if(K<=0){cout << 0 << endl;}
	else{
		long long ans=0;
		for(long long i=zero; i<zero+K; i++){
			ans+=A[i];
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1792
import numpy as np

c = np.array([list(map(int, input().split())) for i in range(3)])

flag = True
for a1 in range(c.max()+1):
  b1 = c[0][0] - a1
  b2 = c[0][1] - a1
  b3 = c[0][2] - a1
  if (c[1][0] - b1 != c[1][1] - b2 or c[1][0] - b1 != c[1][2] - b3):
    flag = False
  
  if (c[2][0] - b1 != c[2][1] - b2 or c[2][0] - b1 != c[2][2] - b3):
   	flag = False
  
print("Yes" if flag else "No")

Measured memory_bytes: 12504
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>

#pragma region _define

#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl;
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define endl "\n"
#define y() cout<<"Yes"<<endl
#define Y() cout<<"YES"<<endl
#define n() cout<<"No"<<endl
#define N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vs = vector<st>;
using vb = vector<bool>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
bool graph[node][node];
bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b)*b);
}

/************************************************************************/

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

	int n;
	cin >> n;
	map<LL, LL>m;
	LL i = 1;
	m[n]++;
	while (true) {
		i++;
		if (n % 2 == 0) {
			n /= 2;
		}
		else {
			n = 3 * n + 1;
		}
		if (m[n] > 0) {
			cout << i;
			return 0;
		}
		else {
			m[n]++;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

vector<long long> divisor(long long n) {
    vector<long long> res;
    for (int i = 1; (long long)i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) res.push_back(n / i);
        }
    }
    sort(begin(res), end(res));
    return res;
}

signed main() {
    int n;
    cin >> n;
    map<int, int> mp;
    int a[n];
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }
    int ans = 0;
    set<int> S;
    sort(a, a + n);
    rep(i, n) {
        auto d = divisor(a[i]);
        for(auto b : d){
            if(S.count(b)){
                goto fin;
            }
        }
        if (mp[a[i]] < 2) ans++;
        S.emplace(a[i]);
    fin:;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23028
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
map<ll,ll> insuu;
ll n;
const int MAX = 700000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void prime_factor(ll n){
    ll k=n;
	for(ll i=2;i*i<=n;i++){
	    while(k%i==0){
	        insuu[i]++;
	        k/=i;
	    }
	}
	if(k!=1) insuu[k]=1;
	return ;
}
int main(){
  COMinit();
  ll m;
  cin>>n>>m;prime_factor(m);
  ll ans=1;
  ll k=n-1;
  for(auto p:insuu){
    ans*=COM(p.S+k,k);
    ans%=MOD;
  }
  COUT(ans);
}

Measured memory_bytes: 16768
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,cnt;
	char s[3];
	scanf("%s",s);
	for(i=0;i<3;i++){
		if(s[i]=='B'){
			cnt++;
		}
	}
	if(cnt==0||cnt==3) printf("No\n");
	else printf("Yes\n");
	return 0;
}

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

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 ll INF = 1LL << 60;

//---main---------------------------------------------
int main(){
    //main
    int X,N;
    cin >> X >> N;
    int p[102],pi;
    rep(i,102) p[i] =0;
    rep(i,N){
        cin >> pi;
        p[pi]++;
    }    


    int abd = 1;
    if(p[X]==0){
        cout << X << endl;
    }else{
        while(true){
            if(p[X-abd]==0){
                cout << X-abd << endl;
                return 0;
            }
            if(p[X+abd]==0){
                cout << X+abd << endl;
                return 0;
            }            
            abd++;
        }
    }

    return 0;
}

Measured memory_bytes: 3596
n = gets.to_i
s = []

n.times do
  tmp = gets.chomp.split('').sort
  hash = {}
  tmp.each do |moji|
    if hash[moji.to_sym]
      hash[moji.to_sym] += 1
    else
      hash[moji.to_sym] = 1
    end
  end
  s << hash
end
result = s.shift

s.each do |h|
  result.each do |k,v|
    tmp = [v, h[k] || 0].min
    result[k] = tmp
  end
end

puts result.map{|k,v| k.to_s * v}.join


Measured memory_bytes: 14288
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)

#define MOD 1000000007
#define INF 1073741823
#define LLINF 4611686018427387903
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

struct thing {
    int h, w, c;
};

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int H, W; cin >> H >> W;
    vector<vector<bool>> visited(H, vector<bool>(W,false));
    queue<thing> que;
    int dh[] = {0,1,0,-1}, dw[] = {1,0,-1,0};
    REP(i, H) REP(j, W) {
        char c; cin >> c;
        if (c == '#') {
            que.push(thing{i,j,0});
            visited[i][j] = true;
        }
    }
    int m = 0;
    while (!que.empty()) {
        thing t = que.front(); que.pop();
        REP(i, 4) {
            int h = t.h + dh[i], w = t.w + dw[i];
            if (h >= 0 && h < H &&
                w >= 0 && w < W && !visited[h][w]) {
                que.push(thing{h,w,t.c + 1});
                visited[h][w] = true;
                m = max(m, t.c + 1);
            }
        }
    }
    cout << m << endl;
    getchar(); getchar();
}

Measured memory_bytes: 12560
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    string s;
    cin >> s;

    string answer = s[0] + to_string(s.length()-2) + s.back();
    p(answer);

    return 0;
}

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

int main(void) {
    string s;
    cin >> s;

    map<char, int> mp;
    for(int i = 0; i < 4; i++) {
        if(mp.count(s[i]) == 0) {
            mp[s[i]] = 1;
        } else {
            mp[s[i]]++;
        }
    }
    
    if(mp.size() == 2) {
        for(auto x : mp){
            if(x.second != 2) {
                cout << "No" << endl;
                return 0;
            }
        }
    } else {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;    
    return 0;
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

long long ans = 0;
int consec, state, n;
char str[200005];

int main(){
	scanf("%s", str + 1);
	n = strlen(str + 1);
	state = 'a';
	for(int i = n; i > 0; i--){
		str[i] += ('a' - 'A'); // sorry I trolled
		if(str[i] == 'a'){
			if(state != 'b'){
				state = 'a';
				consec = 0;
			}else{
				ans += consec;
			}
		}else if(str[i] == 'b'){
			if(state == 'c'){
				consec++;
			}else{
				consec = 0;
			}
			state = 'b';
		}else{
			if(state != 'b'){
				consec = 0;
			}
			state = 'c';
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int h,w,d;
  cin>>h>>w>>d;

  char ans[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int x=(i+j)%(2*d);
      int y=(i-j)%(2*d);
      y=(y+(2*d))%(2*d);
      if(x<d){
        if(y<d) ans[i][j]='R';
        else ans[i][j]='Y';
      }else{
        if(y<d) ans[i][j]='G';
        else ans[i][j]='B';
      }
    }
  }

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<ans[i][j];
    }
    cout<<endl;
  }

  return 0;
}


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

using namespace std;

#define pii pair<int, int>
#define fi first
#define se second
#define REP(i, a, n) for (register int i = a, _n = n; i <= _n; ++i)
#define DREP(i, a, n) for (register int i = a, _n = n; i >= _n; --i)
#define FOR(i, a, n) for (register int i = a, _n = n; i < _n; ++i)
#define EREP(i, a) for (register int i = first[a]; i; i = edge[i].nxt)
#define debug(x) cout << #x << " = " << x << endl

char IO;
inline int rd () {
	int res = 0;
	while ((IO = getchar()) && (IO < '0' || IO > '9'));
	while (IO >= '0' && IO <= '9') 
		res = (res << 1) + (res << 3) + (IO ^ 48), IO = getchar();
	return res;
}

const int Mod = 1e9 + 7;

int n, k;

long long dp[55][55][5005];

int main () {
	n = rd(), k = rd();

	dp[0][0][2500] = 1;
	int tem = n * n + 2500;
	REP (i, 0, n - 1) REP (j, 0, i) REP (k, 0, tem) if (dp[i][j][k]) {
		dp[i + 1][j][k] += dp[i][j][k]; // 添自己
		dp[i + 1][j][k] %= Mod;
		dp[i + 1][j + 1][k - (i + 1) * 2] += dp[i][j][k]; // 添右边, 空
		dp[i + 1][j + 1][k - (i + 1) * 2] %= Mod;
		if (j) {
			dp[i + 1][j][k] += dp[i][j][k] * j; // 添左边，取右边
			dp[i + 1][j][k] %= Mod;
			dp[i + 1][j - 1][k + (i + 1) * 2] += dp[i][j][k] * j * j;// 添左边，取左边
			dp[i + 1][j - 1][k + (i + 1) * 2] %= Mod;
			dp[i + 1][j][k] += dp[i][j][k] * j; // 添右边，取左边
			dp[i + 1][j][k] %= Mod;
		}
	}

	printf ("%lld\n", dp[n][0][k + 2500]);
	return 0;
}


Measured memory_bytes: 108800
#include <stdio.h>
 int main(void)
 {
 int a,b,c;
 int i;
 int count=0;
 scanf("%d %d %d",&a,&b,&c);
 for(i=a;
i<=b;
i++)
{
 if(c%i==0){ count++;
 }
 }
 printf("%d\n",count);
 return 0;
 }


Measured memory_bytes: 2108
N,K = map(int,input().split())
R,S,P =  map(int,input().split())
T = input()
T2=[0]*N
rsp = ["r","s","p"]
for i in range(N):
    for j in range(3):
        if T[i] == rsp[j]:
            T2[i] = j

won = [P,R,S]

for i in range(K,N):
    if T2[i]==T2[i-K]:
        T2[i] = -1

ans=0

for i in range(N):
    if T2[i]==0:
        ans += P
    if T2[i]==1:
        ans+= R
    if T2[i]==2:
        ans+= S

print(ans)

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

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

  if (N<=111) {
    cout << 111 << endl;
  }
 else if (N<=222){
  cout << 222 << endl;
}
 else if (N<=333){
  cout << 333 << endl;
}
 else if (N<=444){
  cout << 444 << endl;
}
 else if (N<=555){
  cout << 555 << endl;
}
 else if (N<=666){
  cout << 666 << endl;
}
 else if (N<=777){
  cout << 777 << endl;
}
 else if (N<=888){
  cout << 888 << endl;
}
 else {
  cout << 999 << endl;
}

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int MAXN = 1e6 + 10;
using namespace std;
int prime[MAXN];
int Mark[MAXN];
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
bool isPrime(int n) 
{ 


    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  

    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int32_t main() {
	int a, b;cin >> a >> b;
	int res=gcd(a,b);
	int ans=0;

	
	for(int i=2;i<=sqrt(res);i++){
		if(res%i==0){
			ans++;
			while(res%i==0)res/=i;
		}
	}
	if(res>2)ans++;
	cout<<ans+1<<endl;
	
	return 0;
}


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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL (1LL << 60)
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main(){
  int n, k;
  cin >> n >> k;
  ll x[n], y[n], z[n];
  REP(i, n) cin >> x[i] >> y[i] >> z[i];
  ll val[8][n];
  REP(i, 8)REP(j, n) val[i][j] = 0;
  REP(i, 8){
    REP(j, n){
      if(i/4 == 0) val[i][j] += x[j];
      else val[i][j] -= x[j];
      if((i/2)%2 == 0) val[i][j] += y[j];
      else val[i][j] -= y[j];
      if(i%2 == 0) val[i][j] += z[j];
      else val[i][j] -= z[j];
    }
  }
  REP(i, 8) sort(val[i], val[i]+n);
  ll ans = 0;
  REP(i, 8){
    ll cur = 0;
    REP(j, k){
      cur += val[i][n-1-j];
    }
    ans = (ans<cur?cur:ans);
  }
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )

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

#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define shandom_ruffle random_shuffle
#define funoredered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using funordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int INF = 0x3f3f3f3f;
constexpr int NINF = 0xc0c0c0c0;
constexpr double EPS = 1e-8;
constexpr ll MOD = 1000000007LL;

template <typename T>
using ordered_set = 
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll modPow( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

inline int cmp_double( double x, double y, double tol = EPS) {
    return (x <= y + tol) ? ( x + tol < y) ? -1 : 0 : 1;
}

constexpr int ms = 1e5 + 13;

vi ans;
vi g[ms];
void xablau(int node = 0) {
    ans[node] = 0;
    for(const int& x : g[node] ) {
        if( ans[x] == -1) xablau( x );
        ans[node] = max( ans[node], 1 + ans[x] );   
    }
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    ans.assign(n, -1);
    for(int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        g[a - 1].pb(b - 1);
    }
    for(int i = 0; i < n; ++i) if( ans[i] == -1) xablau( i );
    int acc = accumulate( all(ans), 0, [] (int a, int b) { return max( a, b ); } );
    cout << acc << endl;
}



Measured memory_bytes: 7552
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<stack>
typedef long long int LL;
using namespace std;
LL N,M,fa[100010],sizes[100010],res,cnt[100010]= {0},a[100010],b[100010];
void init()
{
    for(int i=1; i<=N; i++)
    {
        fa[i]=i;
        sizes[i]=1;
    }
}
int finds(int x)
{
    if(fa[x]==x)
        return x;
    else
        return fa[x]=finds(fa[x]);
}
int main()
{
    scanf("%lld%lld",&N,&M);
    init();
    for(int i=1; i<=M; i++)
        scanf("%lld%lld",&a[i],&b[i]);
    res=N*(N-1)/2;
    for(int i=M; i>0; i--)
    {
        cnt[i]=res;
        int x=finds(a[i]),y=finds(b[i]);
        if(x!=y)
        {
            fa[y]=x;
            res-=sizes[x]*sizes[y];
            sizes[x]+=sizes[y];
        }
    }
    for(int i=1; i<=M; i++)
        printf("%lld\n",cnt[i]);
    return 0;
}

Measured memory_bytes: 5248
N,M,Q=map(int,input().split())
cumsum = [[0] * (N+1) for _ in range(N+1)]
for _ in range(M):
    L,R=map(int,input().split())
    cumsum[L][R] += 1
for i in range(1,N+1):
    for j in range(1,N+1):
        cumsum[i][j] += cumsum[i-1][j] + cumsum[i][j-1] - cumsum[i-1][j-1]
for _ in range(Q):
    p,q = map(int,input().split())
    ans = cumsum[q][q]-cumsum[p-1][q]-cumsum[q][p-1]+cumsum[p-1][p-1]
    print(ans)

Measured memory_bytes: 13288
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
    int n;
    scanf("%d",&n);
    char s[n+1],t[n+1];
    scanf("%s %s",s,t);
    char st[2*n+1];
    int i;
    int k=0;
    int l=0;
    for(i=0;i<2*n+1;i++)
       { if((i+1)%2!=0)
            {
                st[i]=s[l];
                l++;
            }
        else
        {
            st[i]=t[k];
            k++;
        }
        }
    printf("%s",st);
    return 0;
}


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

using namespace std;

int main(){
    char str[10] = {0};
    for(int i = 0; i < sizeof(str)/sizeof(char); i++){
        scanf("%c", &str[i]);
    }
    str[0] = '2';
    str[1] = '0';
    str[2] = '1';
    str[3] = '8';
    printf("%s", str);
    return 0;
}


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

int main(void){
    double x1, y1, x2, y2;
    double distance;
    
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    
    distance = sqrt( pow(x1-x2, 2) + pow(y1-y2, 2) );

    printf("%.8f", distance);    
    
    return 0;
}



Measured memory_bytes: 2044
#include<stdio.h>
#include<string.h>
int main()
{
	int A, B, C;
	scanf("%d %d %d", &A, &B, &C);
	
	if(A==B && B==C) printf("No");
	
	else if(A == B || B==C || A ==C) printf("Yes");
	
	else printf("No");
	
		
		return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <utility>
#include <vector>
using namespace std;

using Node = pair<int, vector<int>>;
using Edge = pair<int, int>;
using Used = bitset<100100>;
using ColorList = map<Edge, int>;

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

  vector<Edge> edges;
  vector<Node> nodes;

  for(int i = 0; i <= N; ++i) {
    nodes.push_back(Node(i, vector<int>()));
  }
  int a, b;
  for(int i = 0; i < N - 1; ++i) {
    cin >> a >> b;
    edges.push_back(Edge(min(a, b), max(a, b)));
    nodes[a].second.push_back(b);
    nodes[b].second.push_back(a);
  }

  ColorList colors;
  Used used;
  queue<int> queue;
  used.set(1);
  queue.push(1);

  while(!queue.empty()) {
    auto next = queue.front();
    // cout << "next: " << next << endl;
    queue.pop();
    auto node = nodes[next];
    used.set(next);
    set<int> usedColors;
    for(auto child : node.second) {
      auto color = colors.find(Edge(min(node.first, child), max(node.first, child)));
      if(color != colors.end()) {
        usedColors.insert(color->second);
      }
    }
    int colorNo = 1;
    for(auto child : node.second) {
      if(used.test(child))
        continue;

      while(usedColors.count(colorNo) != 0) {
        colorNo++;
      }
      auto edge = Edge(min(node.first, child), max(node.first, child));
      colors.emplace(edge, colorNo);
      usedColors.insert(colorNo);

      queue.push(child);
    }
  }

  int maxNodeCount = 0;
  for(auto node : nodes) {
    if(node.first == 0)
      continue;
    if(maxNodeCount < node.second.size()) {
      maxNodeCount = node.second.size();
    }
  }
  cout << maxNodeCount << endl;
  for(auto edge : edges) {
    int color = colors.at(edge);
    cout << color << endl;
  }

  return 0;
}

Measured memory_bytes: 13804
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
    void solve()
    {
        string[] buf = Console.ReadLine().Split(' ');
        int n = int.Parse(buf[0]);
        int k = int.Parse(buf[1]);

        Dictionary<int, int> d = new Dictionary<int, int>();
        buf = Console.ReadLine().Split(' ');
        for (int i = 0; i < n; ++i)
        {
            int A = int.Parse(buf[i]);
            if (d.ContainsKey(A))
            {
                d[A] = d[A] + 1;
            }
            else
            {
                d.Add(A, 1);
            }
        }

        int j = 0;
        int count = 0;
        var sorted = d.OrderBy((x) => x.Value);
        foreach (var x in sorted)
        {
            if (d.Count - k < ++j)
            {
                break;
            }
            count += x.Value;

        }
        Console.WriteLine(count);
    }

    public static int Main()
    {
        bool loop = false;
#if ES_DEBUG
        loop = true;
#endif
        do
        {
            new Program().solve();
        } while (loop);
        return 0;
    }
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W; cin >> H >> W;
    int ans[H][W];
    int x = 0;
    int v = 1, row = 0;
    
    int N; cin >> N;
    rep(i, N){
        int a; cin >> a;
        int col = i+1;
        rep(j, a){
            if(v == 1){
                ans[row][x] = col;
                x++;
                if(x == W){
                    x--;
                    row++;
                    v = 0;
                }
            }
            else{
                ans[row][x] = col;
                x--;
                if(x == -1){
                    x++;
                    row++;
                    v = 1;
                }
            }
        }
    }
    rep(i, H){
        rep(j, W){
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
	ll n, m, x;
	vector<ll> a;
	map<ll, ll> mp;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> x;
		a.push_back(x);
		if (i)a[i] = x + a[i - 1];
		else a[i] = x;
		a[i] %= m;
		mp[a[i]]++;
	}
	mp[0]++;
	ll ans = 0;
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	for (int i = 0; i < a.size(); i++)if (mp[a[i]])ans += (mp[a[i]] - 1)*mp[a[i]] / 2;
	cout << ans << endl;
	return 0;
}


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

long c[222222];
int main() {
    int n, p = 1e9 + 7;
    cin >> n;
    for(int i = 0; i < n; i++)
        scanf("%ld", c + i);
    sort(c, c + n);
    long s = 0, t = 0, e = 1;
    for(int i = 0; i < n; i++)
        (s += c[i]) %= p, (t += c[i] * (n - i - 1)) %= p, (e += e * !!i) %= p;
    cout << (t + s + s) * e % p * e % p << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2 * N - 1];

bool X[N][N];

void initialize() {
  for (int i = 0; i < N; i++) {
    row[i] = FREE;
    col[i] = FREE;
  }
  for (int i = 0; i < 2 * N - 1; i++) {
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}

void printBoard() {
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (X[i][j]) {
        if (row[i] != j) {
          return;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cout << ((row[i] == j) ? "Q" : ".");
    }
    cout << endl;
  }
}

void recursive(int i) {
  if (i == N) {
    printBoard();
    return;
  }

  for (int j = 0; j < N; j++) {
    if (col[j] == NOT_FREE ||
        dpos[i + j] == NOT_FREE ||
        dneg[i - j + N - 1] == NOT_FREE) {
      continue;
    }
    row[i] = j; col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    recursive(i + 1);
    row[i] = j; col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }
}

int main(){
  initialize();

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      X[i][j] = false;
    }
  }

  int k; cin >> k;
  for (int i = 0; i < k; i++) {
    int r, c; cin >> r >> c;
    X[r][c] = true;
  }

  recursive(0);

  return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        String o = scan.next();
        String e = scan.next();
        for(int i = 0; i < o.length() + e.length(); i++){
            char c = (i % 2 == 0)? o.charAt(i / 2) : e.charAt((i - 1) / 2);
            System.out.print(c);
        }
        System.out.println();
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int max(int a,int b){return (a>b ? a:b);}
int min(int a,int b){return (a<b ? a:b);}
int compare_int(const void *a, const void *b){return *(int*)a - *(int*)b;}
//qsort(配列, 長さ, sizeof(int), compare_int);
double BS(int array[],int len,int target);

int T,X;

int main(){
    scanf("%d%d",&T,&X);
    printf("%f\n",(double)T/(double)X);
    return 0;
}

double BS(int array[],int len,int target){ //(配列,長さ,見つける値)
    int low,mid,high;

    low = 0;
    high = len-1;

    int mark;

    while(low <= high){
        mid = (low + high) / 2;
        if(array[mid] == target){
            mark = 0;
            break;
        }else if(array[mid] < target){
            low = mid + 1;
            mark = 1;
        }else{
            high = mid - 1;
            mark = -1;
        }
    }
    if(mark == 0){
        return mid; //配列の何番目か（０から）
    }else if(mark == 1){
        return (double)mid + 0.5;//なかったらどこのあいだか
    }else{
        return (double)mid - 0.5;
    }
}

Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <numeric>
#include <cassert>

using namespace std;

class abcA {
public:
    void solve(istream& in, ostream& out) {
        int A, B;
        in >> A >> B;
        out << (A+B) % 24 << "\n";
    }
};


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

	abcA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

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

    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;  // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});

    int counter = 0;
    for (pair<long long, long long> res_pair : res) {
        int max_count = 0;
        for (int i = 1; i <= res_pair.second; ++i) {
            if (i * (i + 1) <= 2 * res_pair.second) {
                max_count = i;
            }
        }
        counter += max_count;
    }

    cout << counter << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin >> n;
    for(int i = 0;i < n.size();i++)
    {
        if(n[i] == '1')
        {
            n[i] = '9';
        }
        else if(n[i] == '9')
        {
            n[i] = '1';
        }
    }
    cout << n;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <iostream>
#include <queue>

using namespace std;

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64; // 9e18
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

//const double PI = 3.141592653589793238463;
//const int MAXN = 1000500;
//const int MAXVALUE = 1000000500;
//const long double EPS = 1e-7;
const i64 INF = 1e18;
//i64 mod = 1e9 + 7;


i64 T, n, m, k;
//vector <vector<i64>> a;
//vector <i64> a;
//vector <i64> b;
//vector <i64> dp;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(16);


    //cin >> T;
    T = 1;

    for (i64 tt = 0; tt < T; ++tt) {

        i64 x, t;
        cin >> n >> x >> t;

        if (n%x) {
            cout << t*(n / x + 1) << endl;
        }
        else {
            cout << t*(n / x) << endl;
        }




    }
    return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define N 998244353
using namespace std;
ll x[10],y[10], n;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>x[i]>>y[i];
    long double ans = 0, f = 1;
    for(int i=2;i<n-1;i++)
        f = f*i;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            ans += f*(n-1)*sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
    f = f*n*(n-1);
    cout<<setprecision(10)<<ans/f;
    return 0;
}

Measured memory_bytes: 256